@pluno/product-agent-web 0.1.15 → 0.1.16
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 +1 -0
- package/dist/product-agent-sdk.js +37 -36
- package/dist/product-agent-widget.js +225 -218
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type ProductAgentAppearance = {
|
|
|
22
22
|
accentColor?: string;
|
|
23
23
|
colorScheme?: "light" | "dark";
|
|
24
24
|
fontFamily?: string;
|
|
25
|
+
scribbleStyle?: boolean;
|
|
25
26
|
};
|
|
26
27
|
export type ProductAgentState = {
|
|
27
28
|
status: "idle" | "connecting" | "connected" | "reconnecting" | "closed" | "error";
|
|
@@ -129,7 +129,7 @@ class q {
|
|
|
129
129
|
isThinking: !0,
|
|
130
130
|
lastError: null
|
|
131
131
|
}), this.emit("message", i);
|
|
132
|
-
const
|
|
132
|
+
const a = {
|
|
133
133
|
type: "chat.user_message",
|
|
134
134
|
sessionId: this.state.sessionId ?? void 0,
|
|
135
135
|
clientMessageId: r,
|
|
@@ -138,7 +138,7 @@ class q {
|
|
|
138
138
|
model: this.options.model,
|
|
139
139
|
metadata: F(this.options.metadata)
|
|
140
140
|
};
|
|
141
|
-
this.activeClientMessageId = r, this.activeUserMessageEvent =
|
|
141
|
+
this.activeClientMessageId = r, this.activeUserMessageEvent = a, this.markThinkingProgress(), this.send(a);
|
|
142
142
|
}
|
|
143
143
|
stop() {
|
|
144
144
|
this.state.sessionId && (this.send({ type: "run.stop", sessionId: this.state.sessionId }), this.setState({ isThinking: !1 }), this.clearThinkingWatchdog());
|
|
@@ -196,11 +196,11 @@ class q {
|
|
|
196
196
|
rawAppearance: t.appearance,
|
|
197
197
|
normalizedAppearance: s
|
|
198
198
|
}), this.runtimeHelperJavascript = et(t.runtimeHelpers)?.javascript ?? null;
|
|
199
|
-
const r = Z(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"),
|
|
199
|
+
const r = Z(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), a = {
|
|
200
200
|
user: at(t.user),
|
|
201
201
|
status: "connected"
|
|
202
202
|
};
|
|
203
|
-
(i || this.state.starterPrompts.length === 0) && (
|
|
203
|
+
(i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r), (n || s) && (a.appearance = s), this.setState(a), this.state.sessionId && this.send({
|
|
204
204
|
type: "page.upsert",
|
|
205
205
|
sessionId: this.state.sessionId,
|
|
206
206
|
page: g(),
|
|
@@ -259,14 +259,14 @@ class q {
|
|
|
259
259
|
if (i >= 1)
|
|
260
260
|
return !1;
|
|
261
261
|
this.retryAttemptsByClientMessageId[n] = i + 1;
|
|
262
|
-
const
|
|
262
|
+
const a = typeof t.retryAfterMs == "number" ? t.retryAfterMs : 2e3;
|
|
263
263
|
return this.setState({ status: "reconnecting", isThinking: !0, lastError: null }), this.retryTimersByClientMessageId[n] = window.setTimeout(() => {
|
|
264
264
|
delete this.retryTimersByClientMessageId[n], this.setState({ status: "connected", isThinking: !0, lastError: null }), this.markThinkingProgress(), this.send({
|
|
265
265
|
type: "chat.retry_last_user_message",
|
|
266
266
|
sessionId: s,
|
|
267
267
|
clientMessageId: n
|
|
268
268
|
});
|
|
269
|
-
},
|
|
269
|
+
}, a), !0;
|
|
270
270
|
}
|
|
271
271
|
clearRetryTimers() {
|
|
272
272
|
for (const t of Object.values(this.retryTimersByClientMessageId))
|
|
@@ -337,10 +337,10 @@ class q {
|
|
|
337
337
|
const s = typeof t.sessionId == "string" ? t.sessionId : null, n = typeof t.callId == "string" ? t.callId : null, r = t.rawInput;
|
|
338
338
|
if (!s || !n || !_t(r))
|
|
339
339
|
return;
|
|
340
|
-
const i = await this.executeRuntimeHelper(),
|
|
340
|
+
const i = await this.executeRuntimeHelper(), a = await M(r).catch((o) => ({
|
|
341
341
|
ok: !1,
|
|
342
342
|
exception: {
|
|
343
|
-
message:
|
|
343
|
+
message: o instanceof Error ? o.message : String(o)
|
|
344
344
|
}
|
|
345
345
|
}));
|
|
346
346
|
this.send({
|
|
@@ -350,7 +350,7 @@ class q {
|
|
|
350
350
|
toolName: "execute_code",
|
|
351
351
|
summary: r.summary,
|
|
352
352
|
rawInput: f(r),
|
|
353
|
-
rawOutput: f(st(
|
|
353
|
+
rawOutput: f(st(a, i))
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
async executeRuntimeHelper() {
|
|
@@ -365,10 +365,10 @@ class q {
|
|
|
365
365
|
if (this.networkCaptureCleanup)
|
|
366
366
|
return;
|
|
367
367
|
const t = window.fetch.bind(window), s = XMLHttpRequest.prototype.open, n = XMLHttpRequest.prototype.setRequestHeader, r = XMLHttpRequest.prototype.send;
|
|
368
|
-
window.fetch = async (i,
|
|
369
|
-
const
|
|
368
|
+
window.fetch = async (i, a) => {
|
|
369
|
+
const o = Date.now(), c = new Date(o).toISOString(), u = i instanceof Request ? i : null, y = typeof i == "string" ? i : i instanceof URL ? i.toString() : u?.url ?? "", w = (a?.method ?? u?.method ?? "GET").toUpperCase(), A = H(new Headers(a?.headers ?? u?.headers ?? void 0)), C = await Et(u, a);
|
|
370
370
|
try {
|
|
371
|
-
const d = await t(i,
|
|
371
|
+
const d = await t(i, a);
|
|
372
372
|
return this.enqueueNetworkEvent({
|
|
373
373
|
requestId: T("fetch"),
|
|
374
374
|
url: y,
|
|
@@ -380,7 +380,7 @@ class q {
|
|
|
380
380
|
responseHeaders: H(d.headers),
|
|
381
381
|
responseBody: await wt(d),
|
|
382
382
|
startedAt: c,
|
|
383
|
-
durationMs: Date.now() -
|
|
383
|
+
durationMs: Date.now() - o
|
|
384
384
|
}), d;
|
|
385
385
|
} catch (d) {
|
|
386
386
|
throw this.enqueueNetworkEvent({
|
|
@@ -392,27 +392,27 @@ class q {
|
|
|
392
392
|
resourceType: "fetch",
|
|
393
393
|
errorText: d instanceof Error ? d.message : String(d),
|
|
394
394
|
startedAt: c,
|
|
395
|
-
durationMs: Date.now() -
|
|
395
|
+
durationMs: Date.now() - o
|
|
396
396
|
}), d;
|
|
397
397
|
}
|
|
398
|
-
}, XMLHttpRequest.prototype.open = function(
|
|
398
|
+
}, XMLHttpRequest.prototype.open = function(a, o, c, u, y) {
|
|
399
399
|
return this.__plunoMeta = {
|
|
400
400
|
requestId: T("xhr"),
|
|
401
|
-
method: String(
|
|
402
|
-
url: typeof
|
|
401
|
+
method: String(a ?? "GET").toUpperCase(),
|
|
402
|
+
url: typeof o == "string" ? o : o.toString(),
|
|
403
403
|
requestHeaders: {},
|
|
404
404
|
startedAtMs: Date.now(),
|
|
405
405
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
406
|
-
}, s.call(this,
|
|
407
|
-
}, XMLHttpRequest.prototype.setRequestHeader = function(
|
|
406
|
+
}, s.call(this, a, o, c ?? !0, u ?? void 0, y ?? void 0);
|
|
407
|
+
}, XMLHttpRequest.prototype.setRequestHeader = function(a, o) {
|
|
408
408
|
const c = this.__plunoMeta;
|
|
409
409
|
if (c) {
|
|
410
410
|
const u = c.requestHeaders ?? {};
|
|
411
|
-
u[
|
|
411
|
+
u[a] = o, c.requestHeaders = u;
|
|
412
412
|
}
|
|
413
|
-
return n.call(this,
|
|
414
|
-
}, XMLHttpRequest.prototype.send = function(
|
|
415
|
-
const
|
|
413
|
+
return n.call(this, a, o);
|
|
414
|
+
}, XMLHttpRequest.prototype.send = function(a) {
|
|
415
|
+
const o = window.__plunoProductAgentInstance, c = this.__plunoMeta ?? {
|
|
416
416
|
requestId: T("xhr"),
|
|
417
417
|
method: "GET",
|
|
418
418
|
url: "",
|
|
@@ -420,10 +420,10 @@ class q {
|
|
|
420
420
|
startedAtMs: Date.now(),
|
|
421
421
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
422
422
|
};
|
|
423
|
-
return c.requestBody = B(
|
|
423
|
+
return c.requestBody = B(a), this.__plunoMeta = c, this.addEventListener(
|
|
424
424
|
"loadend",
|
|
425
425
|
function() {
|
|
426
|
-
!
|
|
426
|
+
!o || !this.__plunoMeta || o.enqueueNetworkEvent({
|
|
427
427
|
requestId: String(this.__plunoMeta.requestId),
|
|
428
428
|
url: String(this.__plunoMeta.url ?? ""),
|
|
429
429
|
method: String(this.__plunoMeta.method ?? "GET"),
|
|
@@ -439,7 +439,7 @@ class q {
|
|
|
439
439
|
});
|
|
440
440
|
},
|
|
441
441
|
{ once: !0 }
|
|
442
|
-
), r.call(this,
|
|
442
|
+
), r.call(this, a ?? null);
|
|
443
443
|
}, window.__plunoProductAgentInstance = this, this.networkCaptureCleanup = () => {
|
|
444
444
|
window.fetch = t, XMLHttpRequest.prototype.open = s, XMLHttpRequest.prototype.setRequestHeader = n, XMLHttpRequest.prototype.send = r, window.__plunoProductAgentInstance === this && delete window.__plunoProductAgentInstance;
|
|
445
445
|
};
|
|
@@ -508,10 +508,10 @@ async function M(e) {
|
|
|
508
508
|
info: console.info,
|
|
509
509
|
warn: console.warn,
|
|
510
510
|
error: console.error
|
|
511
|
-
},
|
|
512
|
-
r.push({ level:
|
|
511
|
+
}, a = (o) => (...c) => {
|
|
512
|
+
r.push({ level: o, args: c }), i[o](...c);
|
|
513
513
|
};
|
|
514
|
-
console.log =
|
|
514
|
+
console.log = a("log"), console.info = a("info"), console.warn = a("warn"), console.error = a("error");
|
|
515
515
|
try {
|
|
516
516
|
return {
|
|
517
517
|
ok: !0,
|
|
@@ -528,14 +528,14 @@ async function M(e) {
|
|
|
528
528
|
origin: location.origin
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
|
-
} catch (
|
|
531
|
+
} catch (o) {
|
|
532
532
|
return {
|
|
533
533
|
ok: !1,
|
|
534
534
|
console: r,
|
|
535
535
|
exception: {
|
|
536
|
-
name:
|
|
537
|
-
message:
|
|
538
|
-
stack:
|
|
536
|
+
name: o instanceof Error ? o.name : "Error",
|
|
537
|
+
message: o instanceof Error ? o.message : String(o),
|
|
538
|
+
stack: o instanceof Error ? o.stack : void 0
|
|
539
539
|
},
|
|
540
540
|
metadata: {
|
|
541
541
|
durationMs: Date.now() - n,
|
|
@@ -581,11 +581,12 @@ function Q(e) {
|
|
|
581
581
|
function tt(e) {
|
|
582
582
|
if (!e || typeof e != "object")
|
|
583
583
|
return null;
|
|
584
|
-
const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null,
|
|
585
|
-
return !r && !i && !o ? null : {
|
|
584
|
+
const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, a = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, o = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
585
|
+
return !r && !i && !a && o === null ? null : {
|
|
586
586
|
...r ? { accentColor: r } : {},
|
|
587
587
|
...i ? { colorScheme: i } : {},
|
|
588
|
-
...
|
|
588
|
+
...a ? { fontFamily: a } : {},
|
|
589
|
+
...o !== null ? { scribbleStyle: o } : {}
|
|
589
590
|
};
|
|
590
591
|
}
|
|
591
592
|
function et(e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const e =
|
|
1
|
+
import { PlunoProductAgent as ye } from "./product-agent-sdk.js";
|
|
2
|
+
const ve = "#7c3aed";
|
|
3
|
+
function ke(t) {
|
|
4
|
+
const e = Te(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,27 +75,27 @@ function ve(t) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function Ce(t) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(ke(t))}`;
|
|
80
80
|
}
|
|
81
81
|
const N = "#2c2a1e", J = [253, 250, 241], Q = 3.5;
|
|
82
|
-
function
|
|
83
|
-
const e =
|
|
82
|
+
function he(t) {
|
|
83
|
+
const e = fe(t);
|
|
84
84
|
if (ee(M(e), J) >= Q)
|
|
85
85
|
return e;
|
|
86
|
-
let
|
|
86
|
+
let o = M(e);
|
|
87
87
|
const a = M(N);
|
|
88
88
|
for (let r = 0; r < 6; r += 1)
|
|
89
|
-
if (
|
|
90
|
-
return
|
|
91
|
-
return
|
|
89
|
+
if (o = Ne(o, a, 0.22), ee(o, J) >= Q)
|
|
90
|
+
return H(o);
|
|
91
|
+
return H(o);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const e =
|
|
93
|
+
function Se(t) {
|
|
94
|
+
const e = he(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">
|
|
98
|
-
<path d="${
|
|
98
|
+
<path d="${n}"/>
|
|
99
99
|
</clipPath>
|
|
100
100
|
<filter id="scribbleBoltWobble" x="-10%" y="-10%" width="120%" height="120%" color-interpolation-filters="sRGB">
|
|
101
101
|
<feTurbulence type="fractalNoise" baseFrequency="0.011" numOctaves="3" seed="7" result="noise"/>
|
|
@@ -104,9 +104,9 @@ function Ce(t) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${Le()}" 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="${
|
|
109
|
+
<path d="${n}" fill="none" stroke="${N}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
110
|
<g transform="rotate(-2 528 463)">
|
|
111
111
|
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${N}" stroke-width="13"/>
|
|
112
112
|
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${N}"/>
|
|
@@ -120,20 +120,20 @@ function Ce(t) {
|
|
|
120
120
|
</g>
|
|
121
121
|
</svg>`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
123
|
+
function Ee(t) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(Se(t))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
let
|
|
126
|
+
function Le() {
|
|
127
|
+
let n = "M 280 120", o = !1, a = 0;
|
|
128
128
|
for (let r = 150; r <= 1170; r += 62) {
|
|
129
|
-
const i = (a % 3 - 1) * 18, d =
|
|
130
|
-
|
|
129
|
+
const i = (a % 3 - 1) * 18, d = o ? 280 - i : 1020 + i;
|
|
130
|
+
n += ` L ${d} ${r}`, o = !o, a += 1;
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const e =
|
|
136
|
-
return
|
|
134
|
+
function Te(t) {
|
|
135
|
+
const e = fe(t), n = W(M(e));
|
|
136
|
+
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
139
139
|
bottom: "#e7e7e7",
|
|
@@ -144,7 +144,7 @@ function Le(t) {
|
|
|
144
144
|
highlight: "#ffffff",
|
|
145
145
|
inner: "#f4f4f4",
|
|
146
146
|
shadow: "#9d9d9d"
|
|
147
|
-
} :
|
|
147
|
+
} : n < 0.05 ? {
|
|
148
148
|
top: "#3d3d3d",
|
|
149
149
|
middle: "#171717",
|
|
150
150
|
bottom: "#030303",
|
|
@@ -168,9 +168,9 @@ function Le(t) {
|
|
|
168
168
|
shadow: v(e, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function fe(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((
|
|
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()}` : ve;
|
|
174
174
|
}
|
|
175
175
|
function M(t) {
|
|
176
176
|
return [
|
|
@@ -179,69 +179,69 @@ function M(t) {
|
|
|
179
179
|
Number.parseInt(t.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const
|
|
184
|
-
return `#${
|
|
182
|
+
function H([t, e, n]) {
|
|
183
|
+
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
|
+
return `#${o(t)}${o(e)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
const
|
|
186
|
+
function W([t, e, n]) {
|
|
187
|
+
const o = (a) => {
|
|
188
188
|
const r = a / 255;
|
|
189
189
|
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
|
-
return 0.2126 *
|
|
191
|
+
return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
193
|
function ee(t, e) {
|
|
194
|
-
const
|
|
194
|
+
const n = W(t), o = W(e), [a, r] = n > o ? [n, o] : [o, n];
|
|
195
195
|
return (a + 0.05) / (r + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const
|
|
197
|
+
function Ne(t, e, n) {
|
|
198
|
+
const o = V(n);
|
|
199
199
|
return [
|
|
200
|
-
t[0] + (e[0] - t[0]) *
|
|
201
|
-
t[1] + (e[1] - t[1]) *
|
|
202
|
-
t[2] + (e[2] - t[2]) *
|
|
200
|
+
t[0] + (e[0] - t[0]) * o,
|
|
201
|
+
t[1] + (e[1] - t[1]) * o,
|
|
202
|
+
t[2] + (e[2] - t[2]) * o
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
|
-
function v(t, e,
|
|
206
|
-
const [
|
|
207
|
-
return
|
|
205
|
+
function v(t, e, n) {
|
|
206
|
+
const [o, a, r] = Pe(M(t));
|
|
207
|
+
return H(Ie(o, V(a + n), V(r + e)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
209
|
+
function Pe([t, e, n]) {
|
|
210
|
+
const o = t / 255, a = e / 255, r = n / 255, i = Math.max(o, a, r), d = Math.min(o, a, r), u = (i + d) / 2;
|
|
211
211
|
if (i === d)
|
|
212
212
|
return [0, 0, u];
|
|
213
213
|
const p = i - d, g = u > 0.5 ? p / (2 - i - d) : p / (i + d);
|
|
214
|
-
return [(i ===
|
|
214
|
+
return [(i === o ? (a - r) / p + (a < r ? 6 : 0) : i === a ? (r - o) / p + 2 : (o - a) / p + 4) / 6, g, u];
|
|
215
215
|
}
|
|
216
|
-
function Ie(t, e,
|
|
216
|
+
function Ie(t, e, n) {
|
|
217
217
|
if (e === 0)
|
|
218
|
-
return [
|
|
219
|
-
const
|
|
218
|
+
return [n * 255, n * 255, n * 255];
|
|
219
|
+
const o = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
B(a,
|
|
222
|
-
B(a,
|
|
223
|
-
B(a,
|
|
221
|
+
B(a, o, t + 1 / 3) * 255,
|
|
222
|
+
B(a, o, t) * 255,
|
|
223
|
+
B(a, o, t - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function B(t, e,
|
|
227
|
-
let
|
|
228
|
-
return
|
|
226
|
+
function B(t, e, n) {
|
|
227
|
+
let o = n;
|
|
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
230
|
function V(t) {
|
|
231
231
|
return Math.max(0, Math.min(1, t));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const Ae = "product-agent:sdk-preview-socket-connect", Me = "product-agent:sdk-preview-socket-send", Oe = "product-agent:sdk-preview-socket-close", $e = "product-agent:sdk-preview-socket-open", De = "product-agent:sdk-preview-socket-message", Fe = "product-agent:sdk-preview-socket-error", Re = "product-agent:sdk-preview-socket-closed", te = "product-agent:sdk-preview-socket-id", Ge = "product-agent:preview-diagnostic", T = {
|
|
234
234
|
launcherLabel: "Ask for anything...",
|
|
235
235
|
accentColor: "#7c3aed",
|
|
236
236
|
colorScheme: "light",
|
|
237
237
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif',
|
|
238
238
|
scribbleStyle: !1,
|
|
239
239
|
position: "bottom-right"
|
|
240
|
-
}, ne = '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>',
|
|
241
|
-
function
|
|
240
|
+
}, ne = '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>', ze = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', oe = "pluno-pa-scribble-font";
|
|
241
|
+
function Be(t) {
|
|
242
242
|
return (e) => new C(e, t);
|
|
243
243
|
}
|
|
244
|
-
async function
|
|
244
|
+
async function Ue(t = {}) {
|
|
245
245
|
const e = {
|
|
246
246
|
launcherLabel: t.launcherLabel ?? T.launcherLabel,
|
|
247
247
|
accentColor: t.accentColor ?? T.accentColor,
|
|
@@ -257,7 +257,7 @@ async function Be(t = {}) {
|
|
|
257
257
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
258
258
|
webSocketFactory: t.webSocketFactory
|
|
259
259
|
};
|
|
260
|
-
|
|
260
|
+
I("web-sdk.widget", "Mounting widget with merged options", {
|
|
261
261
|
accentColor: e.accentColor,
|
|
262
262
|
colorScheme: e.colorScheme,
|
|
263
263
|
fontFamily: e.fontFamily,
|
|
@@ -268,9 +268,9 @@ async function Be(t = {}) {
|
|
|
268
268
|
hasWebSocketFactory: !!e.webSocketFactory,
|
|
269
269
|
initialStarterPromptCount: e.initialStarterPrompts?.length ?? 0
|
|
270
270
|
});
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
const
|
|
271
|
+
const n = document.createElement("div");
|
|
272
|
+
n.className = "pluno-pa-widget-host";
|
|
273
|
+
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
274
274
|
a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`;
|
|
275
275
|
let r = ae(e.accentColor, e.scribbleStyle);
|
|
276
276
|
a.innerHTML = `
|
|
@@ -333,14 +333,14 @@ async function Be(t = {}) {
|
|
|
333
333
|
<a class="pluno-pa-widget__powered-by" href="https://pluno.ai" target="_blank" rel="noopener noreferrer">Powered by Pluno.ai</a>
|
|
334
334
|
</form>
|
|
335
335
|
</section>
|
|
336
|
-
`,
|
|
337
|
-
const i = await
|
|
338
|
-
i.appendChild(
|
|
336
|
+
`, o.appendChild(a);
|
|
337
|
+
const i = await Ye(), d = i.ownerDocument;
|
|
338
|
+
i.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), ue(o, e.accentColor), re(a, r, {
|
|
339
339
|
accentColor: e.accentColor,
|
|
340
340
|
colorScheme: e.colorScheme,
|
|
341
341
|
fontFamily: e.fontFamily,
|
|
342
342
|
scribbleStyle: e.scribbleStyle
|
|
343
|
-
}),
|
|
343
|
+
}), I("web-sdk.widget", "Applied initial widget appearance", {
|
|
344
344
|
accentColor: e.accentColor,
|
|
345
345
|
colorScheme: e.colorScheme,
|
|
346
346
|
fontFamily: e.fontFamily,
|
|
@@ -349,6 +349,7 @@ async function Be(t = {}) {
|
|
|
349
349
|
const u = a.querySelector(".pluno-pa-widget__launcher"), p = a.querySelector(".pluno-pa-widget__launcher-input"), g = a.querySelector(".pluno-pa-widget__panel"), f = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), s = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), c = a.querySelector(".pluno-pa-widget__new-chat"), b = a.querySelector(".pluno-pa-widget__timeline");
|
|
350
350
|
if (!u || !p || !g || !f || !x || !s || !_ || !c || !b)
|
|
351
351
|
throw new Error("Failed to mount Product Agent widget");
|
|
352
|
+
ie(p), ie(s);
|
|
352
353
|
const y = e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
|
|
353
354
|
if (!e.tokenEndpoint)
|
|
354
355
|
throw new Error("Product Agent widget requires token or tokenEndpoint");
|
|
@@ -366,7 +367,7 @@ async function Be(t = {}) {
|
|
|
366
367
|
return k.token;
|
|
367
368
|
});
|
|
368
369
|
let h;
|
|
369
|
-
h = await
|
|
370
|
+
h = await ye.init({
|
|
370
371
|
token: e.token,
|
|
371
372
|
tokenProvider: y,
|
|
372
373
|
backendUrl: e.backendUrl,
|
|
@@ -377,19 +378,19 @@ async function Be(t = {}) {
|
|
|
377
378
|
initialStarterPrompts: e.initialStarterPrompts,
|
|
378
379
|
webSocketFactory: e.webSocketFactory
|
|
379
380
|
});
|
|
380
|
-
const w =
|
|
381
|
+
const w = Ze(e), m = new Set(w.openToolGroupKeys);
|
|
381
382
|
let S = null, j = !1;
|
|
382
|
-
const
|
|
383
|
-
j || typeof document > "u" || (
|
|
384
|
-
}, q = new MutationObserver(
|
|
383
|
+
const _e = () => {
|
|
384
|
+
j || typeof document > "u" || (ue(o, e.accentColor), n.isConnected || d.body?.appendChild(n));
|
|
385
|
+
}, q = new MutationObserver(_e);
|
|
385
386
|
q.observe(d.documentElement, { childList: !0, subtree: !0 });
|
|
386
387
|
const E = () => {
|
|
387
|
-
|
|
388
|
+
Xe(e, {
|
|
388
389
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
389
390
|
composerValue: s.value,
|
|
390
391
|
openToolGroupKeys: [...m]
|
|
391
392
|
});
|
|
392
|
-
},
|
|
393
|
+
}, P = (l = "", k = !0) => {
|
|
393
394
|
if (S !== null && (window.clearTimeout(S), S = null), g.hidden = !1, f.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), !k) {
|
|
394
395
|
a.classList.add("pluno-pa-widget--open"), u.hidden = !0, l && (s.value = l, A(s)), b.scrollTop = b.scrollHeight, s.focus(), s.setSelectionRange(s.value.length, s.value.length), E();
|
|
395
396
|
return;
|
|
@@ -399,23 +400,23 @@ async function Be(t = {}) {
|
|
|
399
400
|
u.hidden = !0, b.scrollTop = b.scrollHeight;
|
|
400
401
|
}, 220);
|
|
401
402
|
});
|
|
402
|
-
},
|
|
403
|
+
}, xe = () => {
|
|
403
404
|
S !== null && (window.clearTimeout(S), S = null), u.hidden = !1, a.classList.add("pluno-pa-widget--closing"), a.classList.remove("pluno-pa-widget--open"), E(), S = window.setTimeout(() => {
|
|
404
405
|
g.hidden = !0, f.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
405
406
|
}, 220);
|
|
406
407
|
};
|
|
407
408
|
u.addEventListener("submit", (l) => {
|
|
408
|
-
l.preventDefault(),
|
|
409
|
+
l.preventDefault(), P(p.value), p.value = "";
|
|
409
410
|
}), u.addEventListener("click", (l) => {
|
|
410
|
-
l.target !== p && (
|
|
411
|
+
l.target !== p && (P(p.value), p.value = "");
|
|
411
412
|
}), p.addEventListener("focus", () => {
|
|
412
|
-
|
|
413
|
+
P(p.value), p.value = "";
|
|
413
414
|
}), p.addEventListener("input", () => {
|
|
414
415
|
if (!p.value)
|
|
415
416
|
return;
|
|
416
417
|
const l = p.value;
|
|
417
|
-
|
|
418
|
-
}), f.addEventListener("click",
|
|
418
|
+
P(l), p.value = "";
|
|
419
|
+
}), f.addEventListener("click", xe);
|
|
419
420
|
const L = () => {
|
|
420
421
|
_.disabled = !h.getState().isThinking && s.value.trim().length === 0;
|
|
421
422
|
};
|
|
@@ -435,20 +436,20 @@ async function Be(t = {}) {
|
|
|
435
436
|
l.key !== "Enter" || l.shiftKey || (l.preventDefault(), U(h, s), L());
|
|
436
437
|
}), a.addEventListener("click", (l) => {
|
|
437
438
|
(l.target instanceof Element ? l.target : null)?.closest("a[href]") && E();
|
|
438
|
-
}), w.composerValue && (s.value = w.composerValue, A(s)), w.isOpen &&
|
|
439
|
+
}), w.composerValue && (s.value = w.composerValue, A(s)), w.isOpen && P(s.value, !1);
|
|
439
440
|
const Y = () => r;
|
|
440
441
|
let R = h.getState().appearance !== null;
|
|
441
442
|
return h.on("state", (l) => {
|
|
442
|
-
l.appearance ? (R = !0,
|
|
443
|
+
l.appearance ? (R = !0, I("web-sdk.widget", "Agent state supplied appearance", {
|
|
443
444
|
appearance: l.appearance
|
|
444
|
-
}), G(l.appearance, "agent.state.appearance")) : R && (R = !1,
|
|
445
|
+
}), G(l.appearance, "agent.state.appearance")) : R && (R = !1, I("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
445
446
|
fallbackAccentColor: e.accentColor,
|
|
446
447
|
fallbackColorScheme: e.colorScheme,
|
|
447
448
|
fallbackFontFamily: e.fontFamily
|
|
448
|
-
}), G({}, "agent.state.appearance-cleared")),
|
|
449
|
+
}), G({}, "agent.state.appearance-cleared")), le(b, _, c, l, m, E, Y, (k) => {
|
|
449
450
|
h.sendMessage(k);
|
|
450
451
|
}), L();
|
|
451
|
-
}),
|
|
452
|
+
}), le(b, _, c, h.getState(), m, E, Y, (l) => {
|
|
452
453
|
h.sendMessage(l);
|
|
453
454
|
}), L(), {
|
|
454
455
|
agent: h,
|
|
@@ -456,7 +457,7 @@ async function Be(t = {}) {
|
|
|
456
457
|
l.scribbleStyle !== void 0 && (e.scribbleStyle = l.scribbleStyle), G(l, "widgetHandle.updateAppearance");
|
|
457
458
|
},
|
|
458
459
|
destroy: () => {
|
|
459
|
-
j = !0, q.disconnect(), h.destroy(),
|
|
460
|
+
j = !0, q.disconnect(), h.destroy(), n.remove();
|
|
460
461
|
}
|
|
461
462
|
};
|
|
462
463
|
function G(l, k) {
|
|
@@ -466,7 +467,7 @@ async function Be(t = {}) {
|
|
|
466
467
|
colorScheme: Z,
|
|
467
468
|
fontFamily: X,
|
|
468
469
|
scribbleStyle: z
|
|
469
|
-
}),
|
|
470
|
+
}), I("web-sdk.widget", "Updated widget appearance", {
|
|
470
471
|
source: k,
|
|
471
472
|
inputAppearance: l,
|
|
472
473
|
appliedAccentColor: O,
|
|
@@ -478,17 +479,17 @@ async function Be(t = {}) {
|
|
|
478
479
|
}
|
|
479
480
|
}
|
|
480
481
|
function ae(t, e) {
|
|
481
|
-
return e ?
|
|
482
|
+
return e ? Ee(t) : Ce(t);
|
|
482
483
|
}
|
|
483
|
-
function re(t, e,
|
|
484
|
-
t.classList.toggle("pluno-pa-widget--dark",
|
|
485
|
-
const
|
|
486
|
-
t.style.setProperty("--pluno-pa-accent",
|
|
484
|
+
function re(t, e, n) {
|
|
485
|
+
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);
|
|
486
|
+
const o = n.scribbleStyle ? he(n.accentColor) : n.accentColor;
|
|
487
|
+
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? ze : n.fontFamily, n.scribbleStyle && He(t.ownerDocument);
|
|
487
488
|
const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
|
|
488
489
|
for (const r of a)
|
|
489
490
|
r.src = e;
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function He(t) {
|
|
492
493
|
if (t.getElementById(oe))
|
|
493
494
|
return;
|
|
494
495
|
const e = t.createElement("style");
|
|
@@ -500,31 +501,37 @@ function Ue(t) {
|
|
|
500
501
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
501
502
|
}`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
|
|
502
503
|
}
|
|
503
|
-
function
|
|
504
|
+
function I(t, e, n) {
|
|
504
505
|
if (typeof window > "u")
|
|
505
506
|
return;
|
|
506
|
-
const
|
|
507
|
+
const o = window, a = {
|
|
507
508
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
508
509
|
source: t,
|
|
509
510
|
message: e,
|
|
510
|
-
details:
|
|
511
|
-
}, r =
|
|
512
|
-
r.push(a), r.length > 120 && r.splice(0, r.length - 120),
|
|
511
|
+
details: n
|
|
512
|
+
}, r = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
513
|
+
r.push(a), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent(Ge, { detail: a }));
|
|
513
514
|
}
|
|
514
515
|
function U(t, e) {
|
|
515
|
-
const
|
|
516
|
-
|
|
516
|
+
const n = e.value.trim();
|
|
517
|
+
n && (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(n), e.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
517
518
|
}
|
|
518
519
|
function A(t) {
|
|
519
520
|
t.style.height = "0px";
|
|
520
521
|
const e = Math.max(22, Math.min(t.scrollHeight, 140));
|
|
521
522
|
t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
|
|
522
523
|
}
|
|
523
|
-
function ie(t
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
524
|
+
function ie(t) {
|
|
525
|
+
for (const e of ["keydown", "keypress", "keyup"])
|
|
526
|
+
t.addEventListener(e, (n) => {
|
|
527
|
+
n.stopPropagation();
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
function le(t, e, n, o, a, r, i, d) {
|
|
531
|
+
const u = [...o.messages];
|
|
532
|
+
t.innerHTML = "", je(e, o.isThinking);
|
|
533
|
+
const p = u.length > 0 || !!o.assistantDraft || o.isThinking;
|
|
534
|
+
if (n.hidden = !p, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
|
|
528
535
|
const c = document.createElement("div");
|
|
529
536
|
c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
530
537
|
const b = document.createElement("img");
|
|
@@ -532,8 +539,8 @@ function ie(t, e, o, n, a, r, i, d) {
|
|
|
532
539
|
const y = document.createElement("div");
|
|
533
540
|
y.className = "pluno-pa-widget__empty", y.innerHTML = "Hey there, I'm Pluno 👋<br />What do you want to do today?", c.appendChild(y);
|
|
534
541
|
const h = document.createElement("div");
|
|
535
|
-
h.className =
|
|
536
|
-
for (const w of
|
|
542
|
+
h.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 && h.setAttribute("aria-hidden", "true");
|
|
543
|
+
for (const w of o.starterPrompts) {
|
|
537
544
|
const m = document.createElement("button");
|
|
538
545
|
m.type = "button", m.className = "pluno-pa-widget__starter-prompt", m.textContent = `"${w}"`, m.addEventListener("click", () => {
|
|
539
546
|
d(w);
|
|
@@ -557,64 +564,64 @@ function ie(t, e, o, n, a, r, i, d) {
|
|
|
557
564
|
}
|
|
558
565
|
if (b.role === "system")
|
|
559
566
|
continue;
|
|
560
|
-
const y = s(), h =
|
|
567
|
+
const y = s(), h = se(b.content);
|
|
561
568
|
if (b.role === "assistant" && !y) {
|
|
562
569
|
const m = K(i());
|
|
563
570
|
t.appendChild(m), g = null, f = m;
|
|
564
571
|
}
|
|
565
572
|
const w = document.createElement("div");
|
|
566
|
-
w.className = `pluno-pa-widget__message pluno-pa-widget__message--${b.role}`, b.role === "assistant" ?
|
|
573
|
+
w.className = `pluno-pa-widget__message pluno-pa-widget__message--${b.role}`, b.role === "assistant" ? ce(w, h) : w.textContent = h, w.appendChild(pe(h)), t.appendChild(w), g = w, f = null;
|
|
567
574
|
}
|
|
568
575
|
const _ = s();
|
|
569
|
-
if (
|
|
576
|
+
if (o.assistantDraft) {
|
|
570
577
|
if (!_) {
|
|
571
578
|
const y = K(i());
|
|
572
579
|
t.appendChild(y), g = null, f = y;
|
|
573
580
|
}
|
|
574
|
-
const c =
|
|
575
|
-
b.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
581
|
+
const c = se(o.assistantDraft), b = document.createElement("div");
|
|
582
|
+
b.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ce(b, c), b.appendChild(pe(c)), t.appendChild(b), g = b, f = null;
|
|
576
583
|
}
|
|
577
|
-
if (
|
|
584
|
+
if (o.isThinking && !o.assistantDraft)
|
|
578
585
|
if (_) {
|
|
579
|
-
const c =
|
|
586
|
+
const c = we();
|
|
580
587
|
t.appendChild(c), g = null, f = c;
|
|
581
588
|
} else {
|
|
582
|
-
const c =
|
|
589
|
+
const c = Ve(i());
|
|
583
590
|
t.appendChild(c), g = null, f = c;
|
|
584
591
|
}
|
|
585
|
-
if (
|
|
592
|
+
if (o.lastError) {
|
|
586
593
|
const c = document.createElement("div");
|
|
587
|
-
c.className = "pluno-pa-widget__error", c.textContent =
|
|
594
|
+
c.className = "pluno-pa-widget__error", c.textContent = o.lastError, t.appendChild(c), g = c, f = null;
|
|
588
595
|
}
|
|
589
596
|
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
|
|
590
597
|
}
|
|
591
|
-
function
|
|
598
|
+
function pe(t) {
|
|
592
599
|
const e = document.createElement("button");
|
|
593
|
-
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.innerHTML = '<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>', e.addEventListener("click", (
|
|
594
|
-
|
|
600
|
+
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.innerHTML = '<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>', e.addEventListener("click", (n) => {
|
|
601
|
+
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
|
|
595
602
|
}), e;
|
|
596
603
|
}
|
|
597
|
-
function
|
|
604
|
+
function se(t) {
|
|
598
605
|
return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
599
606
|
}
|
|
600
|
-
function We(t, e,
|
|
607
|
+
function We(t, e, n, o) {
|
|
601
608
|
const a = document.createElement("article");
|
|
602
609
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
|
|
603
610
|
const r = document.createElement("img");
|
|
604
|
-
r.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", r.src =
|
|
605
|
-
const i = document.createElement("details"), d =
|
|
611
|
+
r.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", r.src = o, r.alt = "", r.setAttribute("aria-hidden", "true"), a.appendChild(r);
|
|
612
|
+
const i = document.createElement("details"), d = Ke(t);
|
|
606
613
|
i.open = e.has(d), i.addEventListener("toggle", () => {
|
|
607
|
-
i.open ? e.add(d) : e.delete(d),
|
|
614
|
+
i.open ? e.add(d) : e.delete(d), n();
|
|
608
615
|
});
|
|
609
616
|
const u = document.createElement("summary");
|
|
610
|
-
u.className = "pluno-pa-widget__tool-summary", t.some((f) => f.loading) && u.appendChild(
|
|
617
|
+
u.className = "pluno-pa-widget__tool-summary", t.some((f) => f.loading) && u.appendChild(de());
|
|
611
618
|
const g = document.createElement("span");
|
|
612
619
|
if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = t[t.length - 1].content || "Run tool", u.appendChild(g), i.appendChild(u), t.length > 0) {
|
|
613
620
|
const f = document.createElement("div");
|
|
614
621
|
f.className = "pluno-pa-widget__tool-lines";
|
|
615
622
|
for (const x of t) {
|
|
616
623
|
const s = document.createElement("div");
|
|
617
|
-
s.className = "pluno-pa-widget__tool-line", x.loading && s.appendChild(
|
|
624
|
+
s.className = "pluno-pa-widget__tool-line", x.loading && s.appendChild(de());
|
|
618
625
|
const _ = document.createElement("span");
|
|
619
626
|
_.textContent = x.content || "Run tool", s.appendChild(_), f.appendChild(s);
|
|
620
627
|
}
|
|
@@ -625,47 +632,47 @@ function We(t, e, o, n) {
|
|
|
625
632
|
function K(t) {
|
|
626
633
|
const e = document.createElement("article");
|
|
627
634
|
e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
628
|
-
const
|
|
629
|
-
return
|
|
635
|
+
const n = document.createElement("img");
|
|
636
|
+
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;
|
|
630
637
|
}
|
|
631
|
-
function
|
|
638
|
+
function Ve(t) {
|
|
632
639
|
const e = K(t);
|
|
633
|
-
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(
|
|
640
|
+
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(we()), e;
|
|
634
641
|
}
|
|
635
|
-
function
|
|
642
|
+
function we() {
|
|
636
643
|
const t = document.createElement("div");
|
|
637
644
|
t.className = "pluno-pa-widget__status";
|
|
638
645
|
const e = document.createElement("span");
|
|
639
646
|
e.className = "pluno-pa-widget__thinking-dot", e.setAttribute("aria-hidden", "true"), t.appendChild(e);
|
|
640
|
-
const
|
|
641
|
-
return
|
|
647
|
+
const n = document.createElement("span");
|
|
648
|
+
return n.textContent = "Thinking...", t.appendChild(n), t;
|
|
642
649
|
}
|
|
643
|
-
function
|
|
650
|
+
function Ke(t) {
|
|
644
651
|
return `tools:${t.map((e) => e.id).join("|")}`;
|
|
645
652
|
}
|
|
646
|
-
function
|
|
653
|
+
function de() {
|
|
647
654
|
const t = document.createElement("span");
|
|
648
655
|
return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
|
|
649
656
|
}
|
|
650
|
-
function
|
|
657
|
+
function je(t, e) {
|
|
651
658
|
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.innerHTML = e ? '<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true"><rect x="6" y="6" width="12" height="12" rx="2" /></svg>' : '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="19" x2="12" y2="5" /><polyline points="5 12 12 5 19 12" /></svg>';
|
|
652
659
|
}
|
|
653
|
-
function
|
|
654
|
-
const
|
|
660
|
+
function ce(t, e) {
|
|
661
|
+
const n = e.replace(/\r\n/g, `
|
|
655
662
|
`).split(`
|
|
656
663
|
`);
|
|
657
|
-
let
|
|
658
|
-
for (;
|
|
659
|
-
const a = o
|
|
664
|
+
let o = 0;
|
|
665
|
+
for (; o < n.length; ) {
|
|
666
|
+
const a = n[o];
|
|
660
667
|
if (!a.trim()) {
|
|
661
|
-
|
|
668
|
+
o += 1;
|
|
662
669
|
continue;
|
|
663
670
|
}
|
|
664
671
|
if (a.match(/^```(\w+)?\s*$/)) {
|
|
665
672
|
const p = [];
|
|
666
|
-
for (
|
|
667
|
-
p.push(o
|
|
668
|
-
|
|
673
|
+
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
674
|
+
p.push(n[o]), o += 1;
|
|
675
|
+
o += o < n.length ? 1 : 0;
|
|
669
676
|
const g = document.createElement("pre"), f = document.createElement("code");
|
|
670
677
|
f.textContent = p.join(`
|
|
671
678
|
`), g.appendChild(f), t.appendChild(g);
|
|
@@ -674,30 +681,30 @@ function de(t, e) {
|
|
|
674
681
|
const i = a.match(/^(#{1,3})\s+(.+)$/);
|
|
675
682
|
if (i) {
|
|
676
683
|
const p = document.createElement(`h${i[1].length + 2}`);
|
|
677
|
-
$(p, i[2]), t.appendChild(p),
|
|
684
|
+
$(p, i[2]), t.appendChild(p), o += 1;
|
|
678
685
|
continue;
|
|
679
686
|
}
|
|
680
687
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
681
688
|
const p = document.createElement("ul");
|
|
682
|
-
for (;
|
|
689
|
+
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
683
690
|
const g = document.createElement("li");
|
|
684
|
-
$(g, o
|
|
691
|
+
$(g, n[o].replace(/^\s*[-*+]\s+/, "")), p.appendChild(g), o += 1;
|
|
685
692
|
}
|
|
686
693
|
t.appendChild(p);
|
|
687
694
|
continue;
|
|
688
695
|
}
|
|
689
696
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
690
697
|
const p = document.createElement("ol");
|
|
691
|
-
for (;
|
|
698
|
+
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
692
699
|
const g = document.createElement("li");
|
|
693
|
-
$(g, o
|
|
700
|
+
$(g, n[o].replace(/^\s*\d+\.\s+/, "")), p.appendChild(g), o += 1;
|
|
694
701
|
}
|
|
695
702
|
t.appendChild(p);
|
|
696
703
|
continue;
|
|
697
704
|
}
|
|
698
705
|
const d = [a];
|
|
699
|
-
for (
|
|
700
|
-
d.push(o
|
|
706
|
+
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]); )
|
|
707
|
+
d.push(n[o]), o += 1;
|
|
701
708
|
const u = document.createElement("p");
|
|
702
709
|
d.forEach((p, g) => {
|
|
703
710
|
g > 0 && u.appendChild(document.createElement("br")), $(u, p);
|
|
@@ -705,11 +712,11 @@ function de(t, e) {
|
|
|
705
712
|
}
|
|
706
713
|
}
|
|
707
714
|
function $(t, e) {
|
|
708
|
-
const
|
|
709
|
-
let
|
|
710
|
-
for (const a of e.matchAll(
|
|
715
|
+
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
716
|
+
let o = 0;
|
|
717
|
+
for (const a of e.matchAll(n)) {
|
|
711
718
|
const r = a.index ?? 0;
|
|
712
|
-
r >
|
|
719
|
+
r > o && t.appendChild(document.createTextNode(e.slice(o, r)));
|
|
713
720
|
const i = a[0];
|
|
714
721
|
if (i.startsWith("`")) {
|
|
715
722
|
const d = document.createElement("code");
|
|
@@ -722,17 +729,17 @@ function $(t, e) {
|
|
|
722
729
|
d.textContent = i.slice(1, -1), t.appendChild(d);
|
|
723
730
|
} else {
|
|
724
731
|
const d = i.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
725
|
-
if (d &&
|
|
732
|
+
if (d && qe(d[2])) {
|
|
726
733
|
const u = document.createElement("a");
|
|
727
734
|
u.href = d[2], u.target = "_top", u.rel = "noreferrer", u.textContent = d[1], t.appendChild(u);
|
|
728
735
|
} else
|
|
729
736
|
t.appendChild(document.createTextNode(i));
|
|
730
737
|
}
|
|
731
|
-
|
|
738
|
+
o = r + i.length;
|
|
732
739
|
}
|
|
733
|
-
|
|
740
|
+
o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
|
|
734
741
|
}
|
|
735
|
-
function
|
|
742
|
+
function qe(t) {
|
|
736
743
|
if (t.startsWith("/") || t.startsWith("#"))
|
|
737
744
|
return !0;
|
|
738
745
|
try {
|
|
@@ -742,11 +749,11 @@ function je(t) {
|
|
|
742
749
|
return !1;
|
|
743
750
|
}
|
|
744
751
|
}
|
|
745
|
-
function
|
|
752
|
+
function ue(t, e) {
|
|
746
753
|
if (t.getElementById("pluno-pa-widget-styles"))
|
|
747
754
|
return;
|
|
748
|
-
const
|
|
749
|
-
|
|
755
|
+
const n = t.ownerDocument.createElement("style");
|
|
756
|
+
n.id = "pluno-pa-widget-styles", n.textContent = `
|
|
750
757
|
:host {
|
|
751
758
|
all: initial;
|
|
752
759
|
color-scheme: light;
|
|
@@ -1749,9 +1756,9 @@ function ce(t, e) {
|
|
|
1749
1756
|
.pluno-pa-widget--scribble .pluno-pa-widget__close svg {
|
|
1750
1757
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
1751
1758
|
}
|
|
1752
|
-
`, t.appendChild(
|
|
1759
|
+
`, t.appendChild(n);
|
|
1753
1760
|
}
|
|
1754
|
-
async function
|
|
1761
|
+
async function Ye() {
|
|
1755
1762
|
return document.body ? document.body : await new Promise((t) => {
|
|
1756
1763
|
const e = new MutationObserver(() => {
|
|
1757
1764
|
document.body && (e.disconnect(), t(document.body));
|
|
@@ -1763,54 +1770,54 @@ function D(t) {
|
|
|
1763
1770
|
const e = document.createElement("span");
|
|
1764
1771
|
return e.textContent = t, e.innerHTML;
|
|
1765
1772
|
}
|
|
1766
|
-
function
|
|
1773
|
+
function me(t) {
|
|
1767
1774
|
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
1768
1775
|
}
|
|
1769
|
-
function
|
|
1776
|
+
function Ze(t) {
|
|
1770
1777
|
try {
|
|
1771
|
-
const e = window.localStorage.getItem(
|
|
1778
|
+
const e = window.localStorage.getItem(me(t));
|
|
1772
1779
|
if (!e)
|
|
1773
1780
|
return { isOpen: !1, composerValue: "", openToolGroupKeys: [] };
|
|
1774
|
-
const
|
|
1781
|
+
const n = JSON.parse(e);
|
|
1775
1782
|
return {
|
|
1776
|
-
isOpen:
|
|
1777
|
-
composerValue: typeof
|
|
1778
|
-
openToolGroupKeys: Array.isArray(
|
|
1783
|
+
isOpen: n.isOpen === !0,
|
|
1784
|
+
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
1785
|
+
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : []
|
|
1779
1786
|
};
|
|
1780
1787
|
} catch {
|
|
1781
1788
|
return { isOpen: !1, composerValue: "", openToolGroupKeys: [] };
|
|
1782
1789
|
}
|
|
1783
1790
|
}
|
|
1784
|
-
function
|
|
1791
|
+
function Xe(t, e) {
|
|
1785
1792
|
try {
|
|
1786
|
-
window.localStorage.setItem(
|
|
1793
|
+
window.localStorage.setItem(me(t), JSON.stringify(e));
|
|
1787
1794
|
} catch {
|
|
1788
1795
|
return;
|
|
1789
1796
|
}
|
|
1790
1797
|
}
|
|
1791
|
-
const
|
|
1792
|
-
function
|
|
1798
|
+
const ge = /* @__PURE__ */ new WeakSet();
|
|
1799
|
+
function Je(t) {
|
|
1793
1800
|
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
1794
1801
|
}
|
|
1795
|
-
function
|
|
1802
|
+
function be(t) {
|
|
1796
1803
|
const e = t.pathname.split("/");
|
|
1797
1804
|
return e[e.length - 1] ?? "";
|
|
1798
1805
|
}
|
|
1799
|
-
function
|
|
1800
|
-
const
|
|
1801
|
-
return
|
|
1806
|
+
function Qe(t, e) {
|
|
1807
|
+
const n = new URL(t.src, document.baseURI);
|
|
1808
|
+
return n.href === e.href || n.pathname === e.pathname ? !0 : be(n) === be(e);
|
|
1802
1809
|
}
|
|
1803
1810
|
class C extends EventTarget {
|
|
1804
|
-
constructor(e,
|
|
1805
|
-
super(), this.channelId =
|
|
1811
|
+
constructor(e, n) {
|
|
1812
|
+
super(), this.channelId = n, this.url = e, this.addPreviewListener($e, () => {
|
|
1806
1813
|
this.readyState = C.OPEN, this.dispatchEvent(new Event("open"));
|
|
1807
|
-
}), this.addPreviewListener(
|
|
1808
|
-
const a =
|
|
1814
|
+
}), this.addPreviewListener(De, (o) => {
|
|
1815
|
+
const a = o;
|
|
1809
1816
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
1810
|
-
}), this.addPreviewListener(
|
|
1817
|
+
}), this.addPreviewListener(Fe, () => {
|
|
1811
1818
|
this.readyState = C.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
1812
|
-
}), this.addPreviewListener(
|
|
1813
|
-
const a =
|
|
1819
|
+
}), this.addPreviewListener(Re, (o) => {
|
|
1820
|
+
const a = o;
|
|
1814
1821
|
this.readyState = C.CLOSED, this.dispatchEvent(
|
|
1815
1822
|
new CloseEvent("close", {
|
|
1816
1823
|
code: a.detail?.code ?? 1e3,
|
|
@@ -1819,7 +1826,7 @@ class C extends EventTarget {
|
|
|
1819
1826
|
})
|
|
1820
1827
|
), this.cleanup();
|
|
1821
1828
|
}), window.dispatchEvent(
|
|
1822
|
-
new CustomEvent(F(
|
|
1829
|
+
new CustomEvent(F(Ae, this.channelId), {
|
|
1823
1830
|
detail: { socketId: this.socketId, url: e }
|
|
1824
1831
|
})
|
|
1825
1832
|
);
|
|
@@ -1835,37 +1842,37 @@ class C extends EventTarget {
|
|
|
1835
1842
|
binaryType = "blob";
|
|
1836
1843
|
bufferedAmount = 0;
|
|
1837
1844
|
readyState = C.CONNECTING;
|
|
1838
|
-
socketId =
|
|
1845
|
+
socketId = et();
|
|
1839
1846
|
listeners = /* @__PURE__ */ new Map();
|
|
1840
1847
|
send(e) {
|
|
1841
1848
|
if (this.readyState !== C.OPEN)
|
|
1842
1849
|
throw new DOMException("Product Agent preview websocket is not open", "InvalidStateError");
|
|
1843
1850
|
window.dispatchEvent(
|
|
1844
|
-
new CustomEvent(F(
|
|
1851
|
+
new CustomEvent(F(Me, this.channelId), {
|
|
1845
1852
|
detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
|
|
1846
1853
|
})
|
|
1847
1854
|
);
|
|
1848
1855
|
}
|
|
1849
|
-
close(e,
|
|
1856
|
+
close(e, n) {
|
|
1850
1857
|
this.readyState !== C.CLOSED && (this.readyState = C.CLOSING, window.dispatchEvent(
|
|
1851
|
-
new CustomEvent(F(
|
|
1852
|
-
detail: { socketId: this.socketId, code: e, reason:
|
|
1858
|
+
new CustomEvent(F(Oe, this.channelId), {
|
|
1859
|
+
detail: { socketId: this.socketId, code: e, reason: n }
|
|
1853
1860
|
})
|
|
1854
1861
|
), this.cleanup());
|
|
1855
1862
|
}
|
|
1856
|
-
addPreviewListener(e,
|
|
1857
|
-
const
|
|
1858
|
-
r.detail?.socketId === this.socketId &&
|
|
1863
|
+
addPreviewListener(e, n) {
|
|
1864
|
+
const o = F(e, this.channelId), a = (r) => {
|
|
1865
|
+
r.detail?.socketId === this.socketId && n(r);
|
|
1859
1866
|
};
|
|
1860
|
-
this.listeners.set(
|
|
1867
|
+
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
1861
1868
|
}
|
|
1862
1869
|
cleanup() {
|
|
1863
|
-
for (const [e,
|
|
1864
|
-
window.removeEventListener(e,
|
|
1870
|
+
for (const [e, n] of this.listeners.entries())
|
|
1871
|
+
window.removeEventListener(e, n);
|
|
1865
1872
|
this.listeners.clear();
|
|
1866
1873
|
}
|
|
1867
1874
|
}
|
|
1868
|
-
function
|
|
1875
|
+
function et() {
|
|
1869
1876
|
const t = window.sessionStorage.getItem(te);
|
|
1870
1877
|
if (t)
|
|
1871
1878
|
return t;
|
|
@@ -1875,39 +1882,39 @@ function Qe() {
|
|
|
1875
1882
|
function F(t, e) {
|
|
1876
1883
|
return `${t}:${e}`;
|
|
1877
1884
|
}
|
|
1878
|
-
function
|
|
1885
|
+
function tt(t) {
|
|
1879
1886
|
const e = document.currentScript;
|
|
1880
1887
|
if (e instanceof HTMLScriptElement)
|
|
1881
1888
|
return [e];
|
|
1882
|
-
const
|
|
1889
|
+
const n = new URL(t, document.baseURI).href, o = new URL(n);
|
|
1883
1890
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
1884
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
1891
|
+
(a) => a instanceof HTMLScriptElement && Je(a) && Qe(a, o)
|
|
1885
1892
|
);
|
|
1886
1893
|
}
|
|
1887
|
-
function
|
|
1888
|
-
for (const e of
|
|
1889
|
-
if (
|
|
1894
|
+
function nt(t) {
|
|
1895
|
+
for (const e of tt(t)) {
|
|
1896
|
+
if (ge.has(e) || e.dataset.plunoAutoMount === "false")
|
|
1890
1897
|
continue;
|
|
1891
|
-
|
|
1892
|
-
const
|
|
1893
|
-
|
|
1898
|
+
ge.add(e);
|
|
1899
|
+
const n = e.dataset.plunoPreviewChannel;
|
|
1900
|
+
Ue({
|
|
1894
1901
|
token: e.dataset.plunoToken,
|
|
1895
1902
|
tokenEndpoint: e.dataset.plunoTokenEndpoint,
|
|
1896
1903
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
1897
|
-
webSocketFactory:
|
|
1904
|
+
webSocketFactory: n ? Be(n) : void 0,
|
|
1898
1905
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
1899
1906
|
accentColor: e.dataset.plunoAccentColor,
|
|
1900
1907
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
1901
1908
|
fontFamily: e.dataset.plunoFontFamily,
|
|
1902
1909
|
scribbleStyle: e.dataset.plunoScribbleStyle === "true",
|
|
1903
1910
|
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
1904
|
-
}).catch((
|
|
1905
|
-
console.error("Failed to mount Pluno Product Agent widget",
|
|
1911
|
+
}).catch((o) => {
|
|
1912
|
+
console.error("Failed to mount Pluno Product Agent widget", o);
|
|
1906
1913
|
});
|
|
1907
1914
|
}
|
|
1908
1915
|
}
|
|
1909
|
-
|
|
1916
|
+
nt(import.meta.url);
|
|
1910
1917
|
export {
|
|
1911
|
-
|
|
1912
|
-
|
|
1918
|
+
Be as createProductAgentPreviewBridgeWebSocketFactory,
|
|
1919
|
+
Ue as mountPlunoProductAgentWidget
|
|
1913
1920
|
};
|
package/package.json
CHANGED