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