@pluno/product-agent-web 0.1.31 → 0.1.34
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-sdk.js +238 -171
- package/dist/product-agent-widget.js +781 -680
- 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", kn = 1800, Sn = 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 S = Math.min(1, (performance.now() -
|
|
289
|
-
o = Math.round(
|
|
290
|
-
},
|
|
288
|
+
const S = Math.min(1, (performance.now() - C) / kn);
|
|
289
|
+
o = Math.round(f + (s - f) * Mn(S)), e(o), S >= 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(Sn);
|
|
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", Bn = "product-agent:sdk-preview-socket-send", On = "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", Gn = "product-agent:sdk-preview-socket-closed", ct = "product-agent:sdk-preview-socket-id", $n = "product-agent:preview-diagnostic", Rt = "pluno.productAgent.sharePromptsDisabled", Ce = 10, Hn = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Bt).join(","), 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>', jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ot = 190, Ft = 41, Vn = 48, qn = 420, Kn = 520, Yn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, R = 8, Ge = 50, Qn = "http://www.w3.org/2000/svg", eo = 11, to = 13, ht = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", Ut = "pluno-pa-widget-styles", zt = "data-pluno-pa-widget-styles";
|
|
340
|
+
function io(e) {
|
|
341
341
|
return (t) => new V(t, e);
|
|
342
342
|
}
|
|
343
|
-
async function
|
|
343
|
+
async function ro(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
|
+
wo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
390
|
+
const l = await sa(), 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"), S = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"), D = 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"), T = 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 || !S || !x || !D || !v || !y || !h || !g || !_ || !T || !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 = [], k = null;
|
|
409
|
+
const P = () => {
|
|
410
|
+
Io(v, m, (r) => {
|
|
411
|
+
m = m.filter((u, A) => A !== r), P(), M(w.getState()), U();
|
|
412
412
|
});
|
|
413
|
-
},
|
|
413
|
+
}, B = 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
|
+
}), F = window.fetch.bind(window);
|
|
429
|
+
let w;
|
|
430
|
+
w = await sn.init({
|
|
431
431
|
token: t.token,
|
|
432
|
-
tokenProvider:
|
|
432
|
+
tokenProvider: B,
|
|
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,42 +442,42 @@ 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 = da(t), Ee = new Set(J.openToolGroupKeys), ae = new Set(J.seenShareCandidateIds), fe = new Set(ae);
|
|
446
|
+
let ke = J.sharePromptsDisabled || await ca(t), $ = t.movableLauncher ? J.launcherPosition : null, qe = $ !== null, q = null, Se = !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
|
+
Se || 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 = $e(a, r);
|
|
463
|
+
return bt(
|
|
464
464
|
a,
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
$ ?? so(a, t.position, u),
|
|
466
|
+
u
|
|
467
467
|
);
|
|
468
|
-
},
|
|
469
|
-
|
|
468
|
+
}, O = () => {
|
|
469
|
+
ga(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 ? $ : null,
|
|
474
|
+
seenShareCandidateIds: [...ae].slice(-Mt),
|
|
475
|
+
sharePromptsDisabled: ke
|
|
476
476
|
});
|
|
477
|
-
},
|
|
478
|
-
|
|
479
|
-
debugVersion:
|
|
480
|
-
launcherPosition:
|
|
477
|
+
}, ne = (r, u = {}) => {
|
|
478
|
+
mo(r, {
|
|
479
|
+
debugVersion: ao,
|
|
480
|
+
launcherPosition: $,
|
|
481
481
|
rootClasses: a.className,
|
|
482
482
|
rootStyle: {
|
|
483
483
|
left: a.style.left,
|
|
@@ -485,76 +485,76 @@ 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
|
-
},
|
|
497
|
-
if (
|
|
498
|
-
return
|
|
499
|
-
const
|
|
500
|
-
return
|
|
501
|
-
},
|
|
502
|
-
if (!r || !
|
|
503
|
-
|
|
496
|
+
}, be = (r = !0) => {
|
|
497
|
+
if (!$)
|
|
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
|
+
ho(a);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
|
|
507
|
-
x: r.x -
|
|
508
|
-
y: r.y -
|
|
506
|
+
go(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
|
|
513
|
+
const u = wt(a, r, t.position);
|
|
514
|
+
Xe(u, r), ne("Applied open panel position after viewport resize", { openPanelPosition: u });
|
|
515
|
+
} else $ && 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 = po({
|
|
520
520
|
root: a,
|
|
521
521
|
launcher: c,
|
|
522
522
|
launcherDragHandle: d,
|
|
523
|
-
getPosition: () =>
|
|
523
|
+
getPosition: () => Le(),
|
|
524
524
|
setPosition: (r) => {
|
|
525
|
-
const
|
|
526
|
-
|
|
525
|
+
const u = r;
|
|
526
|
+
$ = bt(a, r, $e(a)), _e(a, $), ne("Dragging closed launcher", { requestedPosition: u });
|
|
527
527
|
},
|
|
528
528
|
persist: () => {
|
|
529
|
-
|
|
529
|
+
qe = !0, O(), 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, Oe(D, t.billingStatus, w.getState().lastErrorCode), U());
|
|
539
539
|
} finally {
|
|
540
|
-
|
|
540
|
+
Pe = !1;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
}, oe = (r = "",
|
|
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 A = be(), K = wt(a, A, t.position);
|
|
546
|
+
if (Xe(K, A), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: A }), 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), O();
|
|
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), O(), 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, $ && (be(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), O(), 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) => {
|
|
@@ -570,218 +570,227 @@ async function oo(e = {}) {
|
|
|
570
570
|
return;
|
|
571
571
|
const r = s.value;
|
|
572
572
|
oe(r), s.value = "";
|
|
573
|
-
}),
|
|
574
|
-
|
|
575
|
-
}),
|
|
576
|
-
|
|
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 = G(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || G(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, S.hidden = !0), S.addEventListener("submit", (r) => {
|
|
589
589
|
if (r.preventDefault(), t.loginRequired) {
|
|
590
590
|
t.onLoginClick?.();
|
|
591
591
|
return;
|
|
592
592
|
}
|
|
593
|
-
|
|
593
|
+
G(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
|
+
k !== null && window.clearTimeout(k), x.textContent = r, x.hidden = !1, k = window.setTimeout(() => {
|
|
600
|
+
x.textContent = "", x.hidden = !0, k = null;
|
|
601
601
|
}, 3e3);
|
|
602
|
-
},
|
|
603
|
-
|
|
604
|
-
},
|
|
602
|
+
}, rn = () => {
|
|
603
|
+
k !== null && (window.clearTimeout(k), k = 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 Bo(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(), M(w.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
|
|
611
611
|
};
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
h.addEventListener("click", () => {
|
|
613
|
+
t.loginRequired || G(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((A) => {
|
|
631
|
+
tt(A instanceof Error ? A.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
632
|
+
message: A instanceof Error ? A.message : String(A)
|
|
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(), M(w.getState());
|
|
645
|
+
}), T.addEventListener("click", () => {
|
|
646
|
+
Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g), O(), U(), g.focus(), M(w.getState());
|
|
647
|
+
}), g.addEventListener("input", () => {
|
|
648
|
+
ge(g), O(), U(), M(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(), M(w.getState());
|
|
647
656
|
}
|
|
648
657
|
}), a.addEventListener("click", (r) => {
|
|
649
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
650
|
-
}),
|
|
651
|
-
const
|
|
652
|
-
let
|
|
658
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && O();
|
|
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, M = (r) => {
|
|
664
|
+
if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (re = null), Oe(D, t.billingStatus, re), t.loginRequired) {
|
|
665
|
+
Yo(E, _, T, ot, t.loginButtonLabel, t.onLoginClick);
|
|
657
666
|
return;
|
|
658
667
|
}
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
+
const u = fo(r), A = u !== Ke;
|
|
669
|
+
Ke = u;
|
|
670
|
+
const K = Q || ee.enabled;
|
|
671
|
+
Q = !1, Ko(
|
|
672
|
+
E,
|
|
673
|
+
b,
|
|
674
|
+
_,
|
|
675
|
+
T,
|
|
676
|
+
de,
|
|
668
677
|
r,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
() =>
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
(
|
|
677
|
-
|
|
678
|
+
Te,
|
|
679
|
+
Te !== null && Ct(r, g.value.trim().length > 0 || m.length > 0),
|
|
680
|
+
K,
|
|
681
|
+
() => ee.enabled,
|
|
682
|
+
Ee,
|
|
683
|
+
O,
|
|
684
|
+
ot,
|
|
685
|
+
(I) => {
|
|
686
|
+
Q = !0, H(!0, "send"), W(), w.sendMessage(I);
|
|
678
687
|
},
|
|
679
|
-
|
|
680
|
-
dismissedCandidateIds:
|
|
681
|
-
draftingCandidateId:
|
|
682
|
-
error:
|
|
683
|
-
onSeen: (
|
|
684
|
-
|
|
688
|
+
ln && !ke ? {
|
|
689
|
+
dismissedCandidateIds: fe,
|
|
690
|
+
draftingCandidateId: we,
|
|
691
|
+
error: ue,
|
|
692
|
+
onSeen: (I) => {
|
|
693
|
+
ae.add(I.id), O();
|
|
685
694
|
},
|
|
686
|
-
onDraft: (
|
|
687
|
-
|
|
695
|
+
onDraft: (I) => {
|
|
696
|
+
pn(I);
|
|
688
697
|
},
|
|
689
|
-
onDismiss: (
|
|
690
|
-
|
|
698
|
+
onDismiss: (I) => {
|
|
699
|
+
ae.add(I.id), fe.add(I.id), O(), ue = null, M(w.getState());
|
|
691
700
|
},
|
|
692
|
-
onDisable: (
|
|
693
|
-
|
|
701
|
+
onDisable: (I) => {
|
|
702
|
+
ke = !0, ae.add(I.id), fe.add(I.id), O(), ua(t, !0), ue = null, M(w.getState());
|
|
694
703
|
}
|
|
695
704
|
} : void 0
|
|
696
|
-
),
|
|
705
|
+
), K ? (te = E.scrollTop, W()) : A && bo(r) && en();
|
|
697
706
|
};
|
|
698
|
-
return
|
|
699
|
-
|
|
700
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
701
|
-
const
|
|
702
|
-
|
|
707
|
+
return it = Tn((r) => {
|
|
708
|
+
Te = r, !Se && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) && M(w.getState());
|
|
709
|
+
}, { backendUrl: t.backendUrl, fetcher: F, 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
|
-
}),
|
|
710
|
-
agent:
|
|
717
|
+
}), Ne({}, "agent.state.appearance-cleared")), M(r), U(), u && Qe();
|
|
718
|
+
}), M(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 && !G(t.billingStatus) && (re = null), Oe(
|
|
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
|
-
oe(
|
|
732
|
+
oe(g.value, !1);
|
|
724
733
|
},
|
|
725
734
|
destroy: () => {
|
|
726
|
-
|
|
735
|
+
Se = !0, Ye.disconnect(), et?.disconnect(), window.removeEventListener("resize", Ze), Je(), k !== null && window.clearTimeout(k), 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, M(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), O(), ie?.remove(), ie = Jo(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, M(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 A = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, I = r.fontFamily ?? t.fontFamily, Ie = r.scribbleStyle ?? t.scribbleStyle;
|
|
762
|
+
i = mt(A, Ie), ft(a, i, {
|
|
763
|
+
accentColor: A,
|
|
764
|
+
colorScheme: K,
|
|
765
|
+
fontFamily: I,
|
|
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: A,
|
|
771
|
+
appliedColorScheme: K,
|
|
772
|
+
appliedFontFamily: I,
|
|
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);
|
|
771
780
|
}
|
|
772
|
-
function
|
|
781
|
+
function ft(e, t, n) {
|
|
773
782
|
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 ?
|
|
783
|
+
const o = n.scribbleStyle ? Nt(n.accentColor) : n.accentColor;
|
|
784
|
+
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? jn : n.fontFamily, n.scribbleStyle && lo(e.ownerDocument);
|
|
776
785
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
777
786
|
for (const i of a)
|
|
778
787
|
i.src = t;
|
|
779
788
|
}
|
|
780
|
-
function
|
|
781
|
-
if (e.getElementById(
|
|
789
|
+
function lo(e) {
|
|
790
|
+
if (e.getElementById(gt))
|
|
782
791
|
return;
|
|
783
792
|
const t = e.createElement("style");
|
|
784
|
-
t.id =
|
|
793
|
+
t.id = gt, t.textContent = `@font-face {
|
|
785
794
|
font-family: "Architects Daughter";
|
|
786
795
|
font-style: normal;
|
|
787
796
|
font-weight: 400;
|
|
@@ -789,7 +798,7 @@ function ao(e) {
|
|
|
789
798
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
790
799
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
791
800
|
}
|
|
792
|
-
function
|
|
801
|
+
function po({
|
|
793
802
|
root: e,
|
|
794
803
|
launcher: t,
|
|
795
804
|
launcherDragHandle: n,
|
|
@@ -798,117 +807,117 @@ function io({
|
|
|
798
807
|
persist: i
|
|
799
808
|
}) {
|
|
800
809
|
let l = null, p = null, c = null, d = !1, s = null;
|
|
801
|
-
const
|
|
810
|
+
const f = () => {
|
|
802
811
|
l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
803
|
-
},
|
|
812
|
+
}, C = (h) => {
|
|
804
813
|
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
814
|
}, S = (h) => {
|
|
806
815
|
if (l !== h.pointerId || !p || !c)
|
|
807
816
|
return;
|
|
808
817
|
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(),
|
|
818
|
+
const g = h.clientX - p.x, _ = h.clientY - p.y;
|
|
819
|
+
!d && Math.hypot(g, _) < ht || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
|
|
820
|
+
}, x = (h) => {
|
|
821
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
|
|
822
|
+
}, D = (h) => {
|
|
823
|
+
l === h.pointerId && (h.preventDefault(), f());
|
|
815
824
|
}, v = (h) => {
|
|
816
825
|
if (!s)
|
|
817
826
|
return;
|
|
818
|
-
const
|
|
819
|
-
s = null,
|
|
820
|
-
},
|
|
827
|
+
const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= ht;
|
|
828
|
+
s = null, g && (h.preventDefault(), h.stopPropagation());
|
|
829
|
+
}, y = (h) => {
|
|
821
830
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
822
831
|
return;
|
|
823
|
-
const
|
|
824
|
-
let
|
|
825
|
-
h.key === "ArrowUp" ?
|
|
832
|
+
const g = h.shiftKey ? oo : no, _ = o();
|
|
833
|
+
let T = null;
|
|
834
|
+
h.key === "ArrowUp" ? T = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? T = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? T = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (T = { x: _.x + g, y: _.y }), T && (h.preventDefault(), h.stopPropagation(), a(T), i());
|
|
826
835
|
};
|
|
827
|
-
return t.addEventListener("pointerdown",
|
|
828
|
-
t.removeEventListener("pointerdown",
|
|
836
|
+
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", S), t.addEventListener("pointerup", x), t.addEventListener("pointercancel", D), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
|
|
837
|
+
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel", D), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
|
|
829
838
|
};
|
|
830
839
|
}
|
|
831
|
-
function
|
|
832
|
-
const n =
|
|
840
|
+
function $e(e, t = !0) {
|
|
841
|
+
const n = se(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
833
842
|
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") ?
|
|
843
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Ot, n.width - 36),
|
|
844
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vn : Ft
|
|
836
845
|
};
|
|
837
846
|
}
|
|
838
|
-
function
|
|
839
|
-
const e =
|
|
847
|
+
function Gt() {
|
|
848
|
+
const e = se();
|
|
840
849
|
return {
|
|
841
850
|
width: Math.min(
|
|
842
|
-
|
|
843
|
-
e.width -
|
|
851
|
+
pe(e.width * Yn, qn, Kn),
|
|
852
|
+
e.width - R * 2
|
|
844
853
|
),
|
|
845
854
|
height: Math.min(
|
|
846
|
-
|
|
847
|
-
e.height -
|
|
855
|
+
pe(e.height * Jn, Xn, Zn),
|
|
856
|
+
e.height - Ge - R
|
|
848
857
|
)
|
|
849
858
|
};
|
|
850
859
|
}
|
|
851
|
-
function
|
|
860
|
+
function so(e, t, n) {
|
|
852
861
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
853
862
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
854
863
|
return { x: o, y: a };
|
|
855
864
|
const i = e.getBoundingClientRect();
|
|
856
865
|
if (i.width > 0 || i.height > 0)
|
|
857
866
|
return { x: i.left, y: i.top };
|
|
858
|
-
const l =
|
|
867
|
+
const l = se();
|
|
859
868
|
return {
|
|
860
869
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
861
870
|
y: l.height - 24 - n.height
|
|
862
871
|
};
|
|
863
872
|
}
|
|
864
|
-
function
|
|
865
|
-
const o =
|
|
873
|
+
function bt(e, t, n) {
|
|
874
|
+
const o = se(), a = R + co(e);
|
|
866
875
|
return {
|
|
867
|
-
x:
|
|
868
|
-
y:
|
|
876
|
+
x: pe(t.x, R, Math.max(R, o.width - n.width - R)),
|
|
877
|
+
y: pe(t.y, a, Math.max(a, o.height - n.height - R))
|
|
869
878
|
};
|
|
870
879
|
}
|
|
871
|
-
function
|
|
872
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
880
|
+
function co(e) {
|
|
881
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
|
|
873
882
|
}
|
|
874
|
-
function
|
|
875
|
-
const o =
|
|
883
|
+
function wt(e, t, n) {
|
|
884
|
+
const o = $e(e), a = Gt(), i = {
|
|
876
885
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
877
886
|
y: t.y + o.height - a.height
|
|
878
887
|
};
|
|
879
|
-
return
|
|
888
|
+
return uo(i);
|
|
880
889
|
}
|
|
881
|
-
function
|
|
882
|
-
const t =
|
|
890
|
+
function uo(e) {
|
|
891
|
+
const t = se(), n = Gt();
|
|
883
892
|
return {
|
|
884
|
-
x:
|
|
885
|
-
y:
|
|
893
|
+
x: pe(e.x, R, Math.max(R, t.width - n.width - R)),
|
|
894
|
+
y: pe(
|
|
886
895
|
e.y,
|
|
887
|
-
|
|
888
|
-
Math.max(
|
|
896
|
+
Ge,
|
|
897
|
+
Math.max(Ge, t.height - n.height - R)
|
|
889
898
|
)
|
|
890
899
|
};
|
|
891
900
|
}
|
|
892
|
-
function
|
|
901
|
+
function _e(e, t) {
|
|
893
902
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
894
903
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
895
904
|
return;
|
|
896
905
|
}
|
|
897
906
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
898
907
|
}
|
|
899
|
-
function
|
|
908
|
+
function go(e, t) {
|
|
900
909
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
901
910
|
}
|
|
902
|
-
function
|
|
911
|
+
function ho(e) {
|
|
903
912
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
904
913
|
}
|
|
905
|
-
function
|
|
914
|
+
function se() {
|
|
906
915
|
return {
|
|
907
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
908
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
916
|
+
width: window.innerWidth || document.documentElement.clientWidth || Ot + R * 2,
|
|
917
|
+
height: window.innerHeight || document.documentElement.clientHeight || Ft + R * 2
|
|
909
918
|
};
|
|
910
919
|
}
|
|
911
|
-
function
|
|
920
|
+
function Me(e) {
|
|
912
921
|
const t = e.getBoundingClientRect();
|
|
913
922
|
return {
|
|
914
923
|
x: Math.round(t.x),
|
|
@@ -917,10 +926,10 @@ function De(e) {
|
|
|
917
926
|
height: Math.round(t.height)
|
|
918
927
|
};
|
|
919
928
|
}
|
|
920
|
-
function
|
|
929
|
+
function pe(e, t, n) {
|
|
921
930
|
return Math.min(Math.max(e, t), n);
|
|
922
931
|
}
|
|
923
|
-
function
|
|
932
|
+
function Y(e, t, n) {
|
|
924
933
|
if (typeof window > "u")
|
|
925
934
|
return;
|
|
926
935
|
const o = window, a = {
|
|
@@ -929,26 +938,26 @@ function Q(e, t, n) {
|
|
|
929
938
|
message: t,
|
|
930
939
|
details: n
|
|
931
940
|
}, 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(
|
|
941
|
+
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($n, { detail: a }));
|
|
933
942
|
}
|
|
934
|
-
function
|
|
935
|
-
|
|
943
|
+
function mo(e, t) {
|
|
944
|
+
Y("web-sdk.widget.position", e, t);
|
|
936
945
|
}
|
|
937
|
-
function
|
|
946
|
+
function Re(e, t, n) {
|
|
938
947
|
const o = t.value.trim();
|
|
939
948
|
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
949
|
}
|
|
941
|
-
function
|
|
950
|
+
function ge(e) {
|
|
942
951
|
e.style.height = "0px";
|
|
943
952
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
944
953
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
945
954
|
}
|
|
946
|
-
function
|
|
955
|
+
function he(e, t = () => !0) {
|
|
947
956
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
948
957
|
t() && (e.scrollTop = e.scrollHeight);
|
|
949
958
|
});
|
|
950
959
|
}
|
|
951
|
-
function
|
|
960
|
+
function fo(e) {
|
|
952
961
|
const t = e.messages[e.messages.length - 1];
|
|
953
962
|
return [
|
|
954
963
|
e.messages.length,
|
|
@@ -959,37 +968,37 @@ function go(e) {
|
|
|
959
968
|
e.lastError ?? ""
|
|
960
969
|
].join(":");
|
|
961
970
|
}
|
|
962
|
-
function
|
|
971
|
+
function bo(e) {
|
|
963
972
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
964
973
|
}
|
|
965
|
-
function
|
|
966
|
-
e.appendChild(
|
|
974
|
+
function wo(e, t, n, o) {
|
|
975
|
+
e.appendChild(Eo()), e.appendChild(_o(t, n, o)), e.appendChild(Wt("pluno-pa-widget__close", "Close", ko(16), !0)), e.appendChild(xo(n));
|
|
967
976
|
}
|
|
968
|
-
function
|
|
977
|
+
function _o(e, t, n) {
|
|
969
978
|
const o = document.createElement("form");
|
|
970
979
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
971
980
|
const i = document.createElement("button");
|
|
972
981
|
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
982
|
}
|
|
974
|
-
o.appendChild(
|
|
983
|
+
o.appendChild(Ht("pluno-pa-widget__character--launcher", t));
|
|
975
984
|
const a = document.createElement("input");
|
|
976
985
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
977
986
|
}
|
|
978
|
-
function
|
|
987
|
+
function xo(e) {
|
|
979
988
|
const t = document.createElement("section");
|
|
980
989
|
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
981
990
|
const n = document.createElement("div");
|
|
982
991
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
983
992
|
const o = document.createElement("main");
|
|
984
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
993
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(yo(e));
|
|
985
994
|
const a = document.createElement("div");
|
|
986
995
|
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
987
996
|
const i = document.createElement("div");
|
|
988
997
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
989
998
|
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(
|
|
999
|
+
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", So(), !0)), t.appendChild(n), t.appendChild(vo()), t;
|
|
991
1000
|
}
|
|
992
|
-
function
|
|
1001
|
+
function vo() {
|
|
993
1002
|
const e = document.createElement("form");
|
|
994
1003
|
e.className = "pluno-pa-widget__composer";
|
|
995
1004
|
const t = document.createElement("div");
|
|
@@ -1000,52 +1009,56 @@ function wo() {
|
|
|
1000
1009
|
o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
|
|
1001
1010
|
const a = document.createElement("div");
|
|
1002
1011
|
a.className = "pluno-pa-widget__composer-inner";
|
|
1003
|
-
const i = document.createElement("
|
|
1004
|
-
i.className = "pluno-pa-
|
|
1012
|
+
const i = document.createElement("input");
|
|
1013
|
+
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
1014
|
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
|
-
|
|
1015
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Lo()), l.appendChild(Po()), a.appendChild(l);
|
|
1016
|
+
const p = document.createElement("textarea");
|
|
1017
|
+
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
|
|
1018
|
+
const c = document.createElement("button");
|
|
1019
|
+
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(jt()), a.appendChild(c), e.appendChild(a);
|
|
1020
|
+
const d = document.createElement("div");
|
|
1021
|
+
d.className = "pluno-pa-widget__composer-meta";
|
|
1022
|
+
const s = document.createElement("a");
|
|
1023
|
+
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);
|
|
1024
|
+
const f = document.createElement("span");
|
|
1025
|
+
return f.className = "pluno-pa-widget__ai-disclaimer", f.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(f), e.appendChild(d), e;
|
|
1013
1026
|
}
|
|
1014
|
-
function
|
|
1027
|
+
function yo(e) {
|
|
1015
1028
|
const t = document.createElement("div");
|
|
1016
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1029
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild($t()), t;
|
|
1017
1030
|
}
|
|
1018
|
-
function
|
|
1031
|
+
function $t() {
|
|
1019
1032
|
const e = document.createElement("div");
|
|
1020
1033
|
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
1034
|
}
|
|
1022
|
-
function
|
|
1035
|
+
function Co(e, t) {
|
|
1023
1036
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1024
1037
|
const n = document.createElement("span");
|
|
1025
1038
|
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
1039
|
}
|
|
1027
|
-
function
|
|
1040
|
+
function Ht(e, t) {
|
|
1028
1041
|
const n = document.createElement("img");
|
|
1029
1042
|
return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1030
1043
|
}
|
|
1031
|
-
function
|
|
1044
|
+
function Wt(e, t, n, o) {
|
|
1032
1045
|
const a = document.createElement("button");
|
|
1033
1046
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1034
1047
|
}
|
|
1035
|
-
function
|
|
1036
|
-
const e =
|
|
1048
|
+
function Eo() {
|
|
1049
|
+
const e = L("svg", {
|
|
1037
1050
|
class: "pluno-pa-widget__scribble-defs",
|
|
1038
1051
|
"aria-hidden": "true",
|
|
1039
1052
|
focusable: "false",
|
|
1040
1053
|
width: "0",
|
|
1041
1054
|
height: "0"
|
|
1042
|
-
}), t =
|
|
1043
|
-
return t.appendChild(
|
|
1055
|
+
}), t = L("defs");
|
|
1056
|
+
return t.appendChild(Be("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Be("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Be("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1044
1057
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const o =
|
|
1058
|
+
function Be(e, t, n) {
|
|
1059
|
+
const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1047
1060
|
return o.appendChild(
|
|
1048
|
-
|
|
1061
|
+
L("feTurbulence", {
|
|
1049
1062
|
type: "fractalNoise",
|
|
1050
1063
|
baseFrequency: "0.012 0.028",
|
|
1051
1064
|
numOctaves: "3",
|
|
@@ -1053,7 +1066,7 @@ function Me(e, t, n) {
|
|
|
1053
1066
|
result: "stroke-noise"
|
|
1054
1067
|
})
|
|
1055
1068
|
), o.appendChild(
|
|
1056
|
-
|
|
1069
|
+
L("feDisplacementMap", {
|
|
1057
1070
|
in: "SourceGraphic",
|
|
1058
1071
|
in2: "stroke-noise",
|
|
1059
1072
|
scale: "3.5",
|
|
@@ -1062,7 +1075,7 @@ function Me(e, t, n) {
|
|
|
1062
1075
|
result: "warped"
|
|
1063
1076
|
})
|
|
1064
1077
|
), o.appendChild(
|
|
1065
|
-
|
|
1078
|
+
L("feTurbulence", {
|
|
1066
1079
|
type: "fractalNoise",
|
|
1067
1080
|
baseFrequency: "0.7",
|
|
1068
1081
|
numOctaves: "1",
|
|
@@ -1070,7 +1083,7 @@ function Me(e, t, n) {
|
|
|
1070
1083
|
result: "ink-noise"
|
|
1071
1084
|
})
|
|
1072
1085
|
), o.appendChild(
|
|
1073
|
-
|
|
1086
|
+
L("feDisplacementMap", {
|
|
1074
1087
|
in: "warped",
|
|
1075
1088
|
in2: "ink-noise",
|
|
1076
1089
|
scale: "0.9",
|
|
@@ -1079,31 +1092,51 @@ function Me(e, t, n) {
|
|
|
1079
1092
|
})
|
|
1080
1093
|
), o;
|
|
1081
1094
|
}
|
|
1082
|
-
function
|
|
1083
|
-
const t =
|
|
1084
|
-
return t.appendChild(
|
|
1085
|
-
}
|
|
1086
|
-
function Co() {
|
|
1087
|
-
const e = se("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1088
|
-
return e.appendChild(P("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(P("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1095
|
+
function ko(e) {
|
|
1096
|
+
const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1097
|
+
return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1089
1098
|
}
|
|
1090
|
-
function
|
|
1091
|
-
const e =
|
|
1092
|
-
return e.appendChild(
|
|
1099
|
+
function So() {
|
|
1100
|
+
const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1101
|
+
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;
|
|
1102
|
+
}
|
|
1103
|
+
function jt() {
|
|
1104
|
+
const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1105
|
+
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;
|
|
1106
|
+
}
|
|
1107
|
+
function Lo() {
|
|
1108
|
+
const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1109
|
+
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1110
|
+
L("path", {
|
|
1111
|
+
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"
|
|
1112
|
+
})
|
|
1113
|
+
), e;
|
|
1114
|
+
}
|
|
1115
|
+
function Po() {
|
|
1116
|
+
const e = X("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1117
|
+
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1118
|
+
L("path", {
|
|
1119
|
+
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",
|
|
1120
|
+
stroke: "currentColor",
|
|
1121
|
+
"stroke-width": "2",
|
|
1122
|
+
"stroke-linecap": "round",
|
|
1123
|
+
"stroke-linejoin": "round"
|
|
1124
|
+
})
|
|
1125
|
+
), e;
|
|
1093
1126
|
}
|
|
1094
|
-
function
|
|
1095
|
-
const e =
|
|
1096
|
-
return e.appendChild(
|
|
1127
|
+
function Ao() {
|
|
1128
|
+
const e = X("0 0 24 24", 18, 18, "currentColor");
|
|
1129
|
+
return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1097
1130
|
}
|
|
1098
|
-
function
|
|
1099
|
-
const e =
|
|
1100
|
-
return e.appendChild(
|
|
1131
|
+
function To() {
|
|
1132
|
+
const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1133
|
+
return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
|
|
1101
1134
|
}
|
|
1102
|
-
function
|
|
1103
|
-
const e =
|
|
1104
|
-
return e.appendChild(
|
|
1135
|
+
function No() {
|
|
1136
|
+
const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1137
|
+
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
1138
|
}
|
|
1106
|
-
function
|
|
1139
|
+
function X(e, t, n, o, a, i) {
|
|
1107
1140
|
const l = {
|
|
1108
1141
|
viewBox: e,
|
|
1109
1142
|
width: String(t),
|
|
@@ -1111,41 +1144,41 @@ function se(e, t, n, o, a, i) {
|
|
|
1111
1144
|
fill: o,
|
|
1112
1145
|
"aria-hidden": "true"
|
|
1113
1146
|
};
|
|
1114
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i),
|
|
1147
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
|
|
1115
1148
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const n = document.createElementNS(
|
|
1149
|
+
function L(e, t = {}) {
|
|
1150
|
+
const n = document.createElementNS(Qn, e);
|
|
1118
1151
|
for (const [o, a] of Object.entries(t))
|
|
1119
1152
|
n.setAttribute(o, a);
|
|
1120
1153
|
return n;
|
|
1121
1154
|
}
|
|
1122
|
-
function
|
|
1155
|
+
function _t(e) {
|
|
1123
1156
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1124
1157
|
e.addEventListener(t, (n) => {
|
|
1125
1158
|
n.stopPropagation();
|
|
1126
1159
|
});
|
|
1127
1160
|
}
|
|
1128
|
-
function
|
|
1161
|
+
function Io(e, t, n) {
|
|
1129
1162
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1130
1163
|
for (const [o, a] of t.entries()) {
|
|
1131
1164
|
const i = document.createElement("div");
|
|
1132
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1165
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Do(a));
|
|
1133
1166
|
const l = document.createElement("span");
|
|
1134
1167
|
l.textContent = a.name, i.appendChild(l);
|
|
1135
1168
|
const p = document.createElement("button");
|
|
1136
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1169
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(To()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1137
1170
|
}
|
|
1138
1171
|
}
|
|
1139
|
-
function
|
|
1140
|
-
if (
|
|
1172
|
+
function Do(e) {
|
|
1173
|
+
if (Vt(e)) {
|
|
1141
1174
|
const n = document.createElement("img");
|
|
1142
1175
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1143
1176
|
}
|
|
1144
1177
|
const t = document.createElement("span");
|
|
1145
1178
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1146
1179
|
}
|
|
1147
|
-
function
|
|
1148
|
-
if (
|
|
1180
|
+
function Mo(e) {
|
|
1181
|
+
if (Vt(e)) {
|
|
1149
1182
|
const a = document.createElement("img");
|
|
1150
1183
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1151
1184
|
}
|
|
@@ -1156,51 +1189,51 @@ function Ao(e) {
|
|
|
1156
1189
|
const o = document.createElement("strong");
|
|
1157
1190
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1158
1191
|
}
|
|
1159
|
-
function
|
|
1192
|
+
function Vt(e) {
|
|
1160
1193
|
return e.mimeType.startsWith("image/");
|
|
1161
1194
|
}
|
|
1162
|
-
function
|
|
1195
|
+
function Ro(e) {
|
|
1163
1196
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1164
1197
|
}
|
|
1165
|
-
async function
|
|
1198
|
+
async function Bo(e) {
|
|
1166
1199
|
if (!e)
|
|
1167
1200
|
return [];
|
|
1168
1201
|
const t = Array.from(e);
|
|
1169
|
-
if (t.length >
|
|
1170
|
-
throw new Error(`Attach up to ${
|
|
1202
|
+
if (t.length > Ce)
|
|
1203
|
+
throw new Error(`Attach up to ${Ce} files per message.`);
|
|
1171
1204
|
return Promise.all(
|
|
1172
1205
|
t.map(async (n) => {
|
|
1173
|
-
const o =
|
|
1206
|
+
const o = Oo(n);
|
|
1174
1207
|
if (!o)
|
|
1175
1208
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1176
|
-
if (n.size >
|
|
1209
|
+
if (n.size > Hn)
|
|
1177
1210
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1178
1211
|
if (o === "image/gif") {
|
|
1179
|
-
const a = new Uint8Array(await
|
|
1180
|
-
if (
|
|
1212
|
+
const a = new Uint8Array(await Vo(n));
|
|
1213
|
+
if (Uo(a))
|
|
1181
1214
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1182
1215
|
}
|
|
1183
1216
|
return {
|
|
1184
|
-
name: n.name ||
|
|
1217
|
+
name: n.name || Ro(o),
|
|
1185
1218
|
mimeType: o,
|
|
1186
1219
|
sizeBytes: n.size,
|
|
1187
|
-
dataUrl:
|
|
1220
|
+
dataUrl: Fo(await qo(n), o)
|
|
1188
1221
|
};
|
|
1189
1222
|
})
|
|
1190
1223
|
);
|
|
1191
1224
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (
|
|
1225
|
+
function Oo(e) {
|
|
1226
|
+
if (Bt.has(e.type))
|
|
1194
1227
|
return e.type;
|
|
1195
1228
|
const t = e.name.toLowerCase();
|
|
1196
1229
|
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
1230
|
}
|
|
1198
|
-
function
|
|
1231
|
+
function Fo(e, t) {
|
|
1199
1232
|
const n = `data:${t};base64,`;
|
|
1200
1233
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1201
1234
|
}
|
|
1202
|
-
function
|
|
1203
|
-
if (e.length < 14 || !
|
|
1235
|
+
function Uo(e) {
|
|
1236
|
+
if (e.length < 14 || !zo(e))
|
|
1204
1237
|
return !1;
|
|
1205
1238
|
const t = e[10];
|
|
1206
1239
|
let n = 13;
|
|
@@ -1211,7 +1244,7 @@ function Mo(e) {
|
|
|
1211
1244
|
if (n += 1, a === 59)
|
|
1212
1245
|
return !1;
|
|
1213
1246
|
if (a === 33) {
|
|
1214
|
-
n += 1, n =
|
|
1247
|
+
n += 1, n = xt(e, n);
|
|
1215
1248
|
continue;
|
|
1216
1249
|
}
|
|
1217
1250
|
if (a !== 44)
|
|
@@ -1223,14 +1256,14 @@ function Mo(e) {
|
|
|
1223
1256
|
const i = e[n + 8];
|
|
1224
1257
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1225
1258
|
return !1;
|
|
1226
|
-
n += 1, n =
|
|
1259
|
+
n += 1, n = xt(e, n);
|
|
1227
1260
|
}
|
|
1228
1261
|
return !1;
|
|
1229
1262
|
}
|
|
1230
|
-
function
|
|
1263
|
+
function zo(e) {
|
|
1231
1264
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1232
1265
|
}
|
|
1233
|
-
function
|
|
1266
|
+
function xt(e, t) {
|
|
1234
1267
|
for (; t < e.length; ) {
|
|
1235
1268
|
const n = e[t];
|
|
1236
1269
|
if (t += 1, n === 0)
|
|
@@ -1239,69 +1272,69 @@ function ft(e, t) {
|
|
|
1239
1272
|
}
|
|
1240
1273
|
return t;
|
|
1241
1274
|
}
|
|
1242
|
-
function
|
|
1275
|
+
function xe(e) {
|
|
1243
1276
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1244
1277
|
}
|
|
1245
|
-
function
|
|
1246
|
-
if (!e || !
|
|
1278
|
+
function Oe(e, t, n = null) {
|
|
1279
|
+
if (!e || !He(t, n)) {
|
|
1247
1280
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1248
1281
|
return;
|
|
1249
1282
|
}
|
|
1250
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1283
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", G(t) || Ve(n) ? e.appendChild(Go(t, n)) : qt(t) && e.appendChild($o(t));
|
|
1251
1284
|
}
|
|
1252
|
-
function
|
|
1285
|
+
function Go(e, t) {
|
|
1253
1286
|
const n = document.createElement("div");
|
|
1254
1287
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1255
1288
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1256
1289
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1257
1290
|
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(
|
|
1291
|
+
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
1292
|
}
|
|
1260
|
-
function
|
|
1293
|
+
function $o(e) {
|
|
1261
1294
|
const t = document.createElement("div");
|
|
1262
1295
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1263
1296
|
const n = document.createElement("strong");
|
|
1264
1297
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1265
1298
|
const o = document.createElement("span");
|
|
1266
|
-
return o.textContent =
|
|
1299
|
+
return o.textContent = Wo(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
1300
|
}
|
|
1268
|
-
function
|
|
1269
|
-
return e !== null && (
|
|
1301
|
+
function He(e, t) {
|
|
1302
|
+
return e !== null && (G(e) || qt(e) || Ve(t));
|
|
1270
1303
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return
|
|
1304
|
+
function vt(e, t, n) {
|
|
1305
|
+
return He(t, n) || Ho(t) ? !0 : !He(e, n);
|
|
1273
1306
|
}
|
|
1274
|
-
function
|
|
1275
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1307
|
+
function Ho(e) {
|
|
1308
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || G(e));
|
|
1276
1309
|
}
|
|
1277
|
-
function
|
|
1310
|
+
function G(e) {
|
|
1278
1311
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1279
1312
|
}
|
|
1280
|
-
function
|
|
1313
|
+
function Ve(e) {
|
|
1281
1314
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1282
1315
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return !
|
|
1316
|
+
function qt(e) {
|
|
1317
|
+
return !G(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1285
1318
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return e.creditsRemaining === null ? null : `${
|
|
1319
|
+
function Wo(e) {
|
|
1320
|
+
return e.creditsRemaining === null ? null : `${jo(e.creditsRemaining)} credits left`;
|
|
1288
1321
|
}
|
|
1289
|
-
function
|
|
1322
|
+
function jo(e) {
|
|
1290
1323
|
return new Intl.NumberFormat("en-US", {
|
|
1291
1324
|
maximumFractionDigits: 0
|
|
1292
1325
|
}).format(Math.ceil(e));
|
|
1293
1326
|
}
|
|
1294
|
-
function
|
|
1327
|
+
function Kt(e, t, n) {
|
|
1295
1328
|
const o = document.createElement("div");
|
|
1296
|
-
return o.className = n, o.appendChild(
|
|
1329
|
+
return o.className = n, o.appendChild(yt(t, e.pricingUrl)), o.appendChild(yt("Earn credits", e.earnCreditsUrl)), o;
|
|
1297
1330
|
}
|
|
1298
|
-
function
|
|
1331
|
+
function yt(e, t) {
|
|
1299
1332
|
const n = document.createElement("button");
|
|
1300
1333
|
return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
|
|
1301
1334
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1302
1335
|
}), n;
|
|
1303
1336
|
}
|
|
1304
|
-
function
|
|
1337
|
+
function Vo(e) {
|
|
1305
1338
|
return new Promise((t, n) => {
|
|
1306
1339
|
const o = new FileReader();
|
|
1307
1340
|
o.addEventListener("load", () => {
|
|
@@ -1315,7 +1348,7 @@ function Go(e) {
|
|
|
1315
1348
|
}), o.readAsArrayBuffer(e);
|
|
1316
1349
|
});
|
|
1317
1350
|
}
|
|
1318
|
-
function
|
|
1351
|
+
function qo(e) {
|
|
1319
1352
|
return new Promise((t, n) => {
|
|
1320
1353
|
const o = new FileReader();
|
|
1321
1354
|
o.addEventListener("load", () => {
|
|
@@ -1329,94 +1362,94 @@ function $o(e) {
|
|
|
1329
1362
|
}), o.readAsDataURL(e);
|
|
1330
1363
|
});
|
|
1331
1364
|
}
|
|
1332
|
-
function
|
|
1333
|
-
return e.messages.filter((o) => !
|
|
1365
|
+
function Ct(e, t) {
|
|
1366
|
+
return e.messages.filter((o) => !Yt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1334
1367
|
}
|
|
1335
|
-
function
|
|
1336
|
-
const
|
|
1337
|
-
e.replaceChildren(),
|
|
1368
|
+
function Ko(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
|
|
1369
|
+
const D = [...i.messages], v = D.filter((b) => !Yt(b)), y = e.scrollTop;
|
|
1370
|
+
e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null && Co(a, l);
|
|
1338
1371
|
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1339
1372
|
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1373
|
+
const b = document.createElement("div");
|
|
1374
|
+
b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1340
1375
|
const m = document.createElement("div");
|
|
1341
|
-
m.className = "pluno-pa-widget__empty-
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
}
|
|
1354
|
-
m.appendChild(R), e.appendChild(m), e.appendChild(t);
|
|
1376
|
+
m.className = "pluno-pa-widget__empty-hero";
|
|
1377
|
+
const k = document.createElement("img");
|
|
1378
|
+
k.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", k.src = C(), k.alt = "", k.setAttribute("aria-hidden", "true"), m.appendChild(k), b.appendChild(m), b.appendChild($t());
|
|
1379
|
+
const P = document.createElement("div");
|
|
1380
|
+
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");
|
|
1381
|
+
for (const B of i.starterPrompts) {
|
|
1382
|
+
const F = document.createElement("button");
|
|
1383
|
+
F.type = "button", F.className = "pluno-pa-widget__starter-prompt", F.textContent = `"${B}"`, F.addEventListener("click", () => {
|
|
1384
|
+
S(B);
|
|
1385
|
+
}), P.appendChild(F);
|
|
1386
|
+
}
|
|
1387
|
+
b.appendChild(P), e.appendChild(b), e.appendChild(t);
|
|
1355
1388
|
return;
|
|
1356
1389
|
}
|
|
1357
|
-
let
|
|
1358
|
-
const
|
|
1359
|
-
if (
|
|
1390
|
+
let g = null, _ = null, T = [];
|
|
1391
|
+
const Z = () => {
|
|
1392
|
+
if (T.length === 0)
|
|
1360
1393
|
return !1;
|
|
1361
|
-
const
|
|
1362
|
-
return e.appendChild(
|
|
1394
|
+
const b = oa(T, s, f, C());
|
|
1395
|
+
return e.appendChild(b), g = null, _ = b, T = [], !0;
|
|
1363
1396
|
};
|
|
1364
|
-
for (let
|
|
1365
|
-
const
|
|
1366
|
-
if (
|
|
1367
|
-
|
|
1397
|
+
for (let b = 0; b < v.length; b += 1) {
|
|
1398
|
+
const m = v[b];
|
|
1399
|
+
if (m.role === "tool") {
|
|
1400
|
+
T.push(m);
|
|
1368
1401
|
continue;
|
|
1369
1402
|
}
|
|
1370
|
-
if (
|
|
1403
|
+
if (m.role === "system")
|
|
1371
1404
|
continue;
|
|
1372
|
-
const
|
|
1373
|
-
if (
|
|
1374
|
-
const
|
|
1375
|
-
e.appendChild(
|
|
1376
|
-
}
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1405
|
+
const k = Z(), P = kt(m.content);
|
|
1406
|
+
if (m.role === "assistant" && !k) {
|
|
1407
|
+
const w = We(C());
|
|
1408
|
+
e.appendChild(w), g = null, _ = w;
|
|
1409
|
+
}
|
|
1410
|
+
const B = document.createElement("div");
|
|
1411
|
+
B.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? St(B, P) : B.textContent = P, m.role === "user" && m.attachments?.length && B.appendChild(Xo(m.attachments));
|
|
1412
|
+
const F = document.createElement("div");
|
|
1413
|
+
F.className = "pluno-pa-widget__message-actions", F.appendChild(Et(P)), B.appendChild(F), e.appendChild(B), g = B, _ = null;
|
|
1381
1414
|
}
|
|
1382
|
-
const
|
|
1415
|
+
const de = Z();
|
|
1383
1416
|
if (i.assistantDraft) {
|
|
1384
|
-
if (!
|
|
1385
|
-
const
|
|
1386
|
-
e.appendChild(
|
|
1387
|
-
}
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1417
|
+
if (!de) {
|
|
1418
|
+
const P = We(C());
|
|
1419
|
+
e.appendChild(P), g = null, _ = P;
|
|
1420
|
+
}
|
|
1421
|
+
const b = kt(i.assistantDraft), m = document.createElement("div");
|
|
1422
|
+
m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", St(m, b);
|
|
1423
|
+
const k = document.createElement("div");
|
|
1424
|
+
k.className = "pluno-pa-widget__message-actions", k.appendChild(Et(b)), m.appendChild(k), e.appendChild(m), g = m, _ = null;
|
|
1392
1425
|
}
|
|
1393
1426
|
if (i.isThinking && !i.assistantDraft)
|
|
1394
|
-
if (
|
|
1395
|
-
const
|
|
1396
|
-
e.appendChild(
|
|
1427
|
+
if (de) {
|
|
1428
|
+
const b = Xt();
|
|
1429
|
+
e.appendChild(b), g = null, _ = b;
|
|
1397
1430
|
} else {
|
|
1398
|
-
const
|
|
1399
|
-
e.appendChild(
|
|
1431
|
+
const b = aa(C());
|
|
1432
|
+
e.appendChild(b), g = null, _ = b;
|
|
1400
1433
|
}
|
|
1401
1434
|
if (i.lastError) {
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1435
|
+
const b = document.createElement("div");
|
|
1436
|
+
b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
|
|
1404
1437
|
}
|
|
1405
|
-
const E =
|
|
1406
|
-
if (
|
|
1407
|
-
const
|
|
1408
|
-
isDrafting:
|
|
1409
|
-
error:
|
|
1410
|
-
onDraft:
|
|
1411
|
-
onDismiss:
|
|
1412
|
-
onDisable:
|
|
1438
|
+
const E = x && !i.isThinking ? xn(D) : null;
|
|
1439
|
+
if (x && E && !x.dismissedCandidateIds.has(E.id)) {
|
|
1440
|
+
const b = Zo(E, {
|
|
1441
|
+
isDrafting: x.draftingCandidateId === E.id,
|
|
1442
|
+
error: x.error,
|
|
1443
|
+
onDraft: x.onDraft,
|
|
1444
|
+
onDismiss: x.onDismiss,
|
|
1445
|
+
onDisable: x.onDisable
|
|
1413
1446
|
});
|
|
1414
|
-
e.appendChild(
|
|
1447
|
+
e.appendChild(b), x.onSeen(E), g = null, _ = b;
|
|
1415
1448
|
}
|
|
1416
|
-
|
|
1449
|
+
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
1450
|
}
|
|
1418
|
-
function
|
|
1419
|
-
e.replaceChildren(),
|
|
1451
|
+
function Yo(e, t, n, o, a, i) {
|
|
1452
|
+
e.replaceChildren(), Zt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1420
1453
|
const l = document.createElement("div");
|
|
1421
1454
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1422
1455
|
const p = document.createElement("img");
|
|
@@ -1426,20 +1459,20 @@ function Wo(e, t, n, o, a, i) {
|
|
|
1426
1459
|
const d = document.createElement("button");
|
|
1427
1460
|
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1428
1461
|
}
|
|
1429
|
-
function
|
|
1462
|
+
function Xo(e) {
|
|
1430
1463
|
const t = document.createElement("div");
|
|
1431
1464
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1432
1465
|
for (const n of e)
|
|
1433
|
-
t.appendChild(
|
|
1466
|
+
t.appendChild(Mo(n));
|
|
1434
1467
|
return t;
|
|
1435
1468
|
}
|
|
1436
|
-
function
|
|
1469
|
+
function Et(e) {
|
|
1437
1470
|
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(
|
|
1471
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(No()), t.addEventListener("click", (n) => {
|
|
1439
1472
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1440
1473
|
}), t;
|
|
1441
1474
|
}
|
|
1442
|
-
function
|
|
1475
|
+
function Zo(e, t) {
|
|
1443
1476
|
const n = document.createElement("article");
|
|
1444
1477
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1445
1478
|
const o = document.createElement("div");
|
|
@@ -1461,21 +1494,21 @@ function jo(e, t) {
|
|
|
1461
1494
|
const d = document.createElement("button");
|
|
1462
1495
|
if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
|
|
1463
1496
|
t.onDraft(e);
|
|
1464
|
-
}), t.isDrafting ? (d.appendChild(
|
|
1497
|
+
}), t.isDrafting ? (d.appendChild(je()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
|
|
1465
1498
|
p.appendChild(c);
|
|
1466
1499
|
else {
|
|
1467
1500
|
const s = document.createElement("button");
|
|
1468
1501
|
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
1502
|
t.onDismiss(e);
|
|
1470
1503
|
}), c.appendChild(s), p.appendChild(c);
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1504
|
+
const f = document.createElement("button");
|
|
1505
|
+
f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
|
|
1473
1506
|
t.onDisable(e);
|
|
1474
|
-
}), p.appendChild(
|
|
1507
|
+
}), p.appendChild(f);
|
|
1475
1508
|
}
|
|
1476
1509
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1477
1510
|
}
|
|
1478
|
-
function
|
|
1511
|
+
function Jo(e, t) {
|
|
1479
1512
|
const n = document.createElement("div");
|
|
1480
1513
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1481
1514
|
v.target === n && t.onClose();
|
|
@@ -1494,49 +1527,49 @@ function qo(e, t) {
|
|
|
1494
1527
|
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1495
1528
|
const s = document.createElement("strong");
|
|
1496
1529
|
s.textContent = "1) Copy Screenshot", d.appendChild(s);
|
|
1497
|
-
const
|
|
1530
|
+
const f = Qo("Copy Screenshot", async () => {
|
|
1498
1531
|
try {
|
|
1499
|
-
return await
|
|
1532
|
+
return await vn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1500
1533
|
} catch {
|
|
1501
1534
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1502
1535
|
}
|
|
1503
1536
|
});
|
|
1504
|
-
if (d.appendChild(
|
|
1537
|
+
if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
|
|
1505
1538
|
const v = document.createElement("div");
|
|
1506
1539
|
v.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1540
|
+
const y = document.createElement("img");
|
|
1541
|
+
y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
|
|
1509
1542
|
}
|
|
1510
1543
|
o.appendChild(c), o.appendChild(p);
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1544
|
+
const C = document.createElement("div");
|
|
1545
|
+
C.className = "pluno-pa-widget__share-dialog-step";
|
|
1513
1546
|
const S = document.createElement("strong");
|
|
1514
|
-
S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on",
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
for (const v of
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1547
|
+
S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", C.appendChild(S);
|
|
1548
|
+
const x = document.createElement("p");
|
|
1549
|
+
x.className = "pluno-pa-widget__share-dialog-hint", x.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(x);
|
|
1550
|
+
const D = document.createElement("footer");
|
|
1551
|
+
D.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1552
|
+
for (const v of ea(e)) {
|
|
1553
|
+
const y = document.createElement("a");
|
|
1554
|
+
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ta(v.id)), D.appendChild(y);
|
|
1522
1555
|
}
|
|
1523
|
-
if (
|
|
1556
|
+
if (C.appendChild(D), o.appendChild(C), t.socialPostRewardsUrl) {
|
|
1524
1557
|
const v = document.createElement("div");
|
|
1525
1558
|
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1559
|
+
const y = document.createElement("strong");
|
|
1560
|
+
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
|
|
1528
1561
|
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(
|
|
1562
|
+
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(na()), v.appendChild(h), o.appendChild(v);
|
|
1530
1563
|
}
|
|
1531
1564
|
return n.appendChild(o), n;
|
|
1532
1565
|
}
|
|
1533
|
-
function
|
|
1566
|
+
function Qo(e, t) {
|
|
1534
1567
|
const n = document.createElement("button");
|
|
1535
1568
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1536
1569
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1537
1570
|
}), n;
|
|
1538
1571
|
}
|
|
1539
|
-
function
|
|
1572
|
+
function ea(e) {
|
|
1540
1573
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1541
1574
|
return [
|
|
1542
1575
|
{
|
|
@@ -1556,60 +1589,60 @@ function Yo(e) {
|
|
|
1556
1589
|
}
|
|
1557
1590
|
];
|
|
1558
1591
|
}
|
|
1559
|
-
function
|
|
1592
|
+
function ta(e) {
|
|
1560
1593
|
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" ? (
|
|
1594
|
+
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" ? (N(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), N(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"), N(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), N(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"), N(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (N(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), N(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), N(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (N(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"), N(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"), N(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"), N(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
1595
|
}
|
|
1563
|
-
function
|
|
1596
|
+
function N(e, t, n) {
|
|
1564
1597
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1565
1598
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1566
1599
|
}
|
|
1567
|
-
function
|
|
1600
|
+
function na() {
|
|
1568
1601
|
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"),
|
|
1602
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), N(e, "M14 5h5v5"), N(e, "M19 5l-8 8"), N(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1570
1603
|
}
|
|
1571
|
-
function
|
|
1572
|
-
return e.role === "tool" && e.toolName ===
|
|
1604
|
+
function Yt(e) {
|
|
1605
|
+
return e.role === "tool" && e.toolName === Dt;
|
|
1573
1606
|
}
|
|
1574
|
-
function
|
|
1607
|
+
function kt(e) {
|
|
1575
1608
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1576
1609
|
}
|
|
1577
|
-
function
|
|
1610
|
+
function oa(e, t, n, o) {
|
|
1578
1611
|
const a = document.createElement("article");
|
|
1579
1612
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1580
1613
|
const i = document.createElement("img");
|
|
1581
1614
|
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 =
|
|
1615
|
+
const l = document.createElement("details"), p = ia(e);
|
|
1583
1616
|
l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
|
|
1584
1617
|
a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
|
|
1585
1618
|
});
|
|
1586
1619
|
const c = document.createElement("summary");
|
|
1587
|
-
c.className = "pluno-pa-widget__tool-summary", e.some((
|
|
1620
|
+
c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(je());
|
|
1588
1621
|
const s = document.createElement("span");
|
|
1589
1622
|
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
|
|
1623
|
+
const f = document.createElement("div");
|
|
1624
|
+
f.className = "pluno-pa-widget__tool-lines";
|
|
1625
|
+
for (const C of e) {
|
|
1593
1626
|
const S = document.createElement("div");
|
|
1594
|
-
S.className = "pluno-pa-widget__tool-line",
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1627
|
+
S.className = "pluno-pa-widget__tool-line", C.loading && S.appendChild(je());
|
|
1628
|
+
const x = document.createElement("span");
|
|
1629
|
+
x.textContent = C.content || "Run tool", S.appendChild(x), f.appendChild(S);
|
|
1597
1630
|
}
|
|
1598
|
-
l.appendChild(
|
|
1631
|
+
l.appendChild(f);
|
|
1599
1632
|
}
|
|
1600
1633
|
return a.appendChild(l), a;
|
|
1601
1634
|
}
|
|
1602
|
-
function
|
|
1635
|
+
function We(e) {
|
|
1603
1636
|
const t = document.createElement("article");
|
|
1604
1637
|
t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1605
1638
|
const n = document.createElement("img");
|
|
1606
1639
|
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
1640
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const t =
|
|
1610
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1641
|
+
function aa(e) {
|
|
1642
|
+
const t = We(e);
|
|
1643
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Xt()), t;
|
|
1611
1644
|
}
|
|
1612
|
-
function
|
|
1645
|
+
function Xt() {
|
|
1613
1646
|
const e = document.createElement("div");
|
|
1614
1647
|
e.className = "pluno-pa-widget__status";
|
|
1615
1648
|
const t = document.createElement("span");
|
|
@@ -1617,17 +1650,17 @@ function Vt() {
|
|
|
1617
1650
|
const n = document.createElement("span");
|
|
1618
1651
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1619
1652
|
}
|
|
1620
|
-
function
|
|
1653
|
+
function ia(e) {
|
|
1621
1654
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1622
1655
|
}
|
|
1623
|
-
function
|
|
1656
|
+
function je() {
|
|
1624
1657
|
const e = document.createElement("span");
|
|
1625
1658
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1626
1659
|
}
|
|
1627
|
-
function
|
|
1628
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1660
|
+
function Zt(e, t) {
|
|
1661
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ao() : jt());
|
|
1629
1662
|
}
|
|
1630
|
-
function
|
|
1663
|
+
function St(e, t) {
|
|
1631
1664
|
const n = t.replace(/\r\n/g, `
|
|
1632
1665
|
`).split(`
|
|
1633
1666
|
`);
|
|
@@ -1643,22 +1676,22 @@ function yt(e, t) {
|
|
|
1643
1676
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1644
1677
|
d.push(n[o]), o += 1;
|
|
1645
1678
|
o += o < n.length ? 1 : 0;
|
|
1646
|
-
const s = document.createElement("pre"),
|
|
1647
|
-
|
|
1648
|
-
`), s.appendChild(
|
|
1679
|
+
const s = document.createElement("pre"), f = document.createElement("code");
|
|
1680
|
+
f.textContent = d.join(`
|
|
1681
|
+
`), s.appendChild(f), e.appendChild(s);
|
|
1649
1682
|
continue;
|
|
1650
1683
|
}
|
|
1651
1684
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1652
1685
|
if (l) {
|
|
1653
1686
|
const d = document.createElement(`h${l[1].length + 2}`);
|
|
1654
|
-
|
|
1687
|
+
ve(d, l[2]), e.appendChild(d), o += 1;
|
|
1655
1688
|
continue;
|
|
1656
1689
|
}
|
|
1657
1690
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1658
1691
|
const d = document.createElement("ul");
|
|
1659
1692
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1660
1693
|
const s = document.createElement("li");
|
|
1661
|
-
|
|
1694
|
+
ve(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
|
|
1662
1695
|
}
|
|
1663
1696
|
e.appendChild(d);
|
|
1664
1697
|
continue;
|
|
@@ -1667,7 +1700,7 @@ function yt(e, t) {
|
|
|
1667
1700
|
const d = document.createElement("ol");
|
|
1668
1701
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1669
1702
|
const s = document.createElement("li");
|
|
1670
|
-
|
|
1703
|
+
ve(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
|
|
1671
1704
|
}
|
|
1672
1705
|
e.appendChild(d);
|
|
1673
1706
|
continue;
|
|
@@ -1677,11 +1710,11 @@ function yt(e, t) {
|
|
|
1677
1710
|
p.push(n[o]), o += 1;
|
|
1678
1711
|
const c = document.createElement("p");
|
|
1679
1712
|
p.forEach((d, s) => {
|
|
1680
|
-
s > 0 && c.appendChild(document.createElement("br")),
|
|
1713
|
+
s > 0 && c.appendChild(document.createElement("br")), ve(c, d);
|
|
1681
1714
|
}), e.appendChild(c);
|
|
1682
1715
|
}
|
|
1683
1716
|
}
|
|
1684
|
-
function
|
|
1717
|
+
function ve(e, t) {
|
|
1685
1718
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1686
1719
|
let o = 0;
|
|
1687
1720
|
for (const a of t.matchAll(n)) {
|
|
@@ -1699,7 +1732,7 @@ function xe(e, t) {
|
|
|
1699
1732
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
1700
1733
|
} else {
|
|
1701
1734
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1702
|
-
if (p &&
|
|
1735
|
+
if (p && ra(p[2])) {
|
|
1703
1736
|
const c = document.createElement("a");
|
|
1704
1737
|
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
1705
1738
|
} else
|
|
@@ -1709,7 +1742,7 @@ function xe(e, t) {
|
|
|
1709
1742
|
}
|
|
1710
1743
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1711
1744
|
}
|
|
1712
|
-
function
|
|
1745
|
+
function ra(e) {
|
|
1713
1746
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1714
1747
|
return !0;
|
|
1715
1748
|
try {
|
|
@@ -1719,8 +1752,8 @@ function ta(e) {
|
|
|
1719
1752
|
return !1;
|
|
1720
1753
|
}
|
|
1721
1754
|
}
|
|
1722
|
-
function
|
|
1723
|
-
if (
|
|
1755
|
+
function Lt(e, t) {
|
|
1756
|
+
if (la(e))
|
|
1724
1757
|
return;
|
|
1725
1758
|
const n = `
|
|
1726
1759
|
:host {
|
|
@@ -1773,7 +1806,7 @@ function Ct(e, t) {
|
|
|
1773
1806
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1774
1807
|
position: fixed;
|
|
1775
1808
|
z-index: 2147483645;
|
|
1776
|
-
font-family: ${
|
|
1809
|
+
font-family: ${j.fontFamily};
|
|
1777
1810
|
font-size: 14px;
|
|
1778
1811
|
color: var(--pluno-pa-text);
|
|
1779
1812
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -2514,7 +2547,7 @@ function Ct(e, t) {
|
|
|
2514
2547
|
place-items: center;
|
|
2515
2548
|
padding: 18px;
|
|
2516
2549
|
background: rgba(24, 24, 27, 0.28);
|
|
2517
|
-
font-family: var(--pluno-pa-font, ${
|
|
2550
|
+
font-family: var(--pluno-pa-font, ${j.fontFamily});
|
|
2518
2551
|
color: var(--pluno-pa-text);
|
|
2519
2552
|
}
|
|
2520
2553
|
.pluno-pa-widget__share-dialog {
|
|
@@ -2878,12 +2911,48 @@ function Ct(e, t) {
|
|
|
2878
2911
|
background: var(--pluno-pa-surface);
|
|
2879
2912
|
border: 1px solid var(--pluno-pa-divider);
|
|
2880
2913
|
border-radius: 14px;
|
|
2881
|
-
padding: 8px 44px 8px
|
|
2914
|
+
padding: 8px 44px 8px 38px;
|
|
2882
2915
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
|
|
2883
2916
|
}
|
|
2884
2917
|
.pluno-pa-widget__composer-inner:focus-within {
|
|
2885
2918
|
border-color: var(--pluno-pa-accent);
|
|
2886
2919
|
}
|
|
2920
|
+
.pluno-pa-widget__attachment-input {
|
|
2921
|
+
position: absolute;
|
|
2922
|
+
width: 1px;
|
|
2923
|
+
height: 1px;
|
|
2924
|
+
opacity: 0;
|
|
2925
|
+
pointer-events: none;
|
|
2926
|
+
}
|
|
2927
|
+
.pluno-pa-widget__attach {
|
|
2928
|
+
position: absolute;
|
|
2929
|
+
left: 6px;
|
|
2930
|
+
top: 50%;
|
|
2931
|
+
margin-top: -14px;
|
|
2932
|
+
width: 28px;
|
|
2933
|
+
height: 28px;
|
|
2934
|
+
display: inline-flex;
|
|
2935
|
+
align-items: center;
|
|
2936
|
+
justify-content: center;
|
|
2937
|
+
border: 0;
|
|
2938
|
+
border-radius: 999px;
|
|
2939
|
+
background: transparent;
|
|
2940
|
+
color: var(--pluno-pa-muted);
|
|
2941
|
+
cursor: pointer;
|
|
2942
|
+
transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
|
|
2943
|
+
}
|
|
2944
|
+
.pluno-pa-widget__attach:hover:not(:disabled),
|
|
2945
|
+
.pluno-pa-widget__attach:focus-visible {
|
|
2946
|
+
background: var(--pluno-pa-bubble);
|
|
2947
|
+
color: var(--pluno-pa-accent);
|
|
2948
|
+
}
|
|
2949
|
+
.pluno-pa-widget__attach:disabled {
|
|
2950
|
+
cursor: not-allowed;
|
|
2951
|
+
opacity: 0.45;
|
|
2952
|
+
}
|
|
2953
|
+
.pluno-pa-widget__paperclip-icon--scribble {
|
|
2954
|
+
display: none;
|
|
2955
|
+
}
|
|
2887
2956
|
.pluno-pa-widget--drag-over .pluno-pa-widget__composer-inner {
|
|
2888
2957
|
border-color: var(--pluno-pa-accent);
|
|
2889
2958
|
background: var(--pluno-pa-accent-soft);
|
|
@@ -2948,12 +3017,12 @@ function Ct(e, t) {
|
|
|
2948
3017
|
display: flex;
|
|
2949
3018
|
align-items: center;
|
|
2950
3019
|
justify-content: center;
|
|
2951
|
-
column-gap: 0.
|
|
2952
|
-
margin-top:
|
|
3020
|
+
column-gap: 0.3em;
|
|
3021
|
+
margin-top: 5px;
|
|
2953
3022
|
color: var(--pluno-pa-faint);
|
|
2954
3023
|
font: inherit;
|
|
2955
|
-
font-size:
|
|
2956
|
-
line-height: 1.
|
|
3024
|
+
font-size: 10px;
|
|
3025
|
+
line-height: 1.1;
|
|
2957
3026
|
flex-wrap: wrap;
|
|
2958
3027
|
text-align: center;
|
|
2959
3028
|
}
|
|
@@ -3037,11 +3106,30 @@ function Ct(e, t) {
|
|
|
3037
3106
|
text-transform: lowercase;
|
|
3038
3107
|
}
|
|
3039
3108
|
.pluno-pa-widget__active-users-counter-dot {
|
|
3109
|
+
flex: 0 0 auto;
|
|
3040
3110
|
width: 7px;
|
|
3041
3111
|
height: 7px;
|
|
3042
3112
|
border-radius: 999px;
|
|
3043
3113
|
background: #22c55e;
|
|
3044
3114
|
box-shadow: 0 0 0 4px rgb(34 197 94 / 10%);
|
|
3115
|
+
animation: pluno-pa-active-users-live-pulse 1.7s ease-out infinite;
|
|
3116
|
+
}
|
|
3117
|
+
@keyframes pluno-pa-active-users-live-pulse {
|
|
3118
|
+
0% {
|
|
3119
|
+
box-shadow: 0 0 0 0 rgb(34 197 94 / 42%);
|
|
3120
|
+
}
|
|
3121
|
+
70% {
|
|
3122
|
+
box-shadow: 0 0 0 7px rgb(34 197 94 / 0%);
|
|
3123
|
+
}
|
|
3124
|
+
100% {
|
|
3125
|
+
box-shadow: 0 0 0 0 rgb(34 197 94 / 0%);
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3129
|
+
.pluno-pa-widget__active-users-counter-dot {
|
|
3130
|
+
animation: none;
|
|
3131
|
+
box-shadow: 0 0 0 4px rgb(34 197 94 / 10%);
|
|
3132
|
+
}
|
|
3045
3133
|
}
|
|
3046
3134
|
.pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
|
|
3047
3135
|
margin-bottom: -24px;
|
|
@@ -3183,7 +3271,7 @@ function Ct(e, t) {
|
|
|
3183
3271
|
right: 16px;
|
|
3184
3272
|
height: 36px;
|
|
3185
3273
|
z-index: 3;
|
|
3186
|
-
background-image: url('${
|
|
3274
|
+
background-image: url('${ut}');
|
|
3187
3275
|
background-repeat: repeat-x;
|
|
3188
3276
|
background-size: 104px 36px;
|
|
3189
3277
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3371,6 +3459,19 @@ function Ct(e, t) {
|
|
|
3371
3459
|
opacity: 0.6;
|
|
3372
3460
|
transform: rotate(5deg);
|
|
3373
3461
|
}
|
|
3462
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
|
|
3463
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
|
|
3464
|
+
background: transparent;
|
|
3465
|
+
color: var(--pluno-pa-accent);
|
|
3466
|
+
}
|
|
3467
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--standard {
|
|
3468
|
+
display: none;
|
|
3469
|
+
}
|
|
3470
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--scribble {
|
|
3471
|
+
display: block;
|
|
3472
|
+
transform: rotate(-8deg);
|
|
3473
|
+
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3474
|
+
}
|
|
3374
3475
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
|
|
3375
3476
|
transform: rotate(-10deg);
|
|
3376
3477
|
filter: url(#pluno-pa-scribble-wobble);
|
|
@@ -3436,7 +3537,7 @@ function Ct(e, t) {
|
|
|
3436
3537
|
right: 12px;
|
|
3437
3538
|
height: 22px;
|
|
3438
3539
|
z-index: 1;
|
|
3439
|
-
background-image: url('${
|
|
3540
|
+
background-image: url('${ut}');
|
|
3440
3541
|
background-repeat: repeat-x;
|
|
3441
3542
|
background-size: 62px 21.5px;
|
|
3442
3543
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3449,28 +3550,28 @@ function Ct(e, t) {
|
|
|
3449
3550
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3450
3551
|
}
|
|
3451
3552
|
`;
|
|
3452
|
-
if (
|
|
3553
|
+
if (pa(e, n))
|
|
3453
3554
|
return;
|
|
3454
3555
|
const o = e.ownerDocument.createElement("style");
|
|
3455
|
-
o.id =
|
|
3556
|
+
o.id = Ut, o.textContent = n, e.appendChild(o), Jt(e);
|
|
3456
3557
|
}
|
|
3457
|
-
function
|
|
3458
|
-
return e.getElementById(
|
|
3558
|
+
function la(e) {
|
|
3559
|
+
return e.getElementById(Ut) !== null || e.host instanceof HTMLElement && e.host.getAttribute(zt) === "true";
|
|
3459
3560
|
}
|
|
3460
|
-
function
|
|
3461
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3561
|
+
function Jt(e) {
|
|
3562
|
+
e.host instanceof HTMLElement && e.host.setAttribute(zt, "true");
|
|
3462
3563
|
}
|
|
3463
|
-
function
|
|
3564
|
+
function pa(e, t) {
|
|
3464
3565
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3465
3566
|
return !1;
|
|
3466
3567
|
try {
|
|
3467
3568
|
const n = new CSSStyleSheet();
|
|
3468
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3569
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Jt(e), !0;
|
|
3469
3570
|
} catch {
|
|
3470
3571
|
return !1;
|
|
3471
3572
|
}
|
|
3472
3573
|
}
|
|
3473
|
-
async function
|
|
3574
|
+
async function sa() {
|
|
3474
3575
|
return document.body ? document.body : await new Promise((e) => {
|
|
3475
3576
|
const t = new MutationObserver(() => {
|
|
3476
3577
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3478,49 +3579,49 @@ async function aa() {
|
|
|
3478
3579
|
t.observe(document.documentElement, { childList: !0 });
|
|
3479
3580
|
});
|
|
3480
3581
|
}
|
|
3481
|
-
function
|
|
3582
|
+
function Qt(e) {
|
|
3482
3583
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3483
3584
|
}
|
|
3484
|
-
function
|
|
3585
|
+
function da(e) {
|
|
3485
3586
|
try {
|
|
3486
|
-
const t = window.localStorage.getItem(
|
|
3587
|
+
const t = window.localStorage.getItem(Qt(e));
|
|
3487
3588
|
if (!t)
|
|
3488
|
-
return
|
|
3589
|
+
return Pt();
|
|
3489
3590
|
const n = JSON.parse(t);
|
|
3490
3591
|
return {
|
|
3491
3592
|
isOpen: n.isOpen === !0,
|
|
3492
3593
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3493
3594
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3494
|
-
launcherPosition:
|
|
3495
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3595
|
+
launcherPosition: ha(n.launcherPosition) ? n.launcherPosition : null,
|
|
3596
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
|
|
3496
3597
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3497
3598
|
};
|
|
3498
3599
|
} catch {
|
|
3499
|
-
return
|
|
3600
|
+
return Pt();
|
|
3500
3601
|
}
|
|
3501
3602
|
}
|
|
3502
|
-
async function
|
|
3603
|
+
async function ca(e) {
|
|
3503
3604
|
if (e.loadSharePromptsDisabled)
|
|
3504
3605
|
return e.loadSharePromptsDisabled();
|
|
3505
3606
|
try {
|
|
3506
|
-
return window.localStorage.getItem(
|
|
3607
|
+
return window.localStorage.getItem(Rt) === "true";
|
|
3507
3608
|
} catch {
|
|
3508
3609
|
return !1;
|
|
3509
3610
|
}
|
|
3510
3611
|
}
|
|
3511
|
-
function
|
|
3612
|
+
function ua(e, t) {
|
|
3512
3613
|
if (e.persistSharePromptsDisabled) {
|
|
3513
3614
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3514
3615
|
});
|
|
3515
3616
|
return;
|
|
3516
3617
|
}
|
|
3517
3618
|
try {
|
|
3518
|
-
t && window.localStorage.setItem(
|
|
3619
|
+
t && window.localStorage.setItem(Rt, "true");
|
|
3519
3620
|
} catch {
|
|
3520
3621
|
return;
|
|
3521
3622
|
}
|
|
3522
3623
|
}
|
|
3523
|
-
function
|
|
3624
|
+
function Pt() {
|
|
3524
3625
|
return {
|
|
3525
3626
|
isOpen: !1,
|
|
3526
3627
|
composerValue: "",
|
|
@@ -3530,41 +3631,41 @@ function Et() {
|
|
|
3530
3631
|
sharePromptsDisabled: !1
|
|
3531
3632
|
};
|
|
3532
3633
|
}
|
|
3533
|
-
function
|
|
3634
|
+
function ga(e, t) {
|
|
3534
3635
|
try {
|
|
3535
|
-
window.localStorage.setItem(
|
|
3636
|
+
window.localStorage.setItem(Qt(e), JSON.stringify(t));
|
|
3536
3637
|
} catch {
|
|
3537
3638
|
return;
|
|
3538
3639
|
}
|
|
3539
3640
|
}
|
|
3540
|
-
function
|
|
3641
|
+
function ha(e) {
|
|
3541
3642
|
if (!e || typeof e != "object")
|
|
3542
3643
|
return !1;
|
|
3543
3644
|
const t = e;
|
|
3544
3645
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3545
3646
|
}
|
|
3546
|
-
const
|
|
3547
|
-
function
|
|
3647
|
+
const At = /* @__PURE__ */ new WeakSet();
|
|
3648
|
+
function ma(e) {
|
|
3548
3649
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3549
3650
|
}
|
|
3550
|
-
function
|
|
3651
|
+
function Tt(e) {
|
|
3551
3652
|
const t = e.pathname.split("/");
|
|
3552
3653
|
return t[t.length - 1] ?? "";
|
|
3553
3654
|
}
|
|
3554
|
-
function
|
|
3655
|
+
function fa(e, t) {
|
|
3555
3656
|
const n = new URL(e.src, document.baseURI);
|
|
3556
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3657
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Tt(n) === Tt(t);
|
|
3557
3658
|
}
|
|
3558
3659
|
class V extends EventTarget {
|
|
3559
3660
|
constructor(t, n) {
|
|
3560
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3661
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
|
|
3561
3662
|
this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
|
|
3562
|
-
}), this.addPreviewListener(
|
|
3663
|
+
}), this.addPreviewListener(Un, (o) => {
|
|
3563
3664
|
const a = o;
|
|
3564
3665
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3565
|
-
}), this.addPreviewListener(
|
|
3666
|
+
}), this.addPreviewListener(zn, () => {
|
|
3566
3667
|
this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3567
|
-
}), this.addPreviewListener(
|
|
3668
|
+
}), this.addPreviewListener(Gn, (o) => {
|
|
3568
3669
|
const a = o;
|
|
3569
3670
|
this.readyState = V.CLOSED, this.dispatchEvent(
|
|
3570
3671
|
new CloseEvent("close", {
|
|
@@ -3574,7 +3675,7 @@ class V extends EventTarget {
|
|
|
3574
3675
|
})
|
|
3575
3676
|
), this.cleanup();
|
|
3576
3677
|
}), window.dispatchEvent(
|
|
3577
|
-
new CustomEvent(
|
|
3678
|
+
new CustomEvent(ye(Rn, this.channelId), {
|
|
3578
3679
|
detail: { socketId: this.socketId, url: t }
|
|
3579
3680
|
})
|
|
3580
3681
|
);
|
|
@@ -3590,26 +3691,26 @@ class V extends EventTarget {
|
|
|
3590
3691
|
binaryType = "blob";
|
|
3591
3692
|
bufferedAmount = 0;
|
|
3592
3693
|
readyState = V.CONNECTING;
|
|
3593
|
-
socketId =
|
|
3694
|
+
socketId = ba();
|
|
3594
3695
|
listeners = /* @__PURE__ */ new Map();
|
|
3595
3696
|
send(t) {
|
|
3596
3697
|
if (this.readyState !== V.OPEN)
|
|
3597
3698
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3598
3699
|
window.dispatchEvent(
|
|
3599
|
-
new CustomEvent(
|
|
3700
|
+
new CustomEvent(ye(Bn, this.channelId), {
|
|
3600
3701
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3601
3702
|
})
|
|
3602
3703
|
);
|
|
3603
3704
|
}
|
|
3604
3705
|
close(t, n) {
|
|
3605
3706
|
this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
|
|
3606
|
-
new CustomEvent(
|
|
3707
|
+
new CustomEvent(ye(On, this.channelId), {
|
|
3607
3708
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3608
3709
|
})
|
|
3609
3710
|
), this.cleanup());
|
|
3610
3711
|
}
|
|
3611
3712
|
addPreviewListener(t, n) {
|
|
3612
|
-
const o =
|
|
3713
|
+
const o = ye(t, this.channelId), a = (i) => {
|
|
3613
3714
|
i.detail?.socketId === this.socketId && n(i);
|
|
3614
3715
|
};
|
|
3615
3716
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -3620,36 +3721,36 @@ class V extends EventTarget {
|
|
|
3620
3721
|
this.listeners.clear();
|
|
3621
3722
|
}
|
|
3622
3723
|
}
|
|
3623
|
-
function
|
|
3624
|
-
const e = window.sessionStorage.getItem(
|
|
3724
|
+
function ba() {
|
|
3725
|
+
const e = window.sessionStorage.getItem(ct);
|
|
3625
3726
|
if (e)
|
|
3626
3727
|
return e;
|
|
3627
3728
|
const t = crypto.randomUUID();
|
|
3628
|
-
return window.sessionStorage.setItem(
|
|
3729
|
+
return window.sessionStorage.setItem(ct, t), t;
|
|
3629
3730
|
}
|
|
3630
|
-
function
|
|
3731
|
+
function ye(e, t) {
|
|
3631
3732
|
return `${e}:${t}`;
|
|
3632
3733
|
}
|
|
3633
|
-
function
|
|
3734
|
+
function wa(e) {
|
|
3634
3735
|
const t = document.currentScript;
|
|
3635
3736
|
if (t instanceof HTMLScriptElement)
|
|
3636
3737
|
return [t];
|
|
3637
3738
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3638
3739
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3639
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3740
|
+
(a) => a instanceof HTMLScriptElement && ma(a) && fa(a, o)
|
|
3640
3741
|
);
|
|
3641
3742
|
}
|
|
3642
|
-
function
|
|
3643
|
-
for (const t of
|
|
3644
|
-
if (
|
|
3743
|
+
function _a(e) {
|
|
3744
|
+
for (const t of wa(e)) {
|
|
3745
|
+
if (At.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3645
3746
|
continue;
|
|
3646
|
-
|
|
3747
|
+
At.add(t);
|
|
3647
3748
|
const n = t.dataset.plunoPreviewChannel;
|
|
3648
|
-
|
|
3749
|
+
ro({
|
|
3649
3750
|
token: t.dataset.plunoToken,
|
|
3650
3751
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3651
3752
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3652
|
-
webSocketFactory: n ?
|
|
3753
|
+
webSocketFactory: n ? io(n) : void 0,
|
|
3653
3754
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3654
3755
|
accentColor: t.dataset.plunoAccentColor,
|
|
3655
3756
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3661,8 +3762,8 @@ function ha(e) {
|
|
|
3661
3762
|
});
|
|
3662
3763
|
}
|
|
3663
3764
|
}
|
|
3664
|
-
|
|
3765
|
+
_a(import.meta.url);
|
|
3665
3766
|
export {
|
|
3666
|
-
|
|
3667
|
-
|
|
3767
|
+
io as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3768
|
+
ro as mountPlunoProductAgentWidget
|
|
3668
3769
|
};
|