@pluno/product-agent-web 0.1.25 → 0.1.27
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/activeUsersCounter.d.ts +11 -0
- package/dist/product-agent-widget.js +835 -709
- package/dist/widget.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { PlunoProductAgent as qt } from "./product-agent-sdk.js";
|
|
2
|
+
const Kt = "#7c3aed";
|
|
3
|
+
function Yt(e) {
|
|
4
|
+
const t = en(e);
|
|
5
5
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
6
6
|
<defs>
|
|
7
7
|
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
@@ -75,23 +75,23 @@ function Ut(e) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function Xt(e) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(Yt(e))}`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const t =
|
|
84
|
-
if (
|
|
81
|
+
const X = "#2c2a1e", je = [253, 250, 241], qe = 3.5;
|
|
82
|
+
function bt(e) {
|
|
83
|
+
const t = wt(e);
|
|
84
|
+
if (Ke(ae(t), je) >= qe)
|
|
85
85
|
return t;
|
|
86
|
-
let o =
|
|
87
|
-
const a =
|
|
86
|
+
let o = ae(t);
|
|
87
|
+
const a = ae(X);
|
|
88
88
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
89
|
+
if (o = tn(o, a, 0.22), Ke(o, je) >= qe)
|
|
90
|
+
return Le(o);
|
|
91
|
+
return Le(o);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const t =
|
|
93
|
+
function Zt(e) {
|
|
94
|
+
const t = bt(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
|
|
95
95
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
96
|
<defs>
|
|
97
97
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,26 +104,26 @@ function Wt(e) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${Qt()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
108
|
</g>
|
|
109
|
-
<path d="${n}" fill="none" stroke="${
|
|
109
|
+
<path d="${n}" fill="none" stroke="${X}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
110
|
<g transform="rotate(-2 528 463)">
|
|
111
|
-
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${
|
|
112
|
-
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${
|
|
111
|
+
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${X}" stroke-width="13"/>
|
|
112
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${X}"/>
|
|
113
113
|
<circle cx="557" cy="447" r="16" fill="#ffffff"/>
|
|
114
114
|
</g>
|
|
115
115
|
<g transform="rotate(2 717 462)">
|
|
116
|
-
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${
|
|
117
|
-
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${
|
|
116
|
+
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${X}" stroke-width="13"/>
|
|
117
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${X}"/>
|
|
118
118
|
<circle cx="728" cy="447" r="16" fill="#ffffff"/>
|
|
119
119
|
</g>
|
|
120
120
|
</g>
|
|
121
121
|
</svg>`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
123
|
+
function Jt(e) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(Zt(e))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Qt() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
128
|
for (let i = 150; i <= 1170; i += 62) {
|
|
129
129
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -131,8 +131,8 @@ function Vt() {
|
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
134
|
+
function en(e) {
|
|
135
|
+
const t = wt(e), n = Pe(ae(t));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -156,90 +156,90 @@ function qt(e) {
|
|
|
156
156
|
inner: "#4b4b4b",
|
|
157
157
|
shadow: "#000000"
|
|
158
158
|
} : {
|
|
159
|
-
top:
|
|
160
|
-
middle:
|
|
161
|
-
bottom:
|
|
162
|
-
edgeStart:
|
|
163
|
-
edgeMiddle:
|
|
164
|
-
edgeEnd:
|
|
165
|
-
glow:
|
|
166
|
-
highlight:
|
|
167
|
-
inner:
|
|
168
|
-
shadow:
|
|
159
|
+
top: B(t, 0.28, -0.03),
|
|
160
|
+
middle: B(t, 0.08, 0.04),
|
|
161
|
+
bottom: B(t, -0.1, 0.02),
|
|
162
|
+
edgeStart: B(t, 0.08, 0.08),
|
|
163
|
+
edgeMiddle: B(t, -0.08, 0.08),
|
|
164
|
+
edgeEnd: B(t, -0.18, 0.05),
|
|
165
|
+
glow: B(t, 0.32, -0.12),
|
|
166
|
+
highlight: B(t, 0.38, -0.18),
|
|
167
|
+
inner: B(t, 0.24, -0.1),
|
|
168
|
+
shadow: B(t, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function wt(e) {
|
|
172
172
|
const t = e.trim();
|
|
173
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
173
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Kt;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function ae(e) {
|
|
176
176
|
return [
|
|
177
177
|
Number.parseInt(e.slice(1, 3), 16),
|
|
178
178
|
Number.parseInt(e.slice(3, 5), 16),
|
|
179
179
|
Number.parseInt(e.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Le([e, t, n]) {
|
|
183
183
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
184
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Pe([e, t, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
188
|
const i = a / 255;
|
|
189
189
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
191
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
193
|
+
function Ke(e, t) {
|
|
194
|
+
const n = Pe(e), o = Pe(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
195
|
return (a + 0.05) / (i + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
197
|
+
function tn(e, t, n) {
|
|
198
|
+
const o = Ae(n);
|
|
199
199
|
return [
|
|
200
200
|
e[0] + (t[0] - e[0]) * o,
|
|
201
201
|
e[1] + (t[1] - e[1]) * o,
|
|
202
202
|
e[2] + (t[2] - e[2]) * o
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const [o, a, i] =
|
|
207
|
-
return
|
|
205
|
+
function B(e, t, n) {
|
|
206
|
+
const [o, a, i] = nn(ae(e));
|
|
207
|
+
return Le(on(o, Ae(a + n), Ae(i + t)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i),
|
|
209
|
+
function nn([e, t, n]) {
|
|
210
|
+
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
|
-
return [0, 0,
|
|
213
|
-
const
|
|
214
|
-
return [(l === o ? (a - i) /
|
|
212
|
+
return [0, 0, c];
|
|
213
|
+
const d = l - p, s = c > 0.5 ? d / (2 - l - p) : d / (l + p);
|
|
214
|
+
return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, s, c];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function on(e, t, n) {
|
|
217
217
|
if (t === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
219
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
ye(a, o, e + 1 / 3) * 255,
|
|
222
|
+
ye(a, o, e) * 255,
|
|
223
|
+
ye(a, o, e - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ye(e, t, n) {
|
|
227
227
|
let o = n;
|
|
228
228
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Ae(e) {
|
|
231
231
|
return Math.max(0, Math.min(1, e));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
233
|
+
const _t = "suggest_share_on_socials";
|
|
234
|
+
function an(e) {
|
|
235
235
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
236
236
|
const n = e[t];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== _t)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = Ye(e, t, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = Ye(e, o.index, "user");
|
|
243
243
|
return a ? {
|
|
244
244
|
id: `share:${n.callId ?? n.id}`,
|
|
245
245
|
userPrompt: a.content,
|
|
@@ -248,13 +248,13 @@ function Xt(e) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
252
|
-
const t = await
|
|
251
|
+
async function rn(e) {
|
|
252
|
+
const t = await ln(e);
|
|
253
253
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
254
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
255
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ye(e, t, n) {
|
|
258
258
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
259
259
|
const a = e[o];
|
|
260
260
|
if (a.role === n && a.content.trim())
|
|
@@ -262,10 +262,73 @@ function Ve(e, t, n) {
|
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function
|
|
265
|
+
async function ln(e) {
|
|
266
266
|
return await (await fetch(e)).blob();
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const pn = "https://app.pluno.ai", sn = "/api/product-agent/embed/active-users", dn = 1800, cn = 15e3, un = 250, gn = 1e3, hn = 3e4;
|
|
269
|
+
function mn(e, t = {}) {
|
|
270
|
+
let n = !1, o = null, a = null, i = null;
|
|
271
|
+
const l = () => {
|
|
272
|
+
i !== null && (window.clearInterval(i), i = null);
|
|
273
|
+
}, p = (s) => {
|
|
274
|
+
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
275
|
+
d();
|
|
276
|
+
}, wn(s)));
|
|
277
|
+
}, c = (s) => {
|
|
278
|
+
if (l(), o === null) {
|
|
279
|
+
o = s, e(s);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const f = o, v = performance.now();
|
|
283
|
+
i = window.setInterval(() => {
|
|
284
|
+
if (n) {
|
|
285
|
+
l();
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const x = Math.min(1, (performance.now() - v) / dn);
|
|
289
|
+
o = Math.round(f + (s - f) * _n(x)), e(o), x >= 1 && (o = s, e(s), l());
|
|
290
|
+
}, un);
|
|
291
|
+
}, d = async () => {
|
|
292
|
+
try {
|
|
293
|
+
const s = await fn(t);
|
|
294
|
+
if (n)
|
|
295
|
+
return;
|
|
296
|
+
c(s.count), p(s.refreshAfterMs);
|
|
297
|
+
} catch {
|
|
298
|
+
p(cn);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
return d(), () => {
|
|
302
|
+
n = !0, a !== null && window.clearTimeout(a), l();
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
async function fn(e) {
|
|
306
|
+
if (e.loader)
|
|
307
|
+
return e.loader();
|
|
308
|
+
const n = await (e.fetcher ?? fetch)(new URL(sn, bn(e.backendUrl ?? pn)).toString(), {
|
|
309
|
+
cache: "no-store",
|
|
310
|
+
credentials: "omit"
|
|
311
|
+
});
|
|
312
|
+
if (!n.ok)
|
|
313
|
+
throw new Error("Failed to load active users");
|
|
314
|
+
const o = await n.json(), a = Xe(o.count), i = Xe(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
315
|
+
if (a === null || i === null)
|
|
316
|
+
throw new Error("Invalid active users response");
|
|
317
|
+
return { count: a, refreshAfterMs: i };
|
|
318
|
+
}
|
|
319
|
+
function Xe(e) {
|
|
320
|
+
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
321
|
+
}
|
|
322
|
+
function bn(e) {
|
|
323
|
+
return e.endsWith("/") ? e : `${e}/`;
|
|
324
|
+
}
|
|
325
|
+
function wn(e) {
|
|
326
|
+
return Math.min(hn, Math.max(gn, e));
|
|
327
|
+
}
|
|
328
|
+
function _n(e) {
|
|
329
|
+
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
330
|
+
}
|
|
331
|
+
const xt = 100, xn = "product-agent:sdk-preview-socket-connect", vn = "product-agent:sdk-preview-socket-send", yn = "product-agent:sdk-preview-socket-close", Cn = "product-agent:sdk-preview-socket-open", En = "product-agent:sdk-preview-socket-message", Sn = "product-agent:sdk-preview-socket-error", kn = "product-agent:sdk-preview-socket-closed", Ze = "product-agent:sdk-preview-socket-id", Ln = "product-agent:preview-diagnostic", vt = "pluno.productAgent.sharePromptsDisabled", ue = 10, Pn = 10 * 1024 * 1024, An = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), U = {
|
|
269
332
|
launcherLabel: "Ask for anything...",
|
|
270
333
|
accentColor: "#7c3aed",
|
|
271
334
|
colorScheme: "light",
|
|
@@ -273,19 +336,19 @@ const gt = 100, Qt = "product-agent:sdk-preview-socket-connect", en = "product-a
|
|
|
273
336
|
scribbleStyle: !1,
|
|
274
337
|
position: "bottom-right",
|
|
275
338
|
movableLauncher: !1
|
|
276
|
-
},
|
|
277
|
-
function
|
|
278
|
-
return (t) => new
|
|
339
|
+
}, Je = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Nn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Qe = "pluno-pa-scribble-font", yt = 190, Ct = 41, Tn = 48, Dn = 420, In = 520, Mn = 0.24, Rn = 680, On = 800, Bn = 0.76, D = 8, Ne = 50, Fn = "http://www.w3.org/2000/svg", Un = 11, zn = 13, et = 4, Gn = 10, $n = 40, Hn = "movable-launcher-position-v2", Et = "pluno-pa-widget-styles", St = "data-pluno-pa-widget-styles";
|
|
340
|
+
function Wn(e) {
|
|
341
|
+
return (t) => new z(t, e);
|
|
279
342
|
}
|
|
280
|
-
async function
|
|
343
|
+
async function Vn(e = {}) {
|
|
281
344
|
const t = {
|
|
282
|
-
launcherLabel: e.launcherLabel ??
|
|
283
|
-
accentColor: e.accentColor ??
|
|
284
|
-
colorScheme: e.colorScheme ??
|
|
285
|
-
fontFamily: e.fontFamily ??
|
|
286
|
-
scribbleStyle: e.scribbleStyle ??
|
|
287
|
-
position: e.position ??
|
|
288
|
-
movableLauncher: e.movableLauncher ??
|
|
345
|
+
launcherLabel: e.launcherLabel ?? U.launcherLabel,
|
|
346
|
+
accentColor: e.accentColor ?? U.accentColor,
|
|
347
|
+
colorScheme: e.colorScheme ?? U.colorScheme,
|
|
348
|
+
fontFamily: e.fontFamily ?? U.fontFamily,
|
|
349
|
+
scribbleStyle: e.scribbleStyle ?? U.scribbleStyle,
|
|
350
|
+
position: e.position ?? U.position,
|
|
351
|
+
movableLauncher: e.movableLauncher ?? U.movableLauncher,
|
|
289
352
|
token: e.token,
|
|
290
353
|
tokenProvider: e.tokenProvider,
|
|
291
354
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -302,11 +365,12 @@ async function Sn(e = {}) {
|
|
|
302
365
|
socialPostDraftHandler: e.socialPostDraftHandler,
|
|
303
366
|
billingStatus: e.billingStatus ?? null,
|
|
304
367
|
billingStatusLoader: e.billingStatusLoader,
|
|
368
|
+
activeUsersLoader: e.activeUsersLoader,
|
|
305
369
|
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
306
370
|
loadSharePromptsDisabled: e.loadSharePromptsDisabled,
|
|
307
371
|
persistSharePromptsDisabled: e.persistSharePromptsDisabled
|
|
308
372
|
};
|
|
309
|
-
|
|
373
|
+
V("web-sdk.widget", "Mounting widget with merged options", {
|
|
310
374
|
accentColor: t.accentColor,
|
|
311
375
|
colorScheme: t.colorScheme,
|
|
312
376
|
fontFamily: t.fontFamily,
|
|
@@ -321,32 +385,32 @@ async function Sn(e = {}) {
|
|
|
321
385
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
322
386
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
323
387
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
324
|
-
let i =
|
|
325
|
-
|
|
326
|
-
const l = await
|
|
327
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
388
|
+
let i = tt(t.accentColor, t.scribbleStyle);
|
|
389
|
+
eo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
390
|
+
const l = await Wo(), p = l.ownerDocument;
|
|
391
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), gt(o, t.accentColor), nt(a, i, {
|
|
328
392
|
accentColor: t.accentColor,
|
|
329
393
|
colorScheme: t.colorScheme,
|
|
330
394
|
fontFamily: t.fontFamily,
|
|
331
395
|
scribbleStyle: t.scribbleStyle
|
|
332
|
-
}),
|
|
396
|
+
}), V("web-sdk.widget", "Applied initial widget appearance", {
|
|
333
397
|
accentColor: t.accentColor,
|
|
334
398
|
colorScheme: t.colorScheme,
|
|
335
399
|
fontFamily: t.fontFamily,
|
|
336
400
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
337
401
|
});
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
402
|
+
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), v = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), S = a.querySelector(".pluno-pa-widget__attachment-error"), y = a.querySelector(".pluno-pa-widget__billing-status"), _ = a.querySelector(".pluno-pa-widget__attachments"), g = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), P = a.querySelector(".pluno-pa-widget__new-chat"), E = a.querySelector(".pluno-pa-widget__active-users-counter"), m = a.querySelector(".pluno-pa-widget__timeline");
|
|
403
|
+
if (!c || !s || !f || !v || !x || !S || !y || !_ || !g || !h || !P || !E || !m)
|
|
340
404
|
throw new Error("Failed to mount Pluno widget");
|
|
341
|
-
if (t.movableLauncher && !
|
|
405
|
+
if (t.movableLauncher && !d)
|
|
342
406
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
343
|
-
|
|
344
|
-
let
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
407
|
+
it(s), it(g);
|
|
408
|
+
let b = [], C = null;
|
|
409
|
+
const k = () => {
|
|
410
|
+
go(_, b, (r) => {
|
|
411
|
+
b = b.filter((u, A) => A !== r), k(), T(w.getState()), O();
|
|
348
412
|
});
|
|
349
|
-
},
|
|
413
|
+
}, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
350
414
|
if (!t.tokenEndpoint)
|
|
351
415
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
352
416
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -357,19 +421,19 @@ async function Sn(e = {}) {
|
|
|
357
421
|
});
|
|
358
422
|
if (!r.ok)
|
|
359
423
|
throw new Error("Failed to load Pluno token");
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
424
|
+
const u = await r.json();
|
|
425
|
+
if (!u.token)
|
|
362
426
|
throw new Error("Pluno token endpoint did not return a token");
|
|
363
|
-
return
|
|
364
|
-
});
|
|
365
|
-
let
|
|
366
|
-
|
|
427
|
+
return u.token;
|
|
428
|
+
}), R = window.fetch.bind(window);
|
|
429
|
+
let w;
|
|
430
|
+
w = await qt.init({
|
|
367
431
|
token: t.token,
|
|
368
|
-
tokenProvider:
|
|
432
|
+
tokenProvider: I,
|
|
369
433
|
backendUrl: t.backendUrl,
|
|
370
434
|
metadata: () => ({
|
|
371
435
|
...t.metadata ?? {},
|
|
372
|
-
...!
|
|
436
|
+
...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
373
437
|
}),
|
|
374
438
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
375
439
|
clientId: t.clientId,
|
|
@@ -378,32 +442,32 @@ async function Sn(e = {}) {
|
|
|
378
442
|
webSocketFactory: t.webSocketFactory,
|
|
379
443
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
380
444
|
});
|
|
381
|
-
const
|
|
382
|
-
let
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
const
|
|
389
|
-
return
|
|
445
|
+
const H = Vo(t), ge = new Set(H.openToolGroupKeys), j = new Set(H.seenShareCandidateIds), ie = new Set(j);
|
|
446
|
+
let he = H.sharePromptsDisabled || await jo(t), F = t.movableLauncher ? H.launcherPosition : null, Oe = F !== null, G = null, me = !1;
|
|
447
|
+
const Ut = () => {
|
|
448
|
+
me || typeof document > "u" || (gt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
449
|
+
}, Be = new MutationObserver(Ut);
|
|
450
|
+
Be.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
451
|
+
const fe = (r = !0) => {
|
|
452
|
+
const u = Te(a, r);
|
|
453
|
+
return ot(
|
|
390
454
|
a,
|
|
391
|
-
|
|
392
|
-
|
|
455
|
+
F ?? Kn(a, t.position, u),
|
|
456
|
+
u
|
|
393
457
|
);
|
|
394
|
-
},
|
|
395
|
-
|
|
458
|
+
}, M = () => {
|
|
459
|
+
Ko(t, {
|
|
396
460
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
397
|
-
composerValue:
|
|
398
|
-
openToolGroupKeys: [...
|
|
399
|
-
launcherPosition:
|
|
400
|
-
seenShareCandidateIds: [
|
|
401
|
-
sharePromptsDisabled:
|
|
461
|
+
composerValue: g.value,
|
|
462
|
+
openToolGroupKeys: [...ge],
|
|
463
|
+
launcherPosition: Oe ? F : null,
|
|
464
|
+
seenShareCandidateIds: [...j].slice(-xt),
|
|
465
|
+
sharePromptsDisabled: he
|
|
402
466
|
});
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
debugVersion:
|
|
406
|
-
launcherPosition:
|
|
467
|
+
}, W = (r, u = {}) => {
|
|
468
|
+
Qn(r, {
|
|
469
|
+
debugVersion: Hn,
|
|
470
|
+
launcherPosition: F,
|
|
407
471
|
rootClasses: a.className,
|
|
408
472
|
rootStyle: {
|
|
409
473
|
left: a.style.left,
|
|
@@ -411,130 +475,131 @@ async function Sn(e = {}) {
|
|
|
411
475
|
right: a.style.right,
|
|
412
476
|
bottom: a.style.bottom
|
|
413
477
|
},
|
|
414
|
-
rootRect:
|
|
415
|
-
launcherRect:
|
|
416
|
-
panelRect:
|
|
417
|
-
viewport:
|
|
418
|
-
panelHidden:
|
|
419
|
-
closeHidden:
|
|
420
|
-
...
|
|
478
|
+
rootRect: Ce(a),
|
|
479
|
+
launcherRect: Ce(c),
|
|
480
|
+
panelRect: Ce(f),
|
|
481
|
+
viewport: J(),
|
|
482
|
+
panelHidden: f.hidden,
|
|
483
|
+
closeHidden: v.hidden,
|
|
484
|
+
...u
|
|
421
485
|
});
|
|
422
|
-
},
|
|
423
|
-
if (!
|
|
424
|
-
return
|
|
425
|
-
const
|
|
426
|
-
return
|
|
427
|
-
},
|
|
428
|
-
if (!r || !
|
|
429
|
-
|
|
486
|
+
}, re = (r = !0) => {
|
|
487
|
+
if (!F)
|
|
488
|
+
return pe(a, null), fe(r);
|
|
489
|
+
const u = fe(r);
|
|
490
|
+
return pe(a, u), W("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
|
|
491
|
+
}, Fe = (r, u) => {
|
|
492
|
+
if (!r || !u) {
|
|
493
|
+
Jn(a);
|
|
430
494
|
return;
|
|
431
495
|
}
|
|
432
|
-
|
|
433
|
-
x: r.x -
|
|
434
|
-
y: r.y -
|
|
496
|
+
Zn(a, {
|
|
497
|
+
x: r.x - u.x,
|
|
498
|
+
y: r.y - u.y
|
|
435
499
|
});
|
|
436
|
-
},
|
|
437
|
-
const r =
|
|
500
|
+
}, Ue = () => {
|
|
501
|
+
const r = re();
|
|
438
502
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
} else
|
|
503
|
+
const u = at(a, r, t.position);
|
|
504
|
+
Fe(u, r), W("Applied open panel position after viewport resize", { openPanelPosition: u });
|
|
505
|
+
} else F && W("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
442
506
|
};
|
|
443
|
-
let
|
|
507
|
+
let ze = () => {
|
|
444
508
|
};
|
|
445
|
-
window.addEventListener("resize",
|
|
509
|
+
window.addEventListener("resize", Ue), t.movableLauncher && d ? (re(), ze = qn({
|
|
446
510
|
root: a,
|
|
447
|
-
|
|
448
|
-
|
|
511
|
+
launcher: c,
|
|
512
|
+
launcherDragHandle: d,
|
|
513
|
+
getPosition: () => fe(),
|
|
449
514
|
setPosition: (r) => {
|
|
450
|
-
const
|
|
451
|
-
|
|
515
|
+
const u = r;
|
|
516
|
+
F = ot(a, r, Te(a)), pe(a, F), W("Dragging closed launcher", { requestedPosition: u });
|
|
452
517
|
},
|
|
453
518
|
persist: () => {
|
|
454
|
-
|
|
519
|
+
Oe = !0, M(), W("Persisted closed launcher drag position");
|
|
455
520
|
}
|
|
456
|
-
})) :
|
|
457
|
-
let
|
|
458
|
-
const
|
|
459
|
-
if (!(!t.billingStatusLoader ||
|
|
460
|
-
|
|
521
|
+
})) : pe(a, null);
|
|
522
|
+
let be = !1;
|
|
523
|
+
const Ge = async () => {
|
|
524
|
+
if (!(!t.billingStatusLoader || be)) {
|
|
525
|
+
be = !0;
|
|
461
526
|
try {
|
|
462
527
|
const r = await t.billingStatusLoader();
|
|
463
|
-
|
|
528
|
+
lt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, ke(y, t.billingStatus, w.getState().lastErrorCode), O());
|
|
464
529
|
} finally {
|
|
465
|
-
|
|
530
|
+
be = !1;
|
|
466
531
|
}
|
|
467
532
|
}
|
|
468
|
-
},
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
if (
|
|
472
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
533
|
+
}, q = (r = "", u = !0) => {
|
|
534
|
+
Ge(), G !== null && (window.clearTimeout(G), G = null), f.hidden = !1, v.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
535
|
+
const A = re(), ne = at(a, A, t.position);
|
|
536
|
+
if (Fe(ne, A), W("Opening launcher at clamped open panel position", { openPanelPosition: ne, visibleLauncherPosition: A }), !u) {
|
|
537
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, oe(g)), m.scrollTop = m.scrollHeight, g.focus(), g.setSelectionRange(g.value.length, g.value.length), M();
|
|
473
538
|
return;
|
|
474
539
|
}
|
|
475
540
|
window.requestAnimationFrame(() => {
|
|
476
|
-
a.classList.add("pluno-pa-widget--open"), r && (
|
|
477
|
-
|
|
541
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, oe(g)), m.scrollTop = m.scrollHeight, g.focus(), g.setSelectionRange(g.value.length, g.value.length), M(), G = window.setTimeout(() => {
|
|
542
|
+
c.hidden = !0, m.scrollTop = m.scrollHeight;
|
|
478
543
|
}, 220);
|
|
479
544
|
});
|
|
480
|
-
},
|
|
481
|
-
|
|
482
|
-
|
|
545
|
+
}, zt = () => {
|
|
546
|
+
G !== null && (window.clearTimeout(G), G = null), c.hidden = !1, F && (re(!1), W("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), M(), G = window.setTimeout(() => {
|
|
547
|
+
f.hidden = !0, v.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
483
548
|
}, 220);
|
|
484
549
|
};
|
|
485
|
-
|
|
486
|
-
r.preventDefault(),
|
|
487
|
-
}),
|
|
550
|
+
c.addEventListener("submit", (r) => {
|
|
551
|
+
r.preventDefault(), q(s.value), s.value = "";
|
|
552
|
+
}), d?.addEventListener("click", (r) => {
|
|
488
553
|
r.preventDefault(), r.stopPropagation();
|
|
489
|
-
}),
|
|
490
|
-
r.target
|
|
491
|
-
}),
|
|
492
|
-
|
|
493
|
-
}),
|
|
494
|
-
if (!
|
|
554
|
+
}), c.addEventListener("click", (r) => {
|
|
555
|
+
r.target === s && !d || (q(s.value), s.value = "");
|
|
556
|
+
}), s.addEventListener("focus", () => {
|
|
557
|
+
q(s.value), s.value = "";
|
|
558
|
+
}), s.addEventListener("input", () => {
|
|
559
|
+
if (!s.value)
|
|
495
560
|
return;
|
|
496
|
-
const r =
|
|
497
|
-
|
|
498
|
-
}),
|
|
499
|
-
const
|
|
500
|
-
h.disabled =
|
|
561
|
+
const r = s.value;
|
|
562
|
+
q(r), s.value = "";
|
|
563
|
+
}), v.addEventListener("click", zt);
|
|
564
|
+
const O = () => {
|
|
565
|
+
h.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && b.length === 0;
|
|
501
566
|
};
|
|
502
|
-
t.loginRequired && (
|
|
567
|
+
t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (r) => {
|
|
503
568
|
if (r.preventDefault(), t.loginRequired) {
|
|
504
569
|
t.onLoginClick?.();
|
|
505
570
|
return;
|
|
506
571
|
}
|
|
507
|
-
|
|
572
|
+
$(t.billingStatus) || (b = Ee(w, g, b), k(), O());
|
|
508
573
|
});
|
|
509
|
-
let
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
|
|
574
|
+
let ee = 0;
|
|
575
|
+
const Gt = () => {
|
|
576
|
+
ee = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
577
|
+
}, $t = (r) => {
|
|
578
|
+
C !== null && window.clearTimeout(C), S.textContent = r, S.hidden = !1, C = window.setTimeout(() => {
|
|
579
|
+
S.textContent = "", S.hidden = !0, C = null;
|
|
515
580
|
}, 3e3);
|
|
516
|
-
},
|
|
517
|
-
|
|
518
|
-
},
|
|
581
|
+
}, Ht = () => {
|
|
582
|
+
C !== null && (window.clearTimeout(C), C = null), S.textContent = "", S.hidden = !0;
|
|
583
|
+
}, Wt = async (r) => {
|
|
519
584
|
if (r.length === 0)
|
|
520
585
|
return;
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
throw new Error(`Attach up to ${
|
|
524
|
-
|
|
586
|
+
const u = await bo(r);
|
|
587
|
+
if (b.length + u.length > ue)
|
|
588
|
+
throw new Error(`Attach up to ${ue} files per message.`);
|
|
589
|
+
b = [...b, ...u], k(), Ht(), O(), T(w.getState());
|
|
525
590
|
};
|
|
526
591
|
a.addEventListener("dragenter", (r) => {
|
|
527
|
-
!
|
|
592
|
+
!se(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ee += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
528
593
|
}), a.addEventListener("dragover", (r) => {
|
|
529
|
-
const
|
|
530
|
-
!
|
|
594
|
+
const u = r.dataTransfer;
|
|
595
|
+
!se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
|
|
531
596
|
}), a.addEventListener("dragleave", (r) => {
|
|
532
|
-
|
|
597
|
+
se(r.dataTransfer) && (r.stopPropagation(), ee = Math.max(0, ee - 1), ee === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
533
598
|
}), a.addEventListener("drop", (r) => {
|
|
534
|
-
const
|
|
535
|
-
!
|
|
536
|
-
|
|
537
|
-
message:
|
|
599
|
+
const u = r.dataTransfer;
|
|
600
|
+
!se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Gt(), Wt(u.files).catch((A) => {
|
|
601
|
+
$t(A instanceof Error ? A.message : "Failed to attach file"), V("web-sdk.widget", "Attachment failed", {
|
|
602
|
+
message: A instanceof Error ? A.message : String(A)
|
|
538
603
|
});
|
|
539
604
|
}));
|
|
540
605
|
}), h.addEventListener("click", () => {
|
|
@@ -542,148 +607,154 @@ async function Sn(e = {}) {
|
|
|
542
607
|
t.onLoginClick?.();
|
|
543
608
|
return;
|
|
544
609
|
}
|
|
545
|
-
if (
|
|
546
|
-
|
|
610
|
+
if (w.getState().isThinking) {
|
|
611
|
+
w.stop();
|
|
547
612
|
return;
|
|
548
613
|
}
|
|
549
|
-
|
|
550
|
-
}),
|
|
551
|
-
|
|
552
|
-
}),
|
|
553
|
-
|
|
554
|
-
}),
|
|
614
|
+
b = Ee(w, g, b), k(), O(), T(w.getState());
|
|
615
|
+
}), P.addEventListener("click", () => {
|
|
616
|
+
w.startNewSession(), ge.clear(), g.value = "", b = [], k(), oe(g), M(), O(), g.focus(), T(w.getState());
|
|
617
|
+
}), g.addEventListener("input", () => {
|
|
618
|
+
oe(g), M(), O(), T(w.getState());
|
|
619
|
+
}), g.addEventListener("keydown", (r) => {
|
|
555
620
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
556
621
|
if (r.preventDefault(), t.loginRequired) {
|
|
557
622
|
t.onLoginClick?.();
|
|
558
623
|
return;
|
|
559
624
|
}
|
|
560
|
-
|
|
625
|
+
b = Ee(w, g, b), k(), O(), T(w.getState());
|
|
561
626
|
}
|
|
562
627
|
}), a.addEventListener("click", (r) => {
|
|
563
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
564
|
-
}),
|
|
565
|
-
const
|
|
566
|
-
let
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
628
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && M();
|
|
629
|
+
}), H.composerValue && (g.value = H.composerValue, oe(g)), H.isOpen && q(g.value, !1);
|
|
630
|
+
const $e = () => i;
|
|
631
|
+
let we = w.getState().appearance !== null, le = null, te = null, K = null, He = w.getState().isThinking, Y = null, _e = null, We = () => {
|
|
632
|
+
};
|
|
633
|
+
const Vt = !!t.socialPostDraftHandler, T = (r) => {
|
|
634
|
+
if (Re(r.lastErrorCode) ? Y = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (Y = null), ke(y, t.billingStatus, Y), t.loginRequired) {
|
|
635
|
+
No(m, h, P, $e, t.loginButtonLabel, t.onLoginClick);
|
|
570
636
|
return;
|
|
571
637
|
}
|
|
572
|
-
|
|
573
|
-
|
|
638
|
+
Ao(
|
|
639
|
+
m,
|
|
574
640
|
h,
|
|
575
|
-
|
|
641
|
+
P,
|
|
642
|
+
E,
|
|
576
643
|
r,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
644
|
+
_e,
|
|
645
|
+
_e !== null && st(r, g.value.trim().length > 0 || b.length > 0),
|
|
646
|
+
ge,
|
|
647
|
+
M,
|
|
648
|
+
$e,
|
|
649
|
+
(u) => {
|
|
650
|
+
w.sendMessage(u);
|
|
582
651
|
},
|
|
583
|
-
|
|
584
|
-
dismissedCandidateIds:
|
|
585
|
-
draftingCandidateId:
|
|
586
|
-
error:
|
|
587
|
-
onSeen: (
|
|
588
|
-
|
|
652
|
+
Vt && !he ? {
|
|
653
|
+
dismissedCandidateIds: ie,
|
|
654
|
+
draftingCandidateId: le,
|
|
655
|
+
error: te,
|
|
656
|
+
onSeen: (u) => {
|
|
657
|
+
j.add(u.id), M();
|
|
589
658
|
},
|
|
590
|
-
onDraft: (
|
|
591
|
-
|
|
659
|
+
onDraft: (u) => {
|
|
660
|
+
jt(u);
|
|
592
661
|
},
|
|
593
|
-
onDismiss: (
|
|
594
|
-
|
|
662
|
+
onDismiss: (u) => {
|
|
663
|
+
j.add(u.id), ie.add(u.id), M(), te = null, T(w.getState());
|
|
595
664
|
},
|
|
596
|
-
onDisable: (
|
|
597
|
-
|
|
665
|
+
onDisable: (u) => {
|
|
666
|
+
he = !0, j.add(u.id), ie.add(u.id), M(), qo(t, !0), te = null, T(w.getState());
|
|
598
667
|
}
|
|
599
668
|
} : void 0
|
|
600
669
|
);
|
|
601
670
|
};
|
|
602
|
-
return
|
|
603
|
-
|
|
604
|
-
|
|
671
|
+
return We = mn((r) => {
|
|
672
|
+
_e = r, !me && st(w.getState(), g.value.trim().length > 0 || b.length > 0) && T(w.getState());
|
|
673
|
+
}, { backendUrl: t.backendUrl, fetcher: R, loader: t.activeUsersLoader }), w.on("state", (r) => {
|
|
674
|
+
const u = He && !r.isThinking;
|
|
675
|
+
He = r.isThinking, r.appearance ? (we = !0, V("web-sdk.widget", "Agent state supplied appearance", {
|
|
605
676
|
appearance: r.appearance
|
|
606
|
-
}),
|
|
677
|
+
}), xe(r.appearance, "agent.state.appearance")) : we && (we = !1, V("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
607
678
|
fallbackAccentColor: t.accentColor,
|
|
608
679
|
fallbackColorScheme: t.colorScheme,
|
|
609
680
|
fallbackFontFamily: t.fontFamily
|
|
610
|
-
}),
|
|
611
|
-
}),
|
|
612
|
-
agent:
|
|
681
|
+
}), xe({}, "agent.state.appearance-cleared")), T(r), O(), u && Ge();
|
|
682
|
+
}), T(w.getState()), O(), {
|
|
683
|
+
agent: w,
|
|
613
684
|
updateAppearance: (r) => {
|
|
614
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
685
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), xe(r, "widgetHandle.updateAppearance");
|
|
615
686
|
},
|
|
616
687
|
updateBillingStatus: (r) => {
|
|
617
|
-
const
|
|
618
|
-
|
|
688
|
+
const u = r ?? null;
|
|
689
|
+
lt(t.billingStatus, u, Y) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (Y = null), ke(
|
|
619
690
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
620
691
|
t.billingStatus,
|
|
621
|
-
|
|
622
|
-
),
|
|
692
|
+
Y
|
|
693
|
+
), O());
|
|
623
694
|
},
|
|
624
695
|
openPanel: () => {
|
|
625
|
-
|
|
696
|
+
q(g.value, !1);
|
|
626
697
|
},
|
|
627
698
|
destroy: () => {
|
|
628
|
-
|
|
699
|
+
me = !0, Be.disconnect(), window.removeEventListener("resize", Ue), ze(), C !== null && window.clearTimeout(C), We(), K?.remove(), w.destroy(), n.remove();
|
|
629
700
|
}
|
|
630
701
|
};
|
|
631
|
-
async function
|
|
632
|
-
if (!
|
|
633
|
-
|
|
702
|
+
async function jt(r) {
|
|
703
|
+
if (!le) {
|
|
704
|
+
le = r.id, te = null, T(w.getState());
|
|
634
705
|
try {
|
|
635
706
|
if (!t.socialPostDraftHandler)
|
|
636
707
|
throw new Error("Social post drafting is not available here.");
|
|
637
|
-
const
|
|
638
|
-
if (!
|
|
708
|
+
const u = await t.socialPostDraftHandler(r);
|
|
709
|
+
if (!u.linkedinPost || !u.xPost)
|
|
639
710
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
640
|
-
|
|
711
|
+
j.add(r.id), ie.add(r.id), M(), K?.remove(), K = Io(u, {
|
|
641
712
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
642
713
|
onClose: () => {
|
|
643
|
-
|
|
714
|
+
K?.remove(), K = null;
|
|
644
715
|
}
|
|
645
|
-
}), a.appendChild(
|
|
646
|
-
} catch (
|
|
647
|
-
|
|
716
|
+
}), a.appendChild(K);
|
|
717
|
+
} catch (u) {
|
|
718
|
+
te = u instanceof Error ? u.message : "Could not draft social post.";
|
|
648
719
|
} finally {
|
|
649
|
-
|
|
720
|
+
le = null, T(w.getState());
|
|
650
721
|
}
|
|
651
722
|
}
|
|
652
723
|
}
|
|
653
|
-
function
|
|
654
|
-
const
|
|
655
|
-
i =
|
|
656
|
-
accentColor:
|
|
657
|
-
colorScheme:
|
|
658
|
-
fontFamily:
|
|
659
|
-
scribbleStyle:
|
|
660
|
-
}),
|
|
661
|
-
source:
|
|
724
|
+
function xe(r, u) {
|
|
725
|
+
const A = r.accentColor ?? t.accentColor, ne = r.colorScheme ?? t.colorScheme, Ve = r.fontFamily ?? t.fontFamily, ve = r.scribbleStyle ?? t.scribbleStyle;
|
|
726
|
+
i = tt(A, ve), nt(a, i, {
|
|
727
|
+
accentColor: A,
|
|
728
|
+
colorScheme: ne,
|
|
729
|
+
fontFamily: Ve,
|
|
730
|
+
scribbleStyle: ve
|
|
731
|
+
}), V("web-sdk.widget", "Updated widget appearance", {
|
|
732
|
+
source: u,
|
|
662
733
|
inputAppearance: r,
|
|
663
|
-
appliedAccentColor:
|
|
664
|
-
appliedColorScheme:
|
|
665
|
-
appliedFontFamily:
|
|
666
|
-
appliedScribbleStyle:
|
|
734
|
+
appliedAccentColor: A,
|
|
735
|
+
appliedColorScheme: ne,
|
|
736
|
+
appliedFontFamily: Ve,
|
|
737
|
+
appliedScribbleStyle: ve,
|
|
667
738
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
668
739
|
});
|
|
669
740
|
}
|
|
670
741
|
}
|
|
671
|
-
function
|
|
672
|
-
return t ?
|
|
742
|
+
function tt(e, t) {
|
|
743
|
+
return t ? Jt(e) : Xt(e);
|
|
673
744
|
}
|
|
674
|
-
function
|
|
745
|
+
function nt(e, t, n) {
|
|
675
746
|
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);
|
|
676
|
-
const o = n.scribbleStyle ?
|
|
677
|
-
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ?
|
|
747
|
+
const o = n.scribbleStyle ? bt(n.accentColor) : n.accentColor;
|
|
748
|
+
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? Nn : n.fontFamily, n.scribbleStyle && jn(e.ownerDocument);
|
|
678
749
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
679
750
|
for (const i of a)
|
|
680
751
|
i.src = t;
|
|
681
752
|
}
|
|
682
|
-
function
|
|
683
|
-
if (e.getElementById(
|
|
753
|
+
function jn(e) {
|
|
754
|
+
if (e.getElementById(Qe))
|
|
684
755
|
return;
|
|
685
756
|
const t = e.createElement("style");
|
|
686
|
-
t.id =
|
|
757
|
+
t.id = Qe, t.textContent = `@font-face {
|
|
687
758
|
font-family: "Architects Daughter";
|
|
688
759
|
font-style: normal;
|
|
689
760
|
font-weight: 400;
|
|
@@ -691,120 +762,126 @@ function Ln(e) {
|
|
|
691
762
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
692
763
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
693
764
|
}
|
|
694
|
-
function
|
|
765
|
+
function qn({
|
|
695
766
|
root: e,
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
767
|
+
launcher: t,
|
|
768
|
+
launcherDragHandle: n,
|
|
769
|
+
getPosition: o,
|
|
770
|
+
setPosition: a,
|
|
771
|
+
persist: i
|
|
700
772
|
}) {
|
|
701
|
-
let
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
},
|
|
705
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (
|
|
706
|
-
},
|
|
707
|
-
if (
|
|
773
|
+
let l = null, p = null, c = null, d = !1, s = null;
|
|
774
|
+
const f = () => {
|
|
775
|
+
l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
776
|
+
}, v = (h) => {
|
|
777
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = o(), d = !1, t.setPointerCapture?.(h.pointerId));
|
|
778
|
+
}, x = (h) => {
|
|
779
|
+
if (l !== h.pointerId || !p || !c)
|
|
708
780
|
return;
|
|
709
|
-
|
|
710
|
-
const
|
|
711
|
-
!
|
|
712
|
-
},
|
|
713
|
-
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
},
|
|
781
|
+
h.preventDefault();
|
|
782
|
+
const P = h.clientX - p.x, E = h.clientY - p.y;
|
|
783
|
+
!d && Math.hypot(P, E) < et || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + P, y: c.y + E }));
|
|
784
|
+
}, S = (h) => {
|
|
785
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
|
|
786
|
+
}, y = (h) => {
|
|
787
|
+
l === h.pointerId && (h.preventDefault(), f());
|
|
788
|
+
}, _ = (h) => {
|
|
789
|
+
if (!s)
|
|
790
|
+
return;
|
|
791
|
+
const P = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= et;
|
|
792
|
+
s = null, P && (h.preventDefault(), h.stopPropagation());
|
|
793
|
+
}, g = (h) => {
|
|
717
794
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
718
795
|
return;
|
|
719
|
-
const
|
|
720
|
-
let
|
|
721
|
-
|
|
796
|
+
const P = h.shiftKey ? $n : Gn, E = o();
|
|
797
|
+
let m = null;
|
|
798
|
+
h.key === "ArrowUp" ? m = { x: E.x, y: E.y - P } : h.key === "ArrowDown" ? m = { x: E.x, y: E.y + P } : h.key === "ArrowLeft" ? m = { x: E.x - P, y: E.y } : h.key === "ArrowRight" && (m = { x: E.x + P, y: E.y }), m && (h.preventDefault(), h.stopPropagation(), a(m), i());
|
|
722
799
|
};
|
|
723
|
-
return t.addEventListener("pointerdown",
|
|
724
|
-
t.removeEventListener("pointerdown",
|
|
800
|
+
return t.addEventListener("pointerdown", v), t.addEventListener("pointermove", x), t.addEventListener("pointerup", S), t.addEventListener("pointercancel", y), t.addEventListener("click", _, !0), n.addEventListener("keydown", g), () => {
|
|
801
|
+
t.removeEventListener("pointerdown", v), t.removeEventListener("pointermove", x), t.removeEventListener("pointerup", S), t.removeEventListener("pointercancel", y), t.removeEventListener("click", _, !0), n.removeEventListener("keydown", g);
|
|
725
802
|
};
|
|
726
803
|
}
|
|
727
|
-
function
|
|
728
|
-
const n =
|
|
804
|
+
function Te(e, t = !0) {
|
|
805
|
+
const n = J(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
729
806
|
return {
|
|
730
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
731
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
807
|
+
width: t && a && o.width > 0 ? o.width : Math.min(yt, n.width - 36),
|
|
808
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Tn : Ct
|
|
732
809
|
};
|
|
733
810
|
}
|
|
734
|
-
function
|
|
735
|
-
const e =
|
|
811
|
+
function kt() {
|
|
812
|
+
const e = J();
|
|
736
813
|
return {
|
|
737
814
|
width: Math.min(
|
|
738
|
-
|
|
739
|
-
e.width -
|
|
815
|
+
Z(e.width * Mn, Dn, In),
|
|
816
|
+
e.width - D * 2
|
|
740
817
|
),
|
|
741
818
|
height: Math.min(
|
|
742
|
-
|
|
743
|
-
e.height -
|
|
819
|
+
Z(e.height * Bn, Rn, On),
|
|
820
|
+
e.height - Ne - D
|
|
744
821
|
)
|
|
745
822
|
};
|
|
746
823
|
}
|
|
747
|
-
function
|
|
824
|
+
function Kn(e, t, n) {
|
|
748
825
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
749
826
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
750
827
|
return { x: o, y: a };
|
|
751
828
|
const i = e.getBoundingClientRect();
|
|
752
829
|
if (i.width > 0 || i.height > 0)
|
|
753
830
|
return { x: i.left, y: i.top };
|
|
754
|
-
const l =
|
|
831
|
+
const l = J();
|
|
755
832
|
return {
|
|
756
833
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
757
834
|
y: l.height - 24 - n.height
|
|
758
835
|
};
|
|
759
836
|
}
|
|
760
|
-
function
|
|
761
|
-
const o =
|
|
837
|
+
function ot(e, t, n) {
|
|
838
|
+
const o = J(), a = D + Yn(e);
|
|
762
839
|
return {
|
|
763
|
-
x:
|
|
764
|
-
y:
|
|
840
|
+
x: Z(t.x, D, Math.max(D, o.width - n.width - D)),
|
|
841
|
+
y: Z(t.y, a, Math.max(a, o.height - n.height - D))
|
|
765
842
|
};
|
|
766
843
|
}
|
|
767
|
-
function
|
|
768
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
844
|
+
function Yn(e) {
|
|
845
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? zn : Un;
|
|
769
846
|
}
|
|
770
|
-
function
|
|
771
|
-
const o =
|
|
847
|
+
function at(e, t, n) {
|
|
848
|
+
const o = Te(e), a = kt(), i = {
|
|
772
849
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
773
850
|
y: t.y + o.height - a.height
|
|
774
851
|
};
|
|
775
|
-
return
|
|
852
|
+
return Xn(i);
|
|
776
853
|
}
|
|
777
|
-
function
|
|
778
|
-
const t =
|
|
854
|
+
function Xn(e) {
|
|
855
|
+
const t = J(), n = kt();
|
|
779
856
|
return {
|
|
780
|
-
x:
|
|
781
|
-
y:
|
|
857
|
+
x: Z(e.x, D, Math.max(D, t.width - n.width - D)),
|
|
858
|
+
y: Z(
|
|
782
859
|
e.y,
|
|
783
|
-
|
|
784
|
-
Math.max(
|
|
860
|
+
Ne,
|
|
861
|
+
Math.max(Ne, t.height - n.height - D)
|
|
785
862
|
)
|
|
786
863
|
};
|
|
787
864
|
}
|
|
788
|
-
function
|
|
865
|
+
function pe(e, t) {
|
|
789
866
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
790
867
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
791
868
|
return;
|
|
792
869
|
}
|
|
793
870
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
794
871
|
}
|
|
795
|
-
function
|
|
872
|
+
function Zn(e, t) {
|
|
796
873
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
797
874
|
}
|
|
798
|
-
function
|
|
875
|
+
function Jn(e) {
|
|
799
876
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
800
877
|
}
|
|
801
|
-
function
|
|
878
|
+
function J() {
|
|
802
879
|
return {
|
|
803
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
804
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
880
|
+
width: window.innerWidth || document.documentElement.clientWidth || yt + D * 2,
|
|
881
|
+
height: window.innerHeight || document.documentElement.clientHeight || Ct + D * 2
|
|
805
882
|
};
|
|
806
883
|
}
|
|
807
|
-
function
|
|
884
|
+
function Ce(e) {
|
|
808
885
|
const t = e.getBoundingClientRect();
|
|
809
886
|
return {
|
|
810
887
|
x: Math.round(t.x),
|
|
@@ -813,10 +890,10 @@ function _e(e) {
|
|
|
813
890
|
height: Math.round(t.height)
|
|
814
891
|
};
|
|
815
892
|
}
|
|
816
|
-
function
|
|
893
|
+
function Z(e, t, n) {
|
|
817
894
|
return Math.min(Math.max(e, t), n);
|
|
818
895
|
}
|
|
819
|
-
function
|
|
896
|
+
function V(e, t, n) {
|
|
820
897
|
if (typeof window > "u")
|
|
821
898
|
return;
|
|
822
899
|
const o = window, a = {
|
|
@@ -825,42 +902,44 @@ function U(e, t, n) {
|
|
|
825
902
|
message: t,
|
|
826
903
|
details: n
|
|
827
904
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
828
|
-
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(
|
|
905
|
+
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Ln, { detail: a }));
|
|
829
906
|
}
|
|
830
|
-
function
|
|
831
|
-
|
|
907
|
+
function Qn(e, t) {
|
|
908
|
+
V("web-sdk.widget.position", e, t);
|
|
832
909
|
}
|
|
833
|
-
function
|
|
910
|
+
function Ee(e, t, n) {
|
|
834
911
|
const o = t.value.trim();
|
|
835
912
|
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 })), []);
|
|
836
913
|
}
|
|
837
|
-
function
|
|
914
|
+
function oe(e) {
|
|
838
915
|
e.style.height = "0px";
|
|
839
916
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
840
917
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
841
918
|
}
|
|
842
|
-
function
|
|
843
|
-
e.appendChild(
|
|
919
|
+
function eo(e, t, n, o) {
|
|
920
|
+
e.appendChild(ro()), e.appendChild(to(t, n, o)), e.appendChild(At("pluno-pa-widget__close", "Close", lo(16), !0)), e.appendChild(no(n));
|
|
844
921
|
}
|
|
845
|
-
function
|
|
922
|
+
function to(e, t, n) {
|
|
846
923
|
const o = document.createElement("form");
|
|
847
924
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
848
925
|
const i = document.createElement("button");
|
|
849
926
|
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);
|
|
850
927
|
}
|
|
851
|
-
o.appendChild(
|
|
928
|
+
o.appendChild(Pt("pluno-pa-widget__character--launcher", t));
|
|
852
929
|
const a = document.createElement("input");
|
|
853
930
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
854
931
|
}
|
|
855
|
-
function
|
|
932
|
+
function no(e) {
|
|
856
933
|
const t = document.createElement("section");
|
|
857
934
|
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
858
935
|
const n = document.createElement("div");
|
|
859
936
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
860
937
|
const o = document.createElement("main");
|
|
861
|
-
|
|
938
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(ao(e)), n.appendChild(o);
|
|
939
|
+
const a = document.createElement("div");
|
|
940
|
+
return a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a), n.appendChild(At("pluno-pa-widget__new-chat", "New chat", po(), !0)), t.appendChild(n), t.appendChild(oo()), t;
|
|
862
941
|
}
|
|
863
|
-
function
|
|
942
|
+
function oo() {
|
|
864
943
|
const e = document.createElement("form");
|
|
865
944
|
e.className = "pluno-pa-widget__composer";
|
|
866
945
|
const t = document.createElement("div");
|
|
@@ -874,44 +953,49 @@ function Fn() {
|
|
|
874
953
|
const i = document.createElement("textarea");
|
|
875
954
|
i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
|
|
876
955
|
const l = document.createElement("button");
|
|
877
|
-
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(
|
|
956
|
+
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(Nt()), a.appendChild(l), e.appendChild(a);
|
|
878
957
|
const p = document.createElement("div");
|
|
879
958
|
p.className = "pluno-pa-widget__composer-meta";
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
const
|
|
883
|
-
return
|
|
959
|
+
const c = document.createElement("a");
|
|
960
|
+
c.className = "pluno-pa-widget__powered-by", c.href = "https://pluno.ai", c.target = "_blank", c.rel = "noopener noreferrer", c.textContent = "Powered by Pluno.ai.", p.appendChild(c);
|
|
961
|
+
const d = document.createElement("span");
|
|
962
|
+
return d.className = "pluno-pa-widget__ai-disclaimer", d.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(d), e.appendChild(p), e;
|
|
884
963
|
}
|
|
885
|
-
function
|
|
964
|
+
function ao(e) {
|
|
886
965
|
const t = document.createElement("div");
|
|
887
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
966
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Pt("pluno-pa-widget__character--empty", e)), t.appendChild(Lt()), t;
|
|
888
967
|
}
|
|
889
|
-
function
|
|
968
|
+
function Lt() {
|
|
890
969
|
const e = document.createElement("div");
|
|
891
970
|
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;
|
|
892
971
|
}
|
|
893
|
-
function
|
|
972
|
+
function io(e, t) {
|
|
973
|
+
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
974
|
+
const n = document.createElement("span");
|
|
975
|
+
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`));
|
|
976
|
+
}
|
|
977
|
+
function Pt(e, t) {
|
|
894
978
|
const n = document.createElement("img");
|
|
895
979
|
return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
896
980
|
}
|
|
897
|
-
function
|
|
981
|
+
function At(e, t, n, o) {
|
|
898
982
|
const a = document.createElement("button");
|
|
899
983
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
900
984
|
}
|
|
901
|
-
function
|
|
902
|
-
const e =
|
|
985
|
+
function ro() {
|
|
986
|
+
const e = L("svg", {
|
|
903
987
|
class: "pluno-pa-widget__scribble-defs",
|
|
904
988
|
"aria-hidden": "true",
|
|
905
989
|
focusable: "false",
|
|
906
990
|
width: "0",
|
|
907
991
|
height: "0"
|
|
908
|
-
}), t =
|
|
909
|
-
return t.appendChild(
|
|
992
|
+
}), t = L("defs");
|
|
993
|
+
return t.appendChild(Se("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Se("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Se("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
910
994
|
}
|
|
911
|
-
function
|
|
912
|
-
const o =
|
|
995
|
+
function Se(e, t, n) {
|
|
996
|
+
const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
913
997
|
return o.appendChild(
|
|
914
|
-
|
|
998
|
+
L("feTurbulence", {
|
|
915
999
|
type: "fractalNoise",
|
|
916
1000
|
baseFrequency: "0.012 0.028",
|
|
917
1001
|
numOctaves: "3",
|
|
@@ -919,7 +1003,7 @@ function ye(e, t, n) {
|
|
|
919
1003
|
result: "stroke-noise"
|
|
920
1004
|
})
|
|
921
1005
|
), o.appendChild(
|
|
922
|
-
|
|
1006
|
+
L("feDisplacementMap", {
|
|
923
1007
|
in: "SourceGraphic",
|
|
924
1008
|
in2: "stroke-noise",
|
|
925
1009
|
scale: "3.5",
|
|
@@ -928,7 +1012,7 @@ function ye(e, t, n) {
|
|
|
928
1012
|
result: "warped"
|
|
929
1013
|
})
|
|
930
1014
|
), o.appendChild(
|
|
931
|
-
|
|
1015
|
+
L("feTurbulence", {
|
|
932
1016
|
type: "fractalNoise",
|
|
933
1017
|
baseFrequency: "0.7",
|
|
934
1018
|
numOctaves: "1",
|
|
@@ -936,7 +1020,7 @@ function ye(e, t, n) {
|
|
|
936
1020
|
result: "ink-noise"
|
|
937
1021
|
})
|
|
938
1022
|
), o.appendChild(
|
|
939
|
-
|
|
1023
|
+
L("feDisplacementMap", {
|
|
940
1024
|
in: "warped",
|
|
941
1025
|
in2: "ink-noise",
|
|
942
1026
|
scale: "0.9",
|
|
@@ -945,31 +1029,31 @@ function ye(e, t, n) {
|
|
|
945
1029
|
})
|
|
946
1030
|
), o;
|
|
947
1031
|
}
|
|
948
|
-
function
|
|
949
|
-
const t =
|
|
950
|
-
return t.appendChild(
|
|
1032
|
+
function lo(e) {
|
|
1033
|
+
const t = Q("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1034
|
+
return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
|
|
951
1035
|
}
|
|
952
|
-
function
|
|
953
|
-
const e =
|
|
954
|
-
return e.appendChild(
|
|
1036
|
+
function po() {
|
|
1037
|
+
const e = Q("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1038
|
+
return e.appendChild(L("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(L("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
955
1039
|
}
|
|
956
|
-
function
|
|
957
|
-
const e =
|
|
958
|
-
return e.appendChild(
|
|
1040
|
+
function Nt() {
|
|
1041
|
+
const e = Q("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1042
|
+
return e.appendChild(L("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(L("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
959
1043
|
}
|
|
960
|
-
function
|
|
961
|
-
const e =
|
|
962
|
-
return e.appendChild(
|
|
1044
|
+
function so() {
|
|
1045
|
+
const e = Q("0 0 24 24", 18, 18, "currentColor");
|
|
1046
|
+
return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
963
1047
|
}
|
|
964
|
-
function
|
|
965
|
-
const e =
|
|
966
|
-
return e.appendChild(
|
|
1048
|
+
function co() {
|
|
1049
|
+
const e = Q("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1050
|
+
return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
|
|
967
1051
|
}
|
|
968
|
-
function
|
|
969
|
-
const e =
|
|
970
|
-
return e.appendChild(
|
|
1052
|
+
function uo() {
|
|
1053
|
+
const e = Q("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1054
|
+
return e.appendChild(L("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(L("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
971
1055
|
}
|
|
972
|
-
function
|
|
1056
|
+
function Q(e, t, n, o, a, i) {
|
|
973
1057
|
const l = {
|
|
974
1058
|
viewBox: e,
|
|
975
1059
|
width: String(t),
|
|
@@ -977,41 +1061,41 @@ function X(e, t, n, o, a, i) {
|
|
|
977
1061
|
fill: o,
|
|
978
1062
|
"aria-hidden": "true"
|
|
979
1063
|
};
|
|
980
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i),
|
|
1064
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
|
|
981
1065
|
}
|
|
982
|
-
function
|
|
983
|
-
const n = document.createElementNS(
|
|
1066
|
+
function L(e, t = {}) {
|
|
1067
|
+
const n = document.createElementNS(Fn, e);
|
|
984
1068
|
for (const [o, a] of Object.entries(t))
|
|
985
1069
|
n.setAttribute(o, a);
|
|
986
1070
|
return n;
|
|
987
1071
|
}
|
|
988
|
-
function
|
|
1072
|
+
function it(e) {
|
|
989
1073
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
990
1074
|
e.addEventListener(t, (n) => {
|
|
991
1075
|
n.stopPropagation();
|
|
992
1076
|
});
|
|
993
1077
|
}
|
|
994
|
-
function
|
|
1078
|
+
function go(e, t, n) {
|
|
995
1079
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
996
1080
|
for (const [o, a] of t.entries()) {
|
|
997
1081
|
const i = document.createElement("div");
|
|
998
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1082
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(ho(a));
|
|
999
1083
|
const l = document.createElement("span");
|
|
1000
1084
|
l.textContent = a.name, i.appendChild(l);
|
|
1001
1085
|
const p = document.createElement("button");
|
|
1002
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1086
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(co()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1003
1087
|
}
|
|
1004
1088
|
}
|
|
1005
|
-
function
|
|
1006
|
-
if (
|
|
1089
|
+
function ho(e) {
|
|
1090
|
+
if (Tt(e)) {
|
|
1007
1091
|
const n = document.createElement("img");
|
|
1008
1092
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1009
1093
|
}
|
|
1010
1094
|
const t = document.createElement("span");
|
|
1011
1095
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1012
1096
|
}
|
|
1013
|
-
function
|
|
1014
|
-
if (
|
|
1097
|
+
function mo(e) {
|
|
1098
|
+
if (Tt(e)) {
|
|
1015
1099
|
const a = document.createElement("img");
|
|
1016
1100
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1017
1101
|
}
|
|
@@ -1022,51 +1106,51 @@ function Yn(e) {
|
|
|
1022
1106
|
const o = document.createElement("strong");
|
|
1023
1107
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1024
1108
|
}
|
|
1025
|
-
function
|
|
1109
|
+
function Tt(e) {
|
|
1026
1110
|
return e.mimeType.startsWith("image/");
|
|
1027
1111
|
}
|
|
1028
|
-
function
|
|
1112
|
+
function fo(e) {
|
|
1029
1113
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1030
1114
|
}
|
|
1031
|
-
async function
|
|
1115
|
+
async function bo(e) {
|
|
1032
1116
|
if (!e)
|
|
1033
1117
|
return [];
|
|
1034
1118
|
const t = Array.from(e);
|
|
1035
|
-
if (t.length >
|
|
1036
|
-
throw new Error(`Attach up to ${
|
|
1119
|
+
if (t.length > ue)
|
|
1120
|
+
throw new Error(`Attach up to ${ue} files per message.`);
|
|
1037
1121
|
return Promise.all(
|
|
1038
1122
|
t.map(async (n) => {
|
|
1039
|
-
const o =
|
|
1123
|
+
const o = wo(n);
|
|
1040
1124
|
if (!o)
|
|
1041
1125
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1042
|
-
if (n.size >
|
|
1126
|
+
if (n.size > Pn)
|
|
1043
1127
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1044
1128
|
if (o === "image/gif") {
|
|
1045
|
-
const a = new Uint8Array(await
|
|
1046
|
-
if (
|
|
1129
|
+
const a = new Uint8Array(await Lo(n));
|
|
1130
|
+
if (xo(a))
|
|
1047
1131
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1048
1132
|
}
|
|
1049
1133
|
return {
|
|
1050
|
-
name: n.name ||
|
|
1134
|
+
name: n.name || fo(o),
|
|
1051
1135
|
mimeType: o,
|
|
1052
1136
|
sizeBytes: n.size,
|
|
1053
|
-
dataUrl:
|
|
1137
|
+
dataUrl: _o(await Po(n), o)
|
|
1054
1138
|
};
|
|
1055
1139
|
})
|
|
1056
1140
|
);
|
|
1057
1141
|
}
|
|
1058
|
-
function
|
|
1059
|
-
if (
|
|
1142
|
+
function wo(e) {
|
|
1143
|
+
if (An.has(e.type))
|
|
1060
1144
|
return e.type;
|
|
1061
1145
|
const t = e.name.toLowerCase();
|
|
1062
1146
|
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;
|
|
1063
1147
|
}
|
|
1064
|
-
function
|
|
1148
|
+
function _o(e, t) {
|
|
1065
1149
|
const n = `data:${t};base64,`;
|
|
1066
1150
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1067
1151
|
}
|
|
1068
|
-
function
|
|
1069
|
-
if (e.length < 14 || !
|
|
1152
|
+
function xo(e) {
|
|
1153
|
+
if (e.length < 14 || !vo(e))
|
|
1070
1154
|
return !1;
|
|
1071
1155
|
const t = e[10];
|
|
1072
1156
|
let n = 13;
|
|
@@ -1077,7 +1161,7 @@ function Qn(e) {
|
|
|
1077
1161
|
if (n += 1, a === 59)
|
|
1078
1162
|
return !1;
|
|
1079
1163
|
if (a === 33) {
|
|
1080
|
-
n += 1, n =
|
|
1164
|
+
n += 1, n = rt(e, n);
|
|
1081
1165
|
continue;
|
|
1082
1166
|
}
|
|
1083
1167
|
if (a !== 44)
|
|
@@ -1089,14 +1173,14 @@ function Qn(e) {
|
|
|
1089
1173
|
const i = e[n + 8];
|
|
1090
1174
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1091
1175
|
return !1;
|
|
1092
|
-
n += 1, n =
|
|
1176
|
+
n += 1, n = rt(e, n);
|
|
1093
1177
|
}
|
|
1094
1178
|
return !1;
|
|
1095
1179
|
}
|
|
1096
|
-
function
|
|
1180
|
+
function vo(e) {
|
|
1097
1181
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1098
1182
|
}
|
|
1099
|
-
function
|
|
1183
|
+
function rt(e, t) {
|
|
1100
1184
|
for (; t < e.length; ) {
|
|
1101
1185
|
const n = e[t];
|
|
1102
1186
|
if (t += 1, n === 0)
|
|
@@ -1105,69 +1189,69 @@ function et(e, t) {
|
|
|
1105
1189
|
}
|
|
1106
1190
|
return t;
|
|
1107
1191
|
}
|
|
1108
|
-
function
|
|
1192
|
+
function se(e) {
|
|
1109
1193
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1110
1194
|
}
|
|
1111
|
-
function
|
|
1112
|
-
if (!e || !
|
|
1195
|
+
function ke(e, t, n = null) {
|
|
1196
|
+
if (!e || !De(t, n)) {
|
|
1113
1197
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1114
1198
|
return;
|
|
1115
1199
|
}
|
|
1116
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1200
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", $(t) || Re(n) ? e.appendChild(yo(t, n)) : Dt(t) && e.appendChild(Co(t));
|
|
1117
1201
|
}
|
|
1118
|
-
function
|
|
1202
|
+
function yo(e, t) {
|
|
1119
1203
|
const n = document.createElement("div");
|
|
1120
1204
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1121
1205
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1122
1206
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1123
1207
|
const i = document.createElement("span");
|
|
1124
|
-
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(
|
|
1208
|
+
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(It(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1125
1209
|
}
|
|
1126
|
-
function
|
|
1210
|
+
function Co(e) {
|
|
1127
1211
|
const t = document.createElement("div");
|
|
1128
1212
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1129
1213
|
const n = document.createElement("strong");
|
|
1130
1214
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1131
1215
|
const o = document.createElement("span");
|
|
1132
|
-
return o.textContent =
|
|
1216
|
+
return o.textContent = So(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(It(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1133
1217
|
}
|
|
1134
|
-
function
|
|
1135
|
-
return e !== null && (
|
|
1218
|
+
function De(e, t) {
|
|
1219
|
+
return e !== null && ($(e) || Dt(e) || Re(t));
|
|
1136
1220
|
}
|
|
1137
|
-
function
|
|
1138
|
-
return
|
|
1221
|
+
function lt(e, t, n) {
|
|
1222
|
+
return De(t, n) || Eo(t) ? !0 : !De(e, n);
|
|
1139
1223
|
}
|
|
1140
|
-
function
|
|
1141
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1224
|
+
function Eo(e) {
|
|
1225
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || $(e));
|
|
1142
1226
|
}
|
|
1143
|
-
function
|
|
1227
|
+
function $(e) {
|
|
1144
1228
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1145
1229
|
}
|
|
1146
|
-
function
|
|
1230
|
+
function Re(e) {
|
|
1147
1231
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1148
1232
|
}
|
|
1149
|
-
function
|
|
1150
|
-
return
|
|
1233
|
+
function Dt(e) {
|
|
1234
|
+
return !$(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1151
1235
|
}
|
|
1152
|
-
function
|
|
1153
|
-
return e.creditsRemaining === null ? null : `${
|
|
1236
|
+
function So(e) {
|
|
1237
|
+
return e.creditsRemaining === null ? null : `${ko(e.creditsRemaining)} credits left`;
|
|
1154
1238
|
}
|
|
1155
|
-
function
|
|
1239
|
+
function ko(e) {
|
|
1156
1240
|
return new Intl.NumberFormat("en-US", {
|
|
1157
1241
|
maximumFractionDigits: 0
|
|
1158
1242
|
}).format(Math.ceil(e));
|
|
1159
1243
|
}
|
|
1160
|
-
function
|
|
1244
|
+
function It(e, t, n) {
|
|
1161
1245
|
const o = document.createElement("div");
|
|
1162
|
-
return o.className = n, o.appendChild(
|
|
1246
|
+
return o.className = n, o.appendChild(pt(t, e.pricingUrl)), o.appendChild(pt("Earn credits", e.earnCreditsUrl)), o;
|
|
1163
1247
|
}
|
|
1164
|
-
function
|
|
1248
|
+
function pt(e, t) {
|
|
1165
1249
|
const n = document.createElement("button");
|
|
1166
1250
|
return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
|
|
1167
1251
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1168
1252
|
}), n;
|
|
1169
1253
|
}
|
|
1170
|
-
function
|
|
1254
|
+
function Lo(e) {
|
|
1171
1255
|
return new Promise((t, n) => {
|
|
1172
1256
|
const o = new FileReader();
|
|
1173
1257
|
o.addEventListener("load", () => {
|
|
@@ -1181,7 +1265,7 @@ function ro(e) {
|
|
|
1181
1265
|
}), o.readAsArrayBuffer(e);
|
|
1182
1266
|
});
|
|
1183
1267
|
}
|
|
1184
|
-
function
|
|
1268
|
+
function Po(e) {
|
|
1185
1269
|
return new Promise((t, n) => {
|
|
1186
1270
|
const o = new FileReader();
|
|
1187
1271
|
o.addEventListener("load", () => {
|
|
@@ -1195,112 +1279,117 @@ function lo(e) {
|
|
|
1195
1279
|
}), o.readAsDataURL(e);
|
|
1196
1280
|
});
|
|
1197
1281
|
}
|
|
1198
|
-
function
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1282
|
+
function st(e, t) {
|
|
1283
|
+
return e.messages.filter((o) => !Mt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1284
|
+
}
|
|
1285
|
+
function Ao(e, t, n, o, a, i, l, p, c, d, s, f) {
|
|
1286
|
+
const v = [...a.messages], x = v.filter((m) => !Mt(m));
|
|
1287
|
+
e.replaceChildren(), Ot(t, a.isThinking), o.hidden = !l, l && i !== null && io(o, i);
|
|
1288
|
+
const S = x.length > 0 || !!a.assistantDraft || a.isThinking;
|
|
1289
|
+
if (n.hidden = !S, x.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
|
|
1290
|
+
const m = document.createElement("div");
|
|
1291
|
+
m.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1292
|
+
const b = document.createElement("div");
|
|
1293
|
+
b.className = "pluno-pa-widget__empty-hero";
|
|
1294
|
+
const C = document.createElement("img");
|
|
1295
|
+
C.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", C.src = d(), C.alt = "", C.setAttribute("aria-hidden", "true"), b.appendChild(C), m.appendChild(b), m.appendChild(Lt());
|
|
1207
1296
|
const k = document.createElement("div");
|
|
1208
|
-
k.className =
|
|
1209
|
-
for (const
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
}), k.appendChild(
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1297
|
+
k.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true");
|
|
1298
|
+
for (const I of a.starterPrompts) {
|
|
1299
|
+
const R = document.createElement("button");
|
|
1300
|
+
R.type = "button", R.className = "pluno-pa-widget__starter-prompt", R.textContent = `"${I}"`, R.addEventListener("click", () => {
|
|
1301
|
+
s(I);
|
|
1302
|
+
}), k.appendChild(R);
|
|
1303
|
+
}
|
|
1304
|
+
m.appendChild(k), e.appendChild(m);
|
|
1216
1305
|
return;
|
|
1217
1306
|
}
|
|
1218
|
-
let
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1307
|
+
let y = null, _ = null, g = [];
|
|
1308
|
+
const h = () => {
|
|
1309
|
+
if (g.length === 0)
|
|
1221
1310
|
return !1;
|
|
1222
|
-
const
|
|
1223
|
-
return e.appendChild(
|
|
1311
|
+
const m = Fo(g, p, c, d());
|
|
1312
|
+
return e.appendChild(m), y = null, _ = m, g = [], !0;
|
|
1224
1313
|
};
|
|
1225
|
-
for (let
|
|
1226
|
-
const
|
|
1227
|
-
if (
|
|
1228
|
-
|
|
1314
|
+
for (let m = 0; m < x.length; m += 1) {
|
|
1315
|
+
const b = x[m];
|
|
1316
|
+
if (b.role === "tool") {
|
|
1317
|
+
g.push(b);
|
|
1229
1318
|
continue;
|
|
1230
1319
|
}
|
|
1231
|
-
if (
|
|
1320
|
+
if (b.role === "system")
|
|
1232
1321
|
continue;
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
const
|
|
1236
|
-
e.appendChild(
|
|
1237
|
-
}
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1322
|
+
const C = h(), k = ct(b.content);
|
|
1323
|
+
if (b.role === "assistant" && !C) {
|
|
1324
|
+
const w = Ie(d());
|
|
1325
|
+
e.appendChild(w), y = null, _ = w;
|
|
1326
|
+
}
|
|
1327
|
+
const I = document.createElement("div");
|
|
1328
|
+
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${b.role}`, b.role === "assistant" ? ut(I, k) : I.textContent = k, b.role === "user" && b.attachments?.length && I.appendChild(To(b.attachments));
|
|
1329
|
+
const R = document.createElement("div");
|
|
1330
|
+
R.className = "pluno-pa-widget__message-actions", R.appendChild(dt(k)), I.appendChild(R), e.appendChild(I), y = I, _ = null;
|
|
1242
1331
|
}
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
if (!
|
|
1246
|
-
const
|
|
1247
|
-
e.appendChild(
|
|
1248
|
-
}
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1332
|
+
const P = h();
|
|
1333
|
+
if (a.assistantDraft) {
|
|
1334
|
+
if (!P) {
|
|
1335
|
+
const k = Ie(d());
|
|
1336
|
+
e.appendChild(k), y = null, _ = k;
|
|
1337
|
+
}
|
|
1338
|
+
const m = ct(a.assistantDraft), b = document.createElement("div");
|
|
1339
|
+
b.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ut(b, m);
|
|
1340
|
+
const C = document.createElement("div");
|
|
1341
|
+
C.className = "pluno-pa-widget__message-actions", C.appendChild(dt(m)), b.appendChild(C), e.appendChild(b), y = b, _ = null;
|
|
1253
1342
|
}
|
|
1254
|
-
if (
|
|
1255
|
-
if (
|
|
1256
|
-
const
|
|
1257
|
-
e.appendChild(
|
|
1343
|
+
if (a.isThinking && !a.assistantDraft)
|
|
1344
|
+
if (P) {
|
|
1345
|
+
const m = Rt();
|
|
1346
|
+
e.appendChild(m), y = null, _ = m;
|
|
1258
1347
|
} else {
|
|
1259
|
-
const
|
|
1260
|
-
e.appendChild(
|
|
1348
|
+
const m = Uo(d());
|
|
1349
|
+
e.appendChild(m), y = null, _ = m;
|
|
1261
1350
|
}
|
|
1262
|
-
if (
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1351
|
+
if (a.lastError) {
|
|
1352
|
+
const m = document.createElement("div");
|
|
1353
|
+
m.className = "pluno-pa-widget__error", m.textContent = a.lastError, e.appendChild(m), y = m, _ = null;
|
|
1265
1354
|
}
|
|
1266
|
-
const
|
|
1267
|
-
if (
|
|
1268
|
-
const
|
|
1269
|
-
isDrafting:
|
|
1270
|
-
error:
|
|
1271
|
-
onDraft:
|
|
1272
|
-
onDismiss:
|
|
1273
|
-
onDisable:
|
|
1355
|
+
const E = f && !a.isThinking ? an(v) : null;
|
|
1356
|
+
if (f && E && !f.dismissedCandidateIds.has(E.id)) {
|
|
1357
|
+
const m = Do(E, {
|
|
1358
|
+
isDrafting: f.draftingCandidateId === E.id,
|
|
1359
|
+
error: f.error,
|
|
1360
|
+
onDraft: f.onDraft,
|
|
1361
|
+
onDismiss: f.onDismiss,
|
|
1362
|
+
onDisable: f.onDisable
|
|
1274
1363
|
});
|
|
1275
|
-
e.appendChild(
|
|
1364
|
+
e.appendChild(m), f.onSeen(E), y = null, _ = m;
|
|
1276
1365
|
}
|
|
1277
|
-
|
|
1366
|
+
y?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.scrollTop = e.scrollHeight;
|
|
1278
1367
|
}
|
|
1279
|
-
function
|
|
1280
|
-
e.replaceChildren(),
|
|
1368
|
+
function No(e, t, n, o, a, i) {
|
|
1369
|
+
e.replaceChildren(), Ot(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1281
1370
|
const l = document.createElement("div");
|
|
1282
1371
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1283
1372
|
const p = document.createElement("img");
|
|
1284
1373
|
p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = o(), p.alt = "", p.setAttribute("aria-hidden", "true"), l.appendChild(p);
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1374
|
+
const c = document.createElement("div");
|
|
1375
|
+
c.className = "pluno-pa-widget__empty", c.textContent = "Log in to use Pluno on this page.", l.appendChild(c);
|
|
1376
|
+
const d = document.createElement("button");
|
|
1377
|
+
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1289
1378
|
}
|
|
1290
|
-
function
|
|
1379
|
+
function To(e) {
|
|
1291
1380
|
const t = document.createElement("div");
|
|
1292
1381
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1293
1382
|
for (const n of e)
|
|
1294
|
-
t.appendChild(
|
|
1383
|
+
t.appendChild(mo(n));
|
|
1295
1384
|
return t;
|
|
1296
1385
|
}
|
|
1297
|
-
function
|
|
1386
|
+
function dt(e) {
|
|
1298
1387
|
const t = document.createElement("button");
|
|
1299
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1388
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(uo()), t.addEventListener("click", (n) => {
|
|
1300
1389
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1301
1390
|
}), t;
|
|
1302
1391
|
}
|
|
1303
|
-
function
|
|
1392
|
+
function Do(e, t) {
|
|
1304
1393
|
const n = document.createElement("article");
|
|
1305
1394
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1306
1395
|
const o = document.createElement("div");
|
|
@@ -1311,35 +1400,35 @@ function uo(e, t) {
|
|
|
1311
1400
|
i.textContent = "Share this win?", a.appendChild(i);
|
|
1312
1401
|
const l = document.createElement("span");
|
|
1313
1402
|
if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1403
|
+
const s = document.createElement("span");
|
|
1404
|
+
s.className = "pluno-pa-widget__share-prompt-error", s.textContent = t.error, a.appendChild(s);
|
|
1316
1405
|
}
|
|
1317
1406
|
o.appendChild(a);
|
|
1318
1407
|
const p = document.createElement("div");
|
|
1319
1408
|
p.className = "pluno-pa-widget__share-prompt-actions";
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1409
|
+
const c = document.createElement("div");
|
|
1410
|
+
c.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
1411
|
+
const d = document.createElement("button");
|
|
1412
|
+
if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
|
|
1324
1413
|
t.onDraft(e);
|
|
1325
|
-
}), t.isDrafting ? (
|
|
1326
|
-
p.appendChild(
|
|
1414
|
+
}), t.isDrafting ? (d.appendChild(Me()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
|
|
1415
|
+
p.appendChild(c);
|
|
1327
1416
|
else {
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1417
|
+
const s = document.createElement("button");
|
|
1418
|
+
s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
|
|
1330
1419
|
t.onDismiss(e);
|
|
1331
|
-
}),
|
|
1332
|
-
const
|
|
1333
|
-
|
|
1420
|
+
}), c.appendChild(s), p.appendChild(c);
|
|
1421
|
+
const f = document.createElement("button");
|
|
1422
|
+
f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
|
|
1334
1423
|
t.onDisable(e);
|
|
1335
|
-
}), p.appendChild(
|
|
1424
|
+
}), p.appendChild(f);
|
|
1336
1425
|
}
|
|
1337
1426
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1338
1427
|
}
|
|
1339
|
-
function
|
|
1428
|
+
function Io(e, t) {
|
|
1340
1429
|
const n = document.createElement("div");
|
|
1341
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1342
|
-
|
|
1430
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (_) => {
|
|
1431
|
+
_.target === n && t.onClose();
|
|
1343
1432
|
});
|
|
1344
1433
|
const o = document.createElement("section");
|
|
1345
1434
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
@@ -1349,55 +1438,55 @@ function go(e, t) {
|
|
|
1349
1438
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
|
|
1350
1439
|
const p = document.createElement("p");
|
|
1351
1440
|
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1358
|
-
const
|
|
1441
|
+
const c = document.createElement("div");
|
|
1442
|
+
c.className = "pluno-pa-widget__share-dialog-step";
|
|
1443
|
+
const d = document.createElement("div");
|
|
1444
|
+
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1445
|
+
const s = document.createElement("strong");
|
|
1446
|
+
s.textContent = "1) Copy Screenshot", d.appendChild(s);
|
|
1447
|
+
const f = Mo("Copy Screenshot", async () => {
|
|
1359
1448
|
try {
|
|
1360
|
-
return await
|
|
1449
|
+
return await rn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1361
1450
|
} catch {
|
|
1362
1451
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1363
1452
|
}
|
|
1364
1453
|
});
|
|
1365
|
-
if (
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1454
|
+
if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
|
|
1455
|
+
const _ = document.createElement("div");
|
|
1456
|
+
_.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1457
|
+
const g = document.createElement("img");
|
|
1458
|
+
g.src = e.screenshotDataUrl, g.alt = "Product page with Pluno open", _.appendChild(g), c.appendChild(_);
|
|
1370
1459
|
}
|
|
1371
|
-
o.appendChild(
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1460
|
+
o.appendChild(c), o.appendChild(p);
|
|
1461
|
+
const v = document.createElement("div");
|
|
1462
|
+
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1374
1463
|
const x = document.createElement("strong");
|
|
1375
|
-
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on",
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
for (const
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1464
|
+
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", v.appendChild(x);
|
|
1465
|
+
const S = document.createElement("p");
|
|
1466
|
+
S.className = "pluno-pa-widget__share-dialog-hint", S.textContent = "Post draft opens prefilled on supported platforms.", v.appendChild(S);
|
|
1467
|
+
const y = document.createElement("footer");
|
|
1468
|
+
y.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1469
|
+
for (const _ of Ro(e)) {
|
|
1470
|
+
const g = document.createElement("a");
|
|
1471
|
+
g.href = _.href, g.target = "_blank", g.rel = "noopener noreferrer", g.title = _.label, g.setAttribute("aria-label", `Open ${_.label}`), g.appendChild(Oo(_.id)), y.appendChild(g);
|
|
1383
1472
|
}
|
|
1384
|
-
if (
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1473
|
+
if (v.appendChild(y), o.appendChild(v), t.socialPostRewardsUrl) {
|
|
1474
|
+
const _ = document.createElement("div");
|
|
1475
|
+
_.className = "pluno-pa-widget__share-dialog-step";
|
|
1476
|
+
const g = document.createElement("strong");
|
|
1477
|
+
g.className = "pluno-pa-widget__share-dialog-step-title", g.textContent = "3) Submit post to get 2000 free credits!", _.appendChild(g);
|
|
1389
1478
|
const h = document.createElement("a");
|
|
1390
|
-
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(
|
|
1479
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Bo()), _.appendChild(h), o.appendChild(_);
|
|
1391
1480
|
}
|
|
1392
1481
|
return n.appendChild(o), n;
|
|
1393
1482
|
}
|
|
1394
|
-
function
|
|
1483
|
+
function Mo(e, t) {
|
|
1395
1484
|
const n = document.createElement("button");
|
|
1396
1485
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1397
1486
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1398
1487
|
}), n;
|
|
1399
1488
|
}
|
|
1400
|
-
function
|
|
1489
|
+
function Ro(e) {
|
|
1401
1490
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1402
1491
|
return [
|
|
1403
1492
|
{
|
|
@@ -1417,60 +1506,60 @@ function mo(e) {
|
|
|
1417
1506
|
}
|
|
1418
1507
|
];
|
|
1419
1508
|
}
|
|
1420
|
-
function
|
|
1509
|
+
function Oo(e) {
|
|
1421
1510
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1422
|
-
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (
|
|
1511
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (N(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), N(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), N(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), N(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), N(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (N(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), N(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), N(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (N(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), N(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), N(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), N(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
|
|
1423
1512
|
}
|
|
1424
|
-
function
|
|
1513
|
+
function N(e, t, n) {
|
|
1425
1514
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1426
1515
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1427
1516
|
}
|
|
1428
|
-
function
|
|
1517
|
+
function Bo() {
|
|
1429
1518
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1430
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
1519
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), N(e, "M14 5h5v5"), N(e, "M19 5l-8 8"), N(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1431
1520
|
}
|
|
1432
|
-
function
|
|
1433
|
-
return e.role === "tool" && e.toolName ===
|
|
1521
|
+
function Mt(e) {
|
|
1522
|
+
return e.role === "tool" && e.toolName === _t;
|
|
1434
1523
|
}
|
|
1435
|
-
function
|
|
1524
|
+
function ct(e) {
|
|
1436
1525
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1437
1526
|
}
|
|
1438
|
-
function
|
|
1527
|
+
function Fo(e, t, n, o) {
|
|
1439
1528
|
const a = document.createElement("article");
|
|
1440
1529
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1441
1530
|
const i = document.createElement("img");
|
|
1442
1531
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1443
|
-
const l = document.createElement("details"), p =
|
|
1532
|
+
const l = document.createElement("details"), p = zo(e);
|
|
1444
1533
|
l.open = t.has(p), l.addEventListener("toggle", () => {
|
|
1445
1534
|
l.open ? t.add(p) : t.delete(p), n();
|
|
1446
1535
|
});
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1449
|
-
const
|
|
1450
|
-
if (
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
for (const
|
|
1536
|
+
const c = document.createElement("summary");
|
|
1537
|
+
c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(Me());
|
|
1538
|
+
const s = document.createElement("span");
|
|
1539
|
+
if (s.className = "pluno-pa-widget__tool-summary-title", s.textContent = e[e.length - 1].content || "Run tool", c.appendChild(s), l.appendChild(c), e.length > 0) {
|
|
1540
|
+
const f = document.createElement("div");
|
|
1541
|
+
f.className = "pluno-pa-widget__tool-lines";
|
|
1542
|
+
for (const v of e) {
|
|
1454
1543
|
const x = document.createElement("div");
|
|
1455
|
-
x.className = "pluno-pa-widget__tool-line",
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1544
|
+
x.className = "pluno-pa-widget__tool-line", v.loading && x.appendChild(Me());
|
|
1545
|
+
const S = document.createElement("span");
|
|
1546
|
+
S.textContent = v.content || "Run tool", x.appendChild(S), f.appendChild(x);
|
|
1458
1547
|
}
|
|
1459
|
-
l.appendChild(
|
|
1548
|
+
l.appendChild(f);
|
|
1460
1549
|
}
|
|
1461
1550
|
return a.appendChild(l), a;
|
|
1462
1551
|
}
|
|
1463
|
-
function
|
|
1552
|
+
function Ie(e) {
|
|
1464
1553
|
const t = document.createElement("article");
|
|
1465
1554
|
t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1466
1555
|
const n = document.createElement("img");
|
|
1467
1556
|
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;
|
|
1468
1557
|
}
|
|
1469
|
-
function
|
|
1470
|
-
const t =
|
|
1471
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1558
|
+
function Uo(e) {
|
|
1559
|
+
const t = Ie(e);
|
|
1560
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Rt()), t;
|
|
1472
1561
|
}
|
|
1473
|
-
function
|
|
1562
|
+
function Rt() {
|
|
1474
1563
|
const e = document.createElement("div");
|
|
1475
1564
|
e.className = "pluno-pa-widget__status";
|
|
1476
1565
|
const t = document.createElement("span");
|
|
@@ -1478,17 +1567,17 @@ function Lt() {
|
|
|
1478
1567
|
const n = document.createElement("span");
|
|
1479
1568
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1480
1569
|
}
|
|
1481
|
-
function
|
|
1570
|
+
function zo(e) {
|
|
1482
1571
|
return `tools:${e.map((t) => t.id).join("|")}`;
|
|
1483
1572
|
}
|
|
1484
|
-
function
|
|
1573
|
+
function Me() {
|
|
1485
1574
|
const e = document.createElement("span");
|
|
1486
1575
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1487
1576
|
}
|
|
1488
|
-
function
|
|
1489
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1577
|
+
function Ot(e, t) {
|
|
1578
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? so() : Nt());
|
|
1490
1579
|
}
|
|
1491
|
-
function
|
|
1580
|
+
function ut(e, t) {
|
|
1492
1581
|
const n = t.replace(/\r\n/g, `
|
|
1493
1582
|
`).split(`
|
|
1494
1583
|
`);
|
|
@@ -1500,49 +1589,49 @@ function it(e, t) {
|
|
|
1500
1589
|
continue;
|
|
1501
1590
|
}
|
|
1502
1591
|
if (a.match(/^```(\w+)?\s*$/)) {
|
|
1503
|
-
const
|
|
1592
|
+
const d = [];
|
|
1504
1593
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1505
|
-
|
|
1594
|
+
d.push(n[o]), o += 1;
|
|
1506
1595
|
o += o < n.length ? 1 : 0;
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
`),
|
|
1596
|
+
const s = document.createElement("pre"), f = document.createElement("code");
|
|
1597
|
+
f.textContent = d.join(`
|
|
1598
|
+
`), s.appendChild(f), e.appendChild(s);
|
|
1510
1599
|
continue;
|
|
1511
1600
|
}
|
|
1512
1601
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1513
1602
|
if (l) {
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1603
|
+
const d = document.createElement(`h${l[1].length + 2}`);
|
|
1604
|
+
de(d, l[2]), e.appendChild(d), o += 1;
|
|
1516
1605
|
continue;
|
|
1517
1606
|
}
|
|
1518
1607
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1519
|
-
const
|
|
1608
|
+
const d = document.createElement("ul");
|
|
1520
1609
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1610
|
+
const s = document.createElement("li");
|
|
1611
|
+
de(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
|
|
1523
1612
|
}
|
|
1524
|
-
e.appendChild(
|
|
1613
|
+
e.appendChild(d);
|
|
1525
1614
|
continue;
|
|
1526
1615
|
}
|
|
1527
1616
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1528
|
-
const
|
|
1617
|
+
const d = document.createElement("ol");
|
|
1529
1618
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1619
|
+
const s = document.createElement("li");
|
|
1620
|
+
de(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
|
|
1532
1621
|
}
|
|
1533
|
-
e.appendChild(
|
|
1622
|
+
e.appendChild(d);
|
|
1534
1623
|
continue;
|
|
1535
1624
|
}
|
|
1536
1625
|
const p = [a];
|
|
1537
1626
|
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]); )
|
|
1538
1627
|
p.push(n[o]), o += 1;
|
|
1539
|
-
const
|
|
1540
|
-
p.forEach((
|
|
1541
|
-
|
|
1542
|
-
}), e.appendChild(
|
|
1628
|
+
const c = document.createElement("p");
|
|
1629
|
+
p.forEach((d, s) => {
|
|
1630
|
+
s > 0 && c.appendChild(document.createElement("br")), de(c, d);
|
|
1631
|
+
}), e.appendChild(c);
|
|
1543
1632
|
}
|
|
1544
1633
|
}
|
|
1545
|
-
function
|
|
1634
|
+
function de(e, t) {
|
|
1546
1635
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1547
1636
|
let o = 0;
|
|
1548
1637
|
for (const a of t.matchAll(n)) {
|
|
@@ -1560,9 +1649,9 @@ function pe(e, t) {
|
|
|
1560
1649
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
1561
1650
|
} else {
|
|
1562
1651
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1563
|
-
if (p &&
|
|
1564
|
-
const
|
|
1565
|
-
|
|
1652
|
+
if (p && Go(p[2])) {
|
|
1653
|
+
const c = document.createElement("a");
|
|
1654
|
+
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
1566
1655
|
} else
|
|
1567
1656
|
e.appendChild(document.createTextNode(l));
|
|
1568
1657
|
}
|
|
@@ -1570,7 +1659,7 @@ function pe(e, t) {
|
|
|
1570
1659
|
}
|
|
1571
1660
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1572
1661
|
}
|
|
1573
|
-
function
|
|
1662
|
+
function Go(e) {
|
|
1574
1663
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1575
1664
|
return !0;
|
|
1576
1665
|
try {
|
|
@@ -1580,8 +1669,8 @@ function vo(e) {
|
|
|
1580
1669
|
return !1;
|
|
1581
1670
|
}
|
|
1582
1671
|
}
|
|
1583
|
-
function
|
|
1584
|
-
if (
|
|
1672
|
+
function gt(e, t) {
|
|
1673
|
+
if ($o(e))
|
|
1585
1674
|
return;
|
|
1586
1675
|
const n = `
|
|
1587
1676
|
:host {
|
|
@@ -1634,7 +1723,7 @@ function rt(e, t) {
|
|
|
1634
1723
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1635
1724
|
position: fixed;
|
|
1636
1725
|
z-index: 2147483645;
|
|
1637
|
-
font-family: ${
|
|
1726
|
+
font-family: ${U.fontFamily};
|
|
1638
1727
|
font-size: 14px;
|
|
1639
1728
|
color: var(--pluno-pa-text);
|
|
1640
1729
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -1730,6 +1819,10 @@ function rt(e, t) {
|
|
|
1730
1819
|
.pluno-pa-widget--dragging .pluno-pa-widget__launcher-drag-handle {
|
|
1731
1820
|
cursor: grabbing;
|
|
1732
1821
|
}
|
|
1822
|
+
.pluno-pa-widget--dragging .pluno-pa-widget__launcher,
|
|
1823
|
+
.pluno-pa-widget--dragging .pluno-pa-widget__launcher-input {
|
|
1824
|
+
cursor: grabbing;
|
|
1825
|
+
}
|
|
1733
1826
|
.pluno-pa-widget__launcher-drag-handle:focus-visible {
|
|
1734
1827
|
outline: 2px solid var(--pluno-pa-accent);
|
|
1735
1828
|
outline-offset: 2px;
|
|
@@ -2336,7 +2429,7 @@ function rt(e, t) {
|
|
|
2336
2429
|
place-items: center;
|
|
2337
2430
|
padding: 18px;
|
|
2338
2431
|
background: rgba(24, 24, 27, 0.28);
|
|
2339
|
-
font-family: var(--pluno-pa-font, ${
|
|
2432
|
+
font-family: var(--pluno-pa-font, ${U.fontFamily});
|
|
2340
2433
|
color: var(--pluno-pa-text);
|
|
2341
2434
|
}
|
|
2342
2435
|
.pluno-pa-widget__share-dialog {
|
|
@@ -2832,6 +2925,39 @@ function rt(e, t) {
|
|
|
2832
2925
|
line-height: 1.34;
|
|
2833
2926
|
text-align: left;
|
|
2834
2927
|
}
|
|
2928
|
+
.pluno-pa-widget__empty-hero {
|
|
2929
|
+
display: inline-flex;
|
|
2930
|
+
align-items: center;
|
|
2931
|
+
gap: 16px;
|
|
2932
|
+
}
|
|
2933
|
+
.pluno-pa-widget__empty-hero .pluno-pa-widget__character--empty {
|
|
2934
|
+
margin-bottom: 0;
|
|
2935
|
+
}
|
|
2936
|
+
.pluno-pa-widget__active-users-counter {
|
|
2937
|
+
position: absolute;
|
|
2938
|
+
top: 18px;
|
|
2939
|
+
left: 50%;
|
|
2940
|
+
z-index: 2;
|
|
2941
|
+
display: inline-flex;
|
|
2942
|
+
align-items: center;
|
|
2943
|
+
justify-content: center;
|
|
2944
|
+
gap: 7px;
|
|
2945
|
+
transform: translateX(-50%);
|
|
2946
|
+
color: color-mix(in srgb, var(--pluno-pa-text) 62%, transparent);
|
|
2947
|
+
font-size: 13px;
|
|
2948
|
+
font-weight: 600;
|
|
2949
|
+
line-height: 1.3;
|
|
2950
|
+
font-variant-numeric: tabular-nums;
|
|
2951
|
+
text-align: center;
|
|
2952
|
+
text-transform: lowercase;
|
|
2953
|
+
}
|
|
2954
|
+
.pluno-pa-widget__active-users-counter-dot {
|
|
2955
|
+
width: 7px;
|
|
2956
|
+
height: 7px;
|
|
2957
|
+
border-radius: 999px;
|
|
2958
|
+
background: #22c55e;
|
|
2959
|
+
box-shadow: 0 0 0 4px rgb(34 197 94 / 10%);
|
|
2960
|
+
}
|
|
2835
2961
|
.pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
|
|
2836
2962
|
margin-bottom: -24px;
|
|
2837
2963
|
}
|
|
@@ -2972,7 +3098,7 @@ function rt(e, t) {
|
|
|
2972
3098
|
right: 16px;
|
|
2973
3099
|
height: 36px;
|
|
2974
3100
|
z-index: 3;
|
|
2975
|
-
background-image: url('${
|
|
3101
|
+
background-image: url('${Je}');
|
|
2976
3102
|
background-repeat: repeat-x;
|
|
2977
3103
|
background-size: 104px 36px;
|
|
2978
3104
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3014,7 +3140,7 @@ function rt(e, t) {
|
|
|
3014
3140
|
height: 160px;
|
|
3015
3141
|
}
|
|
3016
3142
|
.pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
|
|
3017
|
-
margin-bottom:
|
|
3143
|
+
margin-bottom: 0;
|
|
3018
3144
|
}
|
|
3019
3145
|
.pluno-pa-widget--scribble .pluno-pa-widget__character--tool-group {
|
|
3020
3146
|
width: 60px;
|
|
@@ -3219,7 +3345,7 @@ function rt(e, t) {
|
|
|
3219
3345
|
right: 12px;
|
|
3220
3346
|
height: 22px;
|
|
3221
3347
|
z-index: 1;
|
|
3222
|
-
background-image: url('${
|
|
3348
|
+
background-image: url('${Je}');
|
|
3223
3349
|
background-repeat: repeat-x;
|
|
3224
3350
|
background-size: 62px 21.5px;
|
|
3225
3351
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3232,28 +3358,28 @@ function rt(e, t) {
|
|
|
3232
3358
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3233
3359
|
}
|
|
3234
3360
|
`;
|
|
3235
|
-
if (
|
|
3361
|
+
if (Ho(e, n))
|
|
3236
3362
|
return;
|
|
3237
3363
|
const o = e.ownerDocument.createElement("style");
|
|
3238
|
-
o.id =
|
|
3364
|
+
o.id = Et, o.textContent = n, e.appendChild(o), Bt(e);
|
|
3239
3365
|
}
|
|
3240
|
-
function
|
|
3241
|
-
return e.getElementById(
|
|
3366
|
+
function $o(e) {
|
|
3367
|
+
return e.getElementById(Et) !== null || e.host instanceof HTMLElement && e.host.getAttribute(St) === "true";
|
|
3242
3368
|
}
|
|
3243
|
-
function
|
|
3244
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3369
|
+
function Bt(e) {
|
|
3370
|
+
e.host instanceof HTMLElement && e.host.setAttribute(St, "true");
|
|
3245
3371
|
}
|
|
3246
|
-
function
|
|
3372
|
+
function Ho(e, t) {
|
|
3247
3373
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3248
3374
|
return !1;
|
|
3249
3375
|
try {
|
|
3250
3376
|
const n = new CSSStyleSheet();
|
|
3251
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3377
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Bt(e), !0;
|
|
3252
3378
|
} catch {
|
|
3253
3379
|
return !1;
|
|
3254
3380
|
}
|
|
3255
3381
|
}
|
|
3256
|
-
async function
|
|
3382
|
+
async function Wo() {
|
|
3257
3383
|
return document.body ? document.body : await new Promise((e) => {
|
|
3258
3384
|
const t = new MutationObserver(() => {
|
|
3259
3385
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3261,49 +3387,49 @@ async function ko() {
|
|
|
3261
3387
|
t.observe(document.documentElement, { childList: !0 });
|
|
3262
3388
|
});
|
|
3263
3389
|
}
|
|
3264
|
-
function
|
|
3390
|
+
function Ft(e) {
|
|
3265
3391
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3266
3392
|
}
|
|
3267
|
-
function
|
|
3393
|
+
function Vo(e) {
|
|
3268
3394
|
try {
|
|
3269
|
-
const t = window.localStorage.getItem(
|
|
3395
|
+
const t = window.localStorage.getItem(Ft(e));
|
|
3270
3396
|
if (!t)
|
|
3271
|
-
return
|
|
3397
|
+
return ht();
|
|
3272
3398
|
const n = JSON.parse(t);
|
|
3273
3399
|
return {
|
|
3274
3400
|
isOpen: n.isOpen === !0,
|
|
3275
3401
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3276
3402
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3277
|
-
launcherPosition:
|
|
3278
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3403
|
+
launcherPosition: Yo(n.launcherPosition) ? n.launcherPosition : null,
|
|
3404
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-xt) : [],
|
|
3279
3405
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3280
3406
|
};
|
|
3281
3407
|
} catch {
|
|
3282
|
-
return
|
|
3408
|
+
return ht();
|
|
3283
3409
|
}
|
|
3284
3410
|
}
|
|
3285
|
-
async function
|
|
3411
|
+
async function jo(e) {
|
|
3286
3412
|
if (e.loadSharePromptsDisabled)
|
|
3287
3413
|
return e.loadSharePromptsDisabled();
|
|
3288
3414
|
try {
|
|
3289
|
-
return window.localStorage.getItem(
|
|
3415
|
+
return window.localStorage.getItem(vt) === "true";
|
|
3290
3416
|
} catch {
|
|
3291
3417
|
return !1;
|
|
3292
3418
|
}
|
|
3293
3419
|
}
|
|
3294
|
-
function
|
|
3420
|
+
function qo(e, t) {
|
|
3295
3421
|
if (e.persistSharePromptsDisabled) {
|
|
3296
3422
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3297
3423
|
});
|
|
3298
3424
|
return;
|
|
3299
3425
|
}
|
|
3300
3426
|
try {
|
|
3301
|
-
t && window.localStorage.setItem(
|
|
3427
|
+
t && window.localStorage.setItem(vt, "true");
|
|
3302
3428
|
} catch {
|
|
3303
3429
|
return;
|
|
3304
3430
|
}
|
|
3305
3431
|
}
|
|
3306
|
-
function
|
|
3432
|
+
function ht() {
|
|
3307
3433
|
return {
|
|
3308
3434
|
isOpen: !1,
|
|
3309
3435
|
composerValue: "",
|
|
@@ -3313,43 +3439,43 @@ function lt() {
|
|
|
3313
3439
|
sharePromptsDisabled: !1
|
|
3314
3440
|
};
|
|
3315
3441
|
}
|
|
3316
|
-
function
|
|
3442
|
+
function Ko(e, t) {
|
|
3317
3443
|
try {
|
|
3318
|
-
window.localStorage.setItem(
|
|
3444
|
+
window.localStorage.setItem(Ft(e), JSON.stringify(t));
|
|
3319
3445
|
} catch {
|
|
3320
3446
|
return;
|
|
3321
3447
|
}
|
|
3322
3448
|
}
|
|
3323
|
-
function
|
|
3449
|
+
function Yo(e) {
|
|
3324
3450
|
if (!e || typeof e != "object")
|
|
3325
3451
|
return !1;
|
|
3326
3452
|
const t = e;
|
|
3327
3453
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3328
3454
|
}
|
|
3329
|
-
const
|
|
3330
|
-
function
|
|
3455
|
+
const mt = /* @__PURE__ */ new WeakSet();
|
|
3456
|
+
function Xo(e) {
|
|
3331
3457
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3332
3458
|
}
|
|
3333
|
-
function
|
|
3459
|
+
function ft(e) {
|
|
3334
3460
|
const t = e.pathname.split("/");
|
|
3335
3461
|
return t[t.length - 1] ?? "";
|
|
3336
3462
|
}
|
|
3337
|
-
function
|
|
3463
|
+
function Zo(e, t) {
|
|
3338
3464
|
const n = new URL(e.src, document.baseURI);
|
|
3339
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3465
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : ft(n) === ft(t);
|
|
3340
3466
|
}
|
|
3341
|
-
class
|
|
3467
|
+
class z extends EventTarget {
|
|
3342
3468
|
constructor(t, n) {
|
|
3343
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3344
|
-
this.readyState =
|
|
3345
|
-
}), this.addPreviewListener(
|
|
3469
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Cn, () => {
|
|
3470
|
+
this.readyState = z.OPEN, this.dispatchEvent(new Event("open"));
|
|
3471
|
+
}), this.addPreviewListener(En, (o) => {
|
|
3346
3472
|
const a = o;
|
|
3347
3473
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3348
|
-
}), this.addPreviewListener(
|
|
3349
|
-
this.readyState =
|
|
3350
|
-
}), this.addPreviewListener(
|
|
3474
|
+
}), this.addPreviewListener(Sn, () => {
|
|
3475
|
+
this.readyState = z.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3476
|
+
}), this.addPreviewListener(kn, (o) => {
|
|
3351
3477
|
const a = o;
|
|
3352
|
-
this.readyState =
|
|
3478
|
+
this.readyState = z.CLOSED, this.dispatchEvent(
|
|
3353
3479
|
new CloseEvent("close", {
|
|
3354
3480
|
code: a.detail?.code ?? 1e3,
|
|
3355
3481
|
reason: a.detail?.reason ?? "",
|
|
@@ -3357,7 +3483,7 @@ class O extends EventTarget {
|
|
|
3357
3483
|
})
|
|
3358
3484
|
), this.cleanup();
|
|
3359
3485
|
}), window.dispatchEvent(
|
|
3360
|
-
new CustomEvent(
|
|
3486
|
+
new CustomEvent(ce(xn, this.channelId), {
|
|
3361
3487
|
detail: { socketId: this.socketId, url: t }
|
|
3362
3488
|
})
|
|
3363
3489
|
);
|
|
@@ -3372,27 +3498,27 @@ class O extends EventTarget {
|
|
|
3372
3498
|
extensions = "";
|
|
3373
3499
|
binaryType = "blob";
|
|
3374
3500
|
bufferedAmount = 0;
|
|
3375
|
-
readyState =
|
|
3376
|
-
socketId =
|
|
3501
|
+
readyState = z.CONNECTING;
|
|
3502
|
+
socketId = Jo();
|
|
3377
3503
|
listeners = /* @__PURE__ */ new Map();
|
|
3378
3504
|
send(t) {
|
|
3379
|
-
if (this.readyState !==
|
|
3505
|
+
if (this.readyState !== z.OPEN)
|
|
3380
3506
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3381
3507
|
window.dispatchEvent(
|
|
3382
|
-
new CustomEvent(
|
|
3508
|
+
new CustomEvent(ce(vn, this.channelId), {
|
|
3383
3509
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3384
3510
|
})
|
|
3385
3511
|
);
|
|
3386
3512
|
}
|
|
3387
3513
|
close(t, n) {
|
|
3388
|
-
this.readyState !==
|
|
3389
|
-
new CustomEvent(
|
|
3514
|
+
this.readyState !== z.CLOSED && (this.readyState = z.CLOSING, window.dispatchEvent(
|
|
3515
|
+
new CustomEvent(ce(yn, this.channelId), {
|
|
3390
3516
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3391
3517
|
})
|
|
3392
3518
|
), this.cleanup());
|
|
3393
3519
|
}
|
|
3394
3520
|
addPreviewListener(t, n) {
|
|
3395
|
-
const o =
|
|
3521
|
+
const o = ce(t, this.channelId), a = (i) => {
|
|
3396
3522
|
i.detail?.socketId === this.socketId && n(i);
|
|
3397
3523
|
};
|
|
3398
3524
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -3403,36 +3529,36 @@ class O extends EventTarget {
|
|
|
3403
3529
|
this.listeners.clear();
|
|
3404
3530
|
}
|
|
3405
3531
|
}
|
|
3406
|
-
function
|
|
3407
|
-
const e = window.sessionStorage.getItem(
|
|
3532
|
+
function Jo() {
|
|
3533
|
+
const e = window.sessionStorage.getItem(Ze);
|
|
3408
3534
|
if (e)
|
|
3409
3535
|
return e;
|
|
3410
3536
|
const t = crypto.randomUUID();
|
|
3411
|
-
return window.sessionStorage.setItem(
|
|
3537
|
+
return window.sessionStorage.setItem(Ze, t), t;
|
|
3412
3538
|
}
|
|
3413
|
-
function
|
|
3539
|
+
function ce(e, t) {
|
|
3414
3540
|
return `${e}:${t}`;
|
|
3415
3541
|
}
|
|
3416
|
-
function
|
|
3542
|
+
function Qo(e) {
|
|
3417
3543
|
const t = document.currentScript;
|
|
3418
3544
|
if (t instanceof HTMLScriptElement)
|
|
3419
3545
|
return [t];
|
|
3420
3546
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3421
3547
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3422
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3548
|
+
(a) => a instanceof HTMLScriptElement && Xo(a) && Zo(a, o)
|
|
3423
3549
|
);
|
|
3424
3550
|
}
|
|
3425
|
-
function
|
|
3426
|
-
for (const t of
|
|
3427
|
-
if (
|
|
3551
|
+
function ea(e) {
|
|
3552
|
+
for (const t of Qo(e)) {
|
|
3553
|
+
if (mt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3428
3554
|
continue;
|
|
3429
|
-
|
|
3555
|
+
mt.add(t);
|
|
3430
3556
|
const n = t.dataset.plunoPreviewChannel;
|
|
3431
|
-
|
|
3557
|
+
Vn({
|
|
3432
3558
|
token: t.dataset.plunoToken,
|
|
3433
3559
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3434
3560
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3435
|
-
webSocketFactory: n ?
|
|
3561
|
+
webSocketFactory: n ? Wn(n) : void 0,
|
|
3436
3562
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3437
3563
|
accentColor: t.dataset.plunoAccentColor,
|
|
3438
3564
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3444,8 +3570,8 @@ function Ro(e) {
|
|
|
3444
3570
|
});
|
|
3445
3571
|
}
|
|
3446
3572
|
}
|
|
3447
|
-
|
|
3573
|
+
ea(import.meta.url);
|
|
3448
3574
|
export {
|
|
3449
|
-
|
|
3450
|
-
|
|
3575
|
+
Wn as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3576
|
+
Vn as mountPlunoProductAgentWidget
|
|
3451
3577
|
};
|