@pluno/product-agent-web 0.1.22 → 0.1.24
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/index.d.ts +19 -0
- package/dist/product-agent-sdk.js +241 -190
- package/dist/product-agent-widget.js +832 -641
- package/dist/widget.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const e =
|
|
1
|
+
import { PlunoProductAgent as Ot } from "./product-agent-sdk.js";
|
|
2
|
+
const Bt = "#7c3aed";
|
|
3
|
+
function Ft(t) {
|
|
4
|
+
const e = Ht(t);
|
|
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 kt(t) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function zt(t) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(Ft(t))}`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const e =
|
|
84
|
-
if (
|
|
81
|
+
const j = "#2c2a1e", $e = [253, 250, 241], He = 3.5;
|
|
82
|
+
function dt(t) {
|
|
83
|
+
const e = ct(t);
|
|
84
|
+
if (We(te(e), $e) >= He)
|
|
85
85
|
return e;
|
|
86
|
-
let o =
|
|
87
|
-
const a =
|
|
88
|
-
for (let
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
function
|
|
94
|
-
const e =
|
|
86
|
+
let o = te(e);
|
|
87
|
+
const a = te(j);
|
|
88
|
+
for (let i = 0; i < 6; i += 1)
|
|
89
|
+
if (o = Wt(o, a, 0.22), We(o, $e) >= He)
|
|
90
|
+
return Ce(o);
|
|
91
|
+
return Ce(o);
|
|
92
|
+
}
|
|
93
|
+
function Gt(t) {
|
|
94
|
+
const e = dt(t), 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,35 +104,35 @@ function Lt(t) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${$t()}" fill="none" stroke="${e}" 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="${j}" 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="${j}" stroke-width="13"/>
|
|
112
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${j}"/>
|
|
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="${j}" stroke-width="13"/>
|
|
117
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${j}"/>
|
|
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 Ut(t) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(Gt(t))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function $t() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
|
-
for (let
|
|
128
|
+
for (let i = 150; i <= 1170; i += 62) {
|
|
129
129
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
130
|
-
n += ` L ${p} ${
|
|
130
|
+
n += ` L ${p} ${i}`, o = !o, a += 1;
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const e =
|
|
134
|
+
function Ht(t) {
|
|
135
|
+
const e = ct(t), n = Ee(te(e));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -156,90 +156,90 @@ function Nt(t) {
|
|
|
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: I(e, 0.28, -0.03),
|
|
160
|
+
middle: I(e, 0.08, 0.04),
|
|
161
|
+
bottom: I(e, -0.1, 0.02),
|
|
162
|
+
edgeStart: I(e, 0.08, 0.08),
|
|
163
|
+
edgeMiddle: I(e, -0.08, 0.08),
|
|
164
|
+
edgeEnd: I(e, -0.18, 0.05),
|
|
165
|
+
glow: I(e, 0.32, -0.12),
|
|
166
|
+
highlight: I(e, 0.38, -0.18),
|
|
167
|
+
inner: I(e, 0.24, -0.1),
|
|
168
|
+
shadow: I(e, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function ct(t) {
|
|
172
172
|
const e = t.trim();
|
|
173
|
-
return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
173
|
+
return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Bt;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function te(t) {
|
|
176
176
|
return [
|
|
177
177
|
Number.parseInt(t.slice(1, 3), 16),
|
|
178
178
|
Number.parseInt(t.slice(3, 5), 16),
|
|
179
179
|
Number.parseInt(t.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Ce([t, e, n]) {
|
|
183
183
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
184
|
return `#${o(t)}${o(e)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Ee([t, e, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
|
-
const
|
|
189
|
-
return
|
|
188
|
+
const i = a / 255;
|
|
189
|
+
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
191
|
return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
195
|
-
return (a + 0.05) / (
|
|
193
|
+
function We(t, e) {
|
|
194
|
+
const n = Ee(t), o = Ee(e), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
|
+
return (a + 0.05) / (i + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
197
|
+
function Wt(t, e, n) {
|
|
198
|
+
const o = ke(n);
|
|
199
199
|
return [
|
|
200
200
|
t[0] + (e[0] - t[0]) * o,
|
|
201
201
|
t[1] + (e[1] - t[1]) * o,
|
|
202
202
|
t[2] + (e[2] - t[2]) * o
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const [o, a,
|
|
207
|
-
return
|
|
205
|
+
function I(t, e, n) {
|
|
206
|
+
const [o, a, i] = Vt(te(t));
|
|
207
|
+
return Ce(qt(o, ke(a + n), ke(i + e)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
const o = t / 255, a = e / 255,
|
|
209
|
+
function Vt([t, e, n]) {
|
|
210
|
+
const o = t / 255, a = e / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), s = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
212
|
return [0, 0, s];
|
|
213
|
-
const g = l - p,
|
|
214
|
-
return [(l === o ? (a -
|
|
213
|
+
const g = l - p, u = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
214
|
+
return [(l === o ? (a - i) / g + (a < i ? 6 : 0) : l === a ? (i - o) / g + 2 : (o - a) / g + 4) / 6, u, s];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function qt(t, e, n) {
|
|
217
217
|
if (e === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
219
|
const o = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
we(a, o, t + 1 / 3) * 255,
|
|
222
|
+
we(a, o, t) * 255,
|
|
223
|
+
we(a, o, t - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function we(t, e, n) {
|
|
227
227
|
let o = n;
|
|
228
228
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? t + (e - t) * 6 * o : o < 1 / 2 ? e : o < 2 / 3 ? t + (e - t) * (2 / 3 - o) * 6 : t;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function ke(t) {
|
|
231
231
|
return Math.max(0, Math.min(1, t));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
233
|
+
const ut = "suggest_share_on_socials";
|
|
234
|
+
function jt(t) {
|
|
235
235
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
236
236
|
const n = t[e];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== ut)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = Ve(t, e, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = Ve(t, 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 Mt(t) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
252
|
-
const e = await
|
|
251
|
+
async function Kt(t) {
|
|
252
|
+
const e = await Yt(t);
|
|
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({ [e.type || "image/png"]: e })]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ve(t, e, n) {
|
|
258
258
|
for (let o = e - 1; o >= 0; o -= 1) {
|
|
259
259
|
const a = t[o];
|
|
260
260
|
if (a.role === n && a.content.trim())
|
|
@@ -262,10 +262,10 @@ function Me(t, e, n) {
|
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function
|
|
265
|
+
async function Yt(t) {
|
|
266
266
|
return await (await fetch(t)).blob();
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const gt = 100, Xt = "product-agent:sdk-preview-socket-connect", Zt = "product-agent:sdk-preview-socket-send", Jt = "product-agent:sdk-preview-socket-close", Qt = "product-agent:sdk-preview-socket-open", en = "product-agent:sdk-preview-socket-message", tn = "product-agent:sdk-preview-socket-error", nn = "product-agent:sdk-preview-socket-closed", qe = "product-agent:sdk-preview-socket-id", on = "product-agent:preview-diagnostic", ht = "pluno.productAgent.sharePromptsDisabled", de = 10, an = 10 * 1024 * 1024, rn = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), M = {
|
|
269
269
|
launcherLabel: "Ask for anything...",
|
|
270
270
|
accentColor: "#7c3aed",
|
|
271
271
|
colorScheme: "light",
|
|
@@ -273,11 +273,11 @@ const ot = 100, Ft = "product-agent:sdk-preview-socket-connect", Bt = "product-a
|
|
|
273
273
|
scribbleStyle: !1,
|
|
274
274
|
position: "bottom-right",
|
|
275
275
|
movableLauncher: !1
|
|
276
|
-
},
|
|
277
|
-
function
|
|
278
|
-
return (e) => new
|
|
276
|
+
}, 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>', ln = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Ke = "pluno-pa-scribble-font", mt = 190, ft = 41, pn = 48, sn = 420, dn = 520, cn = 0.24, un = 680, gn = 800, hn = 0.76, A = 8, Se = 50, mn = "http://www.w3.org/2000/svg", fn = 11, bn = 13, wn = 4, _n = 10, xn = 40, vn = "movable-launcher-position-v2";
|
|
277
|
+
function yn(t) {
|
|
278
|
+
return (e) => new O(e, t);
|
|
279
279
|
}
|
|
280
|
-
async function
|
|
280
|
+
async function Cn(t = {}) {
|
|
281
281
|
const e = {
|
|
282
282
|
launcherLabel: t.launcherLabel ?? M.launcherLabel,
|
|
283
283
|
accentColor: t.accentColor ?? M.accentColor,
|
|
@@ -292,16 +292,21 @@ async function rn(t = {}) {
|
|
|
292
292
|
backendUrl: t.backendUrl,
|
|
293
293
|
metadata: t.metadata,
|
|
294
294
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
295
|
+
clientId: t.clientId,
|
|
296
|
+
restorePersistedState: t.restorePersistedState,
|
|
297
|
+
expectedPersistedSessionId: t.expectedPersistedSessionId,
|
|
295
298
|
webSocketFactory: t.webSocketFactory,
|
|
296
299
|
loginRequired: t.loginRequired === !0,
|
|
297
300
|
loginButtonLabel: t.loginButtonLabel ?? "Log in to Pluno",
|
|
298
301
|
onLoginClick: t.onLoginClick,
|
|
299
302
|
socialPostDraftHandler: t.socialPostDraftHandler,
|
|
303
|
+
billingStatus: t.billingStatus ?? null,
|
|
304
|
+
billingStatusLoader: t.billingStatusLoader,
|
|
300
305
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
301
306
|
loadSharePromptsDisabled: t.loadSharePromptsDisabled,
|
|
302
307
|
persistSharePromptsDisabled: t.persistSharePromptsDisabled
|
|
303
308
|
};
|
|
304
|
-
|
|
309
|
+
U("web-sdk.widget", "Mounting widget with merged options", {
|
|
305
310
|
accentColor: e.accentColor,
|
|
306
311
|
colorScheme: e.colorScheme,
|
|
307
312
|
fontFamily: e.fontFamily,
|
|
@@ -313,89 +318,92 @@ async function rn(t = {}) {
|
|
|
313
318
|
initialStarterPromptCount: e.initialStarterPrompts?.length ?? 0
|
|
314
319
|
});
|
|
315
320
|
const n = document.createElement("div");
|
|
316
|
-
n.className = "pluno-pa-widget-host";
|
|
321
|
+
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
317
322
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
318
|
-
a.className = `pluno-pa-widget pluno-pa-widget--${e.position}
|
|
319
|
-
let
|
|
320
|
-
|
|
321
|
-
const l = await
|
|
322
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`),
|
|
323
|
+
a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
324
|
+
let i = Ye(e.accentColor, e.scribbleStyle);
|
|
325
|
+
Tn(a, e.launcherLabel, i, e.movableLauncher), o.appendChild(a);
|
|
326
|
+
const l = await xo(), p = l.ownerDocument;
|
|
327
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), rt(o, e.accentColor), Xe(a, i, {
|
|
323
328
|
accentColor: e.accentColor,
|
|
324
329
|
colorScheme: e.colorScheme,
|
|
325
330
|
fontFamily: e.fontFamily,
|
|
326
331
|
scribbleStyle: e.scribbleStyle
|
|
327
|
-
}),
|
|
332
|
+
}), U("web-sdk.widget", "Applied initial widget appearance", {
|
|
328
333
|
accentColor: e.accentColor,
|
|
329
334
|
colorScheme: e.colorScheme,
|
|
330
335
|
fontFamily: e.fontFamily,
|
|
331
336
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
332
337
|
});
|
|
333
|
-
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"),
|
|
334
|
-
if (!s || !
|
|
338
|
+
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), u = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), w = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), m = a.querySelector(".pluno-pa-widget__billing-status"), f = a.querySelector(".pluno-pa-widget__attachments"), d = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), _ = a.querySelector(".pluno-pa-widget__new-chat"), k = a.querySelector(".pluno-pa-widget__timeline");
|
|
339
|
+
if (!s || !u || !b || !w || !x || !C || !m || !f || !d || !h || !_ || !k)
|
|
335
340
|
throw new Error("Failed to mount Pluno widget");
|
|
336
341
|
if (e.movableLauncher && !g)
|
|
337
342
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
338
|
-
|
|
339
|
-
let v = [],
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
v = v.filter((
|
|
343
|
+
Qe(u), Qe(d);
|
|
344
|
+
let v = [], y = null;
|
|
345
|
+
const T = () => {
|
|
346
|
+
Hn(f, v, (r) => {
|
|
347
|
+
v = v.filter((c, L) => L !== r), T(), D();
|
|
343
348
|
});
|
|
344
|
-
},
|
|
349
|
+
}, ne = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
|
|
345
350
|
if (!e.tokenEndpoint)
|
|
346
351
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
347
|
-
const
|
|
352
|
+
const r = await fetch(e.tokenEndpoint, {
|
|
348
353
|
method: "POST",
|
|
349
354
|
credentials: "include",
|
|
350
355
|
headers: { "content-type": "application/json" },
|
|
351
356
|
body: JSON.stringify({ origin: location.origin, url: location.href })
|
|
352
357
|
});
|
|
353
|
-
if (!
|
|
358
|
+
if (!r.ok)
|
|
354
359
|
throw new Error("Failed to load Pluno token");
|
|
355
|
-
const
|
|
356
|
-
if (!
|
|
360
|
+
const c = await r.json();
|
|
361
|
+
if (!c.token)
|
|
357
362
|
throw new Error("Pluno token endpoint did not return a token");
|
|
358
|
-
return
|
|
363
|
+
return c.token;
|
|
359
364
|
});
|
|
360
|
-
let
|
|
361
|
-
|
|
365
|
+
let E;
|
|
366
|
+
E = await Ot.init({
|
|
362
367
|
token: e.token,
|
|
363
|
-
tokenProvider:
|
|
368
|
+
tokenProvider: ne,
|
|
364
369
|
backendUrl: e.backendUrl,
|
|
365
370
|
metadata: () => ({
|
|
366
371
|
...e.metadata ?? {},
|
|
367
|
-
...!
|
|
372
|
+
...!E.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
368
373
|
}),
|
|
369
374
|
initialStarterPrompts: e.initialStarterPrompts,
|
|
375
|
+
clientId: e.clientId,
|
|
376
|
+
restorePersistedState: e.restorePersistedState,
|
|
377
|
+
expectedPersistedSessionId: e.expectedPersistedSessionId,
|
|
370
378
|
webSocketFactory: e.webSocketFactory,
|
|
371
379
|
autoConnect: e.loginRequired ? !1 : void 0
|
|
372
380
|
});
|
|
373
|
-
const
|
|
374
|
-
let
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
return
|
|
381
|
+
const z = vo(e), ce = new Set(z.openToolGroupKeys), $ = new Set(z.seenShareCandidateIds), oe = new Set($);
|
|
382
|
+
let ue = z.sharePromptsDisabled || await yo(e), R = e.movableLauncher ? z.launcherPosition : null, Te = R !== null, B = null, Ie = !1;
|
|
383
|
+
const Pt = () => {
|
|
384
|
+
Ie || typeof document > "u" || (rt(o, e.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
385
|
+
}, Re = new MutationObserver(Pt);
|
|
386
|
+
Re.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
387
|
+
const ge = (r = !0) => {
|
|
388
|
+
const c = Le(a, r);
|
|
389
|
+
return Ze(
|
|
382
390
|
a,
|
|
383
|
-
|
|
384
|
-
|
|
391
|
+
R ?? Sn(a, e.position, c),
|
|
392
|
+
c
|
|
385
393
|
);
|
|
386
|
-
},
|
|
387
|
-
|
|
394
|
+
}, N = () => {
|
|
395
|
+
Eo(e, {
|
|
388
396
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
389
397
|
composerValue: d.value,
|
|
390
|
-
openToolGroupKeys: [...
|
|
391
|
-
launcherPosition:
|
|
392
|
-
seenShareCandidateIds: [
|
|
393
|
-
sharePromptsDisabled:
|
|
398
|
+
openToolGroupKeys: [...ce],
|
|
399
|
+
launcherPosition: Te ? R : null,
|
|
400
|
+
seenShareCandidateIds: [...$].slice(-gt),
|
|
401
|
+
sharePromptsDisabled: ue
|
|
394
402
|
});
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
debugVersion:
|
|
398
|
-
launcherPosition:
|
|
403
|
+
}, G = (r, c = {}) => {
|
|
404
|
+
Dn(r, {
|
|
405
|
+
debugVersion: vn,
|
|
406
|
+
launcherPosition: R,
|
|
399
407
|
rootClasses: a.className,
|
|
400
408
|
rootStyle: {
|
|
401
409
|
left: a.style.left,
|
|
@@ -403,262 +411,279 @@ async function rn(t = {}) {
|
|
|
403
411
|
right: a.style.right,
|
|
404
412
|
bottom: a.style.bottom
|
|
405
413
|
},
|
|
406
|
-
rootRect:
|
|
407
|
-
launcherRect:
|
|
408
|
-
panelRect:
|
|
409
|
-
viewport:
|
|
414
|
+
rootRect: _e(a),
|
|
415
|
+
launcherRect: _e(s),
|
|
416
|
+
panelRect: _e(b),
|
|
417
|
+
viewport: Y(),
|
|
410
418
|
panelHidden: b.hidden,
|
|
411
|
-
closeHidden:
|
|
412
|
-
...
|
|
419
|
+
closeHidden: w.hidden,
|
|
420
|
+
...c
|
|
413
421
|
});
|
|
414
|
-
},
|
|
415
|
-
if (!
|
|
416
|
-
return
|
|
417
|
-
const
|
|
418
|
-
return
|
|
419
|
-
},
|
|
420
|
-
if (!
|
|
421
|
-
|
|
422
|
+
}, ae = (r = !0) => {
|
|
423
|
+
if (!R)
|
|
424
|
+
return re(a, null), ge(r);
|
|
425
|
+
const c = ge(r);
|
|
426
|
+
return re(a, c), G("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
|
|
427
|
+
}, Me = (r, c) => {
|
|
428
|
+
if (!r || !c) {
|
|
429
|
+
Nn(a);
|
|
422
430
|
return;
|
|
423
431
|
}
|
|
424
|
-
|
|
425
|
-
x:
|
|
426
|
-
y:
|
|
432
|
+
An(a, {
|
|
433
|
+
x: r.x - c.x,
|
|
434
|
+
y: r.y - c.y
|
|
427
435
|
});
|
|
428
|
-
},
|
|
429
|
-
const
|
|
436
|
+
}, Oe = () => {
|
|
437
|
+
const r = ae();
|
|
430
438
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
} else
|
|
439
|
+
const c = Je(a, r, e.position);
|
|
440
|
+
Me(c, r), G("Applied open panel position after viewport resize", { openPanelPosition: c });
|
|
441
|
+
} else R && G("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
434
442
|
};
|
|
435
|
-
let
|
|
443
|
+
let Be = () => {
|
|
436
444
|
};
|
|
437
|
-
e.movableLauncher && g ? (
|
|
445
|
+
window.addEventListener("resize", Oe), e.movableLauncher && g ? (ae(), Be = kn({
|
|
438
446
|
root: a,
|
|
439
447
|
launcherDragHandle: g,
|
|
440
|
-
getPosition: () =>
|
|
441
|
-
setPosition: (
|
|
442
|
-
const
|
|
443
|
-
|
|
448
|
+
getPosition: () => ge(),
|
|
449
|
+
setPosition: (r) => {
|
|
450
|
+
const c = r;
|
|
451
|
+
R = Ze(a, r, Le(a)), re(a, R), G("Dragging closed launcher", { requestedPosition: c });
|
|
444
452
|
},
|
|
445
453
|
persist: () => {
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
})) :
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
454
|
+
Te = !0, N(), G("Persisted closed launcher drag position");
|
|
455
|
+
}
|
|
456
|
+
})) : re(a, null);
|
|
457
|
+
let he = !1;
|
|
458
|
+
const Fe = async () => {
|
|
459
|
+
if (!(!e.billingStatusLoader || he)) {
|
|
460
|
+
he = !0;
|
|
461
|
+
try {
|
|
462
|
+
const r = await e.billingStatusLoader();
|
|
463
|
+
tt(e.billingStatus, r, E.getState().lastErrorCode) && (e.billingStatus = r, ye(m, e.billingStatus, E.getState().lastErrorCode), D());
|
|
464
|
+
} finally {
|
|
465
|
+
he = !1;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}, H = (r = "", c = !0) => {
|
|
469
|
+
Fe(), B !== null && (window.clearTimeout(B), B = null), b.hidden = !1, w.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
470
|
+
const L = ae(), Q = Je(a, L, e.position);
|
|
471
|
+
if (Me(Q, L), G("Opening launcher at clamped open panel position", { openPanelPosition: Q, visibleLauncherPosition: L }), !c) {
|
|
472
|
+
a.classList.add("pluno-pa-widget--open"), s.hidden = !0, r && (d.value = r, ee(d)), k.scrollTop = k.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), N();
|
|
457
473
|
return;
|
|
458
474
|
}
|
|
459
475
|
window.requestAnimationFrame(() => {
|
|
460
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
461
|
-
s.hidden = !0,
|
|
476
|
+
a.classList.add("pluno-pa-widget--open"), r && (d.value = r, ee(d)), k.scrollTop = k.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), N(), B = window.setTimeout(() => {
|
|
477
|
+
s.hidden = !0, k.scrollTop = k.scrollHeight;
|
|
462
478
|
}, 220);
|
|
463
479
|
});
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
b.hidden = !0,
|
|
480
|
+
}, At = () => {
|
|
481
|
+
B !== null && (window.clearTimeout(B), B = null), s.hidden = !1, R && (ae(!1), G("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), N(), B = window.setTimeout(() => {
|
|
482
|
+
b.hidden = !0, w.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
467
483
|
}, 220);
|
|
468
484
|
};
|
|
469
|
-
s.addEventListener("submit", (
|
|
470
|
-
|
|
471
|
-
}), g?.addEventListener("click", (
|
|
472
|
-
|
|
473
|
-
}), s.addEventListener("click", (
|
|
474
|
-
|
|
475
|
-
}),
|
|
476
|
-
|
|
477
|
-
}),
|
|
478
|
-
if (!
|
|
485
|
+
s.addEventListener("submit", (r) => {
|
|
486
|
+
r.preventDefault(), H(u.value), u.value = "";
|
|
487
|
+
}), g?.addEventListener("click", (r) => {
|
|
488
|
+
r.preventDefault(), r.stopPropagation();
|
|
489
|
+
}), s.addEventListener("click", (r) => {
|
|
490
|
+
r.target !== u && (H(u.value), u.value = "");
|
|
491
|
+
}), u.addEventListener("focus", () => {
|
|
492
|
+
H(u.value), u.value = "";
|
|
493
|
+
}), u.addEventListener("input", () => {
|
|
494
|
+
if (!u.value)
|
|
479
495
|
return;
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
}),
|
|
483
|
-
const
|
|
484
|
-
|
|
496
|
+
const r = u.value;
|
|
497
|
+
H(r), u.value = "";
|
|
498
|
+
}), w.addEventListener("click", At);
|
|
499
|
+
const D = () => {
|
|
500
|
+
h.disabled = F(e.billingStatus) || !E.getState().isThinking && d.value.trim().length === 0 && v.length === 0;
|
|
485
501
|
};
|
|
486
|
-
e.loginRequired && (
|
|
487
|
-
if (
|
|
502
|
+
e.loginRequired && (u.readOnly = !0, u.placeholder = e.loginButtonLabel, d.placeholder = e.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (r) => {
|
|
503
|
+
if (r.preventDefault(), e.loginRequired) {
|
|
488
504
|
e.onLoginClick?.();
|
|
489
505
|
return;
|
|
490
506
|
}
|
|
491
|
-
v =
|
|
507
|
+
F(e.billingStatus) || (v = xe(E, d, v), T(), D());
|
|
492
508
|
});
|
|
493
|
-
let
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
|
|
509
|
+
let Z = 0;
|
|
510
|
+
const Nt = () => {
|
|
511
|
+
Z = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
512
|
+
}, Dt = (r) => {
|
|
513
|
+
y !== null && window.clearTimeout(y), C.textContent = r, C.hidden = !1, y = window.setTimeout(() => {
|
|
514
|
+
C.textContent = "", C.hidden = !0, y = null;
|
|
499
515
|
}, 3e3);
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
},
|
|
503
|
-
if (
|
|
516
|
+
}, Tt = () => {
|
|
517
|
+
y !== null && (window.clearTimeout(y), y = null), C.textContent = "", C.hidden = !0;
|
|
518
|
+
}, It = async (r) => {
|
|
519
|
+
if (r.length === 0)
|
|
504
520
|
return;
|
|
505
|
-
const
|
|
506
|
-
if (v.length +
|
|
507
|
-
throw new Error(`Attach up to ${
|
|
508
|
-
v = [...v, ...
|
|
521
|
+
const c = await jn(r);
|
|
522
|
+
if (v.length + c.length > de)
|
|
523
|
+
throw new Error(`Attach up to ${de} files per message.`);
|
|
524
|
+
v = [...v, ...c], T(), Tt(), D();
|
|
509
525
|
};
|
|
510
|
-
a.addEventListener("dragenter", (
|
|
511
|
-
!
|
|
512
|
-
}), a.addEventListener("dragover", (
|
|
513
|
-
const
|
|
514
|
-
!
|
|
515
|
-
}), a.addEventListener("dragleave", (
|
|
516
|
-
|
|
517
|
-
}), a.addEventListener("drop", (
|
|
518
|
-
const
|
|
519
|
-
!
|
|
520
|
-
|
|
526
|
+
a.addEventListener("dragenter", (r) => {
|
|
527
|
+
!le(r.dataTransfer) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), Z += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
528
|
+
}), a.addEventListener("dragover", (r) => {
|
|
529
|
+
const c = r.dataTransfer;
|
|
530
|
+
!le(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
|
|
531
|
+
}), a.addEventListener("dragleave", (r) => {
|
|
532
|
+
le(r.dataTransfer) && (r.stopPropagation(), Z = Math.max(0, Z - 1), Z === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
533
|
+
}), a.addEventListener("drop", (r) => {
|
|
534
|
+
const c = r.dataTransfer;
|
|
535
|
+
!le(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), Nt(), It(c.files).catch((L) => {
|
|
536
|
+
Dt(L instanceof Error ? L.message : "Failed to attach file"), U("web-sdk.widget", "Attachment failed", {
|
|
521
537
|
message: L instanceof Error ? L.message : String(L)
|
|
522
538
|
});
|
|
523
539
|
}));
|
|
524
|
-
}),
|
|
540
|
+
}), h.addEventListener("click", () => {
|
|
525
541
|
if (e.loginRequired) {
|
|
526
542
|
e.onLoginClick?.();
|
|
527
543
|
return;
|
|
528
544
|
}
|
|
529
|
-
if (
|
|
530
|
-
|
|
545
|
+
if (E.getState().isThinking) {
|
|
546
|
+
E.stop();
|
|
531
547
|
return;
|
|
532
548
|
}
|
|
533
|
-
v =
|
|
534
|
-
}),
|
|
535
|
-
|
|
549
|
+
v = xe(E, d, v), T(), D();
|
|
550
|
+
}), _.addEventListener("click", () => {
|
|
551
|
+
E.startNewSession(), ce.clear(), d.value = "", v = [], T(), ee(d), N(), D(), d.focus();
|
|
536
552
|
}), d.addEventListener("input", () => {
|
|
537
|
-
|
|
538
|
-
}), d.addEventListener("keydown", (
|
|
539
|
-
if (!(
|
|
540
|
-
if (
|
|
553
|
+
ee(d), N(), D();
|
|
554
|
+
}), d.addEventListener("keydown", (r) => {
|
|
555
|
+
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
556
|
+
if (r.preventDefault(), e.loginRequired) {
|
|
541
557
|
e.onLoginClick?.();
|
|
542
558
|
return;
|
|
543
559
|
}
|
|
544
|
-
v =
|
|
545
|
-
}
|
|
546
|
-
}), a.addEventListener("click", (
|
|
547
|
-
(
|
|
548
|
-
}),
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
const
|
|
552
|
-
if (e.loginRequired) {
|
|
553
|
-
|
|
560
|
+
v = xe(E, d, v), T(), D();
|
|
561
|
+
}
|
|
562
|
+
}), a.addEventListener("click", (r) => {
|
|
563
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && N();
|
|
564
|
+
}), z.composerValue && (d.value = z.composerValue, ee(d)), z.isOpen && H(d.value, !1);
|
|
565
|
+
const ze = () => i;
|
|
566
|
+
let me = E.getState().appearance !== null, ie = null, J = null, W = null, Ge = E.getState().isThinking, V = null;
|
|
567
|
+
const Rt = !!e.socialPostDraftHandler, q = (r) => {
|
|
568
|
+
if (De(r.lastErrorCode) ? V = r.lastErrorCode : e.billingStatus?.creditsUsed !== null && !F(e.billingStatus) && (V = null), ye(m, e.billingStatus, V), e.loginRequired) {
|
|
569
|
+
ro(k, h, _, ze, e.loginButtonLabel, e.onLoginClick);
|
|
554
570
|
return;
|
|
555
571
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
(
|
|
565
|
-
|
|
572
|
+
io(
|
|
573
|
+
k,
|
|
574
|
+
h,
|
|
575
|
+
_,
|
|
576
|
+
r,
|
|
577
|
+
ce,
|
|
578
|
+
N,
|
|
579
|
+
ze,
|
|
580
|
+
(c) => {
|
|
581
|
+
E.sendMessage(c);
|
|
566
582
|
},
|
|
567
|
-
|
|
568
|
-
dismissedCandidateIds:
|
|
569
|
-
draftingCandidateId:
|
|
570
|
-
error:
|
|
571
|
-
onSeen: (
|
|
572
|
-
|
|
583
|
+
Rt && !ue ? {
|
|
584
|
+
dismissedCandidateIds: oe,
|
|
585
|
+
draftingCandidateId: ie,
|
|
586
|
+
error: J,
|
|
587
|
+
onSeen: (c) => {
|
|
588
|
+
$.add(c.id), N();
|
|
573
589
|
},
|
|
574
|
-
onDraft: (
|
|
575
|
-
|
|
590
|
+
onDraft: (c) => {
|
|
591
|
+
Mt(c);
|
|
576
592
|
},
|
|
577
|
-
onDismiss: (
|
|
578
|
-
|
|
593
|
+
onDismiss: (c) => {
|
|
594
|
+
$.add(c.id), oe.add(c.id), N(), J = null, q(E.getState());
|
|
579
595
|
},
|
|
580
|
-
onDisable: (
|
|
581
|
-
|
|
596
|
+
onDisable: (c) => {
|
|
597
|
+
ue = !0, $.add(c.id), oe.add(c.id), N(), Co(e, !0), J = null, q(E.getState());
|
|
582
598
|
}
|
|
583
599
|
} : void 0
|
|
584
600
|
);
|
|
585
601
|
};
|
|
586
|
-
return
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
602
|
+
return E.on("state", (r) => {
|
|
603
|
+
const c = Ge && !r.isThinking;
|
|
604
|
+
Ge = r.isThinking, r.appearance ? (me = !0, U("web-sdk.widget", "Agent state supplied appearance", {
|
|
605
|
+
appearance: r.appearance
|
|
606
|
+
}), fe(r.appearance, "agent.state.appearance")) : me && (me = !1, U("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
590
607
|
fallbackAccentColor: e.accentColor,
|
|
591
608
|
fallbackColorScheme: e.colorScheme,
|
|
592
609
|
fallbackFontFamily: e.fontFamily
|
|
593
|
-
}),
|
|
594
|
-
}),
|
|
595
|
-
agent:
|
|
596
|
-
updateAppearance: (
|
|
597
|
-
|
|
610
|
+
}), fe({}, "agent.state.appearance-cleared")), q(r), D(), c && Fe();
|
|
611
|
+
}), q(E.getState()), D(), {
|
|
612
|
+
agent: E,
|
|
613
|
+
updateAppearance: (r) => {
|
|
614
|
+
r.scribbleStyle !== void 0 && (e.scribbleStyle = r.scribbleStyle), fe(r, "widgetHandle.updateAppearance");
|
|
615
|
+
},
|
|
616
|
+
updateBillingStatus: (r) => {
|
|
617
|
+
const c = r ?? null;
|
|
618
|
+
tt(e.billingStatus, c, V) && (e.billingStatus = c, e.billingStatus?.creditsUsed !== null && !F(e.billingStatus) && (V = null), ye(
|
|
619
|
+
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
620
|
+
e.billingStatus,
|
|
621
|
+
V
|
|
622
|
+
), D());
|
|
598
623
|
},
|
|
599
624
|
openPanel: () => {
|
|
600
|
-
|
|
625
|
+
H(d.value, !1);
|
|
601
626
|
},
|
|
602
627
|
destroy: () => {
|
|
603
|
-
|
|
628
|
+
Ie = !0, Re.disconnect(), window.removeEventListener("resize", Oe), Be(), y !== null && window.clearTimeout(y), W?.remove(), E.destroy(), n.remove();
|
|
604
629
|
}
|
|
605
630
|
};
|
|
606
|
-
async function
|
|
607
|
-
if (!
|
|
608
|
-
|
|
631
|
+
async function Mt(r) {
|
|
632
|
+
if (!ie) {
|
|
633
|
+
ie = r.id, J = null, q(E.getState());
|
|
609
634
|
try {
|
|
610
635
|
if (!e.socialPostDraftHandler)
|
|
611
636
|
throw new Error("Social post drafting is not available here.");
|
|
612
|
-
const
|
|
613
|
-
if (!
|
|
637
|
+
const c = await e.socialPostDraftHandler(r);
|
|
638
|
+
if (!c.linkedinPost || !c.xPost)
|
|
614
639
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
615
|
-
|
|
640
|
+
$.add(r.id), oe.add(r.id), N(), W?.remove(), W = so(c, {
|
|
616
641
|
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
617
642
|
onClose: () => {
|
|
618
|
-
|
|
643
|
+
W?.remove(), W = null;
|
|
619
644
|
}
|
|
620
|
-
}), a.appendChild(
|
|
621
|
-
} catch (
|
|
622
|
-
|
|
645
|
+
}), a.appendChild(W);
|
|
646
|
+
} catch (c) {
|
|
647
|
+
J = c instanceof Error ? c.message : "Could not draft social post.";
|
|
623
648
|
} finally {
|
|
624
|
-
|
|
649
|
+
ie = null, q(E.getState());
|
|
625
650
|
}
|
|
626
651
|
}
|
|
627
652
|
}
|
|
628
|
-
function
|
|
629
|
-
const L =
|
|
630
|
-
|
|
653
|
+
function fe(r, c) {
|
|
654
|
+
const L = r.accentColor ?? e.accentColor, Q = r.colorScheme ?? e.colorScheme, Ue = r.fontFamily ?? e.fontFamily, be = r.scribbleStyle ?? e.scribbleStyle;
|
|
655
|
+
i = Ye(L, be), Xe(a, i, {
|
|
631
656
|
accentColor: L,
|
|
632
|
-
colorScheme:
|
|
633
|
-
fontFamily:
|
|
634
|
-
scribbleStyle:
|
|
635
|
-
}),
|
|
636
|
-
source:
|
|
637
|
-
inputAppearance:
|
|
657
|
+
colorScheme: Q,
|
|
658
|
+
fontFamily: Ue,
|
|
659
|
+
scribbleStyle: be
|
|
660
|
+
}), U("web-sdk.widget", "Updated widget appearance", {
|
|
661
|
+
source: c,
|
|
662
|
+
inputAppearance: r,
|
|
638
663
|
appliedAccentColor: L,
|
|
639
|
-
appliedColorScheme:
|
|
640
|
-
appliedFontFamily:
|
|
641
|
-
appliedScribbleStyle:
|
|
664
|
+
appliedColorScheme: Q,
|
|
665
|
+
appliedFontFamily: Ue,
|
|
666
|
+
appliedScribbleStyle: be,
|
|
642
667
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
643
668
|
});
|
|
644
669
|
}
|
|
645
670
|
}
|
|
646
|
-
function
|
|
647
|
-
return e ?
|
|
671
|
+
function Ye(t, e) {
|
|
672
|
+
return e ? Ut(t) : zt(t);
|
|
648
673
|
}
|
|
649
|
-
function
|
|
674
|
+
function Xe(t, e, n) {
|
|
650
675
|
t.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), t.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
651
|
-
const o = n.scribbleStyle ?
|
|
652
|
-
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ?
|
|
676
|
+
const o = n.scribbleStyle ? dt(n.accentColor) : n.accentColor;
|
|
677
|
+
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? ln : n.fontFamily, n.scribbleStyle && En(t.ownerDocument);
|
|
653
678
|
const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
|
|
654
|
-
for (const
|
|
655
|
-
|
|
679
|
+
for (const i of a)
|
|
680
|
+
i.src = e;
|
|
656
681
|
}
|
|
657
|
-
function
|
|
658
|
-
if (t.getElementById(
|
|
682
|
+
function En(t) {
|
|
683
|
+
if (t.getElementById(Ke))
|
|
659
684
|
return;
|
|
660
685
|
const e = t.createElement("style");
|
|
661
|
-
e.id =
|
|
686
|
+
e.id = Ke, e.textContent = `@font-face {
|
|
662
687
|
font-family: "Architects Daughter";
|
|
663
688
|
font-style: normal;
|
|
664
689
|
font-weight: 400;
|
|
@@ -666,107 +691,120 @@ function ln(t) {
|
|
|
666
691
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
667
692
|
}`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
|
|
668
693
|
}
|
|
669
|
-
function
|
|
694
|
+
function kn({
|
|
670
695
|
root: t,
|
|
671
696
|
launcherDragHandle: e,
|
|
672
697
|
getPosition: n,
|
|
673
698
|
setPosition: o,
|
|
674
699
|
persist: a
|
|
675
700
|
}) {
|
|
676
|
-
let
|
|
701
|
+
let i = null, l = null, p = null, s = !1;
|
|
677
702
|
const g = () => {
|
|
678
|
-
|
|
679
|
-
},
|
|
680
|
-
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (
|
|
681
|
-
}, b = (
|
|
682
|
-
if (
|
|
703
|
+
i = null, l = null, p = null, s = !1, t.classList.remove("pluno-pa-widget--dragging");
|
|
704
|
+
}, u = (m) => {
|
|
705
|
+
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), i = m.pointerId, l = { x: m.clientX, y: m.clientY }, p = n(), s = !1, e.setPointerCapture?.(m.pointerId));
|
|
706
|
+
}, b = (m) => {
|
|
707
|
+
if (i !== m.pointerId || !l || !p)
|
|
683
708
|
return;
|
|
684
|
-
|
|
685
|
-
const
|
|
686
|
-
!s && Math.hypot(
|
|
687
|
-
},
|
|
688
|
-
|
|
689
|
-
}, x = (
|
|
690
|
-
|
|
691
|
-
},
|
|
709
|
+
m.preventDefault();
|
|
710
|
+
const f = m.clientX - l.x, d = m.clientY - l.y;
|
|
711
|
+
!s && Math.hypot(f, d) < wn || (s = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + f, y: p.y + d }));
|
|
712
|
+
}, w = (m) => {
|
|
713
|
+
i === m.pointerId && (m.preventDefault(), m.stopPropagation(), s && a(), g());
|
|
714
|
+
}, x = (m) => {
|
|
715
|
+
i === m.pointerId && (m.preventDefault(), g());
|
|
716
|
+
}, C = (m) => {
|
|
692
717
|
if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
|
|
693
718
|
return;
|
|
694
|
-
const
|
|
695
|
-
let
|
|
696
|
-
|
|
719
|
+
const f = m.shiftKey ? xn : _n, d = n();
|
|
720
|
+
let h = null;
|
|
721
|
+
m.key === "ArrowUp" ? h = { x: d.x, y: d.y - f } : m.key === "ArrowDown" ? h = { x: d.x, y: d.y + f } : m.key === "ArrowLeft" ? h = { x: d.x - f, y: d.y } : m.key === "ArrowRight" && (h = { x: d.x + f, y: d.y }), h && (m.preventDefault(), m.stopPropagation(), o(h), a());
|
|
697
722
|
};
|
|
698
|
-
return e.addEventListener("pointerdown",
|
|
699
|
-
e.removeEventListener("pointerdown",
|
|
723
|
+
return e.addEventListener("pointerdown", u), e.addEventListener("pointermove", b), e.addEventListener("pointerup", w), e.addEventListener("pointercancel", x), e.addEventListener("keydown", C), () => {
|
|
724
|
+
e.removeEventListener("pointerdown", u), e.removeEventListener("pointermove", b), e.removeEventListener("pointerup", w), e.removeEventListener("pointercancel", x), e.removeEventListener("keydown", C);
|
|
700
725
|
};
|
|
701
726
|
}
|
|
702
|
-
function
|
|
703
|
-
const n =
|
|
727
|
+
function Le(t, e = !0) {
|
|
728
|
+
const n = Y(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
|
|
704
729
|
return {
|
|
705
|
-
width: e && a && o.width > 0 ? o.width : Math.min(
|
|
706
|
-
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ?
|
|
730
|
+
width: e && a && o.width > 0 ? o.width : Math.min(mt, n.width - 36),
|
|
731
|
+
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? pn : ft
|
|
707
732
|
};
|
|
708
733
|
}
|
|
709
|
-
function
|
|
710
|
-
const t =
|
|
734
|
+
function bt() {
|
|
735
|
+
const t = Y();
|
|
711
736
|
return {
|
|
712
|
-
width: Math.min(
|
|
713
|
-
|
|
737
|
+
width: Math.min(
|
|
738
|
+
K(t.width * cn, sn, dn),
|
|
739
|
+
t.width - A * 2
|
|
740
|
+
),
|
|
741
|
+
height: Math.min(
|
|
742
|
+
K(t.height * hn, un, gn),
|
|
743
|
+
t.height - Se - A
|
|
744
|
+
)
|
|
714
745
|
};
|
|
715
746
|
}
|
|
716
|
-
function
|
|
747
|
+
function Sn(t, e, n) {
|
|
717
748
|
const o = Number.parseFloat(t.style.left), a = Number.parseFloat(t.style.top);
|
|
718
749
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
719
750
|
return { x: o, y: a };
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
722
|
-
return { x:
|
|
723
|
-
const l =
|
|
751
|
+
const i = t.getBoundingClientRect();
|
|
752
|
+
if (i.width > 0 || i.height > 0)
|
|
753
|
+
return { x: i.left, y: i.top };
|
|
754
|
+
const l = Y();
|
|
724
755
|
return {
|
|
725
756
|
x: e === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
726
757
|
y: l.height - 24 - n.height
|
|
727
758
|
};
|
|
728
759
|
}
|
|
729
|
-
function
|
|
730
|
-
const o =
|
|
760
|
+
function Ze(t, e, n) {
|
|
761
|
+
const o = Y(), a = A + Ln(t);
|
|
731
762
|
return {
|
|
732
|
-
x:
|
|
733
|
-
y:
|
|
763
|
+
x: K(e.x, A, Math.max(A, o.width - n.width - A)),
|
|
764
|
+
y: K(e.y, a, Math.max(a, o.height - n.height - A))
|
|
734
765
|
};
|
|
735
766
|
}
|
|
736
|
-
function
|
|
737
|
-
return t.classList.contains("pluno-pa-widget--scribble") ?
|
|
767
|
+
function Ln(t) {
|
|
768
|
+
return t.classList.contains("pluno-pa-widget--scribble") ? bn : fn;
|
|
769
|
+
}
|
|
770
|
+
function Je(t, e, n) {
|
|
771
|
+
const o = Le(t), a = bt(), i = {
|
|
772
|
+
x: n === "bottom-left" ? e.x : e.x + o.width - a.width,
|
|
773
|
+
y: e.y + o.height - a.height
|
|
774
|
+
};
|
|
775
|
+
return Pn(i);
|
|
738
776
|
}
|
|
739
|
-
function
|
|
740
|
-
const e =
|
|
777
|
+
function Pn(t) {
|
|
778
|
+
const e = Y(), n = bt();
|
|
741
779
|
return {
|
|
742
|
-
x:
|
|
743
|
-
y:
|
|
780
|
+
x: K(t.x, A, Math.max(A, e.width - n.width - A)),
|
|
781
|
+
y: K(
|
|
744
782
|
t.y,
|
|
745
|
-
|
|
746
|
-
Math.max(
|
|
783
|
+
Se,
|
|
784
|
+
Math.max(Se, e.height - n.height - A)
|
|
747
785
|
)
|
|
748
786
|
};
|
|
749
787
|
}
|
|
750
|
-
function
|
|
788
|
+
function re(t, e) {
|
|
751
789
|
if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), !e) {
|
|
752
790
|
t.style.removeProperty("left"), t.style.removeProperty("top"), t.style.removeProperty("right"), t.style.removeProperty("bottom");
|
|
753
791
|
return;
|
|
754
792
|
}
|
|
755
793
|
t.style.left = `${e.x}px`, t.style.top = `${e.y}px`, t.style.right = "auto", t.style.bottom = "auto";
|
|
756
794
|
}
|
|
757
|
-
function
|
|
795
|
+
function An(t, e) {
|
|
758
796
|
t.style.setProperty("--pluno-pa-panel-offset-x", `${e.x}px`), t.style.setProperty("--pluno-pa-panel-offset-y", `${e.y}px`);
|
|
759
797
|
}
|
|
760
|
-
function
|
|
798
|
+
function Nn(t) {
|
|
761
799
|
t.style.removeProperty("--pluno-pa-panel-offset-x"), t.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
762
800
|
}
|
|
763
|
-
function
|
|
801
|
+
function Y() {
|
|
764
802
|
return {
|
|
765
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
766
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
803
|
+
width: window.innerWidth || document.documentElement.clientWidth || mt + A * 2,
|
|
804
|
+
height: window.innerHeight || document.documentElement.clientHeight || ft + A * 2
|
|
767
805
|
};
|
|
768
806
|
}
|
|
769
|
-
function
|
|
807
|
+
function _e(t) {
|
|
770
808
|
const e = t.getBoundingClientRect();
|
|
771
809
|
return {
|
|
772
810
|
x: Math.round(e.x),
|
|
@@ -775,10 +813,10 @@ function me(t) {
|
|
|
775
813
|
height: Math.round(e.height)
|
|
776
814
|
};
|
|
777
815
|
}
|
|
778
|
-
function
|
|
816
|
+
function K(t, e, n) {
|
|
779
817
|
return Math.min(Math.max(t, e), n);
|
|
780
818
|
}
|
|
781
|
-
function
|
|
819
|
+
function U(t, e, n) {
|
|
782
820
|
if (typeof window > "u")
|
|
783
821
|
return;
|
|
784
822
|
const o = window, a = {
|
|
@@ -786,79 +824,81 @@ function z(t, e, n) {
|
|
|
786
824
|
source: t,
|
|
787
825
|
message: e,
|
|
788
826
|
details: n
|
|
789
|
-
},
|
|
790
|
-
|
|
827
|
+
}, 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(on, { detail: a }));
|
|
791
829
|
}
|
|
792
|
-
function
|
|
793
|
-
|
|
830
|
+
function Dn(t, e) {
|
|
831
|
+
U("web-sdk.widget.position", t, e);
|
|
794
832
|
}
|
|
795
|
-
function
|
|
833
|
+
function xe(t, e, n) {
|
|
796
834
|
const o = e.value.trim();
|
|
797
835
|
return !o && n.length === 0 ? n : (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), e.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
798
836
|
}
|
|
799
|
-
function
|
|
837
|
+
function ee(t) {
|
|
800
838
|
t.style.height = "0px";
|
|
801
839
|
const e = Math.max(22, Math.min(t.scrollHeight, 140));
|
|
802
840
|
t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
|
|
803
841
|
}
|
|
804
|
-
function
|
|
805
|
-
t.appendChild(
|
|
842
|
+
function Tn(t, e, n, o) {
|
|
843
|
+
t.appendChild(Bn()), t.appendChild(In(e, n, o)), t.appendChild(xt("pluno-pa-widget__close", "Close", Fn(16), !0)), t.appendChild(Rn(n));
|
|
806
844
|
}
|
|
807
|
-
function
|
|
845
|
+
function In(t, e, n) {
|
|
808
846
|
const o = document.createElement("form");
|
|
809
847
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
810
|
-
const
|
|
811
|
-
|
|
848
|
+
const i = document.createElement("button");
|
|
849
|
+
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);
|
|
812
850
|
}
|
|
813
|
-
o.appendChild(
|
|
851
|
+
o.appendChild(_t("pluno-pa-widget__character--launcher", e));
|
|
814
852
|
const a = document.createElement("input");
|
|
815
853
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), o.appendChild(a), o;
|
|
816
854
|
}
|
|
817
|
-
function
|
|
855
|
+
function Rn(t) {
|
|
818
856
|
const e = document.createElement("section");
|
|
819
857
|
e.className = "pluno-pa-widget__panel", e.hidden = !0;
|
|
820
858
|
const n = document.createElement("div");
|
|
821
859
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
822
860
|
const o = document.createElement("main");
|
|
823
|
-
return o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
861
|
+
return o.className = "pluno-pa-widget__timeline", o.appendChild(On(t)), n.appendChild(o), n.appendChild(xt("pluno-pa-widget__new-chat", "New chat", zn(), !0)), e.appendChild(n), e.appendChild(Mn()), e;
|
|
824
862
|
}
|
|
825
|
-
function
|
|
863
|
+
function Mn() {
|
|
826
864
|
const t = document.createElement("form");
|
|
827
865
|
t.className = "pluno-pa-widget__composer";
|
|
828
866
|
const e = document.createElement("div");
|
|
829
|
-
e.className = "pluno-pa-
|
|
867
|
+
e.className = "pluno-pa-widget__billing-status", e.hidden = !0, t.appendChild(e);
|
|
830
868
|
const n = document.createElement("div");
|
|
831
|
-
n.className = "pluno-pa-
|
|
869
|
+
n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, t.appendChild(n);
|
|
832
870
|
const o = document.createElement("div");
|
|
833
|
-
o.className = "pluno-pa-
|
|
834
|
-
const a = document.createElement("
|
|
835
|
-
a.className = "pluno-pa-
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
const l = document.createElement("
|
|
839
|
-
l.className = "pluno-pa-
|
|
840
|
-
const p = document.createElement("
|
|
841
|
-
p.className = "pluno-pa-
|
|
842
|
-
const s = document.createElement("
|
|
843
|
-
|
|
871
|
+
o.className = "pluno-pa-widget__attachments", o.hidden = !0, t.appendChild(o);
|
|
872
|
+
const a = document.createElement("div");
|
|
873
|
+
a.className = "pluno-pa-widget__composer-inner";
|
|
874
|
+
const i = document.createElement("textarea");
|
|
875
|
+
i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
|
|
876
|
+
const l = document.createElement("button");
|
|
877
|
+
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(vt()), a.appendChild(l), t.appendChild(a);
|
|
878
|
+
const p = document.createElement("div");
|
|
879
|
+
p.className = "pluno-pa-widget__composer-meta";
|
|
880
|
+
const s = document.createElement("a");
|
|
881
|
+
s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai.", p.appendChild(s);
|
|
882
|
+
const g = document.createElement("span");
|
|
883
|
+
return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(g), t.appendChild(p), t;
|
|
844
884
|
}
|
|
845
|
-
function
|
|
885
|
+
function On(t) {
|
|
846
886
|
const e = document.createElement("div");
|
|
847
|
-
return e.className = "pluno-pa-widget__empty-state", e.appendChild(
|
|
887
|
+
return e.className = "pluno-pa-widget__empty-state", e.appendChild(_t("pluno-pa-widget__character--empty", t)), e.appendChild(wt()), e;
|
|
848
888
|
}
|
|
849
|
-
function
|
|
889
|
+
function wt() {
|
|
850
890
|
const t = document.createElement("div");
|
|
851
891
|
return t.className = "pluno-pa-widget__empty", t.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), t.appendChild(document.createElement("br")), t.appendChild(document.createTextNode("What do you want to do today?")), t;
|
|
852
892
|
}
|
|
853
|
-
function
|
|
893
|
+
function _t(t, e) {
|
|
854
894
|
const n = document.createElement("img");
|
|
855
895
|
return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
856
896
|
}
|
|
857
|
-
function
|
|
897
|
+
function xt(t, e, n, o) {
|
|
858
898
|
const a = document.createElement("button");
|
|
859
899
|
return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
|
|
860
900
|
}
|
|
861
|
-
function
|
|
901
|
+
function Bn() {
|
|
862
902
|
const t = S("svg", {
|
|
863
903
|
class: "pluno-pa-widget__scribble-defs",
|
|
864
904
|
"aria-hidden": "true",
|
|
@@ -866,9 +906,9 @@ function _n() {
|
|
|
866
906
|
width: "0",
|
|
867
907
|
height: "0"
|
|
868
908
|
}), e = S("defs");
|
|
869
|
-
return e.appendChild(
|
|
909
|
+
return e.appendChild(ve("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(ve("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(ve("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
|
|
870
910
|
}
|
|
871
|
-
function
|
|
911
|
+
function ve(t, e, n) {
|
|
872
912
|
const o = S("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
873
913
|
return o.appendChild(
|
|
874
914
|
S("feTurbulence", {
|
|
@@ -905,31 +945,31 @@ function we(t, e, n) {
|
|
|
905
945
|
})
|
|
906
946
|
), o;
|
|
907
947
|
}
|
|
908
|
-
function
|
|
909
|
-
const e =
|
|
948
|
+
function Fn(t) {
|
|
949
|
+
const e = X("0 0 24 24", t, t, "none", "currentColor", "2.25");
|
|
910
950
|
return e.appendChild(S("path", { d: "m6 9 6 6 6-6" })), e;
|
|
911
951
|
}
|
|
912
|
-
function
|
|
913
|
-
const t =
|
|
952
|
+
function zn() {
|
|
953
|
+
const t = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
914
954
|
return t.appendChild(S("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), t.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
|
|
915
955
|
}
|
|
916
|
-
function
|
|
917
|
-
const t =
|
|
956
|
+
function vt() {
|
|
957
|
+
const t = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
918
958
|
return t.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), t;
|
|
919
959
|
}
|
|
920
|
-
function
|
|
921
|
-
const t =
|
|
960
|
+
function Gn() {
|
|
961
|
+
const t = X("0 0 24 24", 18, 18, "currentColor");
|
|
922
962
|
return t.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
|
|
923
963
|
}
|
|
924
|
-
function
|
|
925
|
-
const t =
|
|
964
|
+
function Un() {
|
|
965
|
+
const t = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
926
966
|
return t.appendChild(S("path", { d: "M18 6 6 18" })), t.appendChild(S("path", { d: "m6 6 12 12" })), t;
|
|
927
967
|
}
|
|
928
|
-
function
|
|
929
|
-
const t =
|
|
968
|
+
function $n() {
|
|
969
|
+
const t = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
930
970
|
return t.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
|
|
931
971
|
}
|
|
932
|
-
function
|
|
972
|
+
function X(t, e, n, o, a, i) {
|
|
933
973
|
const l = {
|
|
934
974
|
viewBox: t,
|
|
935
975
|
width: String(e),
|
|
@@ -937,41 +977,41 @@ function j(t, e, n, o, a, r) {
|
|
|
937
977
|
fill: o,
|
|
938
978
|
"aria-hidden": "true"
|
|
939
979
|
};
|
|
940
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"),
|
|
980
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
|
|
941
981
|
}
|
|
942
982
|
function S(t, e = {}) {
|
|
943
|
-
const n = document.createElementNS(
|
|
983
|
+
const n = document.createElementNS(mn, t);
|
|
944
984
|
for (const [o, a] of Object.entries(e))
|
|
945
985
|
n.setAttribute(o, a);
|
|
946
986
|
return n;
|
|
947
987
|
}
|
|
948
|
-
function
|
|
988
|
+
function Qe(t) {
|
|
949
989
|
for (const e of ["keydown", "keypress", "keyup"])
|
|
950
990
|
t.addEventListener(e, (n) => {
|
|
951
991
|
n.stopPropagation();
|
|
952
992
|
});
|
|
953
993
|
}
|
|
954
|
-
function
|
|
994
|
+
function Hn(t, e, n) {
|
|
955
995
|
t.replaceChildren(), t.hidden = e.length === 0;
|
|
956
996
|
for (const [o, a] of e.entries()) {
|
|
957
|
-
const
|
|
958
|
-
|
|
997
|
+
const i = document.createElement("div");
|
|
998
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Wn(a));
|
|
959
999
|
const l = document.createElement("span");
|
|
960
|
-
l.textContent = a.name,
|
|
1000
|
+
l.textContent = a.name, i.appendChild(l);
|
|
961
1001
|
const p = document.createElement("button");
|
|
962
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1002
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Un()), p.addEventListener("click", () => n(o)), i.appendChild(p), t.appendChild(i);
|
|
963
1003
|
}
|
|
964
1004
|
}
|
|
965
|
-
function
|
|
966
|
-
if (
|
|
1005
|
+
function Wn(t) {
|
|
1006
|
+
if (yt(t)) {
|
|
967
1007
|
const n = document.createElement("img");
|
|
968
1008
|
return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
969
1009
|
}
|
|
970
1010
|
const e = document.createElement("span");
|
|
971
1011
|
return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
|
|
972
1012
|
}
|
|
973
|
-
function
|
|
974
|
-
if (
|
|
1013
|
+
function Vn(t) {
|
|
1014
|
+
if (yt(t)) {
|
|
975
1015
|
const a = document.createElement("img");
|
|
976
1016
|
return a.src = t.dataUrl, a.alt = t.name, a;
|
|
977
1017
|
}
|
|
@@ -982,51 +1022,51 @@ function Ln(t) {
|
|
|
982
1022
|
const o = document.createElement("strong");
|
|
983
1023
|
return o.textContent = t.name, e.append(n, o), e;
|
|
984
1024
|
}
|
|
985
|
-
function
|
|
1025
|
+
function yt(t) {
|
|
986
1026
|
return t.mimeType.startsWith("image/");
|
|
987
1027
|
}
|
|
988
|
-
function
|
|
1028
|
+
function qn(t) {
|
|
989
1029
|
return t === "application/pdf" ? "document.pdf" : "image";
|
|
990
1030
|
}
|
|
991
|
-
async function
|
|
1031
|
+
async function jn(t) {
|
|
992
1032
|
if (!t)
|
|
993
1033
|
return [];
|
|
994
1034
|
const e = Array.from(t);
|
|
995
|
-
if (e.length >
|
|
996
|
-
throw new Error(`Attach up to ${
|
|
1035
|
+
if (e.length > de)
|
|
1036
|
+
throw new Error(`Attach up to ${de} files per message.`);
|
|
997
1037
|
return Promise.all(
|
|
998
1038
|
e.map(async (n) => {
|
|
999
|
-
const o =
|
|
1039
|
+
const o = Kn(n);
|
|
1000
1040
|
if (!o)
|
|
1001
1041
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1002
|
-
if (n.size >
|
|
1042
|
+
if (n.size > an)
|
|
1003
1043
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1004
1044
|
if (o === "image/gif") {
|
|
1005
|
-
const a = new Uint8Array(await
|
|
1006
|
-
if (
|
|
1045
|
+
const a = new Uint8Array(await oo(n));
|
|
1046
|
+
if (Xn(a))
|
|
1007
1047
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1008
1048
|
}
|
|
1009
1049
|
return {
|
|
1010
|
-
name: n.name ||
|
|
1050
|
+
name: n.name || qn(o),
|
|
1011
1051
|
mimeType: o,
|
|
1012
1052
|
sizeBytes: n.size,
|
|
1013
|
-
dataUrl:
|
|
1053
|
+
dataUrl: Yn(await ao(n), o)
|
|
1014
1054
|
};
|
|
1015
1055
|
})
|
|
1016
1056
|
);
|
|
1017
1057
|
}
|
|
1018
|
-
function
|
|
1019
|
-
if (
|
|
1058
|
+
function Kn(t) {
|
|
1059
|
+
if (rn.has(t.type))
|
|
1020
1060
|
return t.type;
|
|
1021
1061
|
const e = t.name.toLowerCase();
|
|
1022
1062
|
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
1023
1063
|
}
|
|
1024
|
-
function
|
|
1064
|
+
function Yn(t, e) {
|
|
1025
1065
|
const n = `data:${e};base64,`;
|
|
1026
1066
|
return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
|
|
1027
1067
|
}
|
|
1028
|
-
function
|
|
1029
|
-
if (t.length < 14 || !
|
|
1068
|
+
function Xn(t) {
|
|
1069
|
+
if (t.length < 14 || !Zn(t))
|
|
1030
1070
|
return !1;
|
|
1031
1071
|
const e = t[10];
|
|
1032
1072
|
let n = 13;
|
|
@@ -1037,7 +1077,7 @@ function Tn(t) {
|
|
|
1037
1077
|
if (n += 1, a === 59)
|
|
1038
1078
|
return !1;
|
|
1039
1079
|
if (a === 33) {
|
|
1040
|
-
n += 1, n =
|
|
1080
|
+
n += 1, n = et(t, n);
|
|
1041
1081
|
continue;
|
|
1042
1082
|
}
|
|
1043
1083
|
if (a !== 44)
|
|
@@ -1046,17 +1086,17 @@ function Tn(t) {
|
|
|
1046
1086
|
return !0;
|
|
1047
1087
|
if (n + 9 >= t.length)
|
|
1048
1088
|
return !1;
|
|
1049
|
-
const
|
|
1050
|
-
if (n += 9,
|
|
1089
|
+
const i = t[n + 8];
|
|
1090
|
+
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= t.length)
|
|
1051
1091
|
return !1;
|
|
1052
|
-
n += 1, n =
|
|
1092
|
+
n += 1, n = et(t, n);
|
|
1053
1093
|
}
|
|
1054
1094
|
return !1;
|
|
1055
1095
|
}
|
|
1056
|
-
function
|
|
1096
|
+
function Zn(t) {
|
|
1057
1097
|
return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
|
|
1058
1098
|
}
|
|
1059
|
-
function
|
|
1099
|
+
function et(t, e) {
|
|
1060
1100
|
for (; e < t.length; ) {
|
|
1061
1101
|
const n = t[e];
|
|
1062
1102
|
if (e += 1, n === 0)
|
|
@@ -1065,10 +1105,69 @@ function je(t, e) {
|
|
|
1065
1105
|
}
|
|
1066
1106
|
return e;
|
|
1067
1107
|
}
|
|
1068
|
-
function
|
|
1108
|
+
function le(t) {
|
|
1069
1109
|
return !!(t && Array.from(t.types).includes("Files"));
|
|
1070
1110
|
}
|
|
1071
|
-
function
|
|
1111
|
+
function ye(t, e, n = null) {
|
|
1112
|
+
if (!t || !Pe(e, n)) {
|
|
1113
|
+
t && (t.hidden = !0, t.replaceChildren());
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
t.hidden = !1, t.replaceChildren(), t.className = "pluno-pa-widget__billing-status", F(e) || De(n) ? t.appendChild(Jn(e, n)) : Ct(e) && t.appendChild(Qn(e));
|
|
1117
|
+
}
|
|
1118
|
+
function Jn(t, e) {
|
|
1119
|
+
const n = document.createElement("div");
|
|
1120
|
+
n.className = "pluno-pa-widget__billing-action-card";
|
|
1121
|
+
const o = t.limitExceeded || e === "limit_exceeded", a = document.createElement("strong");
|
|
1122
|
+
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1123
|
+
const i = document.createElement("span");
|
|
1124
|
+
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : t.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Et(t, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1125
|
+
}
|
|
1126
|
+
function Qn(t) {
|
|
1127
|
+
const e = document.createElement("div");
|
|
1128
|
+
e.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1129
|
+
const n = document.createElement("strong");
|
|
1130
|
+
n.textContent = "Credits running low", e.appendChild(n);
|
|
1131
|
+
const o = document.createElement("span");
|
|
1132
|
+
return o.textContent = to(t) ?? "Credits are running low for this period.", e.appendChild(o), e.appendChild(Et(t, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), e;
|
|
1133
|
+
}
|
|
1134
|
+
function Pe(t, e) {
|
|
1135
|
+
return t !== null && (F(t) || Ct(t) || De(e));
|
|
1136
|
+
}
|
|
1137
|
+
function tt(t, e, n) {
|
|
1138
|
+
return Pe(e, n) || eo(e) ? !0 : !Pe(t, n);
|
|
1139
|
+
}
|
|
1140
|
+
function eo(t) {
|
|
1141
|
+
return t != null && (t.creditsUsed !== null || t.creditLimit !== null || t.creditsRemaining !== null || F(t));
|
|
1142
|
+
}
|
|
1143
|
+
function F(t) {
|
|
1144
|
+
return t?.limitExceeded === !0 || !!t?.paymentIssue;
|
|
1145
|
+
}
|
|
1146
|
+
function De(t) {
|
|
1147
|
+
return t === "limit_exceeded" || t === "subscription_required" || t === "subscription_inactive" || t === "payment_issue" || t === "subscription_invalid" || t === "payment_required";
|
|
1148
|
+
}
|
|
1149
|
+
function Ct(t) {
|
|
1150
|
+
return !F(t) && t.creditLimit !== null && t.creditLimit > 0 && t.creditsRemaining !== null && t.creditsRemaining > 0 && t.creditsRemaining / t.creditLimit <= 0.2;
|
|
1151
|
+
}
|
|
1152
|
+
function to(t) {
|
|
1153
|
+
return t.creditsRemaining === null ? null : `${no(t.creditsRemaining)} credits left`;
|
|
1154
|
+
}
|
|
1155
|
+
function no(t) {
|
|
1156
|
+
return new Intl.NumberFormat("en-US", {
|
|
1157
|
+
maximumFractionDigits: 0
|
|
1158
|
+
}).format(Math.ceil(t));
|
|
1159
|
+
}
|
|
1160
|
+
function Et(t, e, n) {
|
|
1161
|
+
const o = document.createElement("div");
|
|
1162
|
+
return o.className = n, o.appendChild(nt(e, t.pricingUrl)), o.appendChild(nt("Earn credits", t.earnCreditsUrl)), o;
|
|
1163
|
+
}
|
|
1164
|
+
function nt(t, e) {
|
|
1165
|
+
const n = document.createElement("button");
|
|
1166
|
+
return n.type = "button", n.textContent = t, n.disabled = e.trim().length === 0, n.addEventListener("click", () => {
|
|
1167
|
+
e.trim().length !== 0 && window.open(e, "_blank", "noopener,noreferrer");
|
|
1168
|
+
}), n;
|
|
1169
|
+
}
|
|
1170
|
+
function oo(t) {
|
|
1072
1171
|
return new Promise((e, n) => {
|
|
1073
1172
|
const o = new FileReader();
|
|
1074
1173
|
o.addEventListener("load", () => {
|
|
@@ -1082,7 +1181,7 @@ function Mn(t) {
|
|
|
1082
1181
|
}), o.readAsArrayBuffer(t);
|
|
1083
1182
|
});
|
|
1084
1183
|
}
|
|
1085
|
-
function
|
|
1184
|
+
function ao(t) {
|
|
1086
1185
|
return new Promise((e, n) => {
|
|
1087
1186
|
const o = new FileReader();
|
|
1088
1187
|
o.addEventListener("load", () => {
|
|
@@ -1096,89 +1195,89 @@ function Rn(t) {
|
|
|
1096
1195
|
}), o.readAsDataURL(t);
|
|
1097
1196
|
});
|
|
1098
1197
|
}
|
|
1099
|
-
function
|
|
1100
|
-
const g = [...o.messages],
|
|
1101
|
-
t.replaceChildren(),
|
|
1102
|
-
const b =
|
|
1103
|
-
if (n.hidden = !b,
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
for (const
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
p(
|
|
1114
|
-
}),
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1198
|
+
function io(t, e, n, o, a, i, l, p, s) {
|
|
1199
|
+
const g = [...o.messages], u = g.filter((h) => !mo(h));
|
|
1200
|
+
t.replaceChildren(), St(e, o.isThinking);
|
|
1201
|
+
const b = u.length > 0 || !!o.assistantDraft || o.isThinking;
|
|
1202
|
+
if (n.hidden = !b, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
|
|
1203
|
+
const h = document.createElement("div");
|
|
1204
|
+
h.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1205
|
+
const _ = document.createElement("img");
|
|
1206
|
+
_.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", _.src = l(), _.alt = "", _.setAttribute("aria-hidden", "true"), h.appendChild(_), h.appendChild(wt());
|
|
1207
|
+
const k = document.createElement("div");
|
|
1208
|
+
k.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true");
|
|
1209
|
+
for (const v of o.starterPrompts) {
|
|
1210
|
+
const y = document.createElement("button");
|
|
1211
|
+
y.type = "button", y.className = "pluno-pa-widget__starter-prompt", y.textContent = `"${v}"`, y.addEventListener("click", () => {
|
|
1212
|
+
p(v);
|
|
1213
|
+
}), k.appendChild(y);
|
|
1214
|
+
}
|
|
1215
|
+
h.appendChild(k), t.appendChild(h);
|
|
1117
1216
|
return;
|
|
1118
1217
|
}
|
|
1119
|
-
let
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1218
|
+
let w = null, x = null, C = [];
|
|
1219
|
+
const m = () => {
|
|
1220
|
+
if (C.length === 0)
|
|
1122
1221
|
return !1;
|
|
1123
|
-
const
|
|
1124
|
-
return t.appendChild(
|
|
1222
|
+
const h = fo(C, a, i, l());
|
|
1223
|
+
return t.appendChild(h), w = null, x = h, C = [], !0;
|
|
1125
1224
|
};
|
|
1126
|
-
for (let
|
|
1127
|
-
const
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1225
|
+
for (let h = 0; h < u.length; h += 1) {
|
|
1226
|
+
const _ = u[h];
|
|
1227
|
+
if (_.role === "tool") {
|
|
1228
|
+
C.push(_);
|
|
1130
1229
|
continue;
|
|
1131
1230
|
}
|
|
1132
|
-
if (
|
|
1231
|
+
if (_.role === "system")
|
|
1133
1232
|
continue;
|
|
1134
|
-
const
|
|
1135
|
-
if (
|
|
1136
|
-
const
|
|
1137
|
-
t.appendChild(
|
|
1138
|
-
}
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1233
|
+
const k = m(), v = at(_.content);
|
|
1234
|
+
if (_.role === "assistant" && !k) {
|
|
1235
|
+
const ne = Ae(l());
|
|
1236
|
+
t.appendChild(ne), w = null, x = ne;
|
|
1237
|
+
}
|
|
1238
|
+
const y = document.createElement("div");
|
|
1239
|
+
y.className = `pluno-pa-widget__message pluno-pa-widget__message--${_.role}`, _.role === "assistant" ? it(y, v) : y.textContent = v, _.role === "user" && _.attachments?.length && y.appendChild(lo(_.attachments));
|
|
1240
|
+
const T = document.createElement("div");
|
|
1241
|
+
T.className = "pluno-pa-widget__message-actions", T.appendChild(ot(v)), y.appendChild(T), t.appendChild(y), w = y, x = null;
|
|
1143
1242
|
}
|
|
1144
|
-
const
|
|
1243
|
+
const f = m();
|
|
1145
1244
|
if (o.assistantDraft) {
|
|
1146
|
-
if (!
|
|
1147
|
-
const
|
|
1148
|
-
t.appendChild(
|
|
1149
|
-
}
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1245
|
+
if (!f) {
|
|
1246
|
+
const v = Ae(l());
|
|
1247
|
+
t.appendChild(v), w = null, x = v;
|
|
1248
|
+
}
|
|
1249
|
+
const h = at(o.assistantDraft), _ = document.createElement("div");
|
|
1250
|
+
_.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", it(_, h);
|
|
1251
|
+
const k = document.createElement("div");
|
|
1252
|
+
k.className = "pluno-pa-widget__message-actions", k.appendChild(ot(h)), _.appendChild(k), t.appendChild(_), w = _, x = null;
|
|
1154
1253
|
}
|
|
1155
1254
|
if (o.isThinking && !o.assistantDraft)
|
|
1156
|
-
if (
|
|
1157
|
-
const
|
|
1158
|
-
t.appendChild(
|
|
1255
|
+
if (f) {
|
|
1256
|
+
const h = kt();
|
|
1257
|
+
t.appendChild(h), w = null, x = h;
|
|
1159
1258
|
} else {
|
|
1160
|
-
const
|
|
1161
|
-
t.appendChild(
|
|
1259
|
+
const h = bo(l());
|
|
1260
|
+
t.appendChild(h), w = null, x = h;
|
|
1162
1261
|
}
|
|
1163
1262
|
if (o.lastError) {
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1263
|
+
const h = document.createElement("div");
|
|
1264
|
+
h.className = "pluno-pa-widget__error", h.textContent = o.lastError, t.appendChild(h), w = h, x = null;
|
|
1166
1265
|
}
|
|
1167
|
-
const
|
|
1168
|
-
if (s &&
|
|
1169
|
-
const
|
|
1170
|
-
isDrafting: s.draftingCandidateId ===
|
|
1266
|
+
const d = s && !o.isThinking ? jt(g) : null;
|
|
1267
|
+
if (s && d && !s.dismissedCandidateIds.has(d.id)) {
|
|
1268
|
+
const h = po(d, {
|
|
1269
|
+
isDrafting: s.draftingCandidateId === d.id,
|
|
1171
1270
|
error: s.error,
|
|
1172
1271
|
onDraft: s.onDraft,
|
|
1173
1272
|
onDismiss: s.onDismiss,
|
|
1174
1273
|
onDisable: s.onDisable
|
|
1175
1274
|
});
|
|
1176
|
-
t.appendChild(
|
|
1275
|
+
t.appendChild(h), s.onSeen(d), w = null, x = h;
|
|
1177
1276
|
}
|
|
1178
|
-
|
|
1277
|
+
w?.classList.add("pluno-pa-widget__message--bottom-reserve"), x?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
|
|
1179
1278
|
}
|
|
1180
|
-
function
|
|
1181
|
-
t.replaceChildren(),
|
|
1279
|
+
function ro(t, e, n, o, a, i) {
|
|
1280
|
+
t.replaceChildren(), St(e, !1), e.disabled = !0, n.hidden = !0;
|
|
1182
1281
|
const l = document.createElement("div");
|
|
1183
1282
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1184
1283
|
const p = document.createElement("img");
|
|
@@ -1186,34 +1285,34 @@ function Fn(t, e, n, o, a, r) {
|
|
|
1186
1285
|
const s = document.createElement("div");
|
|
1187
1286
|
s.className = "pluno-pa-widget__empty", s.textContent = "Log in to use Pluno on this page.", l.appendChild(s);
|
|
1188
1287
|
const g = document.createElement("button");
|
|
1189
|
-
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () =>
|
|
1288
|
+
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => i?.()), l.appendChild(g), t.appendChild(l);
|
|
1190
1289
|
}
|
|
1191
|
-
function
|
|
1290
|
+
function lo(t) {
|
|
1192
1291
|
const e = document.createElement("div");
|
|
1193
1292
|
e.className = "pluno-pa-widget__message-attachments";
|
|
1194
1293
|
for (const n of t)
|
|
1195
|
-
e.appendChild(
|
|
1294
|
+
e.appendChild(Vn(n));
|
|
1196
1295
|
return e;
|
|
1197
1296
|
}
|
|
1198
|
-
function
|
|
1297
|
+
function ot(t) {
|
|
1199
1298
|
const e = document.createElement("button");
|
|
1200
|
-
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(
|
|
1299
|
+
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild($n()), e.addEventListener("click", (n) => {
|
|
1201
1300
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
|
|
1202
1301
|
}), e;
|
|
1203
1302
|
}
|
|
1204
|
-
function
|
|
1303
|
+
function po(t, e) {
|
|
1205
1304
|
const n = document.createElement("article");
|
|
1206
1305
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1207
1306
|
const o = document.createElement("div");
|
|
1208
1307
|
o.className = "pluno-pa-widget__share-prompt-body";
|
|
1209
1308
|
const a = document.createElement("div");
|
|
1210
1309
|
a.className = "pluno-pa-widget__share-prompt-copy";
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1310
|
+
const i = document.createElement("strong");
|
|
1311
|
+
i.textContent = "Share this win?", a.appendChild(i);
|
|
1213
1312
|
const l = document.createElement("span");
|
|
1214
1313
|
if (l.textContent = e.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), e.error) {
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1314
|
+
const u = document.createElement("span");
|
|
1315
|
+
u.className = "pluno-pa-widget__share-prompt-error", u.textContent = e.error, a.appendChild(u);
|
|
1217
1316
|
}
|
|
1218
1317
|
o.appendChild(a);
|
|
1219
1318
|
const p = document.createElement("div");
|
|
@@ -1223,13 +1322,13 @@ function zn(t, e) {
|
|
|
1223
1322
|
const g = document.createElement("button");
|
|
1224
1323
|
if (g.type = "button", g.disabled = e.isDrafting, g.addEventListener("click", () => {
|
|
1225
1324
|
e.onDraft(t);
|
|
1226
|
-
}), e.isDrafting ? (g.appendChild(
|
|
1325
|
+
}), e.isDrafting ? (g.appendChild(Ne()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), e.isDrafting)
|
|
1227
1326
|
p.appendChild(s);
|
|
1228
1327
|
else {
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1328
|
+
const u = document.createElement("button");
|
|
1329
|
+
u.type = "button", u.className = "pluno-pa-widget__share-prompt-dismiss", u.setAttribute("aria-label", "Dismiss share prompt"), u.title = "Dismiss", u.textContent = "Dismiss", u.addEventListener("click", () => {
|
|
1231
1330
|
e.onDismiss(t);
|
|
1232
|
-
}), s.appendChild(
|
|
1331
|
+
}), s.appendChild(u), p.appendChild(s);
|
|
1233
1332
|
const b = document.createElement("button");
|
|
1234
1333
|
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1235
1334
|
e.onDisable(t);
|
|
@@ -1237,15 +1336,15 @@ function zn(t, e) {
|
|
|
1237
1336
|
}
|
|
1238
1337
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1239
1338
|
}
|
|
1240
|
-
function
|
|
1339
|
+
function so(t, e) {
|
|
1241
1340
|
const n = document.createElement("div");
|
|
1242
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1243
|
-
|
|
1341
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (f) => {
|
|
1342
|
+
f.target === n && e.onClose();
|
|
1244
1343
|
});
|
|
1245
1344
|
const o = document.createElement("section");
|
|
1246
1345
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
1247
|
-
const a = document.createElement("header"),
|
|
1248
|
-
|
|
1346
|
+
const a = document.createElement("header"), i = document.createElement("strong");
|
|
1347
|
+
i.textContent = "Share this win", a.appendChild(i);
|
|
1249
1348
|
const l = document.createElement("button");
|
|
1250
1349
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", e.onClose), a.appendChild(l), o.appendChild(a);
|
|
1251
1350
|
const p = document.createElement("p");
|
|
@@ -1254,49 +1353,51 @@ function Gn(t, e) {
|
|
|
1254
1353
|
s.className = "pluno-pa-widget__share-dialog-step";
|
|
1255
1354
|
const g = document.createElement("div");
|
|
1256
1355
|
g.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
const b =
|
|
1356
|
+
const u = document.createElement("strong");
|
|
1357
|
+
u.textContent = "1) Copy Screenshot", g.appendChild(u);
|
|
1358
|
+
const b = co("Copy Screenshot", async () => {
|
|
1260
1359
|
try {
|
|
1261
|
-
return await
|
|
1360
|
+
return await Kt(t.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1262
1361
|
} catch {
|
|
1263
1362
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1264
1363
|
}
|
|
1265
1364
|
});
|
|
1266
1365
|
if (g.appendChild(b), s.appendChild(g), t.screenshotDataUrl) {
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1366
|
+
const f = document.createElement("div");
|
|
1367
|
+
f.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1269
1368
|
const d = document.createElement("img");
|
|
1270
|
-
d.src = t.screenshotDataUrl, d.alt = "Product page with Pluno open",
|
|
1369
|
+
d.src = t.screenshotDataUrl, d.alt = "Product page with Pluno open", f.appendChild(d), s.appendChild(f);
|
|
1271
1370
|
}
|
|
1272
1371
|
o.appendChild(s), o.appendChild(p);
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1372
|
+
const w = document.createElement("div");
|
|
1373
|
+
w.className = "pluno-pa-widget__share-dialog-step";
|
|
1275
1374
|
const x = document.createElement("strong");
|
|
1276
|
-
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on",
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1279
|
-
|
|
1375
|
+
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", w.appendChild(x);
|
|
1376
|
+
const C = document.createElement("p");
|
|
1377
|
+
C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", w.appendChild(C);
|
|
1378
|
+
const m = document.createElement("footer");
|
|
1379
|
+
m.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1380
|
+
for (const f of uo(t)) {
|
|
1280
1381
|
const d = document.createElement("a");
|
|
1281
|
-
d.href =
|
|
1382
|
+
d.href = f.href, d.target = "_blank", d.rel = "noopener noreferrer", d.title = f.label, d.setAttribute("aria-label", `Open ${f.label}`), d.appendChild(go(f.id)), m.appendChild(d);
|
|
1282
1383
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1384
|
+
if (w.appendChild(m), o.appendChild(w), e.socialPostRewardsUrl) {
|
|
1385
|
+
const f = document.createElement("div");
|
|
1386
|
+
f.className = "pluno-pa-widget__share-dialog-step";
|
|
1286
1387
|
const d = document.createElement("strong");
|
|
1287
|
-
d.className = "pluno-pa-widget__share-dialog-step-title", d.textContent = "3) Submit post to get 2000 free credits!",
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1388
|
+
d.className = "pluno-pa-widget__share-dialog-step-title", d.textContent = "3) Submit post to get 2000 free credits!", f.appendChild(d);
|
|
1389
|
+
const h = document.createElement("a");
|
|
1390
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = e.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(ho()), f.appendChild(h), o.appendChild(f);
|
|
1290
1391
|
}
|
|
1291
1392
|
return n.appendChild(o), n;
|
|
1292
1393
|
}
|
|
1293
|
-
function
|
|
1394
|
+
function co(t, e) {
|
|
1294
1395
|
const n = document.createElement("button");
|
|
1295
1396
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = t, n.addEventListener("click", async (o) => {
|
|
1296
1397
|
o.preventDefault(), o.stopPropagation(), await e() && (n.textContent = "Copied ✓");
|
|
1297
1398
|
}), n;
|
|
1298
1399
|
}
|
|
1299
|
-
function
|
|
1400
|
+
function uo(t) {
|
|
1300
1401
|
const e = t.linkedinPost.trim(), n = t.xPost.trim();
|
|
1301
1402
|
return [
|
|
1302
1403
|
{
|
|
@@ -1316,7 +1417,7 @@ function Un(t) {
|
|
|
1316
1417
|
}
|
|
1317
1418
|
];
|
|
1318
1419
|
}
|
|
1319
|
-
function
|
|
1420
|
+
function go(t) {
|
|
1320
1421
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1321
1422
|
return e.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), e.setAttribute("viewBox", "0 0 32 32"), e.setAttribute("aria-hidden", "true"), t === "linkedin" ? (P(e, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), P(e, "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"), P(e, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), P(e, "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"), P(e, "M20 18c.1 2.2.1 4.7 0 7.2"), e) : t === "x" ? (P(e, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), P(e, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), P(e, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), e) : (P(e, "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"), P(e, "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"), P(e, "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"), P(e, "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"), e);
|
|
1322
1423
|
}
|
|
@@ -1324,52 +1425,52 @@ function P(t, e, n) {
|
|
|
1324
1425
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1325
1426
|
o.setAttribute("d", e), n && o.setAttribute("opacity", n), t.appendChild(o);
|
|
1326
1427
|
}
|
|
1327
|
-
function
|
|
1428
|
+
function ho() {
|
|
1328
1429
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1329
1430
|
return t.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), t.setAttribute("viewBox", "0 0 24 24"), t.setAttribute("aria-hidden", "true"), P(t, "M14 5h5v5"), P(t, "M19 5l-8 8"), P(t, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), t;
|
|
1330
1431
|
}
|
|
1331
|
-
function
|
|
1332
|
-
return t.role === "tool" && t.toolName ===
|
|
1432
|
+
function mo(t) {
|
|
1433
|
+
return t.role === "tool" && t.toolName === ut;
|
|
1333
1434
|
}
|
|
1334
|
-
function
|
|
1435
|
+
function at(t) {
|
|
1335
1436
|
return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1336
1437
|
}
|
|
1337
|
-
function
|
|
1438
|
+
function fo(t, e, n, o) {
|
|
1338
1439
|
const a = document.createElement("article");
|
|
1339
1440
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1342
|
-
const l = document.createElement("details"), p =
|
|
1441
|
+
const i = document.createElement("img");
|
|
1442
|
+
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 = wo(t);
|
|
1343
1444
|
l.open = e.has(p), l.addEventListener("toggle", () => {
|
|
1344
1445
|
l.open ? e.add(p) : e.delete(p), n();
|
|
1345
1446
|
});
|
|
1346
1447
|
const s = document.createElement("summary");
|
|
1347
|
-
s.className = "pluno-pa-widget__tool-summary", t.some((b) => b.loading) && s.appendChild(
|
|
1348
|
-
const
|
|
1349
|
-
if (
|
|
1448
|
+
s.className = "pluno-pa-widget__tool-summary", t.some((b) => b.loading) && s.appendChild(Ne());
|
|
1449
|
+
const u = document.createElement("span");
|
|
1450
|
+
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = t[t.length - 1].content || "Run tool", s.appendChild(u), l.appendChild(s), t.length > 0) {
|
|
1350
1451
|
const b = document.createElement("div");
|
|
1351
1452
|
b.className = "pluno-pa-widget__tool-lines";
|
|
1352
|
-
for (const
|
|
1453
|
+
for (const w of t) {
|
|
1353
1454
|
const x = document.createElement("div");
|
|
1354
|
-
x.className = "pluno-pa-widget__tool-line",
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1455
|
+
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ne());
|
|
1456
|
+
const C = document.createElement("span");
|
|
1457
|
+
C.textContent = w.content || "Run tool", x.appendChild(C), b.appendChild(x);
|
|
1357
1458
|
}
|
|
1358
1459
|
l.appendChild(b);
|
|
1359
1460
|
}
|
|
1360
1461
|
return a.appendChild(l), a;
|
|
1361
1462
|
}
|
|
1362
|
-
function
|
|
1463
|
+
function Ae(t) {
|
|
1363
1464
|
const e = document.createElement("article");
|
|
1364
1465
|
e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1365
1466
|
const n = document.createElement("img");
|
|
1366
1467
|
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e;
|
|
1367
1468
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const e =
|
|
1370
|
-
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(
|
|
1469
|
+
function bo(t) {
|
|
1470
|
+
const e = Ae(t);
|
|
1471
|
+
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(kt()), e;
|
|
1371
1472
|
}
|
|
1372
|
-
function
|
|
1473
|
+
function kt() {
|
|
1373
1474
|
const t = document.createElement("div");
|
|
1374
1475
|
t.className = "pluno-pa-widget__status";
|
|
1375
1476
|
const e = document.createElement("span");
|
|
@@ -1377,17 +1478,17 @@ function ut() {
|
|
|
1377
1478
|
const n = document.createElement("span");
|
|
1378
1479
|
return n.textContent = "Thinking...", t.appendChild(n), t;
|
|
1379
1480
|
}
|
|
1380
|
-
function
|
|
1481
|
+
function wo(t) {
|
|
1381
1482
|
return `tools:${t.map((e) => e.id).join("|")}`;
|
|
1382
1483
|
}
|
|
1383
|
-
function
|
|
1484
|
+
function Ne() {
|
|
1384
1485
|
const t = document.createElement("span");
|
|
1385
1486
|
return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
|
|
1386
1487
|
}
|
|
1387
|
-
function
|
|
1388
|
-
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ?
|
|
1488
|
+
function St(t, e) {
|
|
1489
|
+
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? Gn() : vt());
|
|
1389
1490
|
}
|
|
1390
|
-
function
|
|
1491
|
+
function it(t, e) {
|
|
1391
1492
|
const n = e.replace(/\r\n/g, `
|
|
1392
1493
|
`).split(`
|
|
1393
1494
|
`);
|
|
@@ -1403,22 +1504,22 @@ function Ye(t, e) {
|
|
|
1403
1504
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1404
1505
|
g.push(n[o]), o += 1;
|
|
1405
1506
|
o += o < n.length ? 1 : 0;
|
|
1406
|
-
const
|
|
1507
|
+
const u = document.createElement("pre"), b = document.createElement("code");
|
|
1407
1508
|
b.textContent = g.join(`
|
|
1408
|
-
`),
|
|
1509
|
+
`), u.appendChild(b), t.appendChild(u);
|
|
1409
1510
|
continue;
|
|
1410
1511
|
}
|
|
1411
1512
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1412
1513
|
if (l) {
|
|
1413
1514
|
const g = document.createElement(`h${l[1].length + 2}`);
|
|
1414
|
-
|
|
1515
|
+
pe(g, l[2]), t.appendChild(g), o += 1;
|
|
1415
1516
|
continue;
|
|
1416
1517
|
}
|
|
1417
1518
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1418
1519
|
const g = document.createElement("ul");
|
|
1419
1520
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1521
|
+
const u = document.createElement("li");
|
|
1522
|
+
pe(u, n[o].replace(/^\s*[-*+]\s+/, "")), g.appendChild(u), o += 1;
|
|
1422
1523
|
}
|
|
1423
1524
|
t.appendChild(g);
|
|
1424
1525
|
continue;
|
|
@@ -1426,8 +1527,8 @@ function Ye(t, e) {
|
|
|
1426
1527
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1427
1528
|
const g = document.createElement("ol");
|
|
1428
1529
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1530
|
+
const u = document.createElement("li");
|
|
1531
|
+
pe(u, n[o].replace(/^\s*\d+\.\s+/, "")), g.appendChild(u), o += 1;
|
|
1431
1532
|
}
|
|
1432
1533
|
t.appendChild(g);
|
|
1433
1534
|
continue;
|
|
@@ -1436,17 +1537,17 @@ function Ye(t, e) {
|
|
|
1436
1537
|
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]); )
|
|
1437
1538
|
p.push(n[o]), o += 1;
|
|
1438
1539
|
const s = document.createElement("p");
|
|
1439
|
-
p.forEach((g,
|
|
1440
|
-
|
|
1540
|
+
p.forEach((g, u) => {
|
|
1541
|
+
u > 0 && s.appendChild(document.createElement("br")), pe(s, g);
|
|
1441
1542
|
}), t.appendChild(s);
|
|
1442
1543
|
}
|
|
1443
1544
|
}
|
|
1444
|
-
function
|
|
1545
|
+
function pe(t, e) {
|
|
1445
1546
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1446
1547
|
let o = 0;
|
|
1447
1548
|
for (const a of e.matchAll(n)) {
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1549
|
+
const i = a.index ?? 0;
|
|
1550
|
+
i > o && t.appendChild(document.createTextNode(e.slice(o, i)));
|
|
1450
1551
|
const l = a[0];
|
|
1451
1552
|
if (l.startsWith("`")) {
|
|
1452
1553
|
const p = document.createElement("code");
|
|
@@ -1459,17 +1560,17 @@ function ae(t, e) {
|
|
|
1459
1560
|
p.textContent = l.slice(1, -1), t.appendChild(p);
|
|
1460
1561
|
} else {
|
|
1461
1562
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1462
|
-
if (p &&
|
|
1563
|
+
if (p && _o(p[2])) {
|
|
1463
1564
|
const s = document.createElement("a");
|
|
1464
1565
|
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], t.appendChild(s);
|
|
1465
1566
|
} else
|
|
1466
1567
|
t.appendChild(document.createTextNode(l));
|
|
1467
1568
|
}
|
|
1468
|
-
o =
|
|
1569
|
+
o = i + l.length;
|
|
1469
1570
|
}
|
|
1470
1571
|
o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
|
|
1471
1572
|
}
|
|
1472
|
-
function
|
|
1573
|
+
function _o(t) {
|
|
1473
1574
|
if (t.startsWith("/") || t.startsWith("#"))
|
|
1474
1575
|
return !0;
|
|
1475
1576
|
try {
|
|
@@ -1479,7 +1580,7 @@ function Yn(t) {
|
|
|
1479
1580
|
return !1;
|
|
1480
1581
|
}
|
|
1481
1582
|
}
|
|
1482
|
-
function
|
|
1583
|
+
function rt(t, e) {
|
|
1483
1584
|
if (t.getElementById("pluno-pa-widget-styles"))
|
|
1484
1585
|
return;
|
|
1485
1586
|
const n = t.ownerDocument.createElement("style");
|
|
@@ -1526,8 +1627,8 @@ function Xe(t, e) {
|
|
|
1526
1627
|
--pluno-pa-launcher-hairline: rgba(24, 24, 27, 0.06);
|
|
1527
1628
|
--pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
|
|
1528
1629
|
--pluno-pa-launcher-height: 41px;
|
|
1529
|
-
--pluno-pa-panel-width: min(420px, calc(100vw -
|
|
1530
|
-
--pluno-pa-panel-height: min(680px, calc(100vh -
|
|
1630
|
+
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
|
|
1631
|
+
--pluno-pa-panel-height: min(clamp(680px, 76vh, 800px), calc(100vh - 58px));
|
|
1531
1632
|
--pluno-pa-panel-offset-x: calc(var(--pluno-pa-launcher-width) - var(--pluno-pa-panel-width));
|
|
1532
1633
|
--pluno-pa-panel-offset-y: calc(var(--pluno-pa-launcher-height) - var(--pluno-pa-panel-height));
|
|
1533
1634
|
--pluno-pa-accent-soft: rgba(24, 24, 27, 0.12);
|
|
@@ -2349,6 +2450,12 @@ function Xe(t, e) {
|
|
|
2349
2450
|
.pluno-pa-widget__share-dialog-status[hidden] {
|
|
2350
2451
|
display: none;
|
|
2351
2452
|
}
|
|
2453
|
+
.pluno-pa-widget__share-dialog-hint {
|
|
2454
|
+
margin: -2px 0 0;
|
|
2455
|
+
color: var(--pluno-pa-share-muted);
|
|
2456
|
+
font-size: 12px;
|
|
2457
|
+
line-height: 1.3;
|
|
2458
|
+
}
|
|
2352
2459
|
.pluno-pa-widget__share-dialog-copy {
|
|
2353
2460
|
display: inline-flex;
|
|
2354
2461
|
align-items: center;
|
|
@@ -2448,6 +2555,65 @@ function Xe(t, e) {
|
|
|
2448
2555
|
background: var(--pluno-pa-bg);
|
|
2449
2556
|
border-top: 1px solid var(--pluno-pa-divider);
|
|
2450
2557
|
}
|
|
2558
|
+
.pluno-pa-widget__billing-status {
|
|
2559
|
+
display: grid;
|
|
2560
|
+
gap: 8px;
|
|
2561
|
+
margin: 0 0 8px;
|
|
2562
|
+
}
|
|
2563
|
+
.pluno-pa-widget__billing-status[hidden] {
|
|
2564
|
+
display: none;
|
|
2565
|
+
}
|
|
2566
|
+
.pluno-pa-widget__billing-action-card {
|
|
2567
|
+
display: grid;
|
|
2568
|
+
gap: 8px;
|
|
2569
|
+
padding: 10px;
|
|
2570
|
+
border: 1px solid color-mix(in srgb, var(--pluno-pa-accent) 24%, var(--pluno-pa-divider));
|
|
2571
|
+
border-radius: 8px;
|
|
2572
|
+
background: color-mix(in srgb, var(--pluno-pa-accent-soft) 60%, var(--pluno-pa-surface));
|
|
2573
|
+
color: var(--pluno-pa-text);
|
|
2574
|
+
font-size: 12px;
|
|
2575
|
+
line-height: 1.4;
|
|
2576
|
+
}
|
|
2577
|
+
.pluno-pa-widget__billing-action-card strong {
|
|
2578
|
+
color: var(--pluno-pa-text);
|
|
2579
|
+
font-size: 13px;
|
|
2580
|
+
line-height: 1.25;
|
|
2581
|
+
font-weight: 700;
|
|
2582
|
+
}
|
|
2583
|
+
.pluno-pa-widget__billing-action-card span {
|
|
2584
|
+
color: var(--pluno-pa-muted);
|
|
2585
|
+
}
|
|
2586
|
+
.pluno-pa-widget__billing-action-card-actions {
|
|
2587
|
+
display: flex;
|
|
2588
|
+
flex-wrap: wrap;
|
|
2589
|
+
gap: 7px;
|
|
2590
|
+
}
|
|
2591
|
+
.pluno-pa-widget__billing-action-card-actions button {
|
|
2592
|
+
min-height: 29px;
|
|
2593
|
+
display: inline-flex;
|
|
2594
|
+
align-items: center;
|
|
2595
|
+
gap: 6px;
|
|
2596
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
2597
|
+
border-radius: 8px;
|
|
2598
|
+
background: var(--pluno-pa-bg);
|
|
2599
|
+
color: var(--pluno-pa-text);
|
|
2600
|
+
padding: 0 9px;
|
|
2601
|
+
font-size: 12px;
|
|
2602
|
+
font-weight: 650;
|
|
2603
|
+
line-height: 1;
|
|
2604
|
+
cursor: pointer;
|
|
2605
|
+
white-space: nowrap;
|
|
2606
|
+
}
|
|
2607
|
+
.pluno-pa-widget__billing-action-card-actions button:first-child {
|
|
2608
|
+
border-color: var(--pluno-pa-text);
|
|
2609
|
+
background: var(--pluno-pa-text);
|
|
2610
|
+
color: var(--pluno-pa-bg);
|
|
2611
|
+
}
|
|
2612
|
+
.pluno-pa-widget__billing-action-card-actions button:disabled,
|
|
2613
|
+
.pluno-pa-widget__billing-action-card-actions button:disabled {
|
|
2614
|
+
cursor: not-allowed;
|
|
2615
|
+
opacity: 0.55;
|
|
2616
|
+
}
|
|
2451
2617
|
.pluno-pa-widget__attachment-error {
|
|
2452
2618
|
margin: 0 0 8px;
|
|
2453
2619
|
padding: 6px 9px;
|
|
@@ -2807,7 +2973,7 @@ function Xe(t, e) {
|
|
|
2807
2973
|
right: 16px;
|
|
2808
2974
|
height: 36px;
|
|
2809
2975
|
z-index: 3;
|
|
2810
|
-
background-image: url('${
|
|
2976
|
+
background-image: url('${je}');
|
|
2811
2977
|
background-repeat: repeat-x;
|
|
2812
2978
|
background-size: 104px 36px;
|
|
2813
2979
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -2879,6 +3045,13 @@ function Xe(t, e) {
|
|
|
2879
3045
|
.pluno-pa-widget--scribble .pluno-pa-widget__composer-inner {
|
|
2880
3046
|
border-radius: var(--pluno-pa-scribble-wobble);
|
|
2881
3047
|
}
|
|
3048
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card {
|
|
3049
|
+
position: relative;
|
|
3050
|
+
border-radius: var(--pluno-pa-scribble-wobble);
|
|
3051
|
+
}
|
|
3052
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button {
|
|
3053
|
+
position: relative;
|
|
3054
|
+
}
|
|
2882
3055
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
|
|
2883
3056
|
position: relative;
|
|
2884
3057
|
border-radius: var(--pluno-pa-scribble-wobble);
|
|
@@ -2893,6 +3066,8 @@ function Xe(t, e) {
|
|
|
2893
3066
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
|
|
2894
3067
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
|
|
2895
3068
|
.pluno-pa-widget--scribble .pluno-pa-widget__close,
|
|
3069
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card,
|
|
3070
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button,
|
|
2896
3071
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body,
|
|
2897
3072
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
|
|
2898
3073
|
isolation: isolate;
|
|
@@ -2907,6 +3082,8 @@ function Xe(t, e) {
|
|
|
2907
3082
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
|
|
2908
3083
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
|
|
2909
3084
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::before,
|
|
3085
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before,
|
|
3086
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
|
|
2910
3087
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body::before,
|
|
2911
3088
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
|
|
2912
3089
|
content: "";
|
|
@@ -2932,9 +3109,21 @@ function Xe(t, e) {
|
|
|
2932
3109
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
|
|
2933
3110
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
|
|
2934
3111
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::before,
|
|
3112
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
|
|
2935
3113
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
|
|
2936
3114
|
background: var(--pluno-pa-bg);
|
|
2937
3115
|
}
|
|
3116
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before {
|
|
3117
|
+
background: color-mix(in srgb, var(--pluno-pa-accent-soft) 60%, var(--pluno-pa-surface));
|
|
3118
|
+
filter: url(#pluno-pa-scribble-wobble);
|
|
3119
|
+
}
|
|
3120
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button:first-child {
|
|
3121
|
+
color: var(--pluno-pa-bg);
|
|
3122
|
+
}
|
|
3123
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button:first-child::before {
|
|
3124
|
+
background: var(--pluno-pa-text);
|
|
3125
|
+
border-color: var(--pluno-pa-text);
|
|
3126
|
+
}
|
|
2938
3127
|
.pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within {
|
|
2939
3128
|
border-color: transparent;
|
|
2940
3129
|
}
|
|
@@ -2945,6 +3134,7 @@ function Xe(t, e) {
|
|
|
2945
3134
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
|
|
2946
3135
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
|
|
2947
3136
|
.pluno-pa-widget--scribble .pluno-pa-widget__close,
|
|
3137
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button,
|
|
2948
3138
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable) {
|
|
2949
3139
|
border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
|
|
2950
3140
|
}
|
|
@@ -2952,6 +3142,7 @@ function Xe(t, e) {
|
|
|
2952
3142
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
|
|
2953
3143
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
|
|
2954
3144
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::after,
|
|
3145
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::after,
|
|
2955
3146
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::after {
|
|
2956
3147
|
content: "";
|
|
2957
3148
|
position: absolute;
|
|
@@ -3029,7 +3220,7 @@ function Xe(t, e) {
|
|
|
3029
3220
|
right: 12px;
|
|
3030
3221
|
height: 22px;
|
|
3031
3222
|
z-index: 1;
|
|
3032
|
-
background-image: url('${
|
|
3223
|
+
background-image: url('${je}');
|
|
3033
3224
|
background-repeat: repeat-x;
|
|
3034
3225
|
background-size: 62px 21.5px;
|
|
3035
3226
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3043,7 +3234,7 @@ function Xe(t, e) {
|
|
|
3043
3234
|
}
|
|
3044
3235
|
`, t.appendChild(n);
|
|
3045
3236
|
}
|
|
3046
|
-
async function
|
|
3237
|
+
async function xo() {
|
|
3047
3238
|
return document.body ? document.body : await new Promise((t) => {
|
|
3048
3239
|
const e = new MutationObserver(() => {
|
|
3049
3240
|
document.body && (e.disconnect(), t(document.body));
|
|
@@ -3051,49 +3242,49 @@ async function Xn() {
|
|
|
3051
3242
|
e.observe(document.documentElement, { childList: !0 });
|
|
3052
3243
|
});
|
|
3053
3244
|
}
|
|
3054
|
-
function
|
|
3245
|
+
function Lt(t) {
|
|
3055
3246
|
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
3056
3247
|
}
|
|
3057
|
-
function
|
|
3248
|
+
function vo(t) {
|
|
3058
3249
|
try {
|
|
3059
|
-
const e = window.localStorage.getItem(
|
|
3250
|
+
const e = window.localStorage.getItem(Lt(t));
|
|
3060
3251
|
if (!e)
|
|
3061
|
-
return
|
|
3252
|
+
return lt();
|
|
3062
3253
|
const n = JSON.parse(e);
|
|
3063
3254
|
return {
|
|
3064
3255
|
isOpen: n.isOpen === !0,
|
|
3065
3256
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3066
3257
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3067
|
-
launcherPosition:
|
|
3068
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3258
|
+
launcherPosition: ko(n.launcherPosition) ? n.launcherPosition : null,
|
|
3259
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-gt) : [],
|
|
3069
3260
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3070
3261
|
};
|
|
3071
3262
|
} catch {
|
|
3072
|
-
return
|
|
3263
|
+
return lt();
|
|
3073
3264
|
}
|
|
3074
3265
|
}
|
|
3075
|
-
async function
|
|
3266
|
+
async function yo(t) {
|
|
3076
3267
|
if (t.loadSharePromptsDisabled)
|
|
3077
3268
|
return t.loadSharePromptsDisabled();
|
|
3078
3269
|
try {
|
|
3079
|
-
return window.localStorage.getItem(
|
|
3270
|
+
return window.localStorage.getItem(ht) === "true";
|
|
3080
3271
|
} catch {
|
|
3081
3272
|
return !1;
|
|
3082
3273
|
}
|
|
3083
3274
|
}
|
|
3084
|
-
function
|
|
3275
|
+
function Co(t, e) {
|
|
3085
3276
|
if (t.persistSharePromptsDisabled) {
|
|
3086
3277
|
Promise.resolve(t.persistSharePromptsDisabled(e)).catch(() => {
|
|
3087
3278
|
});
|
|
3088
3279
|
return;
|
|
3089
3280
|
}
|
|
3090
3281
|
try {
|
|
3091
|
-
e && window.localStorage.setItem(
|
|
3282
|
+
e && window.localStorage.setItem(ht, "true");
|
|
3092
3283
|
} catch {
|
|
3093
3284
|
return;
|
|
3094
3285
|
}
|
|
3095
3286
|
}
|
|
3096
|
-
function
|
|
3287
|
+
function lt() {
|
|
3097
3288
|
return {
|
|
3098
3289
|
isOpen: !1,
|
|
3099
3290
|
composerValue: "",
|
|
@@ -3103,43 +3294,43 @@ function Ze() {
|
|
|
3103
3294
|
sharePromptsDisabled: !1
|
|
3104
3295
|
};
|
|
3105
3296
|
}
|
|
3106
|
-
function
|
|
3297
|
+
function Eo(t, e) {
|
|
3107
3298
|
try {
|
|
3108
|
-
window.localStorage.setItem(
|
|
3299
|
+
window.localStorage.setItem(Lt(t), JSON.stringify(e));
|
|
3109
3300
|
} catch {
|
|
3110
3301
|
return;
|
|
3111
3302
|
}
|
|
3112
3303
|
}
|
|
3113
|
-
function
|
|
3304
|
+
function ko(t) {
|
|
3114
3305
|
if (!t || typeof t != "object")
|
|
3115
3306
|
return !1;
|
|
3116
3307
|
const e = t;
|
|
3117
3308
|
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
3118
3309
|
}
|
|
3119
|
-
const
|
|
3120
|
-
function
|
|
3310
|
+
const pt = /* @__PURE__ */ new WeakSet();
|
|
3311
|
+
function So(t) {
|
|
3121
3312
|
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
3122
3313
|
}
|
|
3123
|
-
function
|
|
3314
|
+
function st(t) {
|
|
3124
3315
|
const e = t.pathname.split("/");
|
|
3125
3316
|
return e[e.length - 1] ?? "";
|
|
3126
3317
|
}
|
|
3127
|
-
function
|
|
3318
|
+
function Lo(t, e) {
|
|
3128
3319
|
const n = new URL(t.src, document.baseURI);
|
|
3129
|
-
return n.href === e.href || n.pathname === e.pathname ? !0 :
|
|
3320
|
+
return n.href === e.href || n.pathname === e.pathname ? !0 : st(n) === st(e);
|
|
3130
3321
|
}
|
|
3131
|
-
class
|
|
3322
|
+
class O extends EventTarget {
|
|
3132
3323
|
constructor(e, n) {
|
|
3133
|
-
super(), this.channelId = n, this.url = e, this.addPreviewListener(
|
|
3134
|
-
this.readyState =
|
|
3135
|
-
}), this.addPreviewListener(
|
|
3324
|
+
super(), this.channelId = n, this.url = e, this.addPreviewListener(Qt, () => {
|
|
3325
|
+
this.readyState = O.OPEN, this.dispatchEvent(new Event("open"));
|
|
3326
|
+
}), this.addPreviewListener(en, (o) => {
|
|
3136
3327
|
const a = o;
|
|
3137
3328
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3138
|
-
}), this.addPreviewListener(
|
|
3139
|
-
this.readyState =
|
|
3140
|
-
}), this.addPreviewListener(
|
|
3329
|
+
}), this.addPreviewListener(tn, () => {
|
|
3330
|
+
this.readyState = O.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3331
|
+
}), this.addPreviewListener(nn, (o) => {
|
|
3141
3332
|
const a = o;
|
|
3142
|
-
this.readyState =
|
|
3333
|
+
this.readyState = O.CLOSED, this.dispatchEvent(
|
|
3143
3334
|
new CloseEvent("close", {
|
|
3144
3335
|
code: a.detail?.code ?? 1e3,
|
|
3145
3336
|
reason: a.detail?.reason ?? "",
|
|
@@ -3147,7 +3338,7 @@ class R extends EventTarget {
|
|
|
3147
3338
|
})
|
|
3148
3339
|
), this.cleanup();
|
|
3149
3340
|
}), window.dispatchEvent(
|
|
3150
|
-
new CustomEvent(
|
|
3341
|
+
new CustomEvent(se(Xt, this.channelId), {
|
|
3151
3342
|
detail: { socketId: this.socketId, url: e }
|
|
3152
3343
|
})
|
|
3153
3344
|
);
|
|
@@ -3162,28 +3353,28 @@ class R extends EventTarget {
|
|
|
3162
3353
|
extensions = "";
|
|
3163
3354
|
binaryType = "blob";
|
|
3164
3355
|
bufferedAmount = 0;
|
|
3165
|
-
readyState =
|
|
3166
|
-
socketId =
|
|
3356
|
+
readyState = O.CONNECTING;
|
|
3357
|
+
socketId = Po();
|
|
3167
3358
|
listeners = /* @__PURE__ */ new Map();
|
|
3168
3359
|
send(e) {
|
|
3169
|
-
if (this.readyState !==
|
|
3360
|
+
if (this.readyState !== O.OPEN)
|
|
3170
3361
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3171
3362
|
window.dispatchEvent(
|
|
3172
|
-
new CustomEvent(
|
|
3363
|
+
new CustomEvent(se(Zt, this.channelId), {
|
|
3173
3364
|
detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
|
|
3174
3365
|
})
|
|
3175
3366
|
);
|
|
3176
3367
|
}
|
|
3177
3368
|
close(e, n) {
|
|
3178
|
-
this.readyState !==
|
|
3179
|
-
new CustomEvent(
|
|
3369
|
+
this.readyState !== O.CLOSED && (this.readyState = O.CLOSING, window.dispatchEvent(
|
|
3370
|
+
new CustomEvent(se(Jt, this.channelId), {
|
|
3180
3371
|
detail: { socketId: this.socketId, code: e, reason: n }
|
|
3181
3372
|
})
|
|
3182
3373
|
), this.cleanup());
|
|
3183
3374
|
}
|
|
3184
3375
|
addPreviewListener(e, n) {
|
|
3185
|
-
const o =
|
|
3186
|
-
|
|
3376
|
+
const o = se(e, this.channelId), a = (i) => {
|
|
3377
|
+
i.detail?.socketId === this.socketId && n(i);
|
|
3187
3378
|
};
|
|
3188
3379
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
3189
3380
|
}
|
|
@@ -3193,36 +3384,36 @@ class R extends EventTarget {
|
|
|
3193
3384
|
this.listeners.clear();
|
|
3194
3385
|
}
|
|
3195
3386
|
}
|
|
3196
|
-
function
|
|
3197
|
-
const t = window.sessionStorage.getItem(
|
|
3387
|
+
function Po() {
|
|
3388
|
+
const t = window.sessionStorage.getItem(qe);
|
|
3198
3389
|
if (t)
|
|
3199
3390
|
return t;
|
|
3200
3391
|
const e = crypto.randomUUID();
|
|
3201
|
-
return window.sessionStorage.setItem(
|
|
3392
|
+
return window.sessionStorage.setItem(qe, e), e;
|
|
3202
3393
|
}
|
|
3203
|
-
function
|
|
3394
|
+
function se(t, e) {
|
|
3204
3395
|
return `${t}:${e}`;
|
|
3205
3396
|
}
|
|
3206
|
-
function
|
|
3397
|
+
function Ao(t) {
|
|
3207
3398
|
const e = document.currentScript;
|
|
3208
3399
|
if (e instanceof HTMLScriptElement)
|
|
3209
3400
|
return [e];
|
|
3210
3401
|
const n = new URL(t, document.baseURI).href, o = new URL(n);
|
|
3211
3402
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3212
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3403
|
+
(a) => a instanceof HTMLScriptElement && So(a) && Lo(a, o)
|
|
3213
3404
|
);
|
|
3214
3405
|
}
|
|
3215
|
-
function
|
|
3216
|
-
for (const e of
|
|
3217
|
-
if (
|
|
3406
|
+
function No(t) {
|
|
3407
|
+
for (const e of Ao(t)) {
|
|
3408
|
+
if (pt.has(e) || e.dataset.plunoAutoMount === "false")
|
|
3218
3409
|
continue;
|
|
3219
|
-
|
|
3410
|
+
pt.add(e);
|
|
3220
3411
|
const n = e.dataset.plunoPreviewChannel;
|
|
3221
|
-
|
|
3412
|
+
Cn({
|
|
3222
3413
|
token: e.dataset.plunoToken,
|
|
3223
3414
|
tokenEndpoint: e.dataset.plunoTokenEndpoint,
|
|
3224
3415
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
3225
|
-
webSocketFactory: n ?
|
|
3416
|
+
webSocketFactory: n ? yn(n) : void 0,
|
|
3226
3417
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
3227
3418
|
accentColor: e.dataset.plunoAccentColor,
|
|
3228
3419
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3234,8 +3425,8 @@ function io(t) {
|
|
|
3234
3425
|
});
|
|
3235
3426
|
}
|
|
3236
3427
|
}
|
|
3237
|
-
|
|
3428
|
+
No(import.meta.url);
|
|
3238
3429
|
export {
|
|
3239
|
-
|
|
3240
|
-
|
|
3430
|
+
yn as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3431
|
+
Cn as mountPlunoProductAgentWidget
|
|
3241
3432
|
};
|