@pluno/product-agent-web 0.1.36 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-widget.js +768 -700
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { PlunoProductAgent as dn } from "./product-agent-sdk.js";
|
|
2
|
+
const cn = "#7c3aed";
|
|
3
|
+
function un(e) {
|
|
4
|
+
const t = mn(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,20 @@ function cn(e) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
function Nt(e) {
|
|
83
|
-
const t = It(e);
|
|
84
|
-
if (pt(me(t), rt) >= lt)
|
|
78
|
+
const pe = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
|
|
79
|
+
function It(e) {
|
|
80
|
+
const t = Dt(e);
|
|
81
|
+
if (st(fe(t), lt) >= pt)
|
|
85
82
|
return t;
|
|
86
|
-
let o =
|
|
87
|
-
const a =
|
|
83
|
+
let o = fe(t);
|
|
84
|
+
const a = fe(pe);
|
|
88
85
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
86
|
+
if (o = fn(o, a, 0.22), st(o, lt) >= pt)
|
|
87
|
+
return Ue(o);
|
|
88
|
+
return Ue(o);
|
|
92
89
|
}
|
|
93
90
|
function gn(e) {
|
|
94
|
-
const t =
|
|
91
|
+
const t = It(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
92
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
93
|
<defs>
|
|
97
94
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,35 +101,32 @@ function gn(e) {
|
|
|
104
101
|
</defs>
|
|
105
102
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
103
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
104
|
+
<path d="${hn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
105
|
</g>
|
|
109
|
-
<path d="${n}" fill="none" stroke="${
|
|
106
|
+
<path d="${n}" fill="none" stroke="${pe}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
107
|
<g transform="rotate(-2 528 463)">
|
|
111
|
-
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${
|
|
112
|
-
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${
|
|
108
|
+
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
|
|
109
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${pe}"/>
|
|
113
110
|
<circle cx="557" cy="447" r="16" fill="#ffffff"/>
|
|
114
111
|
</g>
|
|
115
112
|
<g transform="rotate(2 717 462)">
|
|
116
|
-
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${
|
|
117
|
-
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${
|
|
113
|
+
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
|
|
114
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${pe}"/>
|
|
118
115
|
<circle cx="728" cy="447" r="16" fill="#ffffff"/>
|
|
119
116
|
</g>
|
|
120
117
|
</g>
|
|
121
118
|
</svg>`;
|
|
122
119
|
}
|
|
123
|
-
function hn(
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(gn(e))}`;
|
|
125
|
-
}
|
|
126
|
-
function mn() {
|
|
120
|
+
function hn() {
|
|
127
121
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
122
|
for (let i = 150; i <= 1170; i += 62) {
|
|
129
|
-
const l = (a % 3 - 1) * 18,
|
|
130
|
-
n += ` L ${
|
|
123
|
+
const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
|
|
124
|
+
n += ` L ${s} ${i}`, o = !o, a += 1;
|
|
131
125
|
}
|
|
132
126
|
return n;
|
|
133
127
|
}
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
128
|
+
function mn(e) {
|
|
129
|
+
const t = Dt(e), n = ze(fe(t));
|
|
136
130
|
return n > 0.86 ? {
|
|
137
131
|
top: "#ffffff",
|
|
138
132
|
middle: "#f6f6f6",
|
|
@@ -168,34 +162,34 @@ function fn(e) {
|
|
|
168
162
|
shadow: z(t, -0.25, -0.08)
|
|
169
163
|
};
|
|
170
164
|
}
|
|
171
|
-
function
|
|
165
|
+
function Dt(e) {
|
|
172
166
|
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()}` :
|
|
167
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : cn;
|
|
174
168
|
}
|
|
175
|
-
function
|
|
169
|
+
function fe(e) {
|
|
176
170
|
return [
|
|
177
171
|
Number.parseInt(e.slice(1, 3), 16),
|
|
178
172
|
Number.parseInt(e.slice(3, 5), 16),
|
|
179
173
|
Number.parseInt(e.slice(5, 7), 16)
|
|
180
174
|
];
|
|
181
175
|
}
|
|
182
|
-
function
|
|
176
|
+
function Ue([e, t, n]) {
|
|
183
177
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
178
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
185
179
|
}
|
|
186
|
-
function
|
|
180
|
+
function ze([e, t, n]) {
|
|
187
181
|
const o = (a) => {
|
|
188
182
|
const i = a / 255;
|
|
189
183
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
190
184
|
};
|
|
191
185
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
192
186
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
187
|
+
function st(e, t) {
|
|
188
|
+
const n = ze(e), o = ze(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
189
|
return (a + 0.05) / (i + 0.05);
|
|
196
190
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
191
|
+
function fn(e, t, n) {
|
|
192
|
+
const o = Ge(n);
|
|
199
193
|
return [
|
|
200
194
|
e[0] + (t[0] - e[0]) * o,
|
|
201
195
|
e[1] + (t[1] - e[1]) * o,
|
|
@@ -203,43 +197,43 @@ function bn(e, t, n) {
|
|
|
203
197
|
];
|
|
204
198
|
}
|
|
205
199
|
function z(e, t, n) {
|
|
206
|
-
const [o, a, i] =
|
|
207
|
-
return
|
|
200
|
+
const [o, a, i] = bn(fe(e));
|
|
201
|
+
return Ue(wn(o, Ge(a + n), Ge(i + t)));
|
|
208
202
|
}
|
|
209
|
-
function
|
|
210
|
-
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i),
|
|
211
|
-
if (l ===
|
|
212
|
-
return [0, 0,
|
|
213
|
-
const d = l -
|
|
214
|
-
return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6,
|
|
203
|
+
function bn([e, t, n]) {
|
|
204
|
+
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
|
|
205
|
+
if (l === s)
|
|
206
|
+
return [0, 0, u];
|
|
207
|
+
const d = l - s, p = u > 0.5 ? d / (2 - l - s) : d / (l + s);
|
|
208
|
+
return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, p, u];
|
|
215
209
|
}
|
|
216
|
-
function
|
|
210
|
+
function wn(e, t, n) {
|
|
217
211
|
if (t === 0)
|
|
218
212
|
return [n * 255, n * 255, n * 255];
|
|
219
213
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
220
214
|
return [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
215
|
+
Re(a, o, e + 1 / 3) * 255,
|
|
216
|
+
Re(a, o, e) * 255,
|
|
217
|
+
Re(a, o, e - 1 / 3) * 255
|
|
224
218
|
];
|
|
225
219
|
}
|
|
226
|
-
function
|
|
220
|
+
function Re(e, t, n) {
|
|
227
221
|
let o = n;
|
|
228
222
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
229
223
|
}
|
|
230
|
-
function
|
|
224
|
+
function Ge(e) {
|
|
231
225
|
return Math.max(0, Math.min(1, e));
|
|
232
226
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
227
|
+
const Rt = "suggest_share_on_socials";
|
|
228
|
+
function _n(e) {
|
|
235
229
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
236
230
|
const n = e[t];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
231
|
+
if (n.role !== "tool" || n.toolName !== Rt)
|
|
238
232
|
continue;
|
|
239
|
-
const o =
|
|
233
|
+
const o = dt(e, t, "assistant");
|
|
240
234
|
if (!o)
|
|
241
235
|
return null;
|
|
242
|
-
const a =
|
|
236
|
+
const a = dt(e, o.index, "user");
|
|
243
237
|
return a ? {
|
|
244
238
|
id: `share:${n.callId ?? n.id}`,
|
|
245
239
|
userPrompt: a.content,
|
|
@@ -248,13 +242,13 @@ function xn(e) {
|
|
|
248
242
|
}
|
|
249
243
|
return null;
|
|
250
244
|
}
|
|
251
|
-
async function
|
|
252
|
-
const t = await
|
|
245
|
+
async function xn(e) {
|
|
246
|
+
const t = await vn(e);
|
|
253
247
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
248
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
249
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
256
250
|
}
|
|
257
|
-
function
|
|
251
|
+
function dt(e, t, n) {
|
|
258
252
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
259
253
|
const a = e[o];
|
|
260
254
|
if (a.role === n && a.content.trim())
|
|
@@ -262,73 +256,73 @@ function st(e, t, n) {
|
|
|
262
256
|
}
|
|
263
257
|
return null;
|
|
264
258
|
}
|
|
265
|
-
async function
|
|
259
|
+
async function vn(e) {
|
|
266
260
|
return await (await fetch(e)).blob();
|
|
267
261
|
}
|
|
268
|
-
const
|
|
269
|
-
function
|
|
262
|
+
const yn = "https://app.pluno.ai", Cn = "/api/product-agent/embed/active-users", En = 1800, Sn = 15e3, kn = 250, Ln = 1e3, Pn = 3e4;
|
|
263
|
+
function An(e, t = {}) {
|
|
270
264
|
let n = !1, o = null, a = null, i = null;
|
|
271
265
|
const l = () => {
|
|
272
266
|
i !== null && (window.clearInterval(i), i = null);
|
|
273
|
-
},
|
|
267
|
+
}, s = (p) => {
|
|
274
268
|
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
275
269
|
d();
|
|
276
|
-
},
|
|
277
|
-
},
|
|
270
|
+
}, In(p)));
|
|
271
|
+
}, u = (p) => {
|
|
278
272
|
if (l(), o === null) {
|
|
279
|
-
o =
|
|
273
|
+
o = p, e(p);
|
|
280
274
|
return;
|
|
281
275
|
}
|
|
282
|
-
const
|
|
276
|
+
const w = o, x = performance.now();
|
|
283
277
|
i = window.setInterval(() => {
|
|
284
278
|
if (n) {
|
|
285
279
|
l();
|
|
286
280
|
return;
|
|
287
281
|
}
|
|
288
|
-
const
|
|
289
|
-
o = Math.round(
|
|
290
|
-
},
|
|
282
|
+
const L = Math.min(1, (performance.now() - x) / En);
|
|
283
|
+
o = Math.round(w + (p - w) * Dn(L)), e(o), L >= 1 && (o = p, e(p), l());
|
|
284
|
+
}, kn);
|
|
291
285
|
}, d = async () => {
|
|
292
286
|
try {
|
|
293
|
-
const
|
|
287
|
+
const p = await Tn(t);
|
|
294
288
|
if (n)
|
|
295
289
|
return;
|
|
296
|
-
|
|
290
|
+
u(p.count), s(p.refreshAfterMs);
|
|
297
291
|
} catch {
|
|
298
|
-
|
|
292
|
+
s(Sn);
|
|
299
293
|
}
|
|
300
294
|
};
|
|
301
295
|
return d(), () => {
|
|
302
296
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
303
297
|
};
|
|
304
298
|
}
|
|
305
|
-
async function
|
|
299
|
+
async function Tn(e) {
|
|
306
300
|
if (e.loader)
|
|
307
301
|
return e.loader();
|
|
308
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
302
|
+
const n = await (e.fetcher ?? fetch)(new URL(Cn, Nn(e.backendUrl ?? yn)).toString(), {
|
|
309
303
|
cache: "no-store",
|
|
310
304
|
credentials: "omit"
|
|
311
305
|
});
|
|
312
306
|
if (!n.ok)
|
|
313
307
|
throw new Error("Failed to load active users");
|
|
314
|
-
const o = await n.json(), a =
|
|
308
|
+
const o = await n.json(), a = ct(o.count), i = ct(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
315
309
|
if (a === null || i === null)
|
|
316
310
|
throw new Error("Invalid active users response");
|
|
317
311
|
return { count: a, refreshAfterMs: i };
|
|
318
312
|
}
|
|
319
|
-
function
|
|
313
|
+
function ct(e) {
|
|
320
314
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
321
315
|
}
|
|
322
|
-
function
|
|
316
|
+
function Nn(e) {
|
|
323
317
|
return e.endsWith("/") ? e : `${e}/`;
|
|
324
318
|
}
|
|
325
|
-
function
|
|
326
|
-
return Math.min(
|
|
319
|
+
function In(e) {
|
|
320
|
+
return Math.min(Pn, Math.max(Ln, e));
|
|
327
321
|
}
|
|
328
|
-
function
|
|
322
|
+
function Dn(e) {
|
|
329
323
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
330
324
|
}
|
|
331
|
-
const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect",
|
|
325
|
+
const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-agent:sdk-preview-socket-send", On = "product-agent:sdk-preview-socket-close", Bn = "product-agent:sdk-preview-socket-open", Fn = "product-agent:sdk-preview-socket-message", Un = "product-agent:sdk-preview-socket-error", zn = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Ot = "pluno.productAgent.sharePromptsDisabled", Ee = 10, $n = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Bt).join(","), Hn = 3, j = {
|
|
332
326
|
launcherLabel: "Ask for anything...",
|
|
333
327
|
accentColor: "#7c3aed",
|
|
334
328
|
colorScheme: "light",
|
|
@@ -336,11 +330,48 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", On = "product-a
|
|
|
336
330
|
scribbleStyle: !1,
|
|
337
331
|
position: "bottom-right",
|
|
338
332
|
movableLauncher: !1
|
|
339
|
-
},
|
|
340
|
-
|
|
333
|
+
}, jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ft = 190, Ut = 41, Vn = 48, qn = 420, Kn = 520, Yn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, B = 8, $e = 50, Qn = "http://www.w3.org/2000/svg", ht = [
|
|
334
|
+
{
|
|
335
|
+
ellipseCx: "17.5",
|
|
336
|
+
ellipseCy: "24.5",
|
|
337
|
+
ellipseRx: "2.4",
|
|
338
|
+
ellipseRy: "3",
|
|
339
|
+
strokeWidth: "1.6",
|
|
340
|
+
path: "M18.5 27 C20.5 12, 7.5 2.5, 6 18.5",
|
|
341
|
+
pathStrokeWidth: "2.5"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
ellipseCx: "17.9",
|
|
345
|
+
ellipseCy: "24.1",
|
|
346
|
+
ellipseRx: "2.5",
|
|
347
|
+
ellipseRy: "2.8",
|
|
348
|
+
strokeWidth: "1.5",
|
|
349
|
+
path: "M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4",
|
|
350
|
+
pathStrokeWidth: "2.35"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
ellipseCx: "17.1",
|
|
354
|
+
ellipseCy: "24.9",
|
|
355
|
+
ellipseRx: "2.2",
|
|
356
|
+
ellipseRy: "3.1",
|
|
357
|
+
strokeWidth: "1.7",
|
|
358
|
+
path: "M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2",
|
|
359
|
+
pathStrokeWidth: "2.6"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
ellipseCx: "17.6",
|
|
363
|
+
ellipseCy: "24.4",
|
|
364
|
+
ellipseRx: "2.4",
|
|
365
|
+
ellipseRy: "2.9",
|
|
366
|
+
strokeWidth: "1.6",
|
|
367
|
+
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
368
|
+
pathStrokeWidth: "2.45"
|
|
369
|
+
}
|
|
370
|
+
], eo = 11, to = 13, mt = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", zt = "pluno-pa-widget-styles", Gt = "data-pluno-pa-widget-styles";
|
|
371
|
+
function io(e) {
|
|
341
372
|
return (t) => new V(t, e);
|
|
342
373
|
}
|
|
343
|
-
async function
|
|
374
|
+
async function ro(e = {}) {
|
|
344
375
|
const t = {
|
|
345
376
|
launcherLabel: e.launcherLabel ?? j.launcherLabel,
|
|
346
377
|
accentColor: e.accentColor ?? j.accentColor,
|
|
@@ -385,10 +416,10 @@ async function lo(e = {}) {
|
|
|
385
416
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
386
417
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
387
418
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
388
|
-
let i =
|
|
389
|
-
|
|
390
|
-
const l = await
|
|
391
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
419
|
+
let i = ft(t.accentColor, t.scribbleStyle);
|
|
420
|
+
vo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
421
|
+
const l = await ua(), s = l.ownerDocument;
|
|
422
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), bt(a, i, {
|
|
392
423
|
accentColor: t.accentColor,
|
|
393
424
|
colorScheme: t.colorScheme,
|
|
394
425
|
fontFamily: t.fontFamily,
|
|
@@ -399,16 +430,16 @@ async function lo(e = {}) {
|
|
|
399
430
|
fontFamily: t.fontFamily,
|
|
400
431
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
401
432
|
});
|
|
402
|
-
const
|
|
403
|
-
if (!
|
|
433
|
+
const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), L = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
434
|
+
if (!u || !p || !w || !x || !L || !C || !M || !v || !y || !h || !g || !_ || !N || !Z || !ce || !S || !f)
|
|
404
435
|
throw new Error("Failed to mount Pluno widget");
|
|
405
436
|
if (t.movableLauncher && !d)
|
|
406
437
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
407
|
-
|
|
408
|
-
let m = [],
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
m = m.filter((
|
|
438
|
+
xt(p), xt(g);
|
|
439
|
+
let m = [], T = null;
|
|
440
|
+
const k = () => {
|
|
441
|
+
Mo(v, m, (r) => {
|
|
442
|
+
m = m.filter((c, A) => A !== r), k(), O(b.getState()), U();
|
|
412
443
|
});
|
|
413
444
|
}, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
414
445
|
if (!t.tokenEndpoint)
|
|
@@ -421,19 +452,19 @@ async function lo(e = {}) {
|
|
|
421
452
|
});
|
|
422
453
|
if (!r.ok)
|
|
423
454
|
throw new Error("Failed to load Pluno token");
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
455
|
+
const c = await r.json();
|
|
456
|
+
if (!c.token)
|
|
426
457
|
throw new Error("Pluno token endpoint did not return a token");
|
|
427
|
-
return
|
|
428
|
-
}),
|
|
429
|
-
let
|
|
430
|
-
|
|
458
|
+
return c.token;
|
|
459
|
+
}), P = window.fetch.bind(window);
|
|
460
|
+
let b;
|
|
461
|
+
b = await dn.init({
|
|
431
462
|
token: t.token,
|
|
432
463
|
tokenProvider: I,
|
|
433
464
|
backendUrl: t.backendUrl,
|
|
434
465
|
metadata: () => ({
|
|
435
466
|
...t.metadata ?? {},
|
|
436
|
-
...!
|
|
467
|
+
...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
437
468
|
}),
|
|
438
469
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
439
470
|
clientId: t.clientId,
|
|
@@ -442,42 +473,42 @@ async function lo(e = {}) {
|
|
|
442
473
|
webSocketFactory: t.webSocketFactory,
|
|
443
474
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
444
475
|
});
|
|
445
|
-
const J =
|
|
446
|
-
let ke = J.sharePromptsDisabled || await
|
|
476
|
+
const J = ga(t), Se = new Set(J.openToolGroupKeys), ie = new Set(J.seenShareCandidateIds), be = new Set(ie);
|
|
477
|
+
let ke = J.sharePromptsDisabled || await ha(t), $ = t.movableLauncher ? J.launcherPosition : null, Ke = $ !== null, q = null, Le = !1, Q = !1, ee = {
|
|
447
478
|
enabled: !0
|
|
448
|
-
}, te = 0,
|
|
449
|
-
const
|
|
450
|
-
ee = { enabled: r, reason:
|
|
451
|
-
},
|
|
479
|
+
}, te = 0, Ye = "";
|
|
480
|
+
const W = (r, c) => {
|
|
481
|
+
ee = { enabled: r, reason: c };
|
|
482
|
+
}, H = () => {
|
|
452
483
|
Z.hidden = !0;
|
|
453
|
-
},
|
|
484
|
+
}, tn = () => {
|
|
454
485
|
Z.hidden = !1;
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
},
|
|
458
|
-
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
const
|
|
463
|
-
return
|
|
486
|
+
}, nn = (r = "jump") => {
|
|
487
|
+
W(!0, r), H(), me(S, () => ee.enabled), te = S.scrollTop;
|
|
488
|
+
}, on = () => {
|
|
489
|
+
Le || typeof document > "u" || (Pt(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
|
|
490
|
+
}, Xe = new MutationObserver(on);
|
|
491
|
+
Xe.observe(s.documentElement, { childList: !0, subtree: !0 });
|
|
492
|
+
const Pe = (r = !0) => {
|
|
493
|
+
const c = We(a, r);
|
|
494
|
+
return wt(
|
|
464
495
|
a,
|
|
465
|
-
|
|
466
|
-
|
|
496
|
+
$ ?? go(a, t.position, c),
|
|
497
|
+
c
|
|
467
498
|
);
|
|
468
499
|
}, F = () => {
|
|
469
|
-
|
|
500
|
+
fa(t, {
|
|
470
501
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
471
502
|
composerValue: g.value,
|
|
472
|
-
openToolGroupKeys: [...
|
|
473
|
-
launcherPosition:
|
|
474
|
-
seenShareCandidateIds: [...
|
|
503
|
+
openToolGroupKeys: [...Se],
|
|
504
|
+
launcherPosition: Ke ? $ : null,
|
|
505
|
+
seenShareCandidateIds: [...ie].slice(-Mt),
|
|
475
506
|
sharePromptsDisabled: ke
|
|
476
507
|
});
|
|
477
|
-
}, ne = (r,
|
|
478
|
-
|
|
479
|
-
debugVersion:
|
|
480
|
-
launcherPosition:
|
|
508
|
+
}, ne = (r, c = {}) => {
|
|
509
|
+
wo(r, {
|
|
510
|
+
debugVersion: ao,
|
|
511
|
+
launcherPosition: $,
|
|
481
512
|
rootClasses: a.className,
|
|
482
513
|
rootStyle: {
|
|
483
514
|
left: a.style.left,
|
|
@@ -486,150 +517,150 @@ async function lo(e = {}) {
|
|
|
486
517
|
bottom: a.style.bottom
|
|
487
518
|
},
|
|
488
519
|
rootRect: Me(a),
|
|
489
|
-
launcherRect: Me(
|
|
490
|
-
panelRect: Me(
|
|
491
|
-
viewport:
|
|
492
|
-
panelHidden:
|
|
493
|
-
closeHidden:
|
|
494
|
-
...
|
|
520
|
+
launcherRect: Me(u),
|
|
521
|
+
panelRect: Me(w),
|
|
522
|
+
viewport: de(),
|
|
523
|
+
panelHidden: w.hidden,
|
|
524
|
+
closeHidden: x.hidden,
|
|
525
|
+
...c
|
|
495
526
|
});
|
|
496
|
-
},
|
|
497
|
-
if (
|
|
498
|
-
return
|
|
499
|
-
const
|
|
500
|
-
return
|
|
501
|
-
},
|
|
502
|
-
if (!r || !
|
|
503
|
-
|
|
527
|
+
}, we = (r = !0) => {
|
|
528
|
+
if (!$)
|
|
529
|
+
return xe(a, null), Pe(r);
|
|
530
|
+
const c = Pe(r);
|
|
531
|
+
return xe(a, c), ne("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
|
|
532
|
+
}, Ze = (r, c) => {
|
|
533
|
+
if (!r || !c) {
|
|
534
|
+
bo(a);
|
|
504
535
|
return;
|
|
505
536
|
}
|
|
506
|
-
|
|
507
|
-
x: r.x -
|
|
508
|
-
y: r.y -
|
|
537
|
+
fo(a, {
|
|
538
|
+
x: r.x - c.x,
|
|
539
|
+
y: r.y - c.y
|
|
509
540
|
});
|
|
510
|
-
},
|
|
511
|
-
const r =
|
|
541
|
+
}, Je = () => {
|
|
542
|
+
const r = we();
|
|
512
543
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
} else
|
|
544
|
+
const c = _t(a, r, t.position);
|
|
545
|
+
Ze(c, r), ne("Applied open panel position after viewport resize", { openPanelPosition: c });
|
|
546
|
+
} else $ && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
516
547
|
};
|
|
517
|
-
let
|
|
548
|
+
let Qe = () => {
|
|
518
549
|
};
|
|
519
|
-
window.addEventListener("resize",
|
|
550
|
+
window.addEventListener("resize", Je), t.movableLauncher && d ? (we(), Qe = uo({
|
|
520
551
|
root: a,
|
|
521
|
-
launcher:
|
|
552
|
+
launcher: u,
|
|
522
553
|
launcherDragHandle: d,
|
|
523
|
-
getPosition: () =>
|
|
554
|
+
getPosition: () => Pe(),
|
|
524
555
|
setPosition: (r) => {
|
|
525
|
-
const
|
|
526
|
-
|
|
556
|
+
const c = r;
|
|
557
|
+
$ = wt(a, r, We(a)), xe(a, $), ne("Dragging closed launcher", { requestedPosition: c });
|
|
527
558
|
},
|
|
528
559
|
persist: () => {
|
|
529
|
-
|
|
560
|
+
Ke = !0, F(), ne("Persisted closed launcher drag position");
|
|
530
561
|
}
|
|
531
|
-
})) :
|
|
532
|
-
let
|
|
533
|
-
const
|
|
534
|
-
if (!(!t.billingStatusLoader ||
|
|
535
|
-
|
|
562
|
+
})) : xe(a, null);
|
|
563
|
+
let Ae = !1;
|
|
564
|
+
const et = async () => {
|
|
565
|
+
if (!(!t.billingStatusLoader || Ae)) {
|
|
566
|
+
Ae = !0;
|
|
536
567
|
try {
|
|
537
568
|
const r = await t.billingStatusLoader();
|
|
538
|
-
|
|
569
|
+
yt(t.billingStatus, r, b.getState().lastErrorCode) && (t.billingStatus = r, Fe(M, t.billingStatus, b.getState().lastErrorCode), U());
|
|
539
570
|
} finally {
|
|
540
|
-
|
|
571
|
+
Ae = !1;
|
|
541
572
|
}
|
|
542
573
|
}
|
|
543
|
-
}, oe = (r = "",
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
547
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
574
|
+
}, oe = (r = "", c = !0) => {
|
|
575
|
+
et(), q !== null && (window.clearTimeout(q), q = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
576
|
+
const A = we(), K = _t(a, A, t.position);
|
|
577
|
+
if (Ze(K, A), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: A }), W(!0, "open"), H(), !c) {
|
|
578
|
+
a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
|
|
548
579
|
return;
|
|
549
580
|
}
|
|
550
581
|
window.requestAnimationFrame(() => {
|
|
551
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r,
|
|
552
|
-
|
|
582
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
|
|
583
|
+
u.hidden = !0, me(S, () => ee.enabled), te = S.scrollTop;
|
|
553
584
|
}, 220);
|
|
554
585
|
});
|
|
555
|
-
},
|
|
556
|
-
q !== null && (window.clearTimeout(q), q = null),
|
|
557
|
-
|
|
586
|
+
}, an = () => {
|
|
587
|
+
q !== null && (window.clearTimeout(q), q = null), u.hidden = !1, $ && (we(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
|
|
588
|
+
w.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
558
589
|
}, 220);
|
|
559
590
|
};
|
|
560
|
-
|
|
561
|
-
r.preventDefault(), oe(
|
|
591
|
+
u.addEventListener("submit", (r) => {
|
|
592
|
+
r.preventDefault(), oe(p.value), p.value = "";
|
|
562
593
|
}), d?.addEventListener("click", (r) => {
|
|
563
594
|
r.preventDefault(), r.stopPropagation();
|
|
564
|
-
}),
|
|
565
|
-
r.target ===
|
|
566
|
-
}),
|
|
567
|
-
oe(
|
|
568
|
-
}),
|
|
569
|
-
if (!
|
|
595
|
+
}), u.addEventListener("click", (r) => {
|
|
596
|
+
r.target === p && !d || (oe(p.value), p.value = "");
|
|
597
|
+
}), p.addEventListener("focus", () => {
|
|
598
|
+
oe(p.value), p.value = "";
|
|
599
|
+
}), p.addEventListener("input", () => {
|
|
600
|
+
if (!p.value)
|
|
570
601
|
return;
|
|
571
|
-
const r =
|
|
572
|
-
oe(r),
|
|
573
|
-
}),
|
|
574
|
-
|
|
602
|
+
const r = p.value;
|
|
603
|
+
oe(r), p.value = "";
|
|
604
|
+
}), x.addEventListener("click", an), S.addEventListener("scroll", () => {
|
|
605
|
+
S.scrollTop < te - 1 && W(!1, "userScroll"), te = S.scrollTop;
|
|
575
606
|
}), Z.addEventListener("click", () => {
|
|
576
|
-
|
|
607
|
+
nn();
|
|
577
608
|
});
|
|
578
|
-
const
|
|
609
|
+
const tt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
579
610
|
([r]) => {
|
|
580
|
-
r?.isIntersecting && (
|
|
611
|
+
r?.isIntersecting && (W(!0, "bottom"), H());
|
|
581
612
|
},
|
|
582
|
-
{ root:
|
|
613
|
+
{ root: S, threshold: 0 }
|
|
583
614
|
);
|
|
584
|
-
|
|
615
|
+
tt?.observe(f);
|
|
585
616
|
const U = () => {
|
|
586
|
-
_.disabled =
|
|
617
|
+
_.disabled = G(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || G(t.billingStatus);
|
|
587
618
|
};
|
|
588
|
-
t.loginRequired && (
|
|
619
|
+
t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, L.hidden = !0), L.addEventListener("submit", (r) => {
|
|
589
620
|
if (r.preventDefault(), t.loginRequired) {
|
|
590
621
|
t.onLoginClick?.();
|
|
591
622
|
return;
|
|
592
623
|
}
|
|
593
|
-
|
|
624
|
+
G(t.billingStatus) || (Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U());
|
|
594
625
|
});
|
|
595
|
-
let
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
},
|
|
599
|
-
|
|
600
|
-
|
|
626
|
+
let ue = 0;
|
|
627
|
+
const rn = () => {
|
|
628
|
+
ue = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
629
|
+
}, nt = (r) => {
|
|
630
|
+
T !== null && window.clearTimeout(T), C.textContent = r, C.hidden = !1, T = window.setTimeout(() => {
|
|
631
|
+
C.textContent = "", C.hidden = !0, T = null;
|
|
601
632
|
}, 3e3);
|
|
602
|
-
},
|
|
603
|
-
|
|
604
|
-
},
|
|
633
|
+
}, ln = () => {
|
|
634
|
+
T !== null && (window.clearTimeout(T), T = null), C.textContent = "", C.hidden = !0;
|
|
635
|
+
}, ot = async (r) => {
|
|
605
636
|
if (r.length === 0)
|
|
606
637
|
return;
|
|
607
|
-
const
|
|
608
|
-
if (m.length +
|
|
609
|
-
throw new Error(`Attach up to ${
|
|
610
|
-
m = [...m, ...
|
|
638
|
+
const c = await Uo(r);
|
|
639
|
+
if (m.length + c.length > Ee)
|
|
640
|
+
throw new Error(`Attach up to ${Ee} files per message.`);
|
|
641
|
+
m = [...m, ...c], k(), ln(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
|
|
611
642
|
};
|
|
612
643
|
h.addEventListener("click", () => {
|
|
613
|
-
t.loginRequired ||
|
|
644
|
+
t.loginRequired || G(t.billingStatus) || y.click();
|
|
614
645
|
}), y.addEventListener("change", () => {
|
|
615
646
|
const r = Array.from(y.files ?? []);
|
|
616
|
-
y.value = "",
|
|
617
|
-
|
|
618
|
-
message:
|
|
647
|
+
y.value = "", ot(r).catch((c) => {
|
|
648
|
+
nt(c instanceof Error ? c.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
649
|
+
message: c instanceof Error ? c.message : String(c)
|
|
619
650
|
});
|
|
620
651
|
});
|
|
621
652
|
}), a.addEventListener("dragenter", (r) => {
|
|
622
|
-
!
|
|
653
|
+
!ve(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ue += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
623
654
|
}), a.addEventListener("dragover", (r) => {
|
|
624
|
-
const
|
|
625
|
-
!
|
|
655
|
+
const c = r.dataTransfer;
|
|
656
|
+
!ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
|
|
626
657
|
}), a.addEventListener("dragleave", (r) => {
|
|
627
|
-
|
|
658
|
+
ve(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
628
659
|
}), a.addEventListener("drop", (r) => {
|
|
629
|
-
const
|
|
630
|
-
!
|
|
631
|
-
|
|
632
|
-
message:
|
|
660
|
+
const c = r.dataTransfer;
|
|
661
|
+
!ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), rn(), ot(c.files).catch((A) => {
|
|
662
|
+
nt(A instanceof Error ? A.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
663
|
+
message: A instanceof Error ? A.message : String(A)
|
|
633
664
|
});
|
|
634
665
|
}));
|
|
635
666
|
}), _.addEventListener("click", () => {
|
|
@@ -637,152 +668,152 @@ async function lo(e = {}) {
|
|
|
637
668
|
t.onLoginClick?.();
|
|
638
669
|
return;
|
|
639
670
|
}
|
|
640
|
-
if (
|
|
641
|
-
|
|
671
|
+
if (b.getState().isThinking) {
|
|
672
|
+
b.stop();
|
|
642
673
|
return;
|
|
643
674
|
}
|
|
644
|
-
Q = !0,
|
|
675
|
+
Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
|
|
645
676
|
}), N.addEventListener("click", () => {
|
|
646
|
-
Q = !0,
|
|
677
|
+
Q = !0, W(!0, "newSession"), H(), b.startNewSession(), Se.clear(), g.value = "", m = [], k(), he(g), F(), U(), g.focus(), O(b.getState());
|
|
647
678
|
}), g.addEventListener("input", () => {
|
|
648
|
-
|
|
679
|
+
he(g), F(), U(), O(b.getState());
|
|
649
680
|
}), g.addEventListener("keydown", (r) => {
|
|
650
681
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
651
682
|
if (r.preventDefault(), t.loginRequired) {
|
|
652
683
|
t.onLoginClick?.();
|
|
653
684
|
return;
|
|
654
685
|
}
|
|
655
|
-
Q = !0,
|
|
686
|
+
Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
|
|
656
687
|
}
|
|
657
688
|
}), a.addEventListener("click", (r) => {
|
|
658
689
|
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
|
|
659
|
-
}), J.composerValue && (g.value = J.composerValue,
|
|
660
|
-
const
|
|
661
|
-
let
|
|
690
|
+
}), J.composerValue && (g.value = J.composerValue, he(g)), J.isOpen && oe(g.value, !1);
|
|
691
|
+
const at = () => i;
|
|
692
|
+
let Te = b.getState().appearance !== null, _e = null, ge = null, re = null, it = b.getState().isThinking, le = null, Ne = null, rt = () => {
|
|
662
693
|
};
|
|
663
|
-
const
|
|
664
|
-
if (
|
|
665
|
-
|
|
694
|
+
const pn = !!t.socialPostDraftHandler, O = (r) => {
|
|
695
|
+
if (qe(r.lastErrorCode) ? le = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(M, t.billingStatus, le), t.loginRequired) {
|
|
696
|
+
Jo(S, _, N, at, t.loginButtonLabel, t.onLoginClick);
|
|
666
697
|
return;
|
|
667
698
|
}
|
|
668
|
-
const
|
|
669
|
-
|
|
699
|
+
const c = _o(r), A = c !== Ye;
|
|
700
|
+
Ye = c;
|
|
670
701
|
const K = Q || ee.enabled;
|
|
671
|
-
Q = !1,
|
|
672
|
-
|
|
673
|
-
|
|
702
|
+
Q = !1, Zo(
|
|
703
|
+
S,
|
|
704
|
+
f,
|
|
674
705
|
_,
|
|
675
706
|
N,
|
|
676
|
-
|
|
707
|
+
ce,
|
|
677
708
|
r,
|
|
678
|
-
|
|
679
|
-
|
|
709
|
+
Ne,
|
|
710
|
+
Ne !== null && Et(r, g.value.trim().length > 0 || m.length > 0),
|
|
680
711
|
K,
|
|
681
712
|
() => ee.enabled,
|
|
682
|
-
|
|
713
|
+
Se,
|
|
683
714
|
F,
|
|
684
|
-
|
|
685
|
-
(
|
|
686
|
-
Q = !0,
|
|
715
|
+
at,
|
|
716
|
+
(R) => {
|
|
717
|
+
Q = !0, W(!0, "send"), H(), b.sendMessage(R);
|
|
687
718
|
},
|
|
688
|
-
|
|
689
|
-
dismissedCandidateIds:
|
|
690
|
-
draftingCandidateId:
|
|
691
|
-
error:
|
|
692
|
-
onSeen: (
|
|
693
|
-
|
|
719
|
+
pn && !ke ? {
|
|
720
|
+
dismissedCandidateIds: be,
|
|
721
|
+
draftingCandidateId: _e,
|
|
722
|
+
error: ge,
|
|
723
|
+
onSeen: (R) => {
|
|
724
|
+
ie.add(R.id), F();
|
|
694
725
|
},
|
|
695
|
-
onDraft: (
|
|
696
|
-
|
|
726
|
+
onDraft: (R) => {
|
|
727
|
+
sn(R);
|
|
697
728
|
},
|
|
698
|
-
onDismiss: (
|
|
699
|
-
|
|
729
|
+
onDismiss: (R) => {
|
|
730
|
+
ie.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
|
|
700
731
|
},
|
|
701
|
-
onDisable: (
|
|
702
|
-
ke = !0,
|
|
732
|
+
onDisable: (R) => {
|
|
733
|
+
ke = !0, ie.add(R.id), be.add(R.id), F(), ma(t, !0), ge = null, O(b.getState());
|
|
703
734
|
}
|
|
704
735
|
} : void 0
|
|
705
|
-
), K ? (te =
|
|
736
|
+
), K ? (te = S.scrollTop, H()) : A && xo(r) && tn();
|
|
706
737
|
};
|
|
707
|
-
return
|
|
708
|
-
|
|
709
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
710
|
-
const
|
|
711
|
-
|
|
738
|
+
return rt = An((r) => {
|
|
739
|
+
Ne = r, !Le && Et(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
|
|
740
|
+
}, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), b.on("state", (r) => {
|
|
741
|
+
const c = it && !r.isThinking;
|
|
742
|
+
it = r.isThinking, r.appearance ? (Te = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
|
|
712
743
|
appearance: r.appearance
|
|
713
|
-
}),
|
|
744
|
+
}), Ie(r.appearance, "agent.state.appearance")) : Te && (Te = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
714
745
|
fallbackAccentColor: t.accentColor,
|
|
715
746
|
fallbackColorScheme: t.colorScheme,
|
|
716
747
|
fallbackFontFamily: t.fontFamily
|
|
717
|
-
}),
|
|
718
|
-
}), O(
|
|
719
|
-
agent:
|
|
748
|
+
}), Ie({}, "agent.state.appearance-cleared")), O(r), U(), c && et();
|
|
749
|
+
}), O(b.getState()), U(), {
|
|
750
|
+
agent: b,
|
|
720
751
|
updateAppearance: (r) => {
|
|
721
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
752
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ie(r, "widgetHandle.updateAppearance");
|
|
722
753
|
},
|
|
723
754
|
updateBillingStatus: (r) => {
|
|
724
|
-
const
|
|
725
|
-
|
|
755
|
+
const c = r ?? null;
|
|
756
|
+
yt(t.billingStatus, c, le) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(
|
|
726
757
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
727
758
|
t.billingStatus,
|
|
728
|
-
|
|
759
|
+
le
|
|
729
760
|
), U());
|
|
730
761
|
},
|
|
731
762
|
openPanel: () => {
|
|
732
763
|
oe(g.value, !1);
|
|
733
764
|
},
|
|
734
765
|
destroy: () => {
|
|
735
|
-
|
|
766
|
+
Le = !0, Xe.disconnect(), tt?.disconnect(), window.removeEventListener("resize", Je), Qe(), T !== null && window.clearTimeout(T), rt(), re?.remove(), b.destroy(), n.remove();
|
|
736
767
|
}
|
|
737
768
|
};
|
|
738
|
-
async function
|
|
739
|
-
if (!
|
|
740
|
-
|
|
769
|
+
async function sn(r) {
|
|
770
|
+
if (!_e) {
|
|
771
|
+
_e = r.id, ge = null, O(b.getState());
|
|
741
772
|
try {
|
|
742
773
|
if (!t.socialPostDraftHandler)
|
|
743
774
|
throw new Error("Social post drafting is not available here.");
|
|
744
|
-
const
|
|
745
|
-
if (!
|
|
775
|
+
const c = await t.socialPostDraftHandler(r);
|
|
776
|
+
if (!c.linkedinPost || !c.xPost)
|
|
746
777
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
747
|
-
|
|
778
|
+
ie.add(r.id), be.add(r.id), F(), re?.remove(), re = ta(c, {
|
|
748
779
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
749
780
|
onClose: () => {
|
|
750
|
-
|
|
781
|
+
re?.remove(), re = null;
|
|
751
782
|
}
|
|
752
|
-
}), a.appendChild(
|
|
753
|
-
} catch (
|
|
754
|
-
|
|
783
|
+
}), a.appendChild(re);
|
|
784
|
+
} catch (c) {
|
|
785
|
+
ge = c instanceof Error ? c.message : "Could not draft social post.";
|
|
755
786
|
} finally {
|
|
756
|
-
|
|
787
|
+
_e = null, O(b.getState());
|
|
757
788
|
}
|
|
758
789
|
}
|
|
759
790
|
}
|
|
760
|
-
function
|
|
761
|
-
const
|
|
762
|
-
i =
|
|
763
|
-
accentColor:
|
|
791
|
+
function Ie(r, c) {
|
|
792
|
+
const A = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, De = r.scribbleStyle ?? t.scribbleStyle;
|
|
793
|
+
i = ft(A, De), bt(a, i, {
|
|
794
|
+
accentColor: A,
|
|
764
795
|
colorScheme: K,
|
|
765
|
-
fontFamily:
|
|
766
|
-
scribbleStyle:
|
|
796
|
+
fontFamily: R,
|
|
797
|
+
scribbleStyle: De
|
|
767
798
|
}), Y("web-sdk.widget", "Updated widget appearance", {
|
|
768
|
-
source:
|
|
799
|
+
source: c,
|
|
769
800
|
inputAppearance: r,
|
|
770
|
-
appliedAccentColor:
|
|
801
|
+
appliedAccentColor: A,
|
|
771
802
|
appliedColorScheme: K,
|
|
772
|
-
appliedFontFamily:
|
|
773
|
-
appliedScribbleStyle:
|
|
803
|
+
appliedFontFamily: R,
|
|
804
|
+
appliedScribbleStyle: De,
|
|
774
805
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
775
806
|
});
|
|
776
807
|
}
|
|
777
808
|
}
|
|
778
|
-
function
|
|
779
|
-
return t ?
|
|
809
|
+
function ft(e, t) {
|
|
810
|
+
return t ? gn(e) : un(e);
|
|
780
811
|
}
|
|
781
|
-
function
|
|
782
|
-
const t =
|
|
783
|
-
return t === null ? "#fafafa" :
|
|
812
|
+
function lo(e) {
|
|
813
|
+
const t = po(e);
|
|
814
|
+
return t === null ? "#fafafa" : so(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
784
815
|
}
|
|
785
|
-
function
|
|
816
|
+
function po(e) {
|
|
786
817
|
const t = e.trim();
|
|
787
818
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
788
819
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -794,22 +825,22 @@ function so(e) {
|
|
|
794
825
|
Number.parseInt(t[3] + t[3], 16)
|
|
795
826
|
] : null;
|
|
796
827
|
}
|
|
797
|
-
function
|
|
828
|
+
function so([e, t, n]) {
|
|
798
829
|
const o = (a) => {
|
|
799
830
|
const i = a / 255;
|
|
800
831
|
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
801
832
|
};
|
|
802
833
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
803
834
|
}
|
|
804
|
-
function
|
|
835
|
+
function bt(e, t, n) {
|
|
805
836
|
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);
|
|
806
|
-
const o = n.scribbleStyle ?
|
|
807
|
-
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast",
|
|
837
|
+
const o = n.scribbleStyle ? It(n.accentColor) : n.accentColor;
|
|
838
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", lo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? jn : n.fontFamily, n.scribbleStyle && co(e.ownerDocument);
|
|
808
839
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
809
840
|
for (const i of a)
|
|
810
|
-
i.
|
|
841
|
+
i.replaceWith(ae(Array.from(i.classList).join(" "), t));
|
|
811
842
|
}
|
|
812
|
-
function
|
|
843
|
+
function co(e) {
|
|
813
844
|
if (e.getElementById(gt))
|
|
814
845
|
return;
|
|
815
846
|
const t = e.createElement("style");
|
|
@@ -821,7 +852,7 @@ function uo(e) {
|
|
|
821
852
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
822
853
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
823
854
|
}
|
|
824
|
-
function
|
|
855
|
+
function uo({
|
|
825
856
|
root: e,
|
|
826
857
|
launcher: t,
|
|
827
858
|
launcherDragHandle: n,
|
|
@@ -829,115 +860,115 @@ function go({
|
|
|
829
860
|
setPosition: a,
|
|
830
861
|
persist: i
|
|
831
862
|
}) {
|
|
832
|
-
let l = null,
|
|
833
|
-
const
|
|
834
|
-
l = null,
|
|
835
|
-
},
|
|
836
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId,
|
|
837
|
-
},
|
|
838
|
-
if (l !== h.pointerId || !
|
|
863
|
+
let l = null, s = null, u = null, d = !1, p = null;
|
|
864
|
+
const w = () => {
|
|
865
|
+
l = null, s = null, u = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
866
|
+
}, x = (h) => {
|
|
867
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, u = o(), d = !1, t.setPointerCapture?.(h.pointerId));
|
|
868
|
+
}, L = (h) => {
|
|
869
|
+
if (l !== h.pointerId || !s || !u)
|
|
839
870
|
return;
|
|
840
871
|
h.preventDefault();
|
|
841
|
-
const g = h.clientX -
|
|
842
|
-
!d && Math.hypot(g, _) <
|
|
843
|
-
},
|
|
844
|
-
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (
|
|
845
|
-
},
|
|
846
|
-
l === h.pointerId && (h.preventDefault(),
|
|
872
|
+
const g = h.clientX - s.x, _ = h.clientY - s.y;
|
|
873
|
+
!d && Math.hypot(g, _) < mt || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: u.x + g, y: u.y + _ }));
|
|
874
|
+
}, C = (h) => {
|
|
875
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (p = { x: h.clientX, y: h.clientY }, i()), w());
|
|
876
|
+
}, M = (h) => {
|
|
877
|
+
l === h.pointerId && (h.preventDefault(), w());
|
|
847
878
|
}, v = (h) => {
|
|
848
|
-
if (!
|
|
879
|
+
if (!p)
|
|
849
880
|
return;
|
|
850
|
-
const g = Math.hypot(h.clientX -
|
|
851
|
-
|
|
881
|
+
const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= mt;
|
|
882
|
+
p = null, g && (h.preventDefault(), h.stopPropagation());
|
|
852
883
|
}, y = (h) => {
|
|
853
884
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
854
885
|
return;
|
|
855
|
-
const g = h.shiftKey ?
|
|
886
|
+
const g = h.shiftKey ? oo : no, _ = o();
|
|
856
887
|
let N = null;
|
|
857
888
|
h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
|
|
858
889
|
};
|
|
859
|
-
return t.addEventListener("pointerdown",
|
|
860
|
-
t.removeEventListener("pointerdown",
|
|
890
|
+
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", L), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
|
|
891
|
+
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", L), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
|
|
861
892
|
};
|
|
862
893
|
}
|
|
863
|
-
function
|
|
864
|
-
const n =
|
|
894
|
+
function We(e, t = !0) {
|
|
895
|
+
const n = de(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
865
896
|
return {
|
|
866
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
867
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
897
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Ft, n.width - 36),
|
|
898
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vn : Ut
|
|
868
899
|
};
|
|
869
900
|
}
|
|
870
901
|
function $t() {
|
|
871
|
-
const e =
|
|
902
|
+
const e = de();
|
|
872
903
|
return {
|
|
873
904
|
width: Math.min(
|
|
874
|
-
|
|
905
|
+
se(e.width * Yn, qn, Kn),
|
|
875
906
|
e.width - B * 2
|
|
876
907
|
),
|
|
877
908
|
height: Math.min(
|
|
878
|
-
|
|
909
|
+
se(e.height * Jn, Xn, Zn),
|
|
879
910
|
e.height - $e - B
|
|
880
911
|
)
|
|
881
912
|
};
|
|
882
913
|
}
|
|
883
|
-
function
|
|
914
|
+
function go(e, t, n) {
|
|
884
915
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
885
916
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
886
917
|
return { x: o, y: a };
|
|
887
918
|
const i = e.getBoundingClientRect();
|
|
888
919
|
if (i.width > 0 || i.height > 0)
|
|
889
920
|
return { x: i.left, y: i.top };
|
|
890
|
-
const l =
|
|
921
|
+
const l = de();
|
|
891
922
|
return {
|
|
892
923
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
893
924
|
y: l.height - 24 - n.height
|
|
894
925
|
};
|
|
895
926
|
}
|
|
896
|
-
function
|
|
897
|
-
const o =
|
|
927
|
+
function wt(e, t, n) {
|
|
928
|
+
const o = de(), a = B + ho(e);
|
|
898
929
|
return {
|
|
899
|
-
x:
|
|
900
|
-
y:
|
|
930
|
+
x: se(t.x, B, Math.max(B, o.width - n.width - B)),
|
|
931
|
+
y: se(t.y, a, Math.max(a, o.height - n.height - B))
|
|
901
932
|
};
|
|
902
933
|
}
|
|
903
|
-
function
|
|
904
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
934
|
+
function ho(e) {
|
|
935
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
|
|
905
936
|
}
|
|
906
|
-
function
|
|
907
|
-
const o =
|
|
937
|
+
function _t(e, t, n) {
|
|
938
|
+
const o = We(e), a = $t(), i = {
|
|
908
939
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
909
940
|
y: t.y + o.height - a.height
|
|
910
941
|
};
|
|
911
|
-
return
|
|
942
|
+
return mo(i);
|
|
912
943
|
}
|
|
913
|
-
function
|
|
914
|
-
const t =
|
|
944
|
+
function mo(e) {
|
|
945
|
+
const t = de(), n = $t();
|
|
915
946
|
return {
|
|
916
|
-
x:
|
|
917
|
-
y:
|
|
947
|
+
x: se(e.x, B, Math.max(B, t.width - n.width - B)),
|
|
948
|
+
y: se(
|
|
918
949
|
e.y,
|
|
919
950
|
$e,
|
|
920
951
|
Math.max($e, t.height - n.height - B)
|
|
921
952
|
)
|
|
922
953
|
};
|
|
923
954
|
}
|
|
924
|
-
function
|
|
955
|
+
function xe(e, t) {
|
|
925
956
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
926
957
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
927
958
|
return;
|
|
928
959
|
}
|
|
929
960
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
930
961
|
}
|
|
931
|
-
function
|
|
962
|
+
function fo(e, t) {
|
|
932
963
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
933
964
|
}
|
|
934
|
-
function
|
|
965
|
+
function bo(e) {
|
|
935
966
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
936
967
|
}
|
|
937
|
-
function
|
|
968
|
+
function de() {
|
|
938
969
|
return {
|
|
939
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
940
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
970
|
+
width: window.innerWidth || document.documentElement.clientWidth || Ft + B * 2,
|
|
971
|
+
height: window.innerHeight || document.documentElement.clientHeight || Ut + B * 2
|
|
941
972
|
};
|
|
942
973
|
}
|
|
943
974
|
function Me(e) {
|
|
@@ -949,7 +980,7 @@ function Me(e) {
|
|
|
949
980
|
height: Math.round(t.height)
|
|
950
981
|
};
|
|
951
982
|
}
|
|
952
|
-
function
|
|
983
|
+
function se(e, t, n) {
|
|
953
984
|
return Math.min(Math.max(e, t), n);
|
|
954
985
|
}
|
|
955
986
|
function Y(e, t, n) {
|
|
@@ -963,24 +994,24 @@ function Y(e, t, n) {
|
|
|
963
994
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
964
995
|
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(Gn, { detail: a }));
|
|
965
996
|
}
|
|
966
|
-
function
|
|
997
|
+
function wo(e, t) {
|
|
967
998
|
Y("web-sdk.widget.position", e, t);
|
|
968
999
|
}
|
|
969
|
-
function
|
|
1000
|
+
function Oe(e, t, n) {
|
|
970
1001
|
const o = t.value.trim();
|
|
971
1002
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
972
1003
|
}
|
|
973
|
-
function
|
|
1004
|
+
function he(e) {
|
|
974
1005
|
e.style.height = "0px";
|
|
975
1006
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
976
1007
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
977
1008
|
}
|
|
978
|
-
function
|
|
1009
|
+
function me(e, t = () => !0) {
|
|
979
1010
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
980
1011
|
t() && (e.scrollTop = e.scrollHeight);
|
|
981
1012
|
});
|
|
982
1013
|
}
|
|
983
|
-
function
|
|
1014
|
+
function _o(e) {
|
|
984
1015
|
const t = e.messages[e.messages.length - 1];
|
|
985
1016
|
return [
|
|
986
1017
|
e.messages.length,
|
|
@@ -991,25 +1022,25 @@ function xo(e) {
|
|
|
991
1022
|
e.lastError ?? ""
|
|
992
1023
|
].join(":");
|
|
993
1024
|
}
|
|
994
|
-
function
|
|
1025
|
+
function xo(e) {
|
|
995
1026
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
996
1027
|
}
|
|
997
|
-
function
|
|
998
|
-
e.appendChild(
|
|
1028
|
+
function vo(e, t, n, o) {
|
|
1029
|
+
e.appendChild(Lo()), e.appendChild(yo(t, n, o)), e.appendChild(Ht("pluno-pa-widget__close", "Close", Po(16), !0)), e.appendChild(Co(n));
|
|
999
1030
|
}
|
|
1000
|
-
function
|
|
1031
|
+
function yo(e, t, n) {
|
|
1001
1032
|
const o = document.createElement("form");
|
|
1002
1033
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
1003
1034
|
const i = document.createElement("button");
|
|
1004
1035
|
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);
|
|
1005
1036
|
}
|
|
1006
|
-
o.appendChild(
|
|
1037
|
+
o.appendChild(jt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ae("pluno-pa-widget__character--launcher", t));
|
|
1007
1038
|
const a = document.createElement("input");
|
|
1008
1039
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
1009
1040
|
}
|
|
1010
|
-
function
|
|
1041
|
+
function Co(e) {
|
|
1011
1042
|
const t = document.createElement("section");
|
|
1012
|
-
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
1043
|
+
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(jt("pluno-pa-widget__scribble-spirals--panel", 16));
|
|
1013
1044
|
const n = document.createElement("div");
|
|
1014
1045
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1015
1046
|
const o = document.createElement("main");
|
|
@@ -1019,9 +1050,9 @@ function Eo(e) {
|
|
|
1019
1050
|
const i = document.createElement("div");
|
|
1020
1051
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
1021
1052
|
const l = document.createElement("button");
|
|
1022
|
-
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(
|
|
1053
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ht("pluno-pa-widget__new-chat", "New chat", Ao(), !0)), t.appendChild(n), t.appendChild(Eo()), t;
|
|
1023
1054
|
}
|
|
1024
|
-
function
|
|
1055
|
+
function Eo() {
|
|
1025
1056
|
const e = document.createElement("form");
|
|
1026
1057
|
e.className = "pluno-pa-widget__composer";
|
|
1027
1058
|
const t = document.createElement("div");
|
|
@@ -1035,53 +1066,89 @@ function ko() {
|
|
|
1035
1066
|
const i = document.createElement("input");
|
|
1036
1067
|
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Wn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1037
1068
|
const l = document.createElement("button");
|
|
1038
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1069
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(To()), l.appendChild(No()), a.appendChild(l);
|
|
1070
|
+
const s = document.createElement("textarea");
|
|
1071
|
+
s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
|
|
1072
|
+
const u = document.createElement("button");
|
|
1073
|
+
u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(Vt()), a.appendChild(u), e.appendChild(a);
|
|
1043
1074
|
const d = document.createElement("div");
|
|
1044
1075
|
d.className = "pluno-pa-widget__composer-meta";
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
return
|
|
1076
|
+
const p = document.createElement("a");
|
|
1077
|
+
p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", d.appendChild(p);
|
|
1078
|
+
const w = document.createElement("span");
|
|
1079
|
+
return w.className = "pluno-pa-widget__ai-disclaimer", w.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(w), e.appendChild(d), e;
|
|
1049
1080
|
}
|
|
1050
1081
|
function So(e) {
|
|
1051
1082
|
const t = document.createElement("div");
|
|
1052
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1083
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(ae("pluno-pa-widget__character--empty", e)), t.appendChild(Wt()), t;
|
|
1053
1084
|
}
|
|
1054
|
-
function
|
|
1085
|
+
function Wt() {
|
|
1055
1086
|
const e = document.createElement("div");
|
|
1056
1087
|
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;
|
|
1057
1088
|
}
|
|
1058
|
-
function
|
|
1089
|
+
function ko(e, t) {
|
|
1059
1090
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1060
1091
|
const n = document.createElement("span");
|
|
1061
1092
|
n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
|
|
1062
1093
|
}
|
|
1063
|
-
function
|
|
1064
|
-
const n =
|
|
1065
|
-
return
|
|
1094
|
+
function ae(e, t) {
|
|
1095
|
+
const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0), a = e.split(/\s+/).filter(Boolean);
|
|
1096
|
+
return o.setAttribute(
|
|
1097
|
+
"class",
|
|
1098
|
+
a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1099
|
+
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1066
1100
|
}
|
|
1067
|
-
function
|
|
1101
|
+
function Ht(e, t, n, o) {
|
|
1068
1102
|
const a = document.createElement("button");
|
|
1069
1103
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1070
1104
|
}
|
|
1071
|
-
function
|
|
1072
|
-
const e =
|
|
1105
|
+
function Lo() {
|
|
1106
|
+
const e = E("svg", {
|
|
1073
1107
|
class: "pluno-pa-widget__scribble-defs",
|
|
1074
1108
|
"aria-hidden": "true",
|
|
1075
1109
|
focusable: "false",
|
|
1076
1110
|
width: "0",
|
|
1077
1111
|
height: "0"
|
|
1078
|
-
}), t =
|
|
1079
|
-
return t.appendChild(
|
|
1112
|
+
}), t = E("defs");
|
|
1113
|
+
return t.appendChild(Be("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Be("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Be("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1114
|
+
}
|
|
1115
|
+
function jt(e, t) {
|
|
1116
|
+
const n = E("svg", {
|
|
1117
|
+
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1118
|
+
viewBox: `0 0 ${t * 26} 36`,
|
|
1119
|
+
preserveAspectRatio: "none",
|
|
1120
|
+
"aria-hidden": "true",
|
|
1121
|
+
focusable: "false"
|
|
1122
|
+
});
|
|
1123
|
+
for (let o = 0; o < t; o += 1) {
|
|
1124
|
+
const a = ht[o % ht.length], i = E("g", { transform: `translate(${o * 26} 0)` });
|
|
1125
|
+
i.appendChild(
|
|
1126
|
+
E("ellipse", {
|
|
1127
|
+
cx: a.ellipseCx,
|
|
1128
|
+
cy: a.ellipseCy,
|
|
1129
|
+
rx: a.ellipseRx,
|
|
1130
|
+
ry: a.ellipseRy,
|
|
1131
|
+
fill: "none",
|
|
1132
|
+
stroke: "#2c2a1e",
|
|
1133
|
+
"stroke-width": a.strokeWidth,
|
|
1134
|
+
opacity: "0.8"
|
|
1135
|
+
})
|
|
1136
|
+
), i.appendChild(
|
|
1137
|
+
E("path", {
|
|
1138
|
+
d: a.path,
|
|
1139
|
+
fill: "none",
|
|
1140
|
+
stroke: "#2c2a1e",
|
|
1141
|
+
"stroke-width": a.pathStrokeWidth,
|
|
1142
|
+
"stroke-linecap": "round"
|
|
1143
|
+
})
|
|
1144
|
+
), n.appendChild(i);
|
|
1145
|
+
}
|
|
1146
|
+
return n;
|
|
1080
1147
|
}
|
|
1081
|
-
function
|
|
1082
|
-
const o =
|
|
1148
|
+
function Be(e, t, n) {
|
|
1149
|
+
const o = E("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1083
1150
|
return o.appendChild(
|
|
1084
|
-
|
|
1151
|
+
E("feTurbulence", {
|
|
1085
1152
|
type: "fractalNoise",
|
|
1086
1153
|
baseFrequency: "0.012 0.028",
|
|
1087
1154
|
numOctaves: "3",
|
|
@@ -1089,7 +1156,7 @@ function Oe(e, t, n) {
|
|
|
1089
1156
|
result: "stroke-noise"
|
|
1090
1157
|
})
|
|
1091
1158
|
), o.appendChild(
|
|
1092
|
-
|
|
1159
|
+
E("feDisplacementMap", {
|
|
1093
1160
|
in: "SourceGraphic",
|
|
1094
1161
|
in2: "stroke-noise",
|
|
1095
1162
|
scale: "3.5",
|
|
@@ -1098,7 +1165,7 @@ function Oe(e, t, n) {
|
|
|
1098
1165
|
result: "warped"
|
|
1099
1166
|
})
|
|
1100
1167
|
), o.appendChild(
|
|
1101
|
-
|
|
1168
|
+
E("feTurbulence", {
|
|
1102
1169
|
type: "fractalNoise",
|
|
1103
1170
|
baseFrequency: "0.7",
|
|
1104
1171
|
numOctaves: "1",
|
|
@@ -1106,7 +1173,7 @@ function Oe(e, t, n) {
|
|
|
1106
1173
|
result: "ink-noise"
|
|
1107
1174
|
})
|
|
1108
1175
|
), o.appendChild(
|
|
1109
|
-
|
|
1176
|
+
E("feDisplacementMap", {
|
|
1110
1177
|
in: "warped",
|
|
1111
1178
|
in2: "ink-noise",
|
|
1112
1179
|
scale: "0.9",
|
|
@@ -1115,30 +1182,30 @@ function Oe(e, t, n) {
|
|
|
1115
1182
|
})
|
|
1116
1183
|
), o;
|
|
1117
1184
|
}
|
|
1118
|
-
function
|
|
1185
|
+
function Po(e) {
|
|
1119
1186
|
const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1120
|
-
return t.appendChild(
|
|
1187
|
+
return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1121
1188
|
}
|
|
1122
|
-
function
|
|
1189
|
+
function Ao() {
|
|
1123
1190
|
const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1124
|
-
return e.appendChild(
|
|
1191
|
+
return e.appendChild(E("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(E("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1125
1192
|
}
|
|
1126
|
-
function
|
|
1193
|
+
function Vt() {
|
|
1127
1194
|
const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1128
|
-
return e.appendChild(
|
|
1195
|
+
return e.appendChild(E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1129
1196
|
}
|
|
1130
|
-
function
|
|
1197
|
+
function To() {
|
|
1131
1198
|
const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1132
1199
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1133
|
-
|
|
1200
|
+
E("path", {
|
|
1134
1201
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
1135
1202
|
})
|
|
1136
1203
|
), e;
|
|
1137
1204
|
}
|
|
1138
|
-
function
|
|
1205
|
+
function No() {
|
|
1139
1206
|
const e = X("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1140
1207
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1141
|
-
|
|
1208
|
+
E("path", {
|
|
1142
1209
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
1143
1210
|
stroke: "currentColor",
|
|
1144
1211
|
"stroke-width": "2",
|
|
@@ -1147,17 +1214,17 @@ function Io() {
|
|
|
1147
1214
|
})
|
|
1148
1215
|
), e;
|
|
1149
1216
|
}
|
|
1150
|
-
function
|
|
1217
|
+
function Io() {
|
|
1151
1218
|
const e = X("0 0 24 24", 18, 18, "currentColor");
|
|
1152
|
-
return e.appendChild(
|
|
1219
|
+
return e.appendChild(E("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1153
1220
|
}
|
|
1154
|
-
function
|
|
1221
|
+
function Do() {
|
|
1155
1222
|
const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1156
|
-
return e.appendChild(
|
|
1223
|
+
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
1157
1224
|
}
|
|
1158
1225
|
function Ro() {
|
|
1159
1226
|
const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1160
|
-
return e.appendChild(
|
|
1227
|
+
return e.appendChild(E("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(E("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1161
1228
|
}
|
|
1162
1229
|
function X(e, t, n, o, a, i) {
|
|
1163
1230
|
const l = {
|
|
@@ -1167,41 +1234,41 @@ function X(e, t, n, o, a, i) {
|
|
|
1167
1234
|
fill: o,
|
|
1168
1235
|
"aria-hidden": "true"
|
|
1169
1236
|
};
|
|
1170
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i),
|
|
1237
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), E("svg", l);
|
|
1171
1238
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const n = document.createElementNS(
|
|
1239
|
+
function E(e, t = {}) {
|
|
1240
|
+
const n = document.createElementNS(Qn, e);
|
|
1174
1241
|
for (const [o, a] of Object.entries(t))
|
|
1175
1242
|
n.setAttribute(o, a);
|
|
1176
1243
|
return n;
|
|
1177
1244
|
}
|
|
1178
|
-
function
|
|
1245
|
+
function xt(e) {
|
|
1179
1246
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1180
1247
|
e.addEventListener(t, (n) => {
|
|
1181
1248
|
n.stopPropagation();
|
|
1182
1249
|
});
|
|
1183
1250
|
}
|
|
1184
|
-
function
|
|
1251
|
+
function Mo(e, t, n) {
|
|
1185
1252
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1186
1253
|
for (const [o, a] of t.entries()) {
|
|
1187
1254
|
const i = document.createElement("div");
|
|
1188
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1255
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Oo(a));
|
|
1189
1256
|
const l = document.createElement("span");
|
|
1190
1257
|
l.textContent = a.name, i.appendChild(l);
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1258
|
+
const s = document.createElement("button");
|
|
1259
|
+
s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Do()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
|
|
1193
1260
|
}
|
|
1194
1261
|
}
|
|
1195
|
-
function
|
|
1196
|
-
if (
|
|
1262
|
+
function Oo(e) {
|
|
1263
|
+
if (qt(e)) {
|
|
1197
1264
|
const n = document.createElement("img");
|
|
1198
1265
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1199
1266
|
}
|
|
1200
1267
|
const t = document.createElement("span");
|
|
1201
1268
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1202
1269
|
}
|
|
1203
|
-
function
|
|
1204
|
-
if (
|
|
1270
|
+
function Bo(e) {
|
|
1271
|
+
if (qt(e)) {
|
|
1205
1272
|
const a = document.createElement("img");
|
|
1206
1273
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1207
1274
|
}
|
|
@@ -1212,41 +1279,41 @@ function Fo(e) {
|
|
|
1212
1279
|
const o = document.createElement("strong");
|
|
1213
1280
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1214
1281
|
}
|
|
1215
|
-
function
|
|
1282
|
+
function qt(e) {
|
|
1216
1283
|
return e.mimeType.startsWith("image/");
|
|
1217
1284
|
}
|
|
1218
|
-
function
|
|
1285
|
+
function Fo(e) {
|
|
1219
1286
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1220
1287
|
}
|
|
1221
|
-
async function
|
|
1288
|
+
async function Uo(e) {
|
|
1222
1289
|
if (!e)
|
|
1223
1290
|
return [];
|
|
1224
1291
|
const t = Array.from(e);
|
|
1225
|
-
if (t.length >
|
|
1226
|
-
throw new Error(`Attach up to ${
|
|
1292
|
+
if (t.length > Ee)
|
|
1293
|
+
throw new Error(`Attach up to ${Ee} files per message.`);
|
|
1227
1294
|
return Promise.all(
|
|
1228
1295
|
t.map(async (n) => {
|
|
1229
|
-
const o =
|
|
1296
|
+
const o = zo(n);
|
|
1230
1297
|
if (!o)
|
|
1231
1298
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1232
|
-
if (n.size >
|
|
1299
|
+
if (n.size > $n)
|
|
1233
1300
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1234
1301
|
if (o === "image/gif") {
|
|
1235
|
-
const a = new Uint8Array(await
|
|
1236
|
-
if (
|
|
1302
|
+
const a = new Uint8Array(await Yo(n));
|
|
1303
|
+
if ($o(a))
|
|
1237
1304
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1238
1305
|
}
|
|
1239
1306
|
return {
|
|
1240
|
-
name: n.name ||
|
|
1307
|
+
name: n.name || Fo(o),
|
|
1241
1308
|
mimeType: o,
|
|
1242
1309
|
sizeBytes: n.size,
|
|
1243
|
-
dataUrl: Go(await
|
|
1310
|
+
dataUrl: Go(await Xo(n), o)
|
|
1244
1311
|
};
|
|
1245
1312
|
})
|
|
1246
1313
|
);
|
|
1247
1314
|
}
|
|
1248
|
-
function
|
|
1249
|
-
if (
|
|
1315
|
+
function zo(e) {
|
|
1316
|
+
if (Bt.has(e.type))
|
|
1250
1317
|
return e.type;
|
|
1251
1318
|
const t = e.name.toLowerCase();
|
|
1252
1319
|
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;
|
|
@@ -1255,7 +1322,7 @@ function Go(e, t) {
|
|
|
1255
1322
|
const n = `data:${t};base64,`;
|
|
1256
1323
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1257
1324
|
}
|
|
1258
|
-
function
|
|
1325
|
+
function $o(e) {
|
|
1259
1326
|
if (e.length < 14 || !Wo(e))
|
|
1260
1327
|
return !1;
|
|
1261
1328
|
const t = e[10];
|
|
@@ -1267,7 +1334,7 @@ function Ho(e) {
|
|
|
1267
1334
|
if (n += 1, a === 59)
|
|
1268
1335
|
return !1;
|
|
1269
1336
|
if (a === 33) {
|
|
1270
|
-
n += 1, n =
|
|
1337
|
+
n += 1, n = vt(e, n);
|
|
1271
1338
|
continue;
|
|
1272
1339
|
}
|
|
1273
1340
|
if (a !== 44)
|
|
@@ -1279,14 +1346,14 @@ function Ho(e) {
|
|
|
1279
1346
|
const i = e[n + 8];
|
|
1280
1347
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1281
1348
|
return !1;
|
|
1282
|
-
n += 1, n =
|
|
1349
|
+
n += 1, n = vt(e, n);
|
|
1283
1350
|
}
|
|
1284
1351
|
return !1;
|
|
1285
1352
|
}
|
|
1286
1353
|
function Wo(e) {
|
|
1287
1354
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1288
1355
|
}
|
|
1289
|
-
function
|
|
1356
|
+
function vt(e, t) {
|
|
1290
1357
|
for (; t < e.length; ) {
|
|
1291
1358
|
const n = e[t];
|
|
1292
1359
|
if (t += 1, n === 0)
|
|
@@ -1295,63 +1362,63 @@ function xt(e, t) {
|
|
|
1295
1362
|
}
|
|
1296
1363
|
return t;
|
|
1297
1364
|
}
|
|
1298
|
-
function
|
|
1365
|
+
function ve(e) {
|
|
1299
1366
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1300
1367
|
}
|
|
1301
|
-
function
|
|
1368
|
+
function Fe(e, t, n = null) {
|
|
1302
1369
|
if (!e || !He(t, n)) {
|
|
1303
1370
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1304
1371
|
return;
|
|
1305
1372
|
}
|
|
1306
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1373
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", G(t) || qe(n) ? e.appendChild(Ho(t, n)) : Kt(t) && e.appendChild(jo(t));
|
|
1307
1374
|
}
|
|
1308
|
-
function
|
|
1375
|
+
function Ho(e, t) {
|
|
1309
1376
|
const n = document.createElement("div");
|
|
1310
1377
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1311
1378
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1312
1379
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1313
1380
|
const i = document.createElement("span");
|
|
1314
|
-
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(
|
|
1381
|
+
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(Yt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1315
1382
|
}
|
|
1316
|
-
function
|
|
1383
|
+
function jo(e) {
|
|
1317
1384
|
const t = document.createElement("div");
|
|
1318
1385
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1319
1386
|
const n = document.createElement("strong");
|
|
1320
1387
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1321
1388
|
const o = document.createElement("span");
|
|
1322
|
-
return o.textContent =
|
|
1389
|
+
return o.textContent = qo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Yt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1323
1390
|
}
|
|
1324
1391
|
function He(e, t) {
|
|
1325
|
-
return e !== null && (
|
|
1392
|
+
return e !== null && (G(e) || Kt(e) || qe(t));
|
|
1326
1393
|
}
|
|
1327
|
-
function
|
|
1328
|
-
return He(t, n) ||
|
|
1394
|
+
function yt(e, t, n) {
|
|
1395
|
+
return He(t, n) || Vo(t) ? !0 : !He(e, n);
|
|
1329
1396
|
}
|
|
1330
|
-
function
|
|
1331
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1397
|
+
function Vo(e) {
|
|
1398
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || G(e));
|
|
1332
1399
|
}
|
|
1333
|
-
function
|
|
1400
|
+
function G(e) {
|
|
1334
1401
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1335
1402
|
}
|
|
1336
|
-
function
|
|
1403
|
+
function qe(e) {
|
|
1337
1404
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1338
1405
|
}
|
|
1339
|
-
function
|
|
1340
|
-
return
|
|
1406
|
+
function Kt(e) {
|
|
1407
|
+
return !G(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1341
1408
|
}
|
|
1342
|
-
function
|
|
1343
|
-
return e.creditsRemaining === null ? null : `${
|
|
1409
|
+
function qo(e) {
|
|
1410
|
+
return e.creditsRemaining === null ? null : `${Ko(e.creditsRemaining)} credits left`;
|
|
1344
1411
|
}
|
|
1345
|
-
function
|
|
1412
|
+
function Ko(e) {
|
|
1346
1413
|
return new Intl.NumberFormat("en-US", {
|
|
1347
1414
|
maximumFractionDigits: 0
|
|
1348
1415
|
}).format(Math.ceil(e));
|
|
1349
1416
|
}
|
|
1350
|
-
function
|
|
1417
|
+
function Yt(e, t, n) {
|
|
1351
1418
|
const o = document.createElement("div");
|
|
1352
|
-
return o.className = n, o.appendChild(
|
|
1419
|
+
return o.className = n, o.appendChild(Ct(t, e.pricingUrl)), o.appendChild(Ct("Earn credits", e.earnCreditsUrl)), o;
|
|
1353
1420
|
}
|
|
1354
|
-
function
|
|
1421
|
+
function Ct(e, t) {
|
|
1355
1422
|
const n = document.createElement("button");
|
|
1356
1423
|
if (n.type = "button", e === "Earn credits") {
|
|
1357
1424
|
const o = document.createElement("span");
|
|
@@ -1362,7 +1429,7 @@ function yt(e, t) {
|
|
|
1362
1429
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1363
1430
|
}), n;
|
|
1364
1431
|
}
|
|
1365
|
-
function
|
|
1432
|
+
function Yo(e) {
|
|
1366
1433
|
return new Promise((t, n) => {
|
|
1367
1434
|
const o = new FileReader();
|
|
1368
1435
|
o.addEventListener("load", () => {
|
|
@@ -1376,7 +1443,7 @@ function Xo(e) {
|
|
|
1376
1443
|
}), o.readAsArrayBuffer(e);
|
|
1377
1444
|
});
|
|
1378
1445
|
}
|
|
1379
|
-
function
|
|
1446
|
+
function Xo(e) {
|
|
1380
1447
|
return new Promise((t, n) => {
|
|
1381
1448
|
const o = new FileReader();
|
|
1382
1449
|
o.addEventListener("load", () => {
|
|
@@ -1390,122 +1457,122 @@ function Zo(e) {
|
|
|
1390
1457
|
}), o.readAsDataURL(e);
|
|
1391
1458
|
});
|
|
1392
1459
|
}
|
|
1393
|
-
function
|
|
1394
|
-
return e.messages.filter((o) => !
|
|
1460
|
+
function Et(e, t) {
|
|
1461
|
+
return e.messages.filter((o) => !Xt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1395
1462
|
}
|
|
1396
|
-
function
|
|
1397
|
-
const
|
|
1398
|
-
e.replaceChildren(),
|
|
1463
|
+
function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
|
|
1464
|
+
const M = [...i.messages], v = M.filter((f) => !Xt(f)), y = e.scrollTop;
|
|
1465
|
+
e.replaceChildren(), Jt(n, i.isThinking), a.hidden = !s, s && l !== null && ko(a, l);
|
|
1399
1466
|
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1400
1467
|
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1468
|
+
const f = document.createElement("div");
|
|
1469
|
+
f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1403
1470
|
const m = document.createElement("div");
|
|
1404
1471
|
m.className = "pluno-pa-widget__empty-hero";
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
const
|
|
1408
|
-
if (
|
|
1472
|
+
const T = ae("pluno-pa-widget__character--empty", x());
|
|
1473
|
+
m.appendChild(T), f.appendChild(m), f.appendChild(Wt());
|
|
1474
|
+
const k = document.createElement("div");
|
|
1475
|
+
if (k.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1409
1476
|
for (const I of i.starterPrompts) {
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}),
|
|
1477
|
+
const P = document.createElement("button");
|
|
1478
|
+
P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
|
|
1479
|
+
L(I);
|
|
1480
|
+
}), k.appendChild(P);
|
|
1414
1481
|
}
|
|
1415
1482
|
else
|
|
1416
|
-
for (let I = 0; I <
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1483
|
+
for (let I = 0; I < Hn; I += 1) {
|
|
1484
|
+
const P = document.createElement("button");
|
|
1485
|
+
P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = " ", k.appendChild(P);
|
|
1419
1486
|
}
|
|
1420
|
-
|
|
1487
|
+
f.appendChild(k), e.appendChild(f), e.appendChild(t);
|
|
1421
1488
|
return;
|
|
1422
1489
|
}
|
|
1423
1490
|
let g = null, _ = null, N = [];
|
|
1424
1491
|
const Z = () => {
|
|
1425
1492
|
if (N.length === 0)
|
|
1426
1493
|
return !1;
|
|
1427
|
-
const
|
|
1428
|
-
return e.appendChild(
|
|
1494
|
+
const f = ra(N, p, w, x());
|
|
1495
|
+
return e.appendChild(f), g = null, _ = f, N = [], !0;
|
|
1429
1496
|
};
|
|
1430
|
-
for (let
|
|
1431
|
-
const m = v[
|
|
1497
|
+
for (let f = 0; f < v.length; f += 1) {
|
|
1498
|
+
const m = v[f];
|
|
1432
1499
|
if (m.role === "tool") {
|
|
1433
1500
|
N.push(m);
|
|
1434
1501
|
continue;
|
|
1435
1502
|
}
|
|
1436
1503
|
if (m.role === "system")
|
|
1437
1504
|
continue;
|
|
1438
|
-
const
|
|
1439
|
-
if (m.role === "assistant" && !
|
|
1440
|
-
const
|
|
1441
|
-
e.appendChild(
|
|
1505
|
+
const T = Z(), k = kt(m.content);
|
|
1506
|
+
if (m.role === "assistant" && !T) {
|
|
1507
|
+
const b = je(x());
|
|
1508
|
+
e.appendChild(b), g = null, _ = b;
|
|
1442
1509
|
}
|
|
1443
1510
|
const I = document.createElement("div");
|
|
1444
|
-
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ?
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1511
|
+
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? Lt(I, k) : I.textContent = k, m.role === "user" && m.attachments?.length && I.appendChild(Qo(m.attachments));
|
|
1512
|
+
const P = document.createElement("div");
|
|
1513
|
+
P.className = "pluno-pa-widget__message-actions", P.appendChild(St(k)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
|
|
1447
1514
|
}
|
|
1448
|
-
const
|
|
1515
|
+
const ce = Z();
|
|
1449
1516
|
if (i.assistantDraft) {
|
|
1450
|
-
if (!
|
|
1451
|
-
const
|
|
1452
|
-
e.appendChild(
|
|
1453
|
-
}
|
|
1454
|
-
const
|
|
1455
|
-
m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1517
|
+
if (!ce) {
|
|
1518
|
+
const k = je(x());
|
|
1519
|
+
e.appendChild(k), g = null, _ = k;
|
|
1520
|
+
}
|
|
1521
|
+
const f = kt(i.assistantDraft), m = document.createElement("div");
|
|
1522
|
+
m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Lt(m, f);
|
|
1523
|
+
const T = document.createElement("div");
|
|
1524
|
+
T.className = "pluno-pa-widget__message-actions", T.appendChild(St(f)), m.appendChild(T), e.appendChild(m), g = m, _ = null;
|
|
1458
1525
|
}
|
|
1459
1526
|
if (i.isThinking && !i.assistantDraft)
|
|
1460
|
-
if (
|
|
1461
|
-
const
|
|
1462
|
-
e.appendChild(
|
|
1527
|
+
if (ce) {
|
|
1528
|
+
const f = Zt();
|
|
1529
|
+
e.appendChild(f), g = null, _ = f;
|
|
1463
1530
|
} else {
|
|
1464
|
-
const
|
|
1465
|
-
e.appendChild(
|
|
1531
|
+
const f = la(x());
|
|
1532
|
+
e.appendChild(f), g = null, _ = f;
|
|
1466
1533
|
}
|
|
1467
1534
|
if (i.lastError) {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1535
|
+
const f = document.createElement("div");
|
|
1536
|
+
f.className = "pluno-pa-widget__error", f.textContent = i.lastError, e.appendChild(f), g = f, _ = null;
|
|
1470
1537
|
}
|
|
1471
|
-
const
|
|
1472
|
-
if (
|
|
1473
|
-
const
|
|
1474
|
-
isDrafting:
|
|
1475
|
-
error:
|
|
1476
|
-
onDraft:
|
|
1477
|
-
onDismiss:
|
|
1478
|
-
onDisable:
|
|
1538
|
+
const S = C && !i.isThinking ? _n(M) : null;
|
|
1539
|
+
if (C && S && !C.dismissedCandidateIds.has(S.id)) {
|
|
1540
|
+
const f = ea(S, {
|
|
1541
|
+
isDrafting: C.draftingCandidateId === S.id,
|
|
1542
|
+
error: C.error,
|
|
1543
|
+
onDraft: C.onDraft,
|
|
1544
|
+
onDismiss: C.onDismiss,
|
|
1545
|
+
onDisable: C.onDisable
|
|
1479
1546
|
});
|
|
1480
|
-
e.appendChild(
|
|
1547
|
+
e.appendChild(f), C.onSeen(S), g = null, _ = f;
|
|
1481
1548
|
}
|
|
1482
|
-
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t),
|
|
1549
|
+
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), u ? me(e, d) : e.scrollTop = y;
|
|
1483
1550
|
}
|
|
1484
|
-
function
|
|
1485
|
-
e.replaceChildren(),
|
|
1551
|
+
function Jo(e, t, n, o, a, i) {
|
|
1552
|
+
e.replaceChildren(), Jt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1486
1553
|
const l = document.createElement("div");
|
|
1487
1554
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1555
|
+
const s = ae("pluno-pa-widget__character--empty", o());
|
|
1556
|
+
l.appendChild(s);
|
|
1557
|
+
const u = document.createElement("div");
|
|
1558
|
+
u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
|
|
1492
1559
|
const d = document.createElement("button");
|
|
1493
1560
|
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1494
1561
|
}
|
|
1495
|
-
function
|
|
1562
|
+
function Qo(e) {
|
|
1496
1563
|
const t = document.createElement("div");
|
|
1497
1564
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1498
1565
|
for (const n of e)
|
|
1499
|
-
t.appendChild(
|
|
1566
|
+
t.appendChild(Bo(n));
|
|
1500
1567
|
return t;
|
|
1501
1568
|
}
|
|
1502
|
-
function
|
|
1569
|
+
function St(e) {
|
|
1503
1570
|
const t = document.createElement("button");
|
|
1504
1571
|
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ro()), t.addEventListener("click", (n) => {
|
|
1505
1572
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1506
1573
|
}), t;
|
|
1507
1574
|
}
|
|
1508
|
-
function
|
|
1575
|
+
function ea(e, t) {
|
|
1509
1576
|
const n = document.createElement("article");
|
|
1510
1577
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1511
1578
|
const o = document.createElement("div");
|
|
@@ -1516,32 +1583,32 @@ function ta(e, t) {
|
|
|
1516
1583
|
i.textContent = "Share this win?", a.appendChild(i);
|
|
1517
1584
|
const l = document.createElement("span");
|
|
1518
1585
|
if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1586
|
+
const p = document.createElement("span");
|
|
1587
|
+
p.className = "pluno-pa-widget__share-prompt-error", p.textContent = t.error, a.appendChild(p);
|
|
1521
1588
|
}
|
|
1522
1589
|
o.appendChild(a);
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1590
|
+
const s = document.createElement("div");
|
|
1591
|
+
s.className = "pluno-pa-widget__share-prompt-actions";
|
|
1592
|
+
const u = document.createElement("div");
|
|
1593
|
+
u.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
1527
1594
|
const d = document.createElement("button");
|
|
1528
1595
|
if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
|
|
1529
1596
|
t.onDraft(e);
|
|
1530
|
-
}), t.isDrafting ? (d.appendChild(
|
|
1531
|
-
|
|
1597
|
+
}), t.isDrafting ? (d.appendChild(Ve()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", u.appendChild(d), t.isDrafting)
|
|
1598
|
+
s.appendChild(u);
|
|
1532
1599
|
else {
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1600
|
+
const p = document.createElement("button");
|
|
1601
|
+
p.type = "button", p.className = "pluno-pa-widget__share-prompt-dismiss", p.setAttribute("aria-label", "Dismiss share prompt"), p.title = "Dismiss", p.textContent = "Dismiss", p.addEventListener("click", () => {
|
|
1535
1602
|
t.onDismiss(e);
|
|
1536
|
-
}),
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1603
|
+
}), u.appendChild(p), s.appendChild(u);
|
|
1604
|
+
const w = document.createElement("button");
|
|
1605
|
+
w.type = "button", w.className = "pluno-pa-widget__share-prompt-disable", w.textContent = "Don't ask again", w.addEventListener("click", () => {
|
|
1539
1606
|
t.onDisable(e);
|
|
1540
|
-
}),
|
|
1607
|
+
}), s.appendChild(w);
|
|
1541
1608
|
}
|
|
1542
|
-
return o.appendChild(
|
|
1609
|
+
return o.appendChild(s), n.appendChild(o), n;
|
|
1543
1610
|
}
|
|
1544
|
-
function
|
|
1611
|
+
function ta(e, t) {
|
|
1545
1612
|
const n = document.createElement("div");
|
|
1546
1613
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1547
1614
|
v.target === n && t.onClose();
|
|
@@ -1552,57 +1619,57 @@ function na(e, t) {
|
|
|
1552
1619
|
i.textContent = "Share this win", a.appendChild(i);
|
|
1553
1620
|
const l = document.createElement("button");
|
|
1554
1621
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
|
|
1555
|
-
const
|
|
1556
|
-
|
|
1557
|
-
const
|
|
1558
|
-
|
|
1622
|
+
const s = document.createElement("p");
|
|
1623
|
+
s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
|
|
1624
|
+
const u = document.createElement("div");
|
|
1625
|
+
u.className = "pluno-pa-widget__share-dialog-step";
|
|
1559
1626
|
const d = document.createElement("div");
|
|
1560
1627
|
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1563
|
-
const
|
|
1628
|
+
const p = document.createElement("strong");
|
|
1629
|
+
p.textContent = "1) Copy Screenshot", d.appendChild(p);
|
|
1630
|
+
const w = na("Copy Screenshot", async () => {
|
|
1564
1631
|
try {
|
|
1565
|
-
return await
|
|
1632
|
+
return await xn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
|
|
1566
1633
|
} catch {
|
|
1567
|
-
return
|
|
1634
|
+
return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
|
|
1568
1635
|
}
|
|
1569
1636
|
});
|
|
1570
|
-
if (d.appendChild(
|
|
1637
|
+
if (d.appendChild(w), u.appendChild(d), e.screenshotDataUrl) {
|
|
1571
1638
|
const v = document.createElement("div");
|
|
1572
1639
|
v.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1573
1640
|
const y = document.createElement("img");
|
|
1574
|
-
y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y),
|
|
1641
|
+
y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), u.appendChild(v);
|
|
1575
1642
|
}
|
|
1576
|
-
o.appendChild(
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
const
|
|
1582
|
-
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
for (const v of
|
|
1643
|
+
o.appendChild(u), o.appendChild(s);
|
|
1644
|
+
const x = document.createElement("div");
|
|
1645
|
+
x.className = "pluno-pa-widget__share-dialog-step";
|
|
1646
|
+
const L = document.createElement("strong");
|
|
1647
|
+
L.className = "pluno-pa-widget__share-dialog-step-title", L.textContent = "2) Share on", x.appendChild(L);
|
|
1648
|
+
const C = document.createElement("p");
|
|
1649
|
+
C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
|
|
1650
|
+
const M = document.createElement("footer");
|
|
1651
|
+
M.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1652
|
+
for (const v of oa(e)) {
|
|
1586
1653
|
const y = document.createElement("a");
|
|
1587
|
-
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(
|
|
1654
|
+
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(aa(v.id)), M.appendChild(y);
|
|
1588
1655
|
}
|
|
1589
|
-
if (
|
|
1656
|
+
if (x.appendChild(M), o.appendChild(x), t.socialPostRewardsUrl) {
|
|
1590
1657
|
const v = document.createElement("div");
|
|
1591
1658
|
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1592
1659
|
const y = document.createElement("strong");
|
|
1593
1660
|
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
|
|
1594
1661
|
const h = document.createElement("a");
|
|
1595
|
-
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(
|
|
1662
|
+
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(ia()), v.appendChild(h), o.appendChild(v);
|
|
1596
1663
|
}
|
|
1597
1664
|
return n.appendChild(o), n;
|
|
1598
1665
|
}
|
|
1599
|
-
function
|
|
1666
|
+
function na(e, t) {
|
|
1600
1667
|
const n = document.createElement("button");
|
|
1601
1668
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1602
1669
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1603
1670
|
}), n;
|
|
1604
1671
|
}
|
|
1605
|
-
function
|
|
1672
|
+
function oa(e) {
|
|
1606
1673
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1607
1674
|
return [
|
|
1608
1675
|
{
|
|
@@ -1622,7 +1689,7 @@ function aa(e) {
|
|
|
1622
1689
|
}
|
|
1623
1690
|
];
|
|
1624
1691
|
}
|
|
1625
|
-
function
|
|
1692
|
+
function aa(e) {
|
|
1626
1693
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1627
1694
|
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), D(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), D(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), D(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
|
|
1628
1695
|
}
|
|
@@ -1630,52 +1697,48 @@ function D(e, t, n) {
|
|
|
1630
1697
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1631
1698
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1632
1699
|
}
|
|
1633
|
-
function
|
|
1700
|
+
function ia() {
|
|
1634
1701
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1635
1702
|
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1636
1703
|
}
|
|
1637
|
-
function
|
|
1638
|
-
return e.role === "tool" && e.toolName ===
|
|
1704
|
+
function Xt(e) {
|
|
1705
|
+
return e.role === "tool" && e.toolName === Rt;
|
|
1639
1706
|
}
|
|
1640
1707
|
function kt(e) {
|
|
1641
1708
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1642
1709
|
}
|
|
1643
|
-
function
|
|
1710
|
+
function ra(e, t, n, o) {
|
|
1644
1711
|
const a = document.createElement("article");
|
|
1645
|
-
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1646
|
-
const i = document.createElement("
|
|
1647
|
-
i.
|
|
1648
|
-
|
|
1649
|
-
l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
|
|
1650
|
-
a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
|
|
1712
|
+
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ae("pluno-pa-widget__character--tool-group", o));
|
|
1713
|
+
const i = document.createElement("details"), l = pa(e);
|
|
1714
|
+
i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
|
|
1715
|
+
a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
|
|
1651
1716
|
});
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1656
|
-
const
|
|
1657
|
-
|
|
1658
|
-
for (const
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
const
|
|
1662
|
-
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1717
|
+
const s = document.createElement("summary");
|
|
1718
|
+
s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Ve());
|
|
1719
|
+
const d = document.createElement("span");
|
|
1720
|
+
if (d.className = "pluno-pa-widget__tool-summary-title", d.textContent = e[e.length - 1].content || "Run tool", s.appendChild(d), i.appendChild(s), e.length > 0) {
|
|
1721
|
+
const p = document.createElement("div");
|
|
1722
|
+
p.className = "pluno-pa-widget__tool-lines";
|
|
1723
|
+
for (const w of e) {
|
|
1724
|
+
const x = document.createElement("div");
|
|
1725
|
+
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ve());
|
|
1726
|
+
const L = document.createElement("span");
|
|
1727
|
+
L.textContent = w.content || "Run tool", x.appendChild(L), p.appendChild(x);
|
|
1728
|
+
}
|
|
1729
|
+
i.appendChild(p);
|
|
1665
1730
|
}
|
|
1666
|
-
return a.appendChild(
|
|
1731
|
+
return a.appendChild(i), a;
|
|
1667
1732
|
}
|
|
1668
|
-
function
|
|
1733
|
+
function je(e) {
|
|
1669
1734
|
const t = document.createElement("article");
|
|
1670
|
-
t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1671
|
-
const n = document.createElement("img");
|
|
1672
|
-
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;
|
|
1735
|
+
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ae("pluno-pa-widget__character--tool-group", e)), t;
|
|
1673
1736
|
}
|
|
1674
|
-
function
|
|
1675
|
-
const t =
|
|
1676
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1737
|
+
function la(e) {
|
|
1738
|
+
const t = je(e);
|
|
1739
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Zt()), t;
|
|
1677
1740
|
}
|
|
1678
|
-
function
|
|
1741
|
+
function Zt() {
|
|
1679
1742
|
const e = document.createElement("div");
|
|
1680
1743
|
e.className = "pluno-pa-widget__status";
|
|
1681
1744
|
const t = document.createElement("span");
|
|
@@ -1683,17 +1746,17 @@ function Xt() {
|
|
|
1683
1746
|
const n = document.createElement("span");
|
|
1684
1747
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1685
1748
|
}
|
|
1686
|
-
function
|
|
1749
|
+
function pa(e) {
|
|
1687
1750
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1688
1751
|
}
|
|
1689
|
-
function
|
|
1752
|
+
function Ve() {
|
|
1690
1753
|
const e = document.createElement("span");
|
|
1691
1754
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1692
1755
|
}
|
|
1693
|
-
function
|
|
1694
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1756
|
+
function Jt(e, t) {
|
|
1757
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Io() : Vt());
|
|
1695
1758
|
}
|
|
1696
|
-
function
|
|
1759
|
+
function Lt(e, t) {
|
|
1697
1760
|
const n = t.replace(/\r\n/g, `
|
|
1698
1761
|
`).split(`
|
|
1699
1762
|
`);
|
|
@@ -1709,22 +1772,22 @@ function St(e, t) {
|
|
|
1709
1772
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1710
1773
|
d.push(n[o]), o += 1;
|
|
1711
1774
|
o += o < n.length ? 1 : 0;
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1714
|
-
`),
|
|
1775
|
+
const p = document.createElement("pre"), w = document.createElement("code");
|
|
1776
|
+
w.textContent = d.join(`
|
|
1777
|
+
`), p.appendChild(w), e.appendChild(p);
|
|
1715
1778
|
continue;
|
|
1716
1779
|
}
|
|
1717
1780
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1718
1781
|
if (l) {
|
|
1719
1782
|
const d = document.createElement(`h${l[1].length + 2}`);
|
|
1720
|
-
|
|
1783
|
+
ye(d, l[2]), e.appendChild(d), o += 1;
|
|
1721
1784
|
continue;
|
|
1722
1785
|
}
|
|
1723
1786
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1724
1787
|
const d = document.createElement("ul");
|
|
1725
1788
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1789
|
+
const p = document.createElement("li");
|
|
1790
|
+
ye(p, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(p), o += 1;
|
|
1728
1791
|
}
|
|
1729
1792
|
e.appendChild(d);
|
|
1730
1793
|
continue;
|
|
@@ -1732,22 +1795,22 @@ function St(e, t) {
|
|
|
1732
1795
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1733
1796
|
const d = document.createElement("ol");
|
|
1734
1797
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1735
|
-
const
|
|
1736
|
-
|
|
1798
|
+
const p = document.createElement("li");
|
|
1799
|
+
ye(p, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(p), o += 1;
|
|
1737
1800
|
}
|
|
1738
1801
|
e.appendChild(d);
|
|
1739
1802
|
continue;
|
|
1740
1803
|
}
|
|
1741
|
-
const
|
|
1804
|
+
const s = [a];
|
|
1742
1805
|
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]); )
|
|
1743
|
-
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}), e.appendChild(
|
|
1806
|
+
s.push(n[o]), o += 1;
|
|
1807
|
+
const u = document.createElement("p");
|
|
1808
|
+
s.forEach((d, p) => {
|
|
1809
|
+
p > 0 && u.appendChild(document.createElement("br")), ye(u, d);
|
|
1810
|
+
}), e.appendChild(u);
|
|
1748
1811
|
}
|
|
1749
1812
|
}
|
|
1750
|
-
function
|
|
1813
|
+
function ye(e, t) {
|
|
1751
1814
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1752
1815
|
let o = 0;
|
|
1753
1816
|
for (const a of t.matchAll(n)) {
|
|
@@ -1755,19 +1818,19 @@ function ve(e, t) {
|
|
|
1755
1818
|
i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
|
|
1756
1819
|
const l = a[0];
|
|
1757
1820
|
if (l.startsWith("`")) {
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1821
|
+
const s = document.createElement("code");
|
|
1822
|
+
s.textContent = l.slice(1, -1), e.appendChild(s);
|
|
1760
1823
|
} else if (l.startsWith("**")) {
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1824
|
+
const s = document.createElement("strong");
|
|
1825
|
+
s.textContent = l.slice(2, -2), e.appendChild(s);
|
|
1763
1826
|
} else if (l.startsWith("*")) {
|
|
1764
|
-
const
|
|
1765
|
-
|
|
1827
|
+
const s = document.createElement("em");
|
|
1828
|
+
s.textContent = l.slice(1, -1), e.appendChild(s);
|
|
1766
1829
|
} else {
|
|
1767
|
-
const
|
|
1768
|
-
if (
|
|
1769
|
-
const
|
|
1770
|
-
|
|
1830
|
+
const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1831
|
+
if (s && sa(s[2])) {
|
|
1832
|
+
const u = document.createElement("a");
|
|
1833
|
+
u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], e.appendChild(u);
|
|
1771
1834
|
} else
|
|
1772
1835
|
e.appendChild(document.createTextNode(l));
|
|
1773
1836
|
}
|
|
@@ -1775,7 +1838,7 @@ function ve(e, t) {
|
|
|
1775
1838
|
}
|
|
1776
1839
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1777
1840
|
}
|
|
1778
|
-
function
|
|
1841
|
+
function sa(e) {
|
|
1779
1842
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1780
1843
|
return !0;
|
|
1781
1844
|
try {
|
|
@@ -1785,8 +1848,8 @@ function da(e) {
|
|
|
1785
1848
|
return !1;
|
|
1786
1849
|
}
|
|
1787
1850
|
}
|
|
1788
|
-
function
|
|
1789
|
-
if (
|
|
1851
|
+
function Pt(e, t) {
|
|
1852
|
+
if (da(e))
|
|
1790
1853
|
return;
|
|
1791
1854
|
const n = `
|
|
1792
1855
|
:host {
|
|
@@ -1957,6 +2020,9 @@ function Lt(e, t) {
|
|
|
1957
2020
|
transform: translateY(-50%);
|
|
1958
2021
|
pointer-events: none;
|
|
1959
2022
|
}
|
|
2023
|
+
.pluno-pa-widget__scribble-spirals {
|
|
2024
|
+
display: none;
|
|
2025
|
+
}
|
|
1960
2026
|
.pluno-pa-widget__launcher-input {
|
|
1961
2027
|
width: 100%;
|
|
1962
2028
|
height: 22px;
|
|
@@ -3303,18 +3369,22 @@ function Lt(e, t) {
|
|
|
3303
3369
|
pointer-events: none;
|
|
3304
3370
|
}
|
|
3305
3371
|
.pluno-pa-widget--scribble .pluno-pa-widget__panel::after {
|
|
3306
|
-
content:
|
|
3372
|
+
content: none;
|
|
3373
|
+
}
|
|
3374
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals {
|
|
3375
|
+
display: block;
|
|
3376
|
+
position: absolute;
|
|
3377
|
+
pointer-events: none;
|
|
3378
|
+
color: #2c2a1e;
|
|
3379
|
+
}
|
|
3380
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
|
|
3307
3381
|
position: absolute;
|
|
3308
3382
|
top: -16px;
|
|
3309
3383
|
left: 16px;
|
|
3310
3384
|
right: 16px;
|
|
3311
3385
|
height: 36px;
|
|
3312
3386
|
z-index: 3;
|
|
3313
|
-
background-image: url('${ut}');
|
|
3314
|
-
background-repeat: repeat-x;
|
|
3315
|
-
background-size: 104px 36px;
|
|
3316
3387
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3317
|
-
pointer-events: none;
|
|
3318
3388
|
}
|
|
3319
3389
|
.pluno-pa-widget--scribble .pluno-pa-widget__timeline {
|
|
3320
3390
|
padding-top: 34px;
|
|
@@ -3572,18 +3642,16 @@ function Lt(e, t) {
|
|
|
3572
3642
|
background-size: 22px 22px;
|
|
3573
3643
|
}
|
|
3574
3644
|
.pluno-pa-widget--scribble .pluno-pa-widget__launcher::after {
|
|
3575
|
-
content:
|
|
3645
|
+
content: none;
|
|
3646
|
+
}
|
|
3647
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--launcher {
|
|
3576
3648
|
position: absolute;
|
|
3577
3649
|
top: -11px;
|
|
3578
3650
|
left: 12px;
|
|
3579
3651
|
right: 12px;
|
|
3580
3652
|
height: 22px;
|
|
3581
3653
|
z-index: 1;
|
|
3582
|
-
background-image: url('${ut}');
|
|
3583
|
-
background-repeat: repeat-x;
|
|
3584
|
-
background-size: 62px 21.5px;
|
|
3585
3654
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3586
|
-
pointer-events: none;
|
|
3587
3655
|
}
|
|
3588
3656
|
.pluno-pa-widget--scribble .pluno-pa-widget__send svg,
|
|
3589
3657
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
|
|
@@ -3592,28 +3660,28 @@ function Lt(e, t) {
|
|
|
3592
3660
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3593
3661
|
}
|
|
3594
3662
|
`;
|
|
3595
|
-
if (
|
|
3663
|
+
if (ca(e, n))
|
|
3596
3664
|
return;
|
|
3597
3665
|
const o = e.ownerDocument.createElement("style");
|
|
3598
|
-
o.id =
|
|
3666
|
+
o.id = zt, o.textContent = n, e.appendChild(o), Qt(e);
|
|
3599
3667
|
}
|
|
3600
|
-
function
|
|
3601
|
-
return e.getElementById(
|
|
3668
|
+
function da(e) {
|
|
3669
|
+
return e.getElementById(zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gt) === "true";
|
|
3602
3670
|
}
|
|
3603
|
-
function
|
|
3604
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3671
|
+
function Qt(e) {
|
|
3672
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Gt, "true");
|
|
3605
3673
|
}
|
|
3606
|
-
function
|
|
3674
|
+
function ca(e, t) {
|
|
3607
3675
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3608
3676
|
return !1;
|
|
3609
3677
|
try {
|
|
3610
3678
|
const n = new CSSStyleSheet();
|
|
3611
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3679
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Qt(e), !0;
|
|
3612
3680
|
} catch {
|
|
3613
3681
|
return !1;
|
|
3614
3682
|
}
|
|
3615
3683
|
}
|
|
3616
|
-
async function
|
|
3684
|
+
async function ua() {
|
|
3617
3685
|
return document.body ? document.body : await new Promise((e) => {
|
|
3618
3686
|
const t = new MutationObserver(() => {
|
|
3619
3687
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3621,49 +3689,49 @@ async function ga() {
|
|
|
3621
3689
|
t.observe(document.documentElement, { childList: !0 });
|
|
3622
3690
|
});
|
|
3623
3691
|
}
|
|
3624
|
-
function
|
|
3692
|
+
function en(e) {
|
|
3625
3693
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3626
3694
|
}
|
|
3627
|
-
function
|
|
3695
|
+
function ga(e) {
|
|
3628
3696
|
try {
|
|
3629
|
-
const t = window.localStorage.getItem(
|
|
3697
|
+
const t = window.localStorage.getItem(en(e));
|
|
3630
3698
|
if (!t)
|
|
3631
|
-
return
|
|
3699
|
+
return At();
|
|
3632
3700
|
const n = JSON.parse(t);
|
|
3633
3701
|
return {
|
|
3634
3702
|
isOpen: n.isOpen === !0,
|
|
3635
3703
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3636
3704
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3637
|
-
launcherPosition:
|
|
3705
|
+
launcherPosition: ba(n.launcherPosition) ? n.launcherPosition : null,
|
|
3638
3706
|
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
|
|
3639
3707
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3640
3708
|
};
|
|
3641
3709
|
} catch {
|
|
3642
|
-
return
|
|
3710
|
+
return At();
|
|
3643
3711
|
}
|
|
3644
3712
|
}
|
|
3645
|
-
async function
|
|
3713
|
+
async function ha(e) {
|
|
3646
3714
|
if (e.loadSharePromptsDisabled)
|
|
3647
3715
|
return e.loadSharePromptsDisabled();
|
|
3648
3716
|
try {
|
|
3649
|
-
return window.localStorage.getItem(
|
|
3717
|
+
return window.localStorage.getItem(Ot) === "true";
|
|
3650
3718
|
} catch {
|
|
3651
3719
|
return !1;
|
|
3652
3720
|
}
|
|
3653
3721
|
}
|
|
3654
|
-
function
|
|
3722
|
+
function ma(e, t) {
|
|
3655
3723
|
if (e.persistSharePromptsDisabled) {
|
|
3656
3724
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3657
3725
|
});
|
|
3658
3726
|
return;
|
|
3659
3727
|
}
|
|
3660
3728
|
try {
|
|
3661
|
-
t && window.localStorage.setItem(
|
|
3729
|
+
t && window.localStorage.setItem(Ot, "true");
|
|
3662
3730
|
} catch {
|
|
3663
3731
|
return;
|
|
3664
3732
|
}
|
|
3665
3733
|
}
|
|
3666
|
-
function
|
|
3734
|
+
function At() {
|
|
3667
3735
|
return {
|
|
3668
3736
|
isOpen: !1,
|
|
3669
3737
|
composerValue: "",
|
|
@@ -3673,41 +3741,41 @@ function Pt() {
|
|
|
3673
3741
|
sharePromptsDisabled: !1
|
|
3674
3742
|
};
|
|
3675
3743
|
}
|
|
3676
|
-
function
|
|
3744
|
+
function fa(e, t) {
|
|
3677
3745
|
try {
|
|
3678
|
-
window.localStorage.setItem(
|
|
3746
|
+
window.localStorage.setItem(en(e), JSON.stringify(t));
|
|
3679
3747
|
} catch {
|
|
3680
3748
|
return;
|
|
3681
3749
|
}
|
|
3682
3750
|
}
|
|
3683
|
-
function
|
|
3751
|
+
function ba(e) {
|
|
3684
3752
|
if (!e || typeof e != "object")
|
|
3685
3753
|
return !1;
|
|
3686
3754
|
const t = e;
|
|
3687
3755
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3688
3756
|
}
|
|
3689
|
-
const
|
|
3690
|
-
function
|
|
3757
|
+
const Tt = /* @__PURE__ */ new WeakSet();
|
|
3758
|
+
function wa(e) {
|
|
3691
3759
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3692
3760
|
}
|
|
3693
|
-
function
|
|
3761
|
+
function Nt(e) {
|
|
3694
3762
|
const t = e.pathname.split("/");
|
|
3695
3763
|
return t[t.length - 1] ?? "";
|
|
3696
3764
|
}
|
|
3697
|
-
function
|
|
3765
|
+
function _a(e, t) {
|
|
3698
3766
|
const n = new URL(e.src, document.baseURI);
|
|
3699
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3767
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Nt(n) === Nt(t);
|
|
3700
3768
|
}
|
|
3701
3769
|
class V extends EventTarget {
|
|
3702
3770
|
constructor(t, n) {
|
|
3703
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3771
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Bn, () => {
|
|
3704
3772
|
this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
|
|
3705
|
-
}), this.addPreviewListener(
|
|
3773
|
+
}), this.addPreviewListener(Fn, (o) => {
|
|
3706
3774
|
const a = o;
|
|
3707
3775
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3708
|
-
}), this.addPreviewListener(
|
|
3776
|
+
}), this.addPreviewListener(Un, () => {
|
|
3709
3777
|
this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3710
|
-
}), this.addPreviewListener(
|
|
3778
|
+
}), this.addPreviewListener(zn, (o) => {
|
|
3711
3779
|
const a = o;
|
|
3712
3780
|
this.readyState = V.CLOSED, this.dispatchEvent(
|
|
3713
3781
|
new CloseEvent("close", {
|
|
@@ -3717,7 +3785,7 @@ class V extends EventTarget {
|
|
|
3717
3785
|
})
|
|
3718
3786
|
), this.cleanup();
|
|
3719
3787
|
}), window.dispatchEvent(
|
|
3720
|
-
new CustomEvent(
|
|
3788
|
+
new CustomEvent(Ce(Rn, this.channelId), {
|
|
3721
3789
|
detail: { socketId: this.socketId, url: t }
|
|
3722
3790
|
})
|
|
3723
3791
|
);
|
|
@@ -3733,26 +3801,26 @@ class V extends EventTarget {
|
|
|
3733
3801
|
binaryType = "blob";
|
|
3734
3802
|
bufferedAmount = 0;
|
|
3735
3803
|
readyState = V.CONNECTING;
|
|
3736
|
-
socketId =
|
|
3804
|
+
socketId = xa();
|
|
3737
3805
|
listeners = /* @__PURE__ */ new Map();
|
|
3738
3806
|
send(t) {
|
|
3739
3807
|
if (this.readyState !== V.OPEN)
|
|
3740
3808
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3741
3809
|
window.dispatchEvent(
|
|
3742
|
-
new CustomEvent(
|
|
3810
|
+
new CustomEvent(Ce(Mn, this.channelId), {
|
|
3743
3811
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3744
3812
|
})
|
|
3745
3813
|
);
|
|
3746
3814
|
}
|
|
3747
3815
|
close(t, n) {
|
|
3748
3816
|
this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
|
|
3749
|
-
new CustomEvent(
|
|
3817
|
+
new CustomEvent(Ce(On, this.channelId), {
|
|
3750
3818
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3751
3819
|
})
|
|
3752
3820
|
), this.cleanup());
|
|
3753
3821
|
}
|
|
3754
3822
|
addPreviewListener(t, n) {
|
|
3755
|
-
const o =
|
|
3823
|
+
const o = Ce(t, this.channelId), a = (i) => {
|
|
3756
3824
|
i.detail?.socketId === this.socketId && n(i);
|
|
3757
3825
|
};
|
|
3758
3826
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -3763,36 +3831,36 @@ class V extends EventTarget {
|
|
|
3763
3831
|
this.listeners.clear();
|
|
3764
3832
|
}
|
|
3765
3833
|
}
|
|
3766
|
-
function
|
|
3767
|
-
const e = window.sessionStorage.getItem(
|
|
3834
|
+
function xa() {
|
|
3835
|
+
const e = window.sessionStorage.getItem(ut);
|
|
3768
3836
|
if (e)
|
|
3769
3837
|
return e;
|
|
3770
3838
|
const t = crypto.randomUUID();
|
|
3771
|
-
return window.sessionStorage.setItem(
|
|
3839
|
+
return window.sessionStorage.setItem(ut, t), t;
|
|
3772
3840
|
}
|
|
3773
|
-
function
|
|
3841
|
+
function Ce(e, t) {
|
|
3774
3842
|
return `${e}:${t}`;
|
|
3775
3843
|
}
|
|
3776
|
-
function
|
|
3844
|
+
function va(e) {
|
|
3777
3845
|
const t = document.currentScript;
|
|
3778
3846
|
if (t instanceof HTMLScriptElement)
|
|
3779
3847
|
return [t];
|
|
3780
3848
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3781
3849
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3782
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3850
|
+
(a) => a instanceof HTMLScriptElement && wa(a) && _a(a, o)
|
|
3783
3851
|
);
|
|
3784
3852
|
}
|
|
3785
|
-
function
|
|
3786
|
-
for (const t of
|
|
3787
|
-
if (
|
|
3853
|
+
function ya(e) {
|
|
3854
|
+
for (const t of va(e)) {
|
|
3855
|
+
if (Tt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3788
3856
|
continue;
|
|
3789
|
-
|
|
3857
|
+
Tt.add(t);
|
|
3790
3858
|
const n = t.dataset.plunoPreviewChannel;
|
|
3791
|
-
|
|
3859
|
+
ro({
|
|
3792
3860
|
token: t.dataset.plunoToken,
|
|
3793
3861
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3794
3862
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3795
|
-
webSocketFactory: n ?
|
|
3863
|
+
webSocketFactory: n ? io(n) : void 0,
|
|
3796
3864
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3797
3865
|
accentColor: t.dataset.plunoAccentColor,
|
|
3798
3866
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3804,8 +3872,8 @@ function Ca(e) {
|
|
|
3804
3872
|
});
|
|
3805
3873
|
}
|
|
3806
3874
|
}
|
|
3807
|
-
|
|
3875
|
+
ya(import.meta.url);
|
|
3808
3876
|
export {
|
|
3809
|
-
|
|
3810
|
-
|
|
3877
|
+
io as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3878
|
+
ro as mountPlunoProductAgentWidget
|
|
3811
3879
|
};
|