@pluno/product-agent-web 0.1.32 → 0.1.35
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 +794 -679
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { PlunoProductAgent as sn } from "./product-agent-sdk.js";
|
|
2
|
+
const dn = "#7c3aed";
|
|
3
|
+
function cn(e) {
|
|
4
|
+
const t = fn(e);
|
|
5
5
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
6
6
|
<defs>
|
|
7
7
|
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
@@ -75,23 +75,23 @@ function pn(e) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function un(e) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(cn(e))}`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const t =
|
|
84
|
-
if (
|
|
81
|
+
const le = "#2c2a1e", rt = [253, 250, 241], lt = 3.5;
|
|
82
|
+
function Nt(e) {
|
|
83
|
+
const t = It(e);
|
|
84
|
+
if (pt(me(t), rt) >= lt)
|
|
85
85
|
return t;
|
|
86
|
-
let o =
|
|
87
|
-
const a =
|
|
86
|
+
let o = me(t);
|
|
87
|
+
const a = me(le);
|
|
88
88
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
89
|
+
if (o = bn(o, a, 0.22), pt(o, rt) >= lt)
|
|
90
|
+
return Fe(o);
|
|
91
|
+
return Fe(o);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const t =
|
|
93
|
+
function gn(e) {
|
|
94
|
+
const t = Nt(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
|
|
95
95
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
96
|
<defs>
|
|
97
97
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,26 +104,26 @@ function dn(e) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${mn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
108
|
</g>
|
|
109
|
-
<path d="${n}" fill="none" stroke="${
|
|
109
|
+
<path d="${n}" fill="none" stroke="${le}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
110
|
<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="${
|
|
111
|
+
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${le}" stroke-width="13"/>
|
|
112
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${le}"/>
|
|
113
113
|
<circle cx="557" cy="447" r="16" fill="#ffffff"/>
|
|
114
114
|
</g>
|
|
115
115
|
<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="${
|
|
116
|
+
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${le}" stroke-width="13"/>
|
|
117
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${le}"/>
|
|
118
118
|
<circle cx="728" cy="447" r="16" fill="#ffffff"/>
|
|
119
119
|
</g>
|
|
120
120
|
</g>
|
|
121
121
|
</svg>`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
123
|
+
function hn(e) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(gn(e))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function mn() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
128
|
for (let i = 150; i <= 1170; i += 62) {
|
|
129
129
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -131,8 +131,8 @@ function un() {
|
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
134
|
+
function fn(e) {
|
|
135
|
+
const t = It(e), n = Ue(me(t));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -168,34 +168,34 @@ function gn(e) {
|
|
|
168
168
|
shadow: z(t, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function It(e) {
|
|
172
172
|
const t = e.trim();
|
|
173
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
173
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : dn;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function me(e) {
|
|
176
176
|
return [
|
|
177
177
|
Number.parseInt(e.slice(1, 3), 16),
|
|
178
178
|
Number.parseInt(e.slice(3, 5), 16),
|
|
179
179
|
Number.parseInt(e.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Fe([e, t, n]) {
|
|
183
183
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
184
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Ue([e, t, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
188
|
const i = a / 255;
|
|
189
189
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
191
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
193
|
+
function pt(e, t) {
|
|
194
|
+
const n = Ue(e), o = Ue(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
195
|
return (a + 0.05) / (i + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
197
|
+
function bn(e, t, n) {
|
|
198
|
+
const o = ze(n);
|
|
199
199
|
return [
|
|
200
200
|
e[0] + (t[0] - e[0]) * o,
|
|
201
201
|
e[1] + (t[1] - e[1]) * o,
|
|
@@ -203,43 +203,43 @@ function hn(e, t, n) {
|
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
205
|
function z(e, t, n) {
|
|
206
|
-
const [o, a, i] =
|
|
207
|
-
return
|
|
206
|
+
const [o, a, i] = wn(me(e));
|
|
207
|
+
return Fe(_n(o, ze(a + n), ze(i + t)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function wn([e, t, n]) {
|
|
210
210
|
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
212
|
return [0, 0, c];
|
|
213
213
|
const d = l - p, s = c > 0.5 ? d / (2 - l - p) : d / (l + p);
|
|
214
214
|
return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, s, c];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function _n(e, t, n) {
|
|
217
217
|
if (t === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
219
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
De(a, o, e + 1 / 3) * 255,
|
|
222
|
+
De(a, o, e) * 255,
|
|
223
|
+
De(a, o, e - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function De(e, t, n) {
|
|
227
227
|
let o = n;
|
|
228
228
|
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
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function ze(e) {
|
|
231
231
|
return Math.max(0, Math.min(1, e));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
233
|
+
const Dt = "suggest_share_on_socials";
|
|
234
|
+
function xn(e) {
|
|
235
235
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
236
236
|
const n = e[t];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== Dt)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = st(e, t, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = st(e, o.index, "user");
|
|
243
243
|
return a ? {
|
|
244
244
|
id: `share:${n.callId ?? n.id}`,
|
|
245
245
|
userPrompt: a.content,
|
|
@@ -248,13 +248,13 @@ function bn(e) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
252
|
-
const t = await
|
|
251
|
+
async function vn(e) {
|
|
252
|
+
const t = await yn(e);
|
|
253
253
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
254
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
255
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function st(e, t, n) {
|
|
258
258
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
259
259
|
const a = e[o];
|
|
260
260
|
if (a.role === n && a.content.trim())
|
|
@@ -262,73 +262,73 @@ function it(e, t, n) {
|
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function
|
|
265
|
+
async function yn(e) {
|
|
266
266
|
return await (await fetch(e)).blob();
|
|
267
267
|
}
|
|
268
|
-
const
|
|
269
|
-
function
|
|
268
|
+
const Cn = "https://app.pluno.ai", En = "/api/product-agent/embed/active-users", Sn = 1800, kn = 15e3, Ln = 250, Pn = 1e3, An = 3e4;
|
|
269
|
+
function Tn(e, t = {}) {
|
|
270
270
|
let n = !1, o = null, a = null, i = null;
|
|
271
271
|
const l = () => {
|
|
272
272
|
i !== null && (window.clearInterval(i), i = null);
|
|
273
273
|
}, p = (s) => {
|
|
274
274
|
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
275
275
|
d();
|
|
276
|
-
},
|
|
276
|
+
}, Dn(s)));
|
|
277
277
|
}, c = (s) => {
|
|
278
278
|
if (l(), o === null) {
|
|
279
279
|
o = s, e(s);
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
const
|
|
282
|
+
const f = o, C = performance.now();
|
|
283
283
|
i = window.setInterval(() => {
|
|
284
284
|
if (n) {
|
|
285
285
|
l();
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
|
-
const
|
|
289
|
-
o = Math.round(
|
|
290
|
-
},
|
|
288
|
+
const k = Math.min(1, (performance.now() - C) / Sn);
|
|
289
|
+
o = Math.round(f + (s - f) * Mn(k)), e(o), k >= 1 && (o = s, e(s), l());
|
|
290
|
+
}, Ln);
|
|
291
291
|
}, d = async () => {
|
|
292
292
|
try {
|
|
293
|
-
const s = await
|
|
293
|
+
const s = await Nn(t);
|
|
294
294
|
if (n)
|
|
295
295
|
return;
|
|
296
296
|
c(s.count), p(s.refreshAfterMs);
|
|
297
297
|
} catch {
|
|
298
|
-
p(
|
|
298
|
+
p(kn);
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
301
|
return d(), () => {
|
|
302
302
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
async function
|
|
305
|
+
async function Nn(e) {
|
|
306
306
|
if (e.loader)
|
|
307
307
|
return e.loader();
|
|
308
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
308
|
+
const n = await (e.fetcher ?? fetch)(new URL(En, In(e.backendUrl ?? Cn)).toString(), {
|
|
309
309
|
cache: "no-store",
|
|
310
310
|
credentials: "omit"
|
|
311
311
|
});
|
|
312
312
|
if (!n.ok)
|
|
313
313
|
throw new Error("Failed to load active users");
|
|
314
|
-
const o = await n.json(), a =
|
|
314
|
+
const o = await n.json(), a = dt(o.count), i = dt(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
315
315
|
if (a === null || i === null)
|
|
316
316
|
throw new Error("Invalid active users response");
|
|
317
317
|
return { count: a, refreshAfterMs: i };
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function dt(e) {
|
|
320
320
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function In(e) {
|
|
323
323
|
return e.endsWith("/") ? e : `${e}/`;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
return Math.min(
|
|
325
|
+
function Dn(e) {
|
|
326
|
+
return Math.min(An, Math.max(Pn, e));
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Mn(e) {
|
|
329
329
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
330
330
|
}
|
|
331
|
-
const
|
|
331
|
+
const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", On = "product-agent:sdk-preview-socket-send", Bn = "product-agent:sdk-preview-socket-close", Fn = "product-agent:sdk-preview-socket-open", Un = "product-agent:sdk-preview-socket-message", zn = "product-agent:sdk-preview-socket-error", $n = "product-agent:sdk-preview-socket-closed", ct = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Rt = "pluno.productAgent.sharePromptsDisabled", Ce = 10, Hn = 10 * 1024 * 1024, Ot = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Ot).join(","), jn = 3, j = {
|
|
332
332
|
launcherLabel: "Ask for anything...",
|
|
333
333
|
accentColor: "#7c3aed",
|
|
334
334
|
colorScheme: "light",
|
|
@@ -336,19 +336,19 @@ const Tt = 100, Dn = "product-agent:sdk-preview-socket-connect", In = "product-a
|
|
|
336
336
|
scribbleStyle: !1,
|
|
337
337
|
position: "bottom-right",
|
|
338
338
|
movableLauncher: !1
|
|
339
|
-
},
|
|
340
|
-
function
|
|
339
|
+
}, ut = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Vn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Bt = 190, Ft = 41, qn = 48, Kn = 420, Yn = 520, Xn = 0.24, Zn = 680, Jn = 800, Qn = 0.76, B = 8, $e = 50, eo = "http://www.w3.org/2000/svg", to = 11, no = 13, ht = 4, oo = 10, ao = 40, io = "movable-launcher-position-v2", Ut = "pluno-pa-widget-styles", zt = "data-pluno-pa-widget-styles";
|
|
340
|
+
function ro(e) {
|
|
341
341
|
return (t) => new V(t, e);
|
|
342
342
|
}
|
|
343
|
-
async function
|
|
343
|
+
async function lo(e = {}) {
|
|
344
344
|
const t = {
|
|
345
|
-
launcherLabel: e.launcherLabel ??
|
|
346
|
-
accentColor: e.accentColor ??
|
|
347
|
-
colorScheme: e.colorScheme ??
|
|
348
|
-
fontFamily: e.fontFamily ??
|
|
349
|
-
scribbleStyle: e.scribbleStyle ??
|
|
350
|
-
position: e.position ??
|
|
351
|
-
movableLauncher: e.movableLauncher ??
|
|
345
|
+
launcherLabel: e.launcherLabel ?? j.launcherLabel,
|
|
346
|
+
accentColor: e.accentColor ?? j.accentColor,
|
|
347
|
+
colorScheme: e.colorScheme ?? j.colorScheme,
|
|
348
|
+
fontFamily: e.fontFamily ?? j.fontFamily,
|
|
349
|
+
scribbleStyle: e.scribbleStyle ?? j.scribbleStyle,
|
|
350
|
+
position: e.position ?? j.position,
|
|
351
|
+
movableLauncher: e.movableLauncher ?? j.movableLauncher,
|
|
352
352
|
token: e.token,
|
|
353
353
|
tokenProvider: e.tokenProvider,
|
|
354
354
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -370,7 +370,7 @@ async function oo(e = {}) {
|
|
|
370
370
|
loadSharePromptsDisabled: e.loadSharePromptsDisabled,
|
|
371
371
|
persistSharePromptsDisabled: e.persistSharePromptsDisabled
|
|
372
372
|
};
|
|
373
|
-
|
|
373
|
+
Y("web-sdk.widget", "Mounting widget with merged options", {
|
|
374
374
|
accentColor: t.accentColor,
|
|
375
375
|
colorScheme: t.colorScheme,
|
|
376
376
|
fontFamily: t.fontFamily,
|
|
@@ -385,32 +385,32 @@ async function oo(e = {}) {
|
|
|
385
385
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
386
386
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
387
387
|
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}`),
|
|
388
|
+
let i = mt(t.accentColor, t.scribbleStyle);
|
|
389
|
+
yo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
390
|
+
const l = await ga(), p = l.ownerDocument;
|
|
391
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Lt(o, t.accentColor), ft(a, i, {
|
|
392
392
|
accentColor: t.accentColor,
|
|
393
393
|
colorScheme: t.colorScheme,
|
|
394
394
|
fontFamily: t.fontFamily,
|
|
395
395
|
scribbleStyle: t.scribbleStyle
|
|
396
|
-
}),
|
|
396
|
+
}), Y("web-sdk.widget", "Applied initial widget appearance", {
|
|
397
397
|
accentColor: t.accentColor,
|
|
398
398
|
colorScheme: t.colorScheme,
|
|
399
399
|
fontFamily: t.fontFamily,
|
|
400
400
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
401
401
|
});
|
|
402
|
-
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"),
|
|
403
|
-
if (!c || !s || !
|
|
402
|
+
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), C = a.querySelector(".pluno-pa-widget__close"), k = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"), R = 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"), de = a.querySelector(".pluno-pa-widget__active-users-counter"), E = a.querySelector(".pluno-pa-widget__timeline"), b = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
403
|
+
if (!c || !s || !f || !C || !k || !x || !R || !v || !y || !h || !g || !_ || !N || !Z || !de || !E || !b)
|
|
404
404
|
throw new Error("Failed to mount Pluno widget");
|
|
405
405
|
if (t.movableLauncher && !d)
|
|
406
406
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
407
|
-
|
|
408
|
-
let
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
_t(s), _t(g);
|
|
408
|
+
let m = [], S = null;
|
|
409
|
+
const P = () => {
|
|
410
|
+
Oo(v, m, (r) => {
|
|
411
|
+
m = m.filter((u, T) => T !== r), P(), O(w.getState()), U();
|
|
412
412
|
});
|
|
413
|
-
},
|
|
413
|
+
}, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
414
414
|
if (!t.tokenEndpoint)
|
|
415
415
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
416
416
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -421,19 +421,19 @@ async function oo(e = {}) {
|
|
|
421
421
|
});
|
|
422
422
|
if (!r.ok)
|
|
423
423
|
throw new Error("Failed to load Pluno token");
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
424
|
+
const u = await r.json();
|
|
425
|
+
if (!u.token)
|
|
426
426
|
throw new Error("Pluno token endpoint did not return a token");
|
|
427
|
-
return
|
|
428
|
-
}),
|
|
429
|
-
let
|
|
430
|
-
|
|
427
|
+
return u.token;
|
|
428
|
+
}), A = window.fetch.bind(window);
|
|
429
|
+
let w;
|
|
430
|
+
w = await sn.init({
|
|
431
431
|
token: t.token,
|
|
432
|
-
tokenProvider:
|
|
432
|
+
tokenProvider: I,
|
|
433
433
|
backendUrl: t.backendUrl,
|
|
434
434
|
metadata: () => ({
|
|
435
435
|
...t.metadata ?? {},
|
|
436
|
-
...!
|
|
436
|
+
...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
437
437
|
}),
|
|
438
438
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
439
439
|
clientId: t.clientId,
|
|
@@ -442,41 +442,41 @@ async function oo(e = {}) {
|
|
|
442
442
|
webSocketFactory: t.webSocketFactory,
|
|
443
443
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
444
444
|
});
|
|
445
|
-
const
|
|
446
|
-
let
|
|
445
|
+
const J = ha(t), Ee = new Set(J.openToolGroupKeys), ae = new Set(J.seenShareCandidateIds), fe = new Set(ae);
|
|
446
|
+
let Se = J.sharePromptsDisabled || await ma(t), G = t.movableLauncher ? J.launcherPosition : null, qe = G !== null, q = null, ke = !1, Q = !1, ee = {
|
|
447
447
|
enabled: !0
|
|
448
|
-
},
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
},
|
|
452
|
-
|
|
453
|
-
},
|
|
454
|
-
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
},
|
|
458
|
-
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
const
|
|
463
|
-
return
|
|
448
|
+
}, te = 0, Ke = "";
|
|
449
|
+
const H = (r, u) => {
|
|
450
|
+
ee = { enabled: r, reason: u };
|
|
451
|
+
}, W = () => {
|
|
452
|
+
Z.hidden = !0;
|
|
453
|
+
}, en = () => {
|
|
454
|
+
Z.hidden = !1;
|
|
455
|
+
}, tn = (r = "jump") => {
|
|
456
|
+
H(!0, r), W(), he(E, () => ee.enabled), te = E.scrollTop;
|
|
457
|
+
}, nn = () => {
|
|
458
|
+
ke || typeof document > "u" || (Lt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
459
|
+
}, Ye = new MutationObserver(nn);
|
|
460
|
+
Ye.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
461
|
+
const Le = (r = !0) => {
|
|
462
|
+
const u = Ge(a, r);
|
|
463
|
+
return bt(
|
|
464
464
|
a,
|
|
465
|
-
G ??
|
|
466
|
-
|
|
465
|
+
G ?? ho(a, t.position, u),
|
|
466
|
+
u
|
|
467
467
|
);
|
|
468
468
|
}, F = () => {
|
|
469
|
-
|
|
469
|
+
ba(t, {
|
|
470
470
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
471
|
-
composerValue:
|
|
472
|
-
openToolGroupKeys: [...
|
|
473
|
-
launcherPosition:
|
|
474
|
-
seenShareCandidateIds: [...
|
|
475
|
-
sharePromptsDisabled:
|
|
471
|
+
composerValue: g.value,
|
|
472
|
+
openToolGroupKeys: [...Ee],
|
|
473
|
+
launcherPosition: qe ? G : null,
|
|
474
|
+
seenShareCandidateIds: [...ae].slice(-Mt),
|
|
475
|
+
sharePromptsDisabled: Se
|
|
476
476
|
});
|
|
477
|
-
},
|
|
478
|
-
|
|
479
|
-
debugVersion:
|
|
477
|
+
}, ne = (r, u = {}) => {
|
|
478
|
+
_o(r, {
|
|
479
|
+
debugVersion: io,
|
|
480
480
|
launcherPosition: G,
|
|
481
481
|
rootClasses: a.className,
|
|
482
482
|
rootStyle: {
|
|
@@ -485,303 +485,335 @@ async function oo(e = {}) {
|
|
|
485
485
|
right: a.style.right,
|
|
486
486
|
bottom: a.style.bottom
|
|
487
487
|
},
|
|
488
|
-
rootRect:
|
|
489
|
-
launcherRect:
|
|
490
|
-
panelRect:
|
|
491
|
-
viewport:
|
|
492
|
-
panelHidden:
|
|
493
|
-
closeHidden:
|
|
494
|
-
...
|
|
488
|
+
rootRect: Me(a),
|
|
489
|
+
launcherRect: Me(c),
|
|
490
|
+
panelRect: Me(f),
|
|
491
|
+
viewport: se(),
|
|
492
|
+
panelHidden: f.hidden,
|
|
493
|
+
closeHidden: C.hidden,
|
|
494
|
+
...u
|
|
495
495
|
});
|
|
496
|
-
},
|
|
496
|
+
}, be = (r = !0) => {
|
|
497
497
|
if (!G)
|
|
498
|
-
return
|
|
499
|
-
const
|
|
500
|
-
return
|
|
501
|
-
},
|
|
502
|
-
if (!r || !
|
|
503
|
-
|
|
498
|
+
return _e(a, null), Le(r);
|
|
499
|
+
const u = Le(r);
|
|
500
|
+
return _e(a, u), ne("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
|
|
501
|
+
}, Xe = (r, u) => {
|
|
502
|
+
if (!r || !u) {
|
|
503
|
+
wo(a);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
|
|
507
|
-
x: r.x -
|
|
508
|
-
y: r.y -
|
|
506
|
+
bo(a, {
|
|
507
|
+
x: r.x - u.x,
|
|
508
|
+
y: r.y - u.y
|
|
509
509
|
});
|
|
510
|
-
},
|
|
511
|
-
const r =
|
|
510
|
+
}, Ze = () => {
|
|
511
|
+
const r = be();
|
|
512
512
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
} else G &&
|
|
513
|
+
const u = wt(a, r, t.position);
|
|
514
|
+
Xe(u, r), ne("Applied open panel position after viewport resize", { openPanelPosition: u });
|
|
515
|
+
} else G && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
516
516
|
};
|
|
517
|
-
let
|
|
517
|
+
let Je = () => {
|
|
518
518
|
};
|
|
519
|
-
window.addEventListener("resize",
|
|
519
|
+
window.addEventListener("resize", Ze), t.movableLauncher && d ? (be(), Je = go({
|
|
520
520
|
root: a,
|
|
521
521
|
launcher: c,
|
|
522
522
|
launcherDragHandle: d,
|
|
523
|
-
getPosition: () =>
|
|
523
|
+
getPosition: () => Le(),
|
|
524
524
|
setPosition: (r) => {
|
|
525
|
-
const
|
|
526
|
-
G =
|
|
525
|
+
const u = r;
|
|
526
|
+
G = bt(a, r, Ge(a)), _e(a, G), ne("Dragging closed launcher", { requestedPosition: u });
|
|
527
527
|
},
|
|
528
528
|
persist: () => {
|
|
529
|
-
|
|
529
|
+
qe = !0, F(), ne("Persisted closed launcher drag position");
|
|
530
530
|
}
|
|
531
|
-
})) :
|
|
532
|
-
let
|
|
533
|
-
const
|
|
534
|
-
if (!(!t.billingStatusLoader ||
|
|
535
|
-
|
|
531
|
+
})) : _e(a, null);
|
|
532
|
+
let Pe = !1;
|
|
533
|
+
const Qe = async () => {
|
|
534
|
+
if (!(!t.billingStatusLoader || Pe)) {
|
|
535
|
+
Pe = !0;
|
|
536
536
|
try {
|
|
537
537
|
const r = await t.billingStatusLoader();
|
|
538
|
-
|
|
538
|
+
vt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, Be(R, t.billingStatus, w.getState().lastErrorCode), U());
|
|
539
539
|
} finally {
|
|
540
|
-
|
|
540
|
+
Pe = !1;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
},
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
547
|
-
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (
|
|
543
|
+
}, oe = (r = "", u = !0) => {
|
|
544
|
+
Qe(), q !== null && (window.clearTimeout(q), q = null), f.hidden = !1, C.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
545
|
+
const T = be(), K = wt(a, T, t.position);
|
|
546
|
+
if (Xe(K, T), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: T }), H(!0, "open"), W(), !u) {
|
|
547
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
window.requestAnimationFrame(() => {
|
|
551
|
-
a.classList.add("pluno-pa-widget--open"), r && (
|
|
552
|
-
c.hidden = !0,
|
|
551
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
|
|
552
|
+
c.hidden = !0, he(E, () => ee.enabled), te = E.scrollTop;
|
|
553
553
|
}, 220);
|
|
554
554
|
});
|
|
555
|
-
},
|
|
556
|
-
|
|
557
|
-
|
|
555
|
+
}, on = () => {
|
|
556
|
+
q !== null && (window.clearTimeout(q), q = null), c.hidden = !1, G && (be(!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(() => {
|
|
557
|
+
f.hidden = !0, C.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
558
558
|
}, 220);
|
|
559
559
|
};
|
|
560
560
|
c.addEventListener("submit", (r) => {
|
|
561
|
-
r.preventDefault(),
|
|
561
|
+
r.preventDefault(), oe(s.value), s.value = "";
|
|
562
562
|
}), d?.addEventListener("click", (r) => {
|
|
563
563
|
r.preventDefault(), r.stopPropagation();
|
|
564
564
|
}), c.addEventListener("click", (r) => {
|
|
565
|
-
r.target === s && !d || (
|
|
565
|
+
r.target === s && !d || (oe(s.value), s.value = "");
|
|
566
566
|
}), s.addEventListener("focus", () => {
|
|
567
|
-
|
|
567
|
+
oe(s.value), s.value = "";
|
|
568
568
|
}), s.addEventListener("input", () => {
|
|
569
569
|
if (!s.value)
|
|
570
570
|
return;
|
|
571
571
|
const r = s.value;
|
|
572
|
-
|
|
573
|
-
}),
|
|
574
|
-
|
|
575
|
-
}),
|
|
576
|
-
|
|
572
|
+
oe(r), s.value = "";
|
|
573
|
+
}), C.addEventListener("click", on), E.addEventListener("scroll", () => {
|
|
574
|
+
E.scrollTop < te - 1 && H(!1, "userScroll"), te = E.scrollTop;
|
|
575
|
+
}), Z.addEventListener("click", () => {
|
|
576
|
+
tn();
|
|
577
577
|
});
|
|
578
|
-
const
|
|
578
|
+
const et = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
579
579
|
([r]) => {
|
|
580
|
-
r?.isIntersecting && (
|
|
580
|
+
r?.isIntersecting && (H(!0, "bottom"), W());
|
|
581
581
|
},
|
|
582
|
-
{ root:
|
|
582
|
+
{ root: E, threshold: 0 }
|
|
583
583
|
);
|
|
584
|
-
|
|
584
|
+
et?.observe(b);
|
|
585
585
|
const U = () => {
|
|
586
|
-
|
|
586
|
+
_.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || $(t.billingStatus);
|
|
587
587
|
};
|
|
588
|
-
t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel,
|
|
588
|
+
t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, k.hidden = !0), k.addEventListener("submit", (r) => {
|
|
589
589
|
if (r.preventDefault(), t.loginRequired) {
|
|
590
590
|
t.onLoginClick?.();
|
|
591
591
|
return;
|
|
592
592
|
}
|
|
593
|
-
|
|
593
|
+
$(t.billingStatus) || (Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U());
|
|
594
594
|
});
|
|
595
|
-
let
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
},
|
|
599
|
-
|
|
600
|
-
|
|
595
|
+
let ce = 0;
|
|
596
|
+
const an = () => {
|
|
597
|
+
ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
598
|
+
}, tt = (r) => {
|
|
599
|
+
S !== null && window.clearTimeout(S), x.textContent = r, x.hidden = !1, S = window.setTimeout(() => {
|
|
600
|
+
x.textContent = "", x.hidden = !0, S = null;
|
|
601
601
|
}, 3e3);
|
|
602
|
-
},
|
|
603
|
-
|
|
604
|
-
},
|
|
602
|
+
}, rn = () => {
|
|
603
|
+
S !== null && (window.clearTimeout(S), S = null), x.textContent = "", x.hidden = !0;
|
|
604
|
+
}, nt = async (r) => {
|
|
605
605
|
if (r.length === 0)
|
|
606
606
|
return;
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
609
|
-
throw new Error(`Attach up to ${
|
|
610
|
-
|
|
607
|
+
const u = await zo(r);
|
|
608
|
+
if (m.length + u.length > Ce)
|
|
609
|
+
throw new Error(`Attach up to ${Ce} files per message.`);
|
|
610
|
+
m = [...m, ...u], P(), rn(), U(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
|
|
611
611
|
};
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
h.addEventListener("click", () => {
|
|
613
|
+
t.loginRequired || $(t.billingStatus) || y.click();
|
|
614
|
+
}), y.addEventListener("change", () => {
|
|
615
|
+
const r = Array.from(y.files ?? []);
|
|
616
|
+
y.value = "", nt(r).catch((u) => {
|
|
617
|
+
tt(u instanceof Error ? u.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
618
|
+
message: u instanceof Error ? u.message : String(u)
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
}), a.addEventListener("dragenter", (r) => {
|
|
622
|
+
!xe(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ce += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
614
623
|
}), a.addEventListener("dragover", (r) => {
|
|
615
|
-
const
|
|
616
|
-
!
|
|
624
|
+
const u = r.dataTransfer;
|
|
625
|
+
!xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
|
|
617
626
|
}), a.addEventListener("dragleave", (r) => {
|
|
618
|
-
|
|
627
|
+
xe(r.dataTransfer) && (r.stopPropagation(), ce = Math.max(0, ce - 1), ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
619
628
|
}), a.addEventListener("drop", (r) => {
|
|
620
|
-
const
|
|
621
|
-
!
|
|
622
|
-
|
|
623
|
-
message:
|
|
629
|
+
const u = r.dataTransfer;
|
|
630
|
+
!xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), an(), nt(u.files).catch((T) => {
|
|
631
|
+
tt(T instanceof Error ? T.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
632
|
+
message: T instanceof Error ? T.message : String(T)
|
|
624
633
|
});
|
|
625
634
|
}));
|
|
626
|
-
}),
|
|
635
|
+
}), _.addEventListener("click", () => {
|
|
627
636
|
if (t.loginRequired) {
|
|
628
637
|
t.onLoginClick?.();
|
|
629
638
|
return;
|
|
630
639
|
}
|
|
631
|
-
if (
|
|
632
|
-
|
|
640
|
+
if (w.getState().isThinking) {
|
|
641
|
+
w.stop();
|
|
633
642
|
return;
|
|
634
643
|
}
|
|
635
|
-
|
|
636
|
-
}),
|
|
637
|
-
|
|
638
|
-
}),
|
|
639
|
-
|
|
640
|
-
}),
|
|
644
|
+
Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
|
|
645
|
+
}), N.addEventListener("click", () => {
|
|
646
|
+
Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g), F(), U(), g.focus(), O(w.getState());
|
|
647
|
+
}), g.addEventListener("input", () => {
|
|
648
|
+
ge(g), F(), U(), O(w.getState());
|
|
649
|
+
}), g.addEventListener("keydown", (r) => {
|
|
641
650
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
642
651
|
if (r.preventDefault(), t.loginRequired) {
|
|
643
652
|
t.onLoginClick?.();
|
|
644
653
|
return;
|
|
645
654
|
}
|
|
646
|
-
|
|
655
|
+
Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
|
|
647
656
|
}
|
|
648
657
|
}), a.addEventListener("click", (r) => {
|
|
649
658
|
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
|
|
650
|
-
}),
|
|
651
|
-
const
|
|
652
|
-
let
|
|
659
|
+
}), J.composerValue && (g.value = J.composerValue, ge(g)), J.isOpen && oe(g.value, !1);
|
|
660
|
+
const ot = () => i;
|
|
661
|
+
let Ae = w.getState().appearance !== null, we = null, ue = null, ie = null, at = w.getState().isThinking, re = null, Te = null, it = () => {
|
|
653
662
|
};
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
|
|
663
|
+
const ln = !!t.socialPostDraftHandler, O = (r) => {
|
|
664
|
+
if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(R, t.billingStatus, re), t.loginRequired) {
|
|
665
|
+
Qo(E, _, N, ot, t.loginButtonLabel, t.onLoginClick);
|
|
657
666
|
return;
|
|
658
667
|
}
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
C,
|
|
668
|
+
const u = xo(r), T = u !== Ke;
|
|
669
|
+
Ke = u;
|
|
670
|
+
const K = Q || ee.enabled;
|
|
671
|
+
Q = !1, Jo(
|
|
672
|
+
E,
|
|
673
|
+
b,
|
|
674
|
+
_,
|
|
667
675
|
N,
|
|
676
|
+
de,
|
|
668
677
|
r,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
() =>
|
|
673
|
-
|
|
678
|
+
Te,
|
|
679
|
+
Te !== null && Ct(r, g.value.trim().length > 0 || m.length > 0),
|
|
680
|
+
K,
|
|
681
|
+
() => ee.enabled,
|
|
682
|
+
Ee,
|
|
674
683
|
F,
|
|
675
|
-
|
|
676
|
-
(
|
|
677
|
-
|
|
684
|
+
ot,
|
|
685
|
+
(M) => {
|
|
686
|
+
Q = !0, H(!0, "send"), W(), w.sendMessage(M);
|
|
678
687
|
},
|
|
679
|
-
|
|
680
|
-
dismissedCandidateIds:
|
|
681
|
-
draftingCandidateId:
|
|
682
|
-
error:
|
|
683
|
-
onSeen: (
|
|
684
|
-
|
|
688
|
+
ln && !Se ? {
|
|
689
|
+
dismissedCandidateIds: fe,
|
|
690
|
+
draftingCandidateId: we,
|
|
691
|
+
error: ue,
|
|
692
|
+
onSeen: (M) => {
|
|
693
|
+
ae.add(M.id), F();
|
|
685
694
|
},
|
|
686
|
-
onDraft: (
|
|
687
|
-
|
|
695
|
+
onDraft: (M) => {
|
|
696
|
+
pn(M);
|
|
688
697
|
},
|
|
689
|
-
onDismiss: (
|
|
690
|
-
|
|
698
|
+
onDismiss: (M) => {
|
|
699
|
+
ae.add(M.id), fe.add(M.id), F(), ue = null, O(w.getState());
|
|
691
700
|
},
|
|
692
|
-
onDisable: (
|
|
693
|
-
|
|
701
|
+
onDisable: (M) => {
|
|
702
|
+
Se = !0, ae.add(M.id), fe.add(M.id), F(), fa(t, !0), ue = null, O(w.getState());
|
|
694
703
|
}
|
|
695
704
|
} : void 0
|
|
696
|
-
),
|
|
705
|
+
), K ? (te = E.scrollTop, W()) : T && vo(r) && en();
|
|
697
706
|
};
|
|
698
|
-
return
|
|
699
|
-
|
|
700
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
701
|
-
const
|
|
702
|
-
|
|
707
|
+
return it = Tn((r) => {
|
|
708
|
+
Te = r, !ke && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) && O(w.getState());
|
|
709
|
+
}, { backendUrl: t.backendUrl, fetcher: A, loader: t.activeUsersLoader }), w.on("state", (r) => {
|
|
710
|
+
const u = at && !r.isThinking;
|
|
711
|
+
at = r.isThinking, r.appearance ? (Ae = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
|
|
703
712
|
appearance: r.appearance
|
|
704
|
-
}),
|
|
713
|
+
}), Ne(r.appearance, "agent.state.appearance")) : Ae && (Ae = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
705
714
|
fallbackAccentColor: t.accentColor,
|
|
706
715
|
fallbackColorScheme: t.colorScheme,
|
|
707
716
|
fallbackFontFamily: t.fontFamily
|
|
708
|
-
}),
|
|
709
|
-
}), O(
|
|
710
|
-
agent:
|
|
717
|
+
}), Ne({}, "agent.state.appearance-cleared")), O(r), U(), u && Qe();
|
|
718
|
+
}), O(w.getState()), U(), {
|
|
719
|
+
agent: w,
|
|
711
720
|
updateAppearance: (r) => {
|
|
712
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
721
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ne(r, "widgetHandle.updateAppearance");
|
|
713
722
|
},
|
|
714
723
|
updateBillingStatus: (r) => {
|
|
715
|
-
const
|
|
716
|
-
|
|
724
|
+
const u = r ?? null;
|
|
725
|
+
vt(t.billingStatus, u, re) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(
|
|
717
726
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
718
727
|
t.billingStatus,
|
|
719
|
-
|
|
728
|
+
re
|
|
720
729
|
), U());
|
|
721
730
|
},
|
|
722
731
|
openPanel: () => {
|
|
723
|
-
|
|
732
|
+
oe(g.value, !1);
|
|
724
733
|
},
|
|
725
734
|
destroy: () => {
|
|
726
|
-
|
|
735
|
+
ke = !0, Ye.disconnect(), et?.disconnect(), window.removeEventListener("resize", Ze), Je(), S !== null && window.clearTimeout(S), it(), ie?.remove(), w.destroy(), n.remove();
|
|
727
736
|
}
|
|
728
737
|
};
|
|
729
|
-
async function
|
|
730
|
-
if (!
|
|
731
|
-
|
|
738
|
+
async function pn(r) {
|
|
739
|
+
if (!we) {
|
|
740
|
+
we = r.id, ue = null, O(w.getState());
|
|
732
741
|
try {
|
|
733
742
|
if (!t.socialPostDraftHandler)
|
|
734
743
|
throw new Error("Social post drafting is not available here.");
|
|
735
|
-
const
|
|
736
|
-
if (!
|
|
744
|
+
const u = await t.socialPostDraftHandler(r);
|
|
745
|
+
if (!u.linkedinPost || !u.xPost)
|
|
737
746
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
738
|
-
|
|
747
|
+
ae.add(r.id), fe.add(r.id), F(), ie?.remove(), ie = na(u, {
|
|
739
748
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
740
749
|
onClose: () => {
|
|
741
|
-
|
|
750
|
+
ie?.remove(), ie = null;
|
|
742
751
|
}
|
|
743
|
-
}), a.appendChild(
|
|
744
|
-
} catch (
|
|
745
|
-
|
|
752
|
+
}), a.appendChild(ie);
|
|
753
|
+
} catch (u) {
|
|
754
|
+
ue = u instanceof Error ? u.message : "Could not draft social post.";
|
|
746
755
|
} finally {
|
|
747
|
-
|
|
756
|
+
we = null, O(w.getState());
|
|
748
757
|
}
|
|
749
758
|
}
|
|
750
759
|
}
|
|
751
|
-
function
|
|
752
|
-
const
|
|
753
|
-
i =
|
|
754
|
-
accentColor:
|
|
755
|
-
colorScheme:
|
|
756
|
-
fontFamily:
|
|
757
|
-
scribbleStyle:
|
|
758
|
-
}),
|
|
759
|
-
source:
|
|
760
|
+
function Ne(r, u) {
|
|
761
|
+
const T = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, Ie = r.scribbleStyle ?? t.scribbleStyle;
|
|
762
|
+
i = mt(T, Ie), ft(a, i, {
|
|
763
|
+
accentColor: T,
|
|
764
|
+
colorScheme: K,
|
|
765
|
+
fontFamily: M,
|
|
766
|
+
scribbleStyle: Ie
|
|
767
|
+
}), Y("web-sdk.widget", "Updated widget appearance", {
|
|
768
|
+
source: u,
|
|
760
769
|
inputAppearance: r,
|
|
761
|
-
appliedAccentColor:
|
|
762
|
-
appliedColorScheme:
|
|
763
|
-
appliedFontFamily:
|
|
764
|
-
appliedScribbleStyle:
|
|
770
|
+
appliedAccentColor: T,
|
|
771
|
+
appliedColorScheme: K,
|
|
772
|
+
appliedFontFamily: M,
|
|
773
|
+
appliedScribbleStyle: Ie,
|
|
765
774
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
766
775
|
});
|
|
767
776
|
}
|
|
768
777
|
}
|
|
769
|
-
function
|
|
770
|
-
return t ?
|
|
778
|
+
function mt(e, t) {
|
|
779
|
+
return t ? hn(e) : un(e);
|
|
780
|
+
}
|
|
781
|
+
function po(e) {
|
|
782
|
+
const t = so(e);
|
|
783
|
+
return t === null ? "#fafafa" : co(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
784
|
+
}
|
|
785
|
+
function so(e) {
|
|
786
|
+
const t = e.trim();
|
|
787
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
788
|
+
Number.parseInt(t.slice(1, 3), 16),
|
|
789
|
+
Number.parseInt(t.slice(3, 5), 16),
|
|
790
|
+
Number.parseInt(t.slice(5, 7), 16)
|
|
791
|
+
] : /^#[0-9a-f]{3}$/i.test(t) ? [
|
|
792
|
+
Number.parseInt(t[1] + t[1], 16),
|
|
793
|
+
Number.parseInt(t[2] + t[2], 16),
|
|
794
|
+
Number.parseInt(t[3] + t[3], 16)
|
|
795
|
+
] : null;
|
|
796
|
+
}
|
|
797
|
+
function co([e, t, n]) {
|
|
798
|
+
const o = (a) => {
|
|
799
|
+
const i = a / 255;
|
|
800
|
+
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
801
|
+
};
|
|
802
|
+
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
771
803
|
}
|
|
772
|
-
function
|
|
804
|
+
function ft(e, t, n) {
|
|
773
805
|
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);
|
|
774
|
-
const o = n.scribbleStyle ?
|
|
775
|
-
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ?
|
|
806
|
+
const o = n.scribbleStyle ? Nt(n.accentColor) : n.accentColor;
|
|
807
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", po(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Vn : n.fontFamily, n.scribbleStyle && uo(e.ownerDocument);
|
|
776
808
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
777
809
|
for (const i of a)
|
|
778
810
|
i.src = t;
|
|
779
811
|
}
|
|
780
|
-
function
|
|
781
|
-
if (e.getElementById(
|
|
812
|
+
function uo(e) {
|
|
813
|
+
if (e.getElementById(gt))
|
|
782
814
|
return;
|
|
783
815
|
const t = e.createElement("style");
|
|
784
|
-
t.id =
|
|
816
|
+
t.id = gt, t.textContent = `@font-face {
|
|
785
817
|
font-family: "Architects Daughter";
|
|
786
818
|
font-style: normal;
|
|
787
819
|
font-weight: 400;
|
|
@@ -789,7 +821,7 @@ function ao(e) {
|
|
|
789
821
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
790
822
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
791
823
|
}
|
|
792
|
-
function
|
|
824
|
+
function go({
|
|
793
825
|
root: e,
|
|
794
826
|
launcher: t,
|
|
795
827
|
launcherDragHandle: n,
|
|
@@ -798,117 +830,117 @@ function io({
|
|
|
798
830
|
persist: i
|
|
799
831
|
}) {
|
|
800
832
|
let l = null, p = null, c = null, d = !1, s = null;
|
|
801
|
-
const
|
|
833
|
+
const f = () => {
|
|
802
834
|
l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
803
|
-
},
|
|
835
|
+
}, C = (h) => {
|
|
804
836
|
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = o(), d = !1, t.setPointerCapture?.(h.pointerId));
|
|
805
|
-
},
|
|
837
|
+
}, k = (h) => {
|
|
806
838
|
if (l !== h.pointerId || !p || !c)
|
|
807
839
|
return;
|
|
808
840
|
h.preventDefault();
|
|
809
|
-
const
|
|
810
|
-
!d && Math.hypot(
|
|
811
|
-
},
|
|
812
|
-
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()),
|
|
813
|
-
},
|
|
814
|
-
l === h.pointerId && (h.preventDefault(),
|
|
841
|
+
const g = h.clientX - p.x, _ = h.clientY - p.y;
|
|
842
|
+
!d && Math.hypot(g, _) < ht || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
|
|
843
|
+
}, x = (h) => {
|
|
844
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
|
|
845
|
+
}, R = (h) => {
|
|
846
|
+
l === h.pointerId && (h.preventDefault(), f());
|
|
815
847
|
}, v = (h) => {
|
|
816
848
|
if (!s)
|
|
817
849
|
return;
|
|
818
|
-
const
|
|
819
|
-
s = null,
|
|
820
|
-
},
|
|
850
|
+
const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= ht;
|
|
851
|
+
s = null, g && (h.preventDefault(), h.stopPropagation());
|
|
852
|
+
}, y = (h) => {
|
|
821
853
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
822
854
|
return;
|
|
823
|
-
const
|
|
855
|
+
const g = h.shiftKey ? ao : oo, _ = o();
|
|
824
856
|
let N = null;
|
|
825
|
-
h.key === "ArrowUp" ? N = { x: _.x, y: _.y -
|
|
857
|
+
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());
|
|
826
858
|
};
|
|
827
|
-
return t.addEventListener("pointerdown",
|
|
828
|
-
t.removeEventListener("pointerdown",
|
|
859
|
+
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", k), t.addEventListener("pointerup", x), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
|
|
860
|
+
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", k), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
|
|
829
861
|
};
|
|
830
862
|
}
|
|
831
|
-
function
|
|
832
|
-
const n =
|
|
863
|
+
function Ge(e, t = !0) {
|
|
864
|
+
const n = se(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
833
865
|
return {
|
|
834
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
835
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
866
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Bt, n.width - 36),
|
|
867
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? qn : Ft
|
|
836
868
|
};
|
|
837
869
|
}
|
|
838
|
-
function
|
|
839
|
-
const e =
|
|
870
|
+
function $t() {
|
|
871
|
+
const e = se();
|
|
840
872
|
return {
|
|
841
873
|
width: Math.min(
|
|
842
|
-
|
|
874
|
+
pe(e.width * Xn, Kn, Yn),
|
|
843
875
|
e.width - B * 2
|
|
844
876
|
),
|
|
845
877
|
height: Math.min(
|
|
846
|
-
|
|
847
|
-
e.height -
|
|
878
|
+
pe(e.height * Qn, Zn, Jn),
|
|
879
|
+
e.height - $e - B
|
|
848
880
|
)
|
|
849
881
|
};
|
|
850
882
|
}
|
|
851
|
-
function
|
|
883
|
+
function ho(e, t, n) {
|
|
852
884
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
853
885
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
854
886
|
return { x: o, y: a };
|
|
855
887
|
const i = e.getBoundingClientRect();
|
|
856
888
|
if (i.width > 0 || i.height > 0)
|
|
857
889
|
return { x: i.left, y: i.top };
|
|
858
|
-
const l =
|
|
890
|
+
const l = se();
|
|
859
891
|
return {
|
|
860
892
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
861
893
|
y: l.height - 24 - n.height
|
|
862
894
|
};
|
|
863
895
|
}
|
|
864
|
-
function
|
|
865
|
-
const o =
|
|
896
|
+
function bt(e, t, n) {
|
|
897
|
+
const o = se(), a = B + mo(e);
|
|
866
898
|
return {
|
|
867
|
-
x:
|
|
868
|
-
y:
|
|
899
|
+
x: pe(t.x, B, Math.max(B, o.width - n.width - B)),
|
|
900
|
+
y: pe(t.y, a, Math.max(a, o.height - n.height - B))
|
|
869
901
|
};
|
|
870
902
|
}
|
|
871
|
-
function
|
|
872
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
903
|
+
function mo(e) {
|
|
904
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? no : to;
|
|
873
905
|
}
|
|
874
|
-
function
|
|
875
|
-
const o =
|
|
906
|
+
function wt(e, t, n) {
|
|
907
|
+
const o = Ge(e), a = $t(), i = {
|
|
876
908
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
877
909
|
y: t.y + o.height - a.height
|
|
878
910
|
};
|
|
879
|
-
return
|
|
911
|
+
return fo(i);
|
|
880
912
|
}
|
|
881
|
-
function
|
|
882
|
-
const t =
|
|
913
|
+
function fo(e) {
|
|
914
|
+
const t = se(), n = $t();
|
|
883
915
|
return {
|
|
884
|
-
x:
|
|
885
|
-
y:
|
|
916
|
+
x: pe(e.x, B, Math.max(B, t.width - n.width - B)),
|
|
917
|
+
y: pe(
|
|
886
918
|
e.y,
|
|
887
|
-
|
|
888
|
-
Math.max(
|
|
919
|
+
$e,
|
|
920
|
+
Math.max($e, t.height - n.height - B)
|
|
889
921
|
)
|
|
890
922
|
};
|
|
891
923
|
}
|
|
892
|
-
function
|
|
924
|
+
function _e(e, t) {
|
|
893
925
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
894
926
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
895
927
|
return;
|
|
896
928
|
}
|
|
897
929
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
898
930
|
}
|
|
899
|
-
function
|
|
931
|
+
function bo(e, t) {
|
|
900
932
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
901
933
|
}
|
|
902
|
-
function
|
|
934
|
+
function wo(e) {
|
|
903
935
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
904
936
|
}
|
|
905
|
-
function
|
|
937
|
+
function se() {
|
|
906
938
|
return {
|
|
907
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
908
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
939
|
+
width: window.innerWidth || document.documentElement.clientWidth || Bt + B * 2,
|
|
940
|
+
height: window.innerHeight || document.documentElement.clientHeight || Ft + B * 2
|
|
909
941
|
};
|
|
910
942
|
}
|
|
911
|
-
function
|
|
943
|
+
function Me(e) {
|
|
912
944
|
const t = e.getBoundingClientRect();
|
|
913
945
|
return {
|
|
914
946
|
x: Math.round(t.x),
|
|
@@ -917,10 +949,10 @@ function De(e) {
|
|
|
917
949
|
height: Math.round(t.height)
|
|
918
950
|
};
|
|
919
951
|
}
|
|
920
|
-
function
|
|
952
|
+
function pe(e, t, n) {
|
|
921
953
|
return Math.min(Math.max(e, t), n);
|
|
922
954
|
}
|
|
923
|
-
function
|
|
955
|
+
function Y(e, t, n) {
|
|
924
956
|
if (typeof window > "u")
|
|
925
957
|
return;
|
|
926
958
|
const o = window, a = {
|
|
@@ -929,26 +961,26 @@ function ee(e, t, n) {
|
|
|
929
961
|
message: t,
|
|
930
962
|
details: n
|
|
931
963
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
932
|
-
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(
|
|
964
|
+
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 }));
|
|
933
965
|
}
|
|
934
|
-
function
|
|
935
|
-
|
|
966
|
+
function _o(e, t) {
|
|
967
|
+
Y("web-sdk.widget.position", e, t);
|
|
936
968
|
}
|
|
937
|
-
function
|
|
969
|
+
function Re(e, t, n) {
|
|
938
970
|
const o = t.value.trim();
|
|
939
971
|
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 })), []);
|
|
940
972
|
}
|
|
941
|
-
function
|
|
973
|
+
function ge(e) {
|
|
942
974
|
e.style.height = "0px";
|
|
943
975
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
944
976
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
945
977
|
}
|
|
946
|
-
function
|
|
978
|
+
function he(e, t = () => !0) {
|
|
947
979
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
948
980
|
t() && (e.scrollTop = e.scrollHeight);
|
|
949
981
|
});
|
|
950
982
|
}
|
|
951
|
-
function
|
|
983
|
+
function xo(e) {
|
|
952
984
|
const t = e.messages[e.messages.length - 1];
|
|
953
985
|
return [
|
|
954
986
|
e.messages.length,
|
|
@@ -959,37 +991,37 @@ function go(e) {
|
|
|
959
991
|
e.lastError ?? ""
|
|
960
992
|
].join(":");
|
|
961
993
|
}
|
|
962
|
-
function
|
|
994
|
+
function vo(e) {
|
|
963
995
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
964
996
|
}
|
|
965
|
-
function
|
|
966
|
-
e.appendChild(
|
|
997
|
+
function yo(e, t, n, o) {
|
|
998
|
+
e.appendChild(Po()), e.appendChild(Co(t, n, o)), e.appendChild(Wt("pluno-pa-widget__close", "Close", Ao(16), !0)), e.appendChild(Eo(n));
|
|
967
999
|
}
|
|
968
|
-
function
|
|
1000
|
+
function Co(e, t, n) {
|
|
969
1001
|
const o = document.createElement("form");
|
|
970
1002
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
971
1003
|
const i = document.createElement("button");
|
|
972
1004
|
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);
|
|
973
1005
|
}
|
|
974
|
-
o.appendChild(
|
|
1006
|
+
o.appendChild(Ht("pluno-pa-widget__character--launcher", t));
|
|
975
1007
|
const a = document.createElement("input");
|
|
976
1008
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
977
1009
|
}
|
|
978
|
-
function
|
|
1010
|
+
function Eo(e) {
|
|
979
1011
|
const t = document.createElement("section");
|
|
980
1012
|
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
981
1013
|
const n = document.createElement("div");
|
|
982
1014
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
983
1015
|
const o = document.createElement("main");
|
|
984
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1016
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(ko(e));
|
|
985
1017
|
const a = document.createElement("div");
|
|
986
1018
|
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
987
1019
|
const i = document.createElement("div");
|
|
988
1020
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
989
1021
|
const l = document.createElement("button");
|
|
990
|
-
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(
|
|
1022
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Wt("pluno-pa-widget__new-chat", "New chat", To(), !0)), t.appendChild(n), t.appendChild(So()), t;
|
|
991
1023
|
}
|
|
992
|
-
function
|
|
1024
|
+
function So() {
|
|
993
1025
|
const e = document.createElement("form");
|
|
994
1026
|
e.className = "pluno-pa-widget__composer";
|
|
995
1027
|
const t = document.createElement("div");
|
|
@@ -1000,52 +1032,56 @@ function wo() {
|
|
|
1000
1032
|
o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
|
|
1001
1033
|
const a = document.createElement("div");
|
|
1002
1034
|
a.className = "pluno-pa-widget__composer-inner";
|
|
1003
|
-
const i = document.createElement("
|
|
1004
|
-
i.className = "pluno-pa-
|
|
1035
|
+
const i = document.createElement("input");
|
|
1036
|
+
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);
|
|
1005
1037
|
const l = document.createElement("button");
|
|
1006
|
-
l.type = "button", l.className = "pluno-pa-
|
|
1007
|
-
const p = document.createElement("
|
|
1008
|
-
p.className = "pluno-pa-
|
|
1009
|
-
const c = document.createElement("
|
|
1010
|
-
c.
|
|
1011
|
-
const d = document.createElement("
|
|
1012
|
-
|
|
1038
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(No()), l.appendChild(Io()), a.appendChild(l);
|
|
1039
|
+
const p = document.createElement("textarea");
|
|
1040
|
+
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
|
|
1041
|
+
const c = document.createElement("button");
|
|
1042
|
+
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(jt()), a.appendChild(c), e.appendChild(a);
|
|
1043
|
+
const d = document.createElement("div");
|
|
1044
|
+
d.className = "pluno-pa-widget__composer-meta";
|
|
1045
|
+
const s = document.createElement("a");
|
|
1046
|
+
s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai.", d.appendChild(s);
|
|
1047
|
+
const f = document.createElement("span");
|
|
1048
|
+
return f.className = "pluno-pa-widget__ai-disclaimer", f.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(f), e.appendChild(d), e;
|
|
1013
1049
|
}
|
|
1014
|
-
function
|
|
1050
|
+
function ko(e) {
|
|
1015
1051
|
const t = document.createElement("div");
|
|
1016
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1052
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild(Gt()), t;
|
|
1017
1053
|
}
|
|
1018
|
-
function
|
|
1054
|
+
function Gt() {
|
|
1019
1055
|
const e = document.createElement("div");
|
|
1020
1056
|
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;
|
|
1021
1057
|
}
|
|
1022
|
-
function
|
|
1058
|
+
function Lo(e, t) {
|
|
1023
1059
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1024
1060
|
const n = document.createElement("span");
|
|
1025
1061
|
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`));
|
|
1026
1062
|
}
|
|
1027
|
-
function
|
|
1063
|
+
function Ht(e, t) {
|
|
1028
1064
|
const n = document.createElement("img");
|
|
1029
1065
|
return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1030
1066
|
}
|
|
1031
|
-
function
|
|
1067
|
+
function Wt(e, t, n, o) {
|
|
1032
1068
|
const a = document.createElement("button");
|
|
1033
1069
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1034
1070
|
}
|
|
1035
|
-
function
|
|
1036
|
-
const e =
|
|
1071
|
+
function Po() {
|
|
1072
|
+
const e = L("svg", {
|
|
1037
1073
|
class: "pluno-pa-widget__scribble-defs",
|
|
1038
1074
|
"aria-hidden": "true",
|
|
1039
1075
|
focusable: "false",
|
|
1040
1076
|
width: "0",
|
|
1041
1077
|
height: "0"
|
|
1042
|
-
}), t =
|
|
1043
|
-
return t.appendChild(
|
|
1078
|
+
}), t = L("defs");
|
|
1079
|
+
return t.appendChild(Oe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Oe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Oe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1044
1080
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const o =
|
|
1081
|
+
function Oe(e, t, n) {
|
|
1082
|
+
const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1047
1083
|
return o.appendChild(
|
|
1048
|
-
|
|
1084
|
+
L("feTurbulence", {
|
|
1049
1085
|
type: "fractalNoise",
|
|
1050
1086
|
baseFrequency: "0.012 0.028",
|
|
1051
1087
|
numOctaves: "3",
|
|
@@ -1053,7 +1089,7 @@ function Me(e, t, n) {
|
|
|
1053
1089
|
result: "stroke-noise"
|
|
1054
1090
|
})
|
|
1055
1091
|
), o.appendChild(
|
|
1056
|
-
|
|
1092
|
+
L("feDisplacementMap", {
|
|
1057
1093
|
in: "SourceGraphic",
|
|
1058
1094
|
in2: "stroke-noise",
|
|
1059
1095
|
scale: "3.5",
|
|
@@ -1062,7 +1098,7 @@ function Me(e, t, n) {
|
|
|
1062
1098
|
result: "warped"
|
|
1063
1099
|
})
|
|
1064
1100
|
), o.appendChild(
|
|
1065
|
-
|
|
1101
|
+
L("feTurbulence", {
|
|
1066
1102
|
type: "fractalNoise",
|
|
1067
1103
|
baseFrequency: "0.7",
|
|
1068
1104
|
numOctaves: "1",
|
|
@@ -1070,7 +1106,7 @@ function Me(e, t, n) {
|
|
|
1070
1106
|
result: "ink-noise"
|
|
1071
1107
|
})
|
|
1072
1108
|
), o.appendChild(
|
|
1073
|
-
|
|
1109
|
+
L("feDisplacementMap", {
|
|
1074
1110
|
in: "warped",
|
|
1075
1111
|
in2: "ink-noise",
|
|
1076
1112
|
scale: "0.9",
|
|
@@ -1079,31 +1115,51 @@ function Me(e, t, n) {
|
|
|
1079
1115
|
})
|
|
1080
1116
|
), o;
|
|
1081
1117
|
}
|
|
1082
|
-
function
|
|
1083
|
-
const t =
|
|
1084
|
-
return t.appendChild(
|
|
1085
|
-
}
|
|
1086
|
-
function
|
|
1087
|
-
const e =
|
|
1088
|
-
return e.appendChild(
|
|
1089
|
-
}
|
|
1090
|
-
function
|
|
1091
|
-
const e =
|
|
1092
|
-
return e.appendChild(
|
|
1118
|
+
function Ao(e) {
|
|
1119
|
+
const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1120
|
+
return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1121
|
+
}
|
|
1122
|
+
function To() {
|
|
1123
|
+
const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1124
|
+
return e.appendChild(L("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(L("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1125
|
+
}
|
|
1126
|
+
function jt() {
|
|
1127
|
+
const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1128
|
+
return e.appendChild(L("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(L("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1129
|
+
}
|
|
1130
|
+
function No() {
|
|
1131
|
+
const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1132
|
+
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1133
|
+
L("path", {
|
|
1134
|
+
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
|
+
})
|
|
1136
|
+
), e;
|
|
1137
|
+
}
|
|
1138
|
+
function Io() {
|
|
1139
|
+
const e = X("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1140
|
+
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1141
|
+
L("path", {
|
|
1142
|
+
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
|
+
stroke: "currentColor",
|
|
1144
|
+
"stroke-width": "2",
|
|
1145
|
+
"stroke-linecap": "round",
|
|
1146
|
+
"stroke-linejoin": "round"
|
|
1147
|
+
})
|
|
1148
|
+
), e;
|
|
1093
1149
|
}
|
|
1094
|
-
function
|
|
1095
|
-
const e =
|
|
1096
|
-
return e.appendChild(
|
|
1150
|
+
function Do() {
|
|
1151
|
+
const e = X("0 0 24 24", 18, 18, "currentColor");
|
|
1152
|
+
return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1097
1153
|
}
|
|
1098
|
-
function
|
|
1099
|
-
const e =
|
|
1100
|
-
return e.appendChild(
|
|
1154
|
+
function Mo() {
|
|
1155
|
+
const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1156
|
+
return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
|
|
1101
1157
|
}
|
|
1102
|
-
function
|
|
1103
|
-
const e =
|
|
1104
|
-
return e.appendChild(
|
|
1158
|
+
function Ro() {
|
|
1159
|
+
const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1160
|
+
return e.appendChild(L("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(L("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1105
1161
|
}
|
|
1106
|
-
function
|
|
1162
|
+
function X(e, t, n, o, a, i) {
|
|
1107
1163
|
const l = {
|
|
1108
1164
|
viewBox: e,
|
|
1109
1165
|
width: String(t),
|
|
@@ -1111,41 +1167,41 @@ function se(e, t, n, o, a, i) {
|
|
|
1111
1167
|
fill: o,
|
|
1112
1168
|
"aria-hidden": "true"
|
|
1113
1169
|
};
|
|
1114
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i),
|
|
1170
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
|
|
1115
1171
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const n = document.createElementNS(
|
|
1172
|
+
function L(e, t = {}) {
|
|
1173
|
+
const n = document.createElementNS(eo, e);
|
|
1118
1174
|
for (const [o, a] of Object.entries(t))
|
|
1119
1175
|
n.setAttribute(o, a);
|
|
1120
1176
|
return n;
|
|
1121
1177
|
}
|
|
1122
|
-
function
|
|
1178
|
+
function _t(e) {
|
|
1123
1179
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1124
1180
|
e.addEventListener(t, (n) => {
|
|
1125
1181
|
n.stopPropagation();
|
|
1126
1182
|
});
|
|
1127
1183
|
}
|
|
1128
|
-
function
|
|
1184
|
+
function Oo(e, t, n) {
|
|
1129
1185
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1130
1186
|
for (const [o, a] of t.entries()) {
|
|
1131
1187
|
const i = document.createElement("div");
|
|
1132
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1188
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Bo(a));
|
|
1133
1189
|
const l = document.createElement("span");
|
|
1134
1190
|
l.textContent = a.name, i.appendChild(l);
|
|
1135
1191
|
const p = document.createElement("button");
|
|
1136
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1192
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Mo()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1137
1193
|
}
|
|
1138
1194
|
}
|
|
1139
|
-
function
|
|
1140
|
-
if (
|
|
1195
|
+
function Bo(e) {
|
|
1196
|
+
if (Vt(e)) {
|
|
1141
1197
|
const n = document.createElement("img");
|
|
1142
1198
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1143
1199
|
}
|
|
1144
1200
|
const t = document.createElement("span");
|
|
1145
1201
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1146
1202
|
}
|
|
1147
|
-
function
|
|
1148
|
-
if (
|
|
1203
|
+
function Fo(e) {
|
|
1204
|
+
if (Vt(e)) {
|
|
1149
1205
|
const a = document.createElement("img");
|
|
1150
1206
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1151
1207
|
}
|
|
@@ -1156,51 +1212,51 @@ function Ao(e) {
|
|
|
1156
1212
|
const o = document.createElement("strong");
|
|
1157
1213
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1158
1214
|
}
|
|
1159
|
-
function
|
|
1215
|
+
function Vt(e) {
|
|
1160
1216
|
return e.mimeType.startsWith("image/");
|
|
1161
1217
|
}
|
|
1162
|
-
function
|
|
1218
|
+
function Uo(e) {
|
|
1163
1219
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1164
1220
|
}
|
|
1165
|
-
async function
|
|
1221
|
+
async function zo(e) {
|
|
1166
1222
|
if (!e)
|
|
1167
1223
|
return [];
|
|
1168
1224
|
const t = Array.from(e);
|
|
1169
|
-
if (t.length >
|
|
1170
|
-
throw new Error(`Attach up to ${
|
|
1225
|
+
if (t.length > Ce)
|
|
1226
|
+
throw new Error(`Attach up to ${Ce} files per message.`);
|
|
1171
1227
|
return Promise.all(
|
|
1172
1228
|
t.map(async (n) => {
|
|
1173
|
-
const o =
|
|
1229
|
+
const o = $o(n);
|
|
1174
1230
|
if (!o)
|
|
1175
1231
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1176
|
-
if (n.size >
|
|
1232
|
+
if (n.size > Hn)
|
|
1177
1233
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1178
1234
|
if (o === "image/gif") {
|
|
1179
|
-
const a = new Uint8Array(await
|
|
1180
|
-
if (
|
|
1235
|
+
const a = new Uint8Array(await Xo(n));
|
|
1236
|
+
if (Ho(a))
|
|
1181
1237
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1182
1238
|
}
|
|
1183
1239
|
return {
|
|
1184
|
-
name: n.name ||
|
|
1240
|
+
name: n.name || Uo(o),
|
|
1185
1241
|
mimeType: o,
|
|
1186
1242
|
sizeBytes: n.size,
|
|
1187
|
-
dataUrl:
|
|
1243
|
+
dataUrl: Go(await Zo(n), o)
|
|
1188
1244
|
};
|
|
1189
1245
|
})
|
|
1190
1246
|
);
|
|
1191
1247
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (
|
|
1248
|
+
function $o(e) {
|
|
1249
|
+
if (Ot.has(e.type))
|
|
1194
1250
|
return e.type;
|
|
1195
1251
|
const t = e.name.toLowerCase();
|
|
1196
1252
|
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;
|
|
1197
1253
|
}
|
|
1198
|
-
function
|
|
1254
|
+
function Go(e, t) {
|
|
1199
1255
|
const n = `data:${t};base64,`;
|
|
1200
1256
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1201
1257
|
}
|
|
1202
|
-
function
|
|
1203
|
-
if (e.length < 14 || !
|
|
1258
|
+
function Ho(e) {
|
|
1259
|
+
if (e.length < 14 || !Wo(e))
|
|
1204
1260
|
return !1;
|
|
1205
1261
|
const t = e[10];
|
|
1206
1262
|
let n = 13;
|
|
@@ -1211,7 +1267,7 @@ function Mo(e) {
|
|
|
1211
1267
|
if (n += 1, a === 59)
|
|
1212
1268
|
return !1;
|
|
1213
1269
|
if (a === 33) {
|
|
1214
|
-
n += 1, n =
|
|
1270
|
+
n += 1, n = xt(e, n);
|
|
1215
1271
|
continue;
|
|
1216
1272
|
}
|
|
1217
1273
|
if (a !== 44)
|
|
@@ -1223,14 +1279,14 @@ function Mo(e) {
|
|
|
1223
1279
|
const i = e[n + 8];
|
|
1224
1280
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1225
1281
|
return !1;
|
|
1226
|
-
n += 1, n =
|
|
1282
|
+
n += 1, n = xt(e, n);
|
|
1227
1283
|
}
|
|
1228
1284
|
return !1;
|
|
1229
1285
|
}
|
|
1230
|
-
function
|
|
1286
|
+
function Wo(e) {
|
|
1231
1287
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1232
1288
|
}
|
|
1233
|
-
function
|
|
1289
|
+
function xt(e, t) {
|
|
1234
1290
|
for (; t < e.length; ) {
|
|
1235
1291
|
const n = e[t];
|
|
1236
1292
|
if (t += 1, n === 0)
|
|
@@ -1239,69 +1295,69 @@ function ft(e, t) {
|
|
|
1239
1295
|
}
|
|
1240
1296
|
return t;
|
|
1241
1297
|
}
|
|
1242
|
-
function
|
|
1298
|
+
function xe(e) {
|
|
1243
1299
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1244
1300
|
}
|
|
1245
|
-
function
|
|
1246
|
-
if (!e || !
|
|
1301
|
+
function Be(e, t, n = null) {
|
|
1302
|
+
if (!e || !He(t, n)) {
|
|
1247
1303
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1248
1304
|
return;
|
|
1249
1305
|
}
|
|
1250
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1306
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", $(t) || Ve(n) ? e.appendChild(jo(t, n)) : qt(t) && e.appendChild(Vo(t));
|
|
1251
1307
|
}
|
|
1252
|
-
function
|
|
1308
|
+
function jo(e, t) {
|
|
1253
1309
|
const n = document.createElement("div");
|
|
1254
1310
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1255
1311
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1256
1312
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1257
1313
|
const i = document.createElement("span");
|
|
1258
|
-
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(
|
|
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(Kt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1259
1315
|
}
|
|
1260
|
-
function
|
|
1316
|
+
function Vo(e) {
|
|
1261
1317
|
const t = document.createElement("div");
|
|
1262
1318
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1263
1319
|
const n = document.createElement("strong");
|
|
1264
1320
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1265
1321
|
const o = document.createElement("span");
|
|
1266
|
-
return o.textContent =
|
|
1322
|
+
return o.textContent = Ko(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Kt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1267
1323
|
}
|
|
1268
|
-
function
|
|
1269
|
-
return e !== null && (
|
|
1324
|
+
function He(e, t) {
|
|
1325
|
+
return e !== null && ($(e) || qt(e) || Ve(t));
|
|
1270
1326
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return
|
|
1327
|
+
function vt(e, t, n) {
|
|
1328
|
+
return He(t, n) || qo(t) ? !0 : !He(e, n);
|
|
1273
1329
|
}
|
|
1274
|
-
function
|
|
1275
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1330
|
+
function qo(e) {
|
|
1331
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || $(e));
|
|
1276
1332
|
}
|
|
1277
|
-
function
|
|
1333
|
+
function $(e) {
|
|
1278
1334
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1279
1335
|
}
|
|
1280
|
-
function
|
|
1336
|
+
function Ve(e) {
|
|
1281
1337
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1282
1338
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return
|
|
1339
|
+
function qt(e) {
|
|
1340
|
+
return !$(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1285
1341
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return e.creditsRemaining === null ? null : `${
|
|
1342
|
+
function Ko(e) {
|
|
1343
|
+
return e.creditsRemaining === null ? null : `${Yo(e.creditsRemaining)} credits left`;
|
|
1288
1344
|
}
|
|
1289
|
-
function
|
|
1345
|
+
function Yo(e) {
|
|
1290
1346
|
return new Intl.NumberFormat("en-US", {
|
|
1291
1347
|
maximumFractionDigits: 0
|
|
1292
1348
|
}).format(Math.ceil(e));
|
|
1293
1349
|
}
|
|
1294
|
-
function
|
|
1350
|
+
function Kt(e, t, n) {
|
|
1295
1351
|
const o = document.createElement("div");
|
|
1296
|
-
return o.className = n, o.appendChild(
|
|
1352
|
+
return o.className = n, o.appendChild(yt(t, e.pricingUrl)), o.appendChild(yt("Earn credits", e.earnCreditsUrl)), o;
|
|
1297
1353
|
}
|
|
1298
|
-
function
|
|
1354
|
+
function yt(e, t) {
|
|
1299
1355
|
const n = document.createElement("button");
|
|
1300
1356
|
return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
|
|
1301
1357
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1302
1358
|
}), n;
|
|
1303
1359
|
}
|
|
1304
|
-
function
|
|
1360
|
+
function Xo(e) {
|
|
1305
1361
|
return new Promise((t, n) => {
|
|
1306
1362
|
const o = new FileReader();
|
|
1307
1363
|
o.addEventListener("load", () => {
|
|
@@ -1315,7 +1371,7 @@ function Go(e) {
|
|
|
1315
1371
|
}), o.readAsArrayBuffer(e);
|
|
1316
1372
|
});
|
|
1317
1373
|
}
|
|
1318
|
-
function
|
|
1374
|
+
function Zo(e) {
|
|
1319
1375
|
return new Promise((t, n) => {
|
|
1320
1376
|
const o = new FileReader();
|
|
1321
1377
|
o.addEventListener("load", () => {
|
|
@@ -1329,94 +1385,99 @@ function $o(e) {
|
|
|
1329
1385
|
}), o.readAsDataURL(e);
|
|
1330
1386
|
});
|
|
1331
1387
|
}
|
|
1332
|
-
function
|
|
1333
|
-
return e.messages.filter((o) => !
|
|
1388
|
+
function Ct(e, t) {
|
|
1389
|
+
return e.messages.filter((o) => !Yt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1334
1390
|
}
|
|
1335
|
-
function
|
|
1336
|
-
const
|
|
1337
|
-
e.replaceChildren(),
|
|
1391
|
+
function Jo(e, t, n, o, a, i, l, p, c, d, s, f, C, k, x) {
|
|
1392
|
+
const R = [...i.messages], v = R.filter((b) => !Yt(b)), y = e.scrollTop;
|
|
1393
|
+
e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null && Lo(a, l);
|
|
1338
1394
|
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1339
1395
|
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1396
|
+
const b = document.createElement("div");
|
|
1397
|
+
b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1340
1398
|
const m = document.createElement("div");
|
|
1341
|
-
m.className = "pluno-pa-widget__empty-
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1399
|
+
m.className = "pluno-pa-widget__empty-hero";
|
|
1400
|
+
const S = document.createElement("img");
|
|
1401
|
+
S.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", S.src = C(), S.alt = "", S.setAttribute("aria-hidden", "true"), m.appendChild(S), b.appendChild(m), b.appendChild(Gt());
|
|
1402
|
+
const P = document.createElement("div");
|
|
1403
|
+
if (P.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 && P.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1404
|
+
for (const I of i.starterPrompts) {
|
|
1405
|
+
const A = document.createElement("button");
|
|
1406
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${I}"`, A.addEventListener("click", () => {
|
|
1407
|
+
k(I);
|
|
1408
|
+
}), P.appendChild(A);
|
|
1409
|
+
}
|
|
1410
|
+
else
|
|
1411
|
+
for (let I = 0; I < jn; I += 1) {
|
|
1412
|
+
const A = document.createElement("button");
|
|
1413
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.innerHTML = " ", P.appendChild(A);
|
|
1414
|
+
}
|
|
1415
|
+
b.appendChild(P), e.appendChild(b), e.appendChild(t);
|
|
1355
1416
|
return;
|
|
1356
1417
|
}
|
|
1357
|
-
let
|
|
1358
|
-
const
|
|
1418
|
+
let g = null, _ = null, N = [];
|
|
1419
|
+
const Z = () => {
|
|
1359
1420
|
if (N.length === 0)
|
|
1360
1421
|
return !1;
|
|
1361
|
-
const
|
|
1362
|
-
return e.appendChild(
|
|
1422
|
+
const b = la(N, s, f, C());
|
|
1423
|
+
return e.appendChild(b), g = null, _ = b, N = [], !0;
|
|
1363
1424
|
};
|
|
1364
|
-
for (let
|
|
1365
|
-
const
|
|
1366
|
-
if (
|
|
1367
|
-
N.push(
|
|
1425
|
+
for (let b = 0; b < v.length; b += 1) {
|
|
1426
|
+
const m = v[b];
|
|
1427
|
+
if (m.role === "tool") {
|
|
1428
|
+
N.push(m);
|
|
1368
1429
|
continue;
|
|
1369
1430
|
}
|
|
1370
|
-
if (
|
|
1431
|
+
if (m.role === "system")
|
|
1371
1432
|
continue;
|
|
1372
|
-
const
|
|
1373
|
-
if (
|
|
1374
|
-
const
|
|
1375
|
-
e.appendChild(
|
|
1433
|
+
const S = Z(), P = St(m.content);
|
|
1434
|
+
if (m.role === "assistant" && !S) {
|
|
1435
|
+
const w = We(C());
|
|
1436
|
+
e.appendChild(w), g = null, _ = w;
|
|
1376
1437
|
}
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1438
|
+
const I = document.createElement("div");
|
|
1439
|
+
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? kt(I, P) : I.textContent = P, m.role === "user" && m.attachments?.length && I.appendChild(ea(m.attachments));
|
|
1379
1440
|
const A = document.createElement("div");
|
|
1380
|
-
A.className = "pluno-pa-widget__message-actions", A.appendChild(
|
|
1441
|
+
A.className = "pluno-pa-widget__message-actions", A.appendChild(Et(P)), I.appendChild(A), e.appendChild(I), g = I, _ = null;
|
|
1381
1442
|
}
|
|
1382
|
-
const
|
|
1443
|
+
const de = Z();
|
|
1383
1444
|
if (i.assistantDraft) {
|
|
1384
|
-
if (!
|
|
1385
|
-
const
|
|
1386
|
-
e.appendChild(
|
|
1387
|
-
}
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1445
|
+
if (!de) {
|
|
1446
|
+
const P = We(C());
|
|
1447
|
+
e.appendChild(P), g = null, _ = P;
|
|
1448
|
+
}
|
|
1449
|
+
const b = St(i.assistantDraft), m = document.createElement("div");
|
|
1450
|
+
m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", kt(m, b);
|
|
1451
|
+
const S = document.createElement("div");
|
|
1452
|
+
S.className = "pluno-pa-widget__message-actions", S.appendChild(Et(b)), m.appendChild(S), e.appendChild(m), g = m, _ = null;
|
|
1392
1453
|
}
|
|
1393
1454
|
if (i.isThinking && !i.assistantDraft)
|
|
1394
|
-
if (
|
|
1395
|
-
const
|
|
1396
|
-
e.appendChild(
|
|
1455
|
+
if (de) {
|
|
1456
|
+
const b = Xt();
|
|
1457
|
+
e.appendChild(b), g = null, _ = b;
|
|
1397
1458
|
} else {
|
|
1398
|
-
const
|
|
1399
|
-
e.appendChild(
|
|
1459
|
+
const b = pa(C());
|
|
1460
|
+
e.appendChild(b), g = null, _ = b;
|
|
1400
1461
|
}
|
|
1401
1462
|
if (i.lastError) {
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1463
|
+
const b = document.createElement("div");
|
|
1464
|
+
b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
|
|
1404
1465
|
}
|
|
1405
|
-
const E =
|
|
1406
|
-
if (
|
|
1407
|
-
const
|
|
1408
|
-
isDrafting:
|
|
1409
|
-
error:
|
|
1410
|
-
onDraft:
|
|
1411
|
-
onDismiss:
|
|
1412
|
-
onDisable:
|
|
1466
|
+
const E = x && !i.isThinking ? xn(R) : null;
|
|
1467
|
+
if (x && E && !x.dismissedCandidateIds.has(E.id)) {
|
|
1468
|
+
const b = ta(E, {
|
|
1469
|
+
isDrafting: x.draftingCandidateId === E.id,
|
|
1470
|
+
error: x.error,
|
|
1471
|
+
onDraft: x.onDraft,
|
|
1472
|
+
onDismiss: x.onDismiss,
|
|
1473
|
+
onDisable: x.onDisable
|
|
1413
1474
|
});
|
|
1414
|
-
e.appendChild(
|
|
1475
|
+
e.appendChild(b), x.onSeen(E), g = null, _ = b;
|
|
1415
1476
|
}
|
|
1416
|
-
|
|
1477
|
+
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? he(e, d) : e.scrollTop = y;
|
|
1417
1478
|
}
|
|
1418
|
-
function
|
|
1419
|
-
e.replaceChildren(),
|
|
1479
|
+
function Qo(e, t, n, o, a, i) {
|
|
1480
|
+
e.replaceChildren(), Zt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1420
1481
|
const l = document.createElement("div");
|
|
1421
1482
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1422
1483
|
const p = document.createElement("img");
|
|
@@ -1426,20 +1487,20 @@ function Wo(e, t, n, o, a, i) {
|
|
|
1426
1487
|
const d = document.createElement("button");
|
|
1427
1488
|
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1428
1489
|
}
|
|
1429
|
-
function
|
|
1490
|
+
function ea(e) {
|
|
1430
1491
|
const t = document.createElement("div");
|
|
1431
1492
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1432
1493
|
for (const n of e)
|
|
1433
|
-
t.appendChild(
|
|
1494
|
+
t.appendChild(Fo(n));
|
|
1434
1495
|
return t;
|
|
1435
1496
|
}
|
|
1436
|
-
function
|
|
1497
|
+
function Et(e) {
|
|
1437
1498
|
const t = document.createElement("button");
|
|
1438
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1499
|
+
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) => {
|
|
1439
1500
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1440
1501
|
}), t;
|
|
1441
1502
|
}
|
|
1442
|
-
function
|
|
1503
|
+
function ta(e, t) {
|
|
1443
1504
|
const n = document.createElement("article");
|
|
1444
1505
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1445
1506
|
const o = document.createElement("div");
|
|
@@ -1461,21 +1522,21 @@ function jo(e, t) {
|
|
|
1461
1522
|
const d = document.createElement("button");
|
|
1462
1523
|
if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
|
|
1463
1524
|
t.onDraft(e);
|
|
1464
|
-
}), t.isDrafting ? (d.appendChild(
|
|
1525
|
+
}), t.isDrafting ? (d.appendChild(je()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
|
|
1465
1526
|
p.appendChild(c);
|
|
1466
1527
|
else {
|
|
1467
1528
|
const s = document.createElement("button");
|
|
1468
1529
|
s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
|
|
1469
1530
|
t.onDismiss(e);
|
|
1470
1531
|
}), c.appendChild(s), p.appendChild(c);
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1532
|
+
const f = document.createElement("button");
|
|
1533
|
+
f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
|
|
1473
1534
|
t.onDisable(e);
|
|
1474
|
-
}), p.appendChild(
|
|
1535
|
+
}), p.appendChild(f);
|
|
1475
1536
|
}
|
|
1476
1537
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1477
1538
|
}
|
|
1478
|
-
function
|
|
1539
|
+
function na(e, t) {
|
|
1479
1540
|
const n = document.createElement("div");
|
|
1480
1541
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1481
1542
|
v.target === n && t.onClose();
|
|
@@ -1494,49 +1555,49 @@ function qo(e, t) {
|
|
|
1494
1555
|
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1495
1556
|
const s = document.createElement("strong");
|
|
1496
1557
|
s.textContent = "1) Copy Screenshot", d.appendChild(s);
|
|
1497
|
-
const
|
|
1558
|
+
const f = oa("Copy Screenshot", async () => {
|
|
1498
1559
|
try {
|
|
1499
|
-
return await
|
|
1560
|
+
return await vn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1500
1561
|
} catch {
|
|
1501
1562
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1502
1563
|
}
|
|
1503
1564
|
});
|
|
1504
|
-
if (d.appendChild(
|
|
1565
|
+
if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
|
|
1505
1566
|
const v = document.createElement("div");
|
|
1506
1567
|
v.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1568
|
+
const y = document.createElement("img");
|
|
1569
|
+
y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
|
|
1509
1570
|
}
|
|
1510
1571
|
o.appendChild(c), o.appendChild(p);
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
for (const v of
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1572
|
+
const C = document.createElement("div");
|
|
1573
|
+
C.className = "pluno-pa-widget__share-dialog-step";
|
|
1574
|
+
const k = document.createElement("strong");
|
|
1575
|
+
k.className = "pluno-pa-widget__share-dialog-step-title", k.textContent = "2) Share on", C.appendChild(k);
|
|
1576
|
+
const x = document.createElement("p");
|
|
1577
|
+
x.className = "pluno-pa-widget__share-dialog-hint", x.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(x);
|
|
1578
|
+
const R = document.createElement("footer");
|
|
1579
|
+
R.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1580
|
+
for (const v of aa(e)) {
|
|
1581
|
+
const y = document.createElement("a");
|
|
1582
|
+
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ia(v.id)), R.appendChild(y);
|
|
1522
1583
|
}
|
|
1523
|
-
if (
|
|
1584
|
+
if (C.appendChild(R), o.appendChild(C), t.socialPostRewardsUrl) {
|
|
1524
1585
|
const v = document.createElement("div");
|
|
1525
1586
|
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1587
|
+
const y = document.createElement("strong");
|
|
1588
|
+
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
|
|
1528
1589
|
const h = document.createElement("a");
|
|
1529
|
-
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(
|
|
1590
|
+
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(ra()), v.appendChild(h), o.appendChild(v);
|
|
1530
1591
|
}
|
|
1531
1592
|
return n.appendChild(o), n;
|
|
1532
1593
|
}
|
|
1533
|
-
function
|
|
1594
|
+
function oa(e, t) {
|
|
1534
1595
|
const n = document.createElement("button");
|
|
1535
1596
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1536
1597
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1537
1598
|
}), n;
|
|
1538
1599
|
}
|
|
1539
|
-
function
|
|
1600
|
+
function aa(e) {
|
|
1540
1601
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1541
1602
|
return [
|
|
1542
1603
|
{
|
|
@@ -1556,60 +1617,60 @@ function Yo(e) {
|
|
|
1556
1617
|
}
|
|
1557
1618
|
];
|
|
1558
1619
|
}
|
|
1559
|
-
function
|
|
1620
|
+
function ia(e) {
|
|
1560
1621
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1561
|
-
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" ? (
|
|
1622
|
+
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);
|
|
1562
1623
|
}
|
|
1563
|
-
function
|
|
1624
|
+
function D(e, t, n) {
|
|
1564
1625
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1565
1626
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1566
1627
|
}
|
|
1567
|
-
function
|
|
1628
|
+
function ra() {
|
|
1568
1629
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1569
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
1630
|
+
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;
|
|
1570
1631
|
}
|
|
1571
|
-
function
|
|
1572
|
-
return e.role === "tool" && e.toolName ===
|
|
1632
|
+
function Yt(e) {
|
|
1633
|
+
return e.role === "tool" && e.toolName === Dt;
|
|
1573
1634
|
}
|
|
1574
|
-
function
|
|
1635
|
+
function St(e) {
|
|
1575
1636
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1576
1637
|
}
|
|
1577
|
-
function
|
|
1638
|
+
function la(e, t, n, o) {
|
|
1578
1639
|
const a = document.createElement("article");
|
|
1579
1640
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1580
1641
|
const i = document.createElement("img");
|
|
1581
1642
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1582
|
-
const l = document.createElement("details"), p =
|
|
1643
|
+
const l = document.createElement("details"), p = sa(e);
|
|
1583
1644
|
l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
|
|
1584
1645
|
a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
|
|
1585
1646
|
});
|
|
1586
1647
|
const c = document.createElement("summary");
|
|
1587
|
-
c.className = "pluno-pa-widget__tool-summary", e.some((
|
|
1648
|
+
c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(je());
|
|
1588
1649
|
const s = document.createElement("span");
|
|
1589
1650
|
if (s.className = "pluno-pa-widget__tool-summary-title", s.textContent = e[e.length - 1].content || "Run tool", c.appendChild(s), l.appendChild(c), e.length > 0) {
|
|
1590
|
-
const
|
|
1591
|
-
|
|
1592
|
-
for (const
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
}
|
|
1598
|
-
l.appendChild(
|
|
1651
|
+
const f = document.createElement("div");
|
|
1652
|
+
f.className = "pluno-pa-widget__tool-lines";
|
|
1653
|
+
for (const C of e) {
|
|
1654
|
+
const k = document.createElement("div");
|
|
1655
|
+
k.className = "pluno-pa-widget__tool-line", C.loading && k.appendChild(je());
|
|
1656
|
+
const x = document.createElement("span");
|
|
1657
|
+
x.textContent = C.content || "Run tool", k.appendChild(x), f.appendChild(k);
|
|
1658
|
+
}
|
|
1659
|
+
l.appendChild(f);
|
|
1599
1660
|
}
|
|
1600
1661
|
return a.appendChild(l), a;
|
|
1601
1662
|
}
|
|
1602
|
-
function
|
|
1663
|
+
function We(e) {
|
|
1603
1664
|
const t = document.createElement("article");
|
|
1604
1665
|
t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1605
1666
|
const n = document.createElement("img");
|
|
1606
1667
|
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;
|
|
1607
1668
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const t =
|
|
1610
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1669
|
+
function pa(e) {
|
|
1670
|
+
const t = We(e);
|
|
1671
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Xt()), t;
|
|
1611
1672
|
}
|
|
1612
|
-
function
|
|
1673
|
+
function Xt() {
|
|
1613
1674
|
const e = document.createElement("div");
|
|
1614
1675
|
e.className = "pluno-pa-widget__status";
|
|
1615
1676
|
const t = document.createElement("span");
|
|
@@ -1617,17 +1678,17 @@ function Vt() {
|
|
|
1617
1678
|
const n = document.createElement("span");
|
|
1618
1679
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1619
1680
|
}
|
|
1620
|
-
function
|
|
1681
|
+
function sa(e) {
|
|
1621
1682
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1622
1683
|
}
|
|
1623
|
-
function
|
|
1684
|
+
function je() {
|
|
1624
1685
|
const e = document.createElement("span");
|
|
1625
1686
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1626
1687
|
}
|
|
1627
|
-
function
|
|
1628
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1688
|
+
function Zt(e, t) {
|
|
1689
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Do() : jt());
|
|
1629
1690
|
}
|
|
1630
|
-
function
|
|
1691
|
+
function kt(e, t) {
|
|
1631
1692
|
const n = t.replace(/\r\n/g, `
|
|
1632
1693
|
`).split(`
|
|
1633
1694
|
`);
|
|
@@ -1643,22 +1704,22 @@ function yt(e, t) {
|
|
|
1643
1704
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1644
1705
|
d.push(n[o]), o += 1;
|
|
1645
1706
|
o += o < n.length ? 1 : 0;
|
|
1646
|
-
const s = document.createElement("pre"),
|
|
1647
|
-
|
|
1648
|
-
`), s.appendChild(
|
|
1707
|
+
const s = document.createElement("pre"), f = document.createElement("code");
|
|
1708
|
+
f.textContent = d.join(`
|
|
1709
|
+
`), s.appendChild(f), e.appendChild(s);
|
|
1649
1710
|
continue;
|
|
1650
1711
|
}
|
|
1651
1712
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1652
1713
|
if (l) {
|
|
1653
1714
|
const d = document.createElement(`h${l[1].length + 2}`);
|
|
1654
|
-
|
|
1715
|
+
ve(d, l[2]), e.appendChild(d), o += 1;
|
|
1655
1716
|
continue;
|
|
1656
1717
|
}
|
|
1657
1718
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1658
1719
|
const d = document.createElement("ul");
|
|
1659
1720
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1660
1721
|
const s = document.createElement("li");
|
|
1661
|
-
|
|
1722
|
+
ve(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
|
|
1662
1723
|
}
|
|
1663
1724
|
e.appendChild(d);
|
|
1664
1725
|
continue;
|
|
@@ -1667,7 +1728,7 @@ function yt(e, t) {
|
|
|
1667
1728
|
const d = document.createElement("ol");
|
|
1668
1729
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1669
1730
|
const s = document.createElement("li");
|
|
1670
|
-
|
|
1731
|
+
ve(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
|
|
1671
1732
|
}
|
|
1672
1733
|
e.appendChild(d);
|
|
1673
1734
|
continue;
|
|
@@ -1677,11 +1738,11 @@ function yt(e, t) {
|
|
|
1677
1738
|
p.push(n[o]), o += 1;
|
|
1678
1739
|
const c = document.createElement("p");
|
|
1679
1740
|
p.forEach((d, s) => {
|
|
1680
|
-
s > 0 && c.appendChild(document.createElement("br")),
|
|
1741
|
+
s > 0 && c.appendChild(document.createElement("br")), ve(c, d);
|
|
1681
1742
|
}), e.appendChild(c);
|
|
1682
1743
|
}
|
|
1683
1744
|
}
|
|
1684
|
-
function
|
|
1745
|
+
function ve(e, t) {
|
|
1685
1746
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1686
1747
|
let o = 0;
|
|
1687
1748
|
for (const a of t.matchAll(n)) {
|
|
@@ -1699,7 +1760,7 @@ function xe(e, t) {
|
|
|
1699
1760
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
1700
1761
|
} else {
|
|
1701
1762
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1702
|
-
if (p &&
|
|
1763
|
+
if (p && da(p[2])) {
|
|
1703
1764
|
const c = document.createElement("a");
|
|
1704
1765
|
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
1705
1766
|
} else
|
|
@@ -1709,7 +1770,7 @@ function xe(e, t) {
|
|
|
1709
1770
|
}
|
|
1710
1771
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1711
1772
|
}
|
|
1712
|
-
function
|
|
1773
|
+
function da(e) {
|
|
1713
1774
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1714
1775
|
return !0;
|
|
1715
1776
|
try {
|
|
@@ -1719,8 +1780,8 @@ function ta(e) {
|
|
|
1719
1780
|
return !1;
|
|
1720
1781
|
}
|
|
1721
1782
|
}
|
|
1722
|
-
function
|
|
1723
|
-
if (
|
|
1783
|
+
function Lt(e, t) {
|
|
1784
|
+
if (ca(e))
|
|
1724
1785
|
return;
|
|
1725
1786
|
const n = `
|
|
1726
1787
|
:host {
|
|
@@ -1773,7 +1834,7 @@ function Ct(e, t) {
|
|
|
1773
1834
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1774
1835
|
position: fixed;
|
|
1775
1836
|
z-index: 2147483645;
|
|
1776
|
-
font-family: ${
|
|
1837
|
+
font-family: ${j.fontFamily};
|
|
1777
1838
|
font-size: 14px;
|
|
1778
1839
|
color: var(--pluno-pa-text);
|
|
1779
1840
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -2514,7 +2575,7 @@ function Ct(e, t) {
|
|
|
2514
2575
|
place-items: center;
|
|
2515
2576
|
padding: 18px;
|
|
2516
2577
|
background: rgba(24, 24, 27, 0.28);
|
|
2517
|
-
font-family: var(--pluno-pa-font, ${
|
|
2578
|
+
font-family: var(--pluno-pa-font, ${j.fontFamily});
|
|
2518
2579
|
color: var(--pluno-pa-text);
|
|
2519
2580
|
}
|
|
2520
2581
|
.pluno-pa-widget__share-dialog {
|
|
@@ -2878,12 +2939,48 @@ function Ct(e, t) {
|
|
|
2878
2939
|
background: var(--pluno-pa-surface);
|
|
2879
2940
|
border: 1px solid var(--pluno-pa-divider);
|
|
2880
2941
|
border-radius: 14px;
|
|
2881
|
-
padding: 8px 44px 8px
|
|
2942
|
+
padding: 8px 44px 8px 38px;
|
|
2882
2943
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
|
|
2883
2944
|
}
|
|
2884
2945
|
.pluno-pa-widget__composer-inner:focus-within {
|
|
2885
2946
|
border-color: var(--pluno-pa-accent);
|
|
2886
2947
|
}
|
|
2948
|
+
.pluno-pa-widget__attachment-input {
|
|
2949
|
+
position: absolute;
|
|
2950
|
+
width: 1px;
|
|
2951
|
+
height: 1px;
|
|
2952
|
+
opacity: 0;
|
|
2953
|
+
pointer-events: none;
|
|
2954
|
+
}
|
|
2955
|
+
.pluno-pa-widget__attach {
|
|
2956
|
+
position: absolute;
|
|
2957
|
+
left: 6px;
|
|
2958
|
+
top: 50%;
|
|
2959
|
+
margin-top: -14px;
|
|
2960
|
+
width: 28px;
|
|
2961
|
+
height: 28px;
|
|
2962
|
+
display: inline-flex;
|
|
2963
|
+
align-items: center;
|
|
2964
|
+
justify-content: center;
|
|
2965
|
+
border: 0;
|
|
2966
|
+
border-radius: 999px;
|
|
2967
|
+
background: transparent;
|
|
2968
|
+
color: var(--pluno-pa-muted);
|
|
2969
|
+
cursor: pointer;
|
|
2970
|
+
transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
|
|
2971
|
+
}
|
|
2972
|
+
.pluno-pa-widget__attach:hover:not(:disabled),
|
|
2973
|
+
.pluno-pa-widget__attach:focus-visible {
|
|
2974
|
+
background: var(--pluno-pa-bubble);
|
|
2975
|
+
color: var(--pluno-pa-accent);
|
|
2976
|
+
}
|
|
2977
|
+
.pluno-pa-widget__attach:disabled {
|
|
2978
|
+
cursor: not-allowed;
|
|
2979
|
+
opacity: 0.45;
|
|
2980
|
+
}
|
|
2981
|
+
.pluno-pa-widget__paperclip-icon--scribble {
|
|
2982
|
+
display: none;
|
|
2983
|
+
}
|
|
2887
2984
|
.pluno-pa-widget--drag-over .pluno-pa-widget__composer-inner {
|
|
2888
2985
|
border-color: var(--pluno-pa-accent);
|
|
2889
2986
|
background: var(--pluno-pa-accent-soft);
|
|
@@ -2948,12 +3045,12 @@ function Ct(e, t) {
|
|
|
2948
3045
|
display: flex;
|
|
2949
3046
|
align-items: center;
|
|
2950
3047
|
justify-content: center;
|
|
2951
|
-
column-gap: 0.
|
|
2952
|
-
margin-top:
|
|
3048
|
+
column-gap: 0.3em;
|
|
3049
|
+
margin-top: 5px;
|
|
2953
3050
|
color: var(--pluno-pa-faint);
|
|
2954
3051
|
font: inherit;
|
|
2955
|
-
font-size:
|
|
2956
|
-
line-height: 1.
|
|
3052
|
+
font-size: 10px;
|
|
3053
|
+
line-height: 1.1;
|
|
2957
3054
|
flex-wrap: wrap;
|
|
2958
3055
|
text-align: center;
|
|
2959
3056
|
}
|
|
@@ -3071,7 +3168,6 @@ function Ct(e, t) {
|
|
|
3071
3168
|
width: min(100%, 320px);
|
|
3072
3169
|
}
|
|
3073
3170
|
.pluno-pa-widget__starter-prompts--empty {
|
|
3074
|
-
min-height: 96px;
|
|
3075
3171
|
pointer-events: none;
|
|
3076
3172
|
}
|
|
3077
3173
|
.pluno-pa-widget__starter-prompt {
|
|
@@ -3091,6 +3187,9 @@ function Ct(e, t) {
|
|
|
3091
3187
|
color: var(--pluno-pa-text);
|
|
3092
3188
|
background: transparent;
|
|
3093
3189
|
}
|
|
3190
|
+
.pluno-pa-widget__starter-prompt--placeholder {
|
|
3191
|
+
visibility: hidden;
|
|
3192
|
+
}
|
|
3094
3193
|
.pluno-pa-widget__login {
|
|
3095
3194
|
border: 0;
|
|
3096
3195
|
border-radius: 8px;
|
|
@@ -3202,7 +3301,7 @@ function Ct(e, t) {
|
|
|
3202
3301
|
right: 16px;
|
|
3203
3302
|
height: 36px;
|
|
3204
3303
|
z-index: 3;
|
|
3205
|
-
background-image: url('${
|
|
3304
|
+
background-image: url('${ut}');
|
|
3206
3305
|
background-repeat: repeat-x;
|
|
3207
3306
|
background-size: 104px 36px;
|
|
3208
3307
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3338,6 +3437,9 @@ function Ct(e, t) {
|
|
|
3338
3437
|
.pluno-pa-widget--scribble .pluno-pa-widget__send::before {
|
|
3339
3438
|
background: var(--pluno-pa-accent);
|
|
3340
3439
|
}
|
|
3440
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__send:disabled {
|
|
3441
|
+
color: var(--pluno-pa-faint);
|
|
3442
|
+
}
|
|
3341
3443
|
.pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
|
|
3342
3444
|
background: var(--pluno-pa-surface);
|
|
3343
3445
|
}
|
|
@@ -3390,6 +3492,19 @@ function Ct(e, t) {
|
|
|
3390
3492
|
opacity: 0.6;
|
|
3391
3493
|
transform: rotate(5deg);
|
|
3392
3494
|
}
|
|
3495
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
|
|
3496
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
|
|
3497
|
+
background: transparent;
|
|
3498
|
+
color: var(--pluno-pa-accent);
|
|
3499
|
+
}
|
|
3500
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--standard {
|
|
3501
|
+
display: none;
|
|
3502
|
+
}
|
|
3503
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--scribble {
|
|
3504
|
+
display: block;
|
|
3505
|
+
transform: rotate(-8deg);
|
|
3506
|
+
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3507
|
+
}
|
|
3393
3508
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
|
|
3394
3509
|
transform: rotate(-10deg);
|
|
3395
3510
|
filter: url(#pluno-pa-scribble-wobble);
|
|
@@ -3455,7 +3570,7 @@ function Ct(e, t) {
|
|
|
3455
3570
|
right: 12px;
|
|
3456
3571
|
height: 22px;
|
|
3457
3572
|
z-index: 1;
|
|
3458
|
-
background-image: url('${
|
|
3573
|
+
background-image: url('${ut}');
|
|
3459
3574
|
background-repeat: repeat-x;
|
|
3460
3575
|
background-size: 62px 21.5px;
|
|
3461
3576
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3468,28 +3583,28 @@ function Ct(e, t) {
|
|
|
3468
3583
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3469
3584
|
}
|
|
3470
3585
|
`;
|
|
3471
|
-
if (
|
|
3586
|
+
if (ua(e, n))
|
|
3472
3587
|
return;
|
|
3473
3588
|
const o = e.ownerDocument.createElement("style");
|
|
3474
|
-
o.id =
|
|
3589
|
+
o.id = Ut, o.textContent = n, e.appendChild(o), Jt(e);
|
|
3475
3590
|
}
|
|
3476
|
-
function
|
|
3477
|
-
return e.getElementById(
|
|
3591
|
+
function ca(e) {
|
|
3592
|
+
return e.getElementById(Ut) !== null || e.host instanceof HTMLElement && e.host.getAttribute(zt) === "true";
|
|
3478
3593
|
}
|
|
3479
|
-
function
|
|
3480
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3594
|
+
function Jt(e) {
|
|
3595
|
+
e.host instanceof HTMLElement && e.host.setAttribute(zt, "true");
|
|
3481
3596
|
}
|
|
3482
|
-
function
|
|
3597
|
+
function ua(e, t) {
|
|
3483
3598
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3484
3599
|
return !1;
|
|
3485
3600
|
try {
|
|
3486
3601
|
const n = new CSSStyleSheet();
|
|
3487
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3602
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Jt(e), !0;
|
|
3488
3603
|
} catch {
|
|
3489
3604
|
return !1;
|
|
3490
3605
|
}
|
|
3491
3606
|
}
|
|
3492
|
-
async function
|
|
3607
|
+
async function ga() {
|
|
3493
3608
|
return document.body ? document.body : await new Promise((e) => {
|
|
3494
3609
|
const t = new MutationObserver(() => {
|
|
3495
3610
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3497,49 +3612,49 @@ async function aa() {
|
|
|
3497
3612
|
t.observe(document.documentElement, { childList: !0 });
|
|
3498
3613
|
});
|
|
3499
3614
|
}
|
|
3500
|
-
function
|
|
3615
|
+
function Qt(e) {
|
|
3501
3616
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3502
3617
|
}
|
|
3503
|
-
function
|
|
3618
|
+
function ha(e) {
|
|
3504
3619
|
try {
|
|
3505
|
-
const t = window.localStorage.getItem(
|
|
3620
|
+
const t = window.localStorage.getItem(Qt(e));
|
|
3506
3621
|
if (!t)
|
|
3507
|
-
return
|
|
3622
|
+
return Pt();
|
|
3508
3623
|
const n = JSON.parse(t);
|
|
3509
3624
|
return {
|
|
3510
3625
|
isOpen: n.isOpen === !0,
|
|
3511
3626
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3512
3627
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3513
|
-
launcherPosition:
|
|
3514
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3628
|
+
launcherPosition: wa(n.launcherPosition) ? n.launcherPosition : null,
|
|
3629
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
|
|
3515
3630
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3516
3631
|
};
|
|
3517
3632
|
} catch {
|
|
3518
|
-
return
|
|
3633
|
+
return Pt();
|
|
3519
3634
|
}
|
|
3520
3635
|
}
|
|
3521
|
-
async function
|
|
3636
|
+
async function ma(e) {
|
|
3522
3637
|
if (e.loadSharePromptsDisabled)
|
|
3523
3638
|
return e.loadSharePromptsDisabled();
|
|
3524
3639
|
try {
|
|
3525
|
-
return window.localStorage.getItem(
|
|
3640
|
+
return window.localStorage.getItem(Rt) === "true";
|
|
3526
3641
|
} catch {
|
|
3527
3642
|
return !1;
|
|
3528
3643
|
}
|
|
3529
3644
|
}
|
|
3530
|
-
function
|
|
3645
|
+
function fa(e, t) {
|
|
3531
3646
|
if (e.persistSharePromptsDisabled) {
|
|
3532
3647
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3533
3648
|
});
|
|
3534
3649
|
return;
|
|
3535
3650
|
}
|
|
3536
3651
|
try {
|
|
3537
|
-
t && window.localStorage.setItem(
|
|
3652
|
+
t && window.localStorage.setItem(Rt, "true");
|
|
3538
3653
|
} catch {
|
|
3539
3654
|
return;
|
|
3540
3655
|
}
|
|
3541
3656
|
}
|
|
3542
|
-
function
|
|
3657
|
+
function Pt() {
|
|
3543
3658
|
return {
|
|
3544
3659
|
isOpen: !1,
|
|
3545
3660
|
composerValue: "",
|
|
@@ -3549,41 +3664,41 @@ function Et() {
|
|
|
3549
3664
|
sharePromptsDisabled: !1
|
|
3550
3665
|
};
|
|
3551
3666
|
}
|
|
3552
|
-
function
|
|
3667
|
+
function ba(e, t) {
|
|
3553
3668
|
try {
|
|
3554
|
-
window.localStorage.setItem(
|
|
3669
|
+
window.localStorage.setItem(Qt(e), JSON.stringify(t));
|
|
3555
3670
|
} catch {
|
|
3556
3671
|
return;
|
|
3557
3672
|
}
|
|
3558
3673
|
}
|
|
3559
|
-
function
|
|
3674
|
+
function wa(e) {
|
|
3560
3675
|
if (!e || typeof e != "object")
|
|
3561
3676
|
return !1;
|
|
3562
3677
|
const t = e;
|
|
3563
3678
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3564
3679
|
}
|
|
3565
|
-
const
|
|
3566
|
-
function
|
|
3680
|
+
const At = /* @__PURE__ */ new WeakSet();
|
|
3681
|
+
function _a(e) {
|
|
3567
3682
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3568
3683
|
}
|
|
3569
|
-
function
|
|
3684
|
+
function Tt(e) {
|
|
3570
3685
|
const t = e.pathname.split("/");
|
|
3571
3686
|
return t[t.length - 1] ?? "";
|
|
3572
3687
|
}
|
|
3573
|
-
function
|
|
3688
|
+
function xa(e, t) {
|
|
3574
3689
|
const n = new URL(e.src, document.baseURI);
|
|
3575
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3690
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Tt(n) === Tt(t);
|
|
3576
3691
|
}
|
|
3577
3692
|
class V extends EventTarget {
|
|
3578
3693
|
constructor(t, n) {
|
|
3579
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3694
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
|
|
3580
3695
|
this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
|
|
3581
|
-
}), this.addPreviewListener(
|
|
3696
|
+
}), this.addPreviewListener(Un, (o) => {
|
|
3582
3697
|
const a = o;
|
|
3583
3698
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3584
|
-
}), this.addPreviewListener(
|
|
3699
|
+
}), this.addPreviewListener(zn, () => {
|
|
3585
3700
|
this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3586
|
-
}), this.addPreviewListener(
|
|
3701
|
+
}), this.addPreviewListener($n, (o) => {
|
|
3587
3702
|
const a = o;
|
|
3588
3703
|
this.readyState = V.CLOSED, this.dispatchEvent(
|
|
3589
3704
|
new CloseEvent("close", {
|
|
@@ -3593,7 +3708,7 @@ class V extends EventTarget {
|
|
|
3593
3708
|
})
|
|
3594
3709
|
), this.cleanup();
|
|
3595
3710
|
}), window.dispatchEvent(
|
|
3596
|
-
new CustomEvent(
|
|
3711
|
+
new CustomEvent(ye(Rn, this.channelId), {
|
|
3597
3712
|
detail: { socketId: this.socketId, url: t }
|
|
3598
3713
|
})
|
|
3599
3714
|
);
|
|
@@ -3609,26 +3724,26 @@ class V extends EventTarget {
|
|
|
3609
3724
|
binaryType = "blob";
|
|
3610
3725
|
bufferedAmount = 0;
|
|
3611
3726
|
readyState = V.CONNECTING;
|
|
3612
|
-
socketId =
|
|
3727
|
+
socketId = va();
|
|
3613
3728
|
listeners = /* @__PURE__ */ new Map();
|
|
3614
3729
|
send(t) {
|
|
3615
3730
|
if (this.readyState !== V.OPEN)
|
|
3616
3731
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3617
3732
|
window.dispatchEvent(
|
|
3618
|
-
new CustomEvent(
|
|
3733
|
+
new CustomEvent(ye(On, this.channelId), {
|
|
3619
3734
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3620
3735
|
})
|
|
3621
3736
|
);
|
|
3622
3737
|
}
|
|
3623
3738
|
close(t, n) {
|
|
3624
3739
|
this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
|
|
3625
|
-
new CustomEvent(
|
|
3740
|
+
new CustomEvent(ye(Bn, this.channelId), {
|
|
3626
3741
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3627
3742
|
})
|
|
3628
3743
|
), this.cleanup());
|
|
3629
3744
|
}
|
|
3630
3745
|
addPreviewListener(t, n) {
|
|
3631
|
-
const o =
|
|
3746
|
+
const o = ye(t, this.channelId), a = (i) => {
|
|
3632
3747
|
i.detail?.socketId === this.socketId && n(i);
|
|
3633
3748
|
};
|
|
3634
3749
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -3639,36 +3754,36 @@ class V extends EventTarget {
|
|
|
3639
3754
|
this.listeners.clear();
|
|
3640
3755
|
}
|
|
3641
3756
|
}
|
|
3642
|
-
function
|
|
3643
|
-
const e = window.sessionStorage.getItem(
|
|
3757
|
+
function va() {
|
|
3758
|
+
const e = window.sessionStorage.getItem(ct);
|
|
3644
3759
|
if (e)
|
|
3645
3760
|
return e;
|
|
3646
3761
|
const t = crypto.randomUUID();
|
|
3647
|
-
return window.sessionStorage.setItem(
|
|
3762
|
+
return window.sessionStorage.setItem(ct, t), t;
|
|
3648
3763
|
}
|
|
3649
|
-
function
|
|
3764
|
+
function ye(e, t) {
|
|
3650
3765
|
return `${e}:${t}`;
|
|
3651
3766
|
}
|
|
3652
|
-
function
|
|
3767
|
+
function ya(e) {
|
|
3653
3768
|
const t = document.currentScript;
|
|
3654
3769
|
if (t instanceof HTMLScriptElement)
|
|
3655
3770
|
return [t];
|
|
3656
3771
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3657
3772
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3658
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3773
|
+
(a) => a instanceof HTMLScriptElement && _a(a) && xa(a, o)
|
|
3659
3774
|
);
|
|
3660
3775
|
}
|
|
3661
|
-
function
|
|
3662
|
-
for (const t of
|
|
3663
|
-
if (
|
|
3776
|
+
function Ca(e) {
|
|
3777
|
+
for (const t of ya(e)) {
|
|
3778
|
+
if (At.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3664
3779
|
continue;
|
|
3665
|
-
|
|
3780
|
+
At.add(t);
|
|
3666
3781
|
const n = t.dataset.plunoPreviewChannel;
|
|
3667
|
-
|
|
3782
|
+
lo({
|
|
3668
3783
|
token: t.dataset.plunoToken,
|
|
3669
3784
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3670
3785
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3671
|
-
webSocketFactory: n ?
|
|
3786
|
+
webSocketFactory: n ? ro(n) : void 0,
|
|
3672
3787
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3673
3788
|
accentColor: t.dataset.plunoAccentColor,
|
|
3674
3789
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3680,8 +3795,8 @@ function ha(e) {
|
|
|
3680
3795
|
});
|
|
3681
3796
|
}
|
|
3682
3797
|
}
|
|
3683
|
-
|
|
3798
|
+
Ca(import.meta.url);
|
|
3684
3799
|
export {
|
|
3685
|
-
|
|
3686
|
-
|
|
3800
|
+
ro as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3801
|
+
lo as mountPlunoProductAgentWidget
|
|
3687
3802
|
};
|