@pluno/product-agent-web 0.1.17 → 0.1.19
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 +11 -1
- package/dist/product-agent-sdk.js +140 -121
- package/dist/product-agent-widget.js +995 -537
- package/dist/widget.d.ts +3 -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 dt } from "./product-agent-sdk.js";
|
|
2
|
+
const ct = "#7c3aed";
|
|
3
|
+
function ut(t) {
|
|
4
|
+
const e = bt(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 We(t) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function gt(t) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(ut(t))}`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const e =
|
|
84
|
-
if (
|
|
81
|
+
const G = "#2c2a1e", ye = [253, 250, 241], ve = 3.5;
|
|
82
|
+
function Ve(t) {
|
|
83
|
+
const e = qe(t);
|
|
84
|
+
if (Ce(q(e), ye) >= ve)
|
|
85
85
|
return e;
|
|
86
|
-
let o =
|
|
87
|
-
const a = G
|
|
88
|
-
for (let
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
function
|
|
94
|
-
const e =
|
|
86
|
+
let o = q(e);
|
|
87
|
+
const a = q(G);
|
|
88
|
+
for (let r = 0; r < 6; r += 1)
|
|
89
|
+
if (o = wt(o, a, 0.22), Ce(o, ye) >= ve)
|
|
90
|
+
return de(o);
|
|
91
|
+
return de(o);
|
|
92
|
+
}
|
|
93
|
+
function ht(t) {
|
|
94
|
+
const e = Ve(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 Ke(t) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${mt()}" 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="${G}" 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="${G}" stroke-width="13"/>
|
|
112
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${G}"/>
|
|
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="${G}" stroke-width="13"/>
|
|
117
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${G}"/>
|
|
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 ft(t) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(ht(t))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function mt() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
|
-
for (let
|
|
129
|
-
const
|
|
130
|
-
n += ` L ${
|
|
128
|
+
for (let r = 150; r <= 1170; r += 62) {
|
|
129
|
+
const l = (a % 3 - 1) * 18, d = o ? 280 - l : 1020 + l;
|
|
130
|
+
n += ` L ${d} ${r}`, o = !o, a += 1;
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const e =
|
|
134
|
+
function bt(t) {
|
|
135
|
+
const e = qe(t), n = ce(q(e));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -156,81 +156,81 @@ function Ye(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: L(e, 0.28, -0.03),
|
|
160
|
+
middle: L(e, 0.08, 0.04),
|
|
161
|
+
bottom: L(e, -0.1, 0.02),
|
|
162
|
+
edgeStart: L(e, 0.08, 0.08),
|
|
163
|
+
edgeMiddle: L(e, -0.08, 0.08),
|
|
164
|
+
edgeEnd: L(e, -0.18, 0.05),
|
|
165
|
+
glow: L(e, 0.32, -0.12),
|
|
166
|
+
highlight: L(e, 0.38, -0.18),
|
|
167
|
+
inner: L(e, 0.24, -0.1),
|
|
168
|
+
shadow: L(e, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function qe(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()}` : ct;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function q(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 de([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 ce([t, e, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
|
-
const
|
|
189
|
-
return
|
|
188
|
+
const r = a / 255;
|
|
189
|
+
return r <= 0.04045 ? r / 12.92 : ((r + 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 Ce(t, e) {
|
|
194
|
+
const n = ce(t), o = ce(e), [a, r] = n > o ? [n, o] : [o, n];
|
|
195
|
+
return (a + 0.05) / (r + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
197
|
+
function wt(t, e, n) {
|
|
198
|
+
const o = ue(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 L(t, e, n) {
|
|
206
|
+
const [o, a, r] = _t(q(t));
|
|
207
|
+
return de(xt(o, ue(a + n), ue(r + e)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
const o = t / 255, a = e / 255,
|
|
211
|
-
if (
|
|
212
|
-
return [0, 0,
|
|
213
|
-
const h =
|
|
214
|
-
return [(
|
|
209
|
+
function _t([t, e, n]) {
|
|
210
|
+
const o = t / 255, a = e / 255, r = n / 255, l = Math.max(o, a, r), d = Math.min(o, a, r), u = (l + d) / 2;
|
|
211
|
+
if (l === d)
|
|
212
|
+
return [0, 0, u];
|
|
213
|
+
const h = l - d, c = u > 0.5 ? h / (2 - l - d) : h / (l + d);
|
|
214
|
+
return [(l === o ? (a - r) / h + (a < r ? 6 : 0) : l === a ? (r - o) / h + 2 : (o - a) / h + 4) / 6, c, u];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function xt(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
|
+
ie(a, o, t + 1 / 3) * 255,
|
|
222
|
+
ie(a, o, t) * 255,
|
|
223
|
+
ie(a, o, t - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ie(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 ue(t) {
|
|
231
231
|
return Math.max(0, Math.min(1, t));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const yt = "product-agent:sdk-preview-socket-connect", vt = "product-agent:sdk-preview-socket-send", Ct = "product-agent:sdk-preview-socket-close", Et = "product-agent:sdk-preview-socket-open", kt = "product-agent:sdk-preview-socket-message", St = "product-agent:sdk-preview-socket-error", Lt = "product-agent:sdk-preview-socket-closed", Ee = "product-agent:sdk-preview-socket-id", Pt = "product-agent:preview-diagnostic", ee = 10, At = 10 * 1024 * 1024, Tt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), D = {
|
|
234
234
|
launcherLabel: "Ask for anything...",
|
|
235
235
|
accentColor: "#7c3aed",
|
|
236
236
|
colorScheme: "light",
|
|
@@ -238,26 +238,29 @@ const Qe = "product-agent:sdk-preview-socket-connect", et = "product-agent:sdk-p
|
|
|
238
238
|
scribbleStyle: !1,
|
|
239
239
|
position: "bottom-right",
|
|
240
240
|
movableLauncher: !1
|
|
241
|
-
},
|
|
242
|
-
function
|
|
243
|
-
return (e) => new
|
|
241
|
+
}, ke = '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>', Nt = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Se = "pluno-pa-scribble-font", Ke = 190, je = 41, It = 48, Rt = 420, Dt = 680, S = 8, Le = 50, Mt = "http://www.w3.org/2000/svg", Ot = 11, Ft = 13, Gt = 4, Bt = 10, $t = 40, zt = "movable-launcher-position-v2";
|
|
242
|
+
function Wt(t) {
|
|
243
|
+
return (e) => new I(e, t);
|
|
244
244
|
}
|
|
245
|
-
async function
|
|
245
|
+
async function Ut(t = {}) {
|
|
246
246
|
const e = {
|
|
247
|
-
launcherLabel: t.launcherLabel ??
|
|
248
|
-
accentColor: t.accentColor ??
|
|
249
|
-
colorScheme: t.colorScheme ??
|
|
250
|
-
fontFamily: t.fontFamily ??
|
|
251
|
-
scribbleStyle: t.scribbleStyle ??
|
|
252
|
-
position: t.position ??
|
|
253
|
-
movableLauncher: t.movableLauncher ??
|
|
247
|
+
launcherLabel: t.launcherLabel ?? D.launcherLabel,
|
|
248
|
+
accentColor: t.accentColor ?? D.accentColor,
|
|
249
|
+
colorScheme: t.colorScheme ?? D.colorScheme,
|
|
250
|
+
fontFamily: t.fontFamily ?? D.fontFamily,
|
|
251
|
+
scribbleStyle: t.scribbleStyle ?? D.scribbleStyle,
|
|
252
|
+
position: t.position ?? D.position,
|
|
253
|
+
movableLauncher: t.movableLauncher ?? D.movableLauncher,
|
|
254
254
|
token: t.token,
|
|
255
255
|
tokenProvider: t.tokenProvider,
|
|
256
256
|
tokenEndpoint: t.tokenEndpoint,
|
|
257
257
|
backendUrl: t.backendUrl,
|
|
258
258
|
metadata: t.metadata,
|
|
259
259
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
260
|
-
webSocketFactory: t.webSocketFactory
|
|
260
|
+
webSocketFactory: t.webSocketFactory,
|
|
261
|
+
loginRequired: t.loginRequired === !0,
|
|
262
|
+
loginButtonLabel: t.loginButtonLabel ?? "Log in to Pluno",
|
|
263
|
+
onLoginClick: t.onLoginClick
|
|
261
264
|
};
|
|
262
265
|
O("web-sdk.widget", "Mounting widget with merged options", {
|
|
263
266
|
accentColor: e.accentColor,
|
|
@@ -274,71 +277,10 @@ async function mt(t = {}) {
|
|
|
274
277
|
n.className = "pluno-pa-widget-host";
|
|
275
278
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
276
279
|
a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`;
|
|
277
|
-
let
|
|
278
|
-
a.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
<filter id="pluno-pa-scribble-wobble" x="-8%" y="-8%" width="116%" height="116%">
|
|
282
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.012 0.028" numOctaves="3" seed="2" result="stroke-noise" />
|
|
283
|
-
<feDisplacementMap in="SourceGraphic" in2="stroke-noise" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="warped" />
|
|
284
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="1" seed="12" result="ink-noise" />
|
|
285
|
-
<feDisplacementMap in="warped" in2="ink-noise" scale="0.9" xChannelSelector="R" yChannelSelector="G" />
|
|
286
|
-
</filter>
|
|
287
|
-
<filter id="pluno-pa-scribble-wobble-2" x="-8%" y="-8%" width="116%" height="116%">
|
|
288
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.012 0.028" numOctaves="3" seed="5" result="stroke-noise" />
|
|
289
|
-
<feDisplacementMap in="SourceGraphic" in2="stroke-noise" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="warped" />
|
|
290
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="1" seed="15" result="ink-noise" />
|
|
291
|
-
<feDisplacementMap in="warped" in2="ink-noise" scale="0.9" xChannelSelector="R" yChannelSelector="G" />
|
|
292
|
-
</filter>
|
|
293
|
-
<filter id="pluno-pa-scribble-wobble-3" x="-8%" y="-8%" width="116%" height="116%">
|
|
294
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.012 0.028" numOctaves="3" seed="9" result="stroke-noise" />
|
|
295
|
-
<feDisplacementMap in="SourceGraphic" in2="stroke-noise" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="warped" />
|
|
296
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="1" seed="19" result="ink-noise" />
|
|
297
|
-
<feDisplacementMap in="warped" in2="ink-noise" scale="0.9" xChannelSelector="R" yChannelSelector="G" />
|
|
298
|
-
</filter>
|
|
299
|
-
</defs>
|
|
300
|
-
</svg>
|
|
301
|
-
<form class="pluno-pa-widget__launcher">
|
|
302
|
-
${e.movableLauncher ? '<button type="button" class="pluno-pa-widget__launcher-drag-handle" aria-label="Move Product Agent launcher" title="Move Product Agent launcher"></button>' : ""}
|
|
303
|
-
<img class="pluno-pa-widget__character pluno-pa-widget__character--launcher" src="${W(i)}" alt="" aria-hidden="true" />
|
|
304
|
-
<input class="pluno-pa-widget__launcher-input" type="text" placeholder="${W(e.launcherLabel)}" aria-label="${W(e.launcherLabel)}" />
|
|
305
|
-
</form>
|
|
306
|
-
<button type="button" class="pluno-pa-widget__close" aria-label="Close" hidden>
|
|
307
|
-
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
308
|
-
<path d="m6 9 6 6 6-6" />
|
|
309
|
-
</svg>
|
|
310
|
-
</button>
|
|
311
|
-
<section class="pluno-pa-widget__panel" hidden>
|
|
312
|
-
<div class="pluno-pa-widget__timeline-wrap">
|
|
313
|
-
<main class="pluno-pa-widget__timeline">
|
|
314
|
-
<div class="pluno-pa-widget__empty-state">
|
|
315
|
-
<img class="pluno-pa-widget__character pluno-pa-widget__character--empty" src="${W(i)}" alt="" aria-hidden="true" />
|
|
316
|
-
<div class="pluno-pa-widget__empty">Hey there, I'm Pluno 👋<br />What do you want to do today?</div>
|
|
317
|
-
</div>
|
|
318
|
-
</main>
|
|
319
|
-
<button type="button" class="pluno-pa-widget__new-chat" aria-label="New chat" title="New chat" hidden>
|
|
320
|
-
<svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
321
|
-
<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
322
|
-
<path d="M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" />
|
|
323
|
-
</svg>
|
|
324
|
-
</button>
|
|
325
|
-
</div>
|
|
326
|
-
<form class="pluno-pa-widget__composer">
|
|
327
|
-
<div class="pluno-pa-widget__composer-inner">
|
|
328
|
-
<textarea class="pluno-pa-widget__input" rows="1" placeholder="Ask for anything..."></textarea>
|
|
329
|
-
<button type="button" class="pluno-pa-widget__send" aria-label="Send">
|
|
330
|
-
<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">
|
|
331
|
-
<line x1="12" y1="19" x2="12" y2="5" />
|
|
332
|
-
<polyline points="5 12 12 5 19 12" />
|
|
333
|
-
</svg>
|
|
334
|
-
</button>
|
|
335
|
-
</div>
|
|
336
|
-
<a class="pluno-pa-widget__powered-by" href="https://pluno.ai" target="_blank" rel="noopener noreferrer">Powered by Pluno.ai</a>
|
|
337
|
-
</form>
|
|
338
|
-
</section>
|
|
339
|
-
`, o.appendChild(a);
|
|
340
|
-
const p = await Nt(), c = p.ownerDocument;
|
|
341
|
-
p.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), Ne(o, e.accentColor), xe(a, i, {
|
|
280
|
+
let r = Pe(e.accentColor, e.scribbleStyle);
|
|
281
|
+
Zt(a, e.launcherLabel, r, e.movableLauncher), o.appendChild(a);
|
|
282
|
+
const l = await kn(), d = l.ownerDocument;
|
|
283
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), We(o, e.accentColor), Ae(a, r, {
|
|
342
284
|
accentColor: e.accentColor,
|
|
343
285
|
colorScheme: e.colorScheme,
|
|
344
286
|
fontFamily: e.fontFamily,
|
|
@@ -349,64 +291,70 @@ async function mt(t = {}) {
|
|
|
349
291
|
fontFamily: e.fontFamily,
|
|
350
292
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
351
293
|
});
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
354
|
-
throw new Error("Failed to mount
|
|
294
|
+
const u = a.querySelector(".pluno-pa-widget__launcher"), h = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), c = a.querySelector(".pluno-pa-widget__launcher-input"), m = a.querySelector(".pluno-pa-widget__panel"), y = a.querySelector(".pluno-pa-widget__close"), k = a.querySelector(".pluno-pa-widget__composer"), v = a.querySelector(".pluno-pa-widget__attachment-error"), s = a.querySelector(".pluno-pa-widget__attachments"), p = a.querySelector(".pluno-pa-widget__input"), f = a.querySelector(".pluno-pa-widget__send"), w = a.querySelector(".pluno-pa-widget__new-chat"), b = a.querySelector(".pluno-pa-widget__timeline");
|
|
295
|
+
if (!u || !c || !m || !y || !k || !v || !s || !p || !f || !w || !b)
|
|
296
|
+
throw new Error("Failed to mount Pluno widget");
|
|
355
297
|
if (e.movableLauncher && !h)
|
|
356
|
-
throw new Error("Failed to mount
|
|
357
|
-
|
|
358
|
-
|
|
298
|
+
throw new Error("Failed to mount Pluno widget drag handle");
|
|
299
|
+
De(c), De(p);
|
|
300
|
+
let x = [], P = null;
|
|
301
|
+
const F = () => {
|
|
302
|
+
sn(s, x, (i) => {
|
|
303
|
+
x = x.filter((g, E) => E !== i), F(), N();
|
|
304
|
+
});
|
|
305
|
+
}, ot = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
|
|
359
306
|
if (!e.tokenEndpoint)
|
|
360
|
-
throw new Error("
|
|
361
|
-
const
|
|
307
|
+
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
308
|
+
const i = await fetch(e.tokenEndpoint, {
|
|
362
309
|
method: "POST",
|
|
363
310
|
credentials: "include",
|
|
364
311
|
headers: { "content-type": "application/json" },
|
|
365
312
|
body: JSON.stringify({ origin: location.origin, url: location.href })
|
|
366
313
|
});
|
|
367
|
-
if (!
|
|
368
|
-
throw new Error("Failed to load
|
|
369
|
-
const
|
|
370
|
-
if (!
|
|
371
|
-
throw new Error("
|
|
372
|
-
return
|
|
314
|
+
if (!i.ok)
|
|
315
|
+
throw new Error("Failed to load Pluno token");
|
|
316
|
+
const g = await i.json();
|
|
317
|
+
if (!g.token)
|
|
318
|
+
throw new Error("Pluno token endpoint did not return a token");
|
|
319
|
+
return g.token;
|
|
373
320
|
});
|
|
374
|
-
let
|
|
375
|
-
|
|
321
|
+
let C;
|
|
322
|
+
C = await dt.init({
|
|
376
323
|
token: e.token,
|
|
377
|
-
tokenProvider:
|
|
324
|
+
tokenProvider: ot,
|
|
378
325
|
backendUrl: e.backendUrl,
|
|
379
326
|
metadata: () => ({
|
|
380
327
|
...e.metadata ?? {},
|
|
381
|
-
...!
|
|
328
|
+
...!C.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
382
329
|
}),
|
|
383
330
|
initialStarterPrompts: e.initialStarterPrompts,
|
|
384
|
-
webSocketFactory: e.webSocketFactory
|
|
331
|
+
webSocketFactory: e.webSocketFactory,
|
|
332
|
+
autoConnect: e.loginRequired ? !1 : void 0
|
|
385
333
|
});
|
|
386
|
-
const
|
|
387
|
-
let
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
const
|
|
393
|
-
const
|
|
394
|
-
return
|
|
334
|
+
const z = Sn(e), K = new Set(z.openToolGroupKeys);
|
|
335
|
+
let A = e.movableLauncher ? z.launcherPosition : null, he = A !== null, R = null, fe = !1;
|
|
336
|
+
const at = () => {
|
|
337
|
+
fe || typeof document > "u" || (We(o, e.accentColor), n.isConnected || d.body?.appendChild(n));
|
|
338
|
+
}, me = new MutationObserver(at);
|
|
339
|
+
me.observe(d.documentElement, { childList: !0, subtree: !0 });
|
|
340
|
+
const ne = (i = !0) => {
|
|
341
|
+
const g = Te(a, i);
|
|
342
|
+
return Ne(
|
|
395
343
|
a,
|
|
396
|
-
|
|
397
|
-
|
|
344
|
+
A ?? Kt(a, e.position, g),
|
|
345
|
+
g
|
|
398
346
|
);
|
|
399
|
-
},
|
|
400
|
-
|
|
347
|
+
}, T = () => {
|
|
348
|
+
Ln(e, {
|
|
401
349
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
402
|
-
composerValue:
|
|
403
|
-
openToolGroupKeys: [...
|
|
404
|
-
launcherPosition:
|
|
350
|
+
composerValue: p.value,
|
|
351
|
+
openToolGroupKeys: [...K],
|
|
352
|
+
launcherPosition: he ? A : null
|
|
405
353
|
});
|
|
406
|
-
},
|
|
407
|
-
|
|
408
|
-
debugVersion:
|
|
409
|
-
launcherPosition:
|
|
354
|
+
}, M = (i, g = {}) => {
|
|
355
|
+
Xt(i, {
|
|
356
|
+
debugVersion: zt,
|
|
357
|
+
launcherPosition: A,
|
|
410
358
|
rootClasses: a.className,
|
|
411
359
|
rootStyle: {
|
|
412
360
|
left: a.style.left,
|
|
@@ -414,160 +362,206 @@ async function mt(t = {}) {
|
|
|
414
362
|
right: a.style.right,
|
|
415
363
|
bottom: a.style.bottom
|
|
416
364
|
},
|
|
417
|
-
rootRect:
|
|
418
|
-
launcherRect:
|
|
419
|
-
panelRect:
|
|
420
|
-
viewport:
|
|
421
|
-
panelHidden:
|
|
422
|
-
closeHidden:
|
|
423
|
-
...
|
|
365
|
+
rootRect: le(a),
|
|
366
|
+
launcherRect: le(u),
|
|
367
|
+
panelRect: le(m),
|
|
368
|
+
viewport: B(),
|
|
369
|
+
panelHidden: m.hidden,
|
|
370
|
+
closeHidden: y.hidden,
|
|
371
|
+
...g
|
|
424
372
|
});
|
|
425
|
-
},
|
|
426
|
-
if (!
|
|
427
|
-
return
|
|
428
|
-
const
|
|
429
|
-
return
|
|
430
|
-
},
|
|
431
|
-
if (!
|
|
432
|
-
|
|
373
|
+
}, j = (i = !0) => {
|
|
374
|
+
if (!A)
|
|
375
|
+
return X(a, null), ne(i);
|
|
376
|
+
const g = ne(i);
|
|
377
|
+
return X(a, g), M("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
|
|
378
|
+
}, be = (i, g) => {
|
|
379
|
+
if (!i || !g) {
|
|
380
|
+
Re(a);
|
|
433
381
|
return;
|
|
434
382
|
}
|
|
435
|
-
|
|
436
|
-
x:
|
|
437
|
-
y:
|
|
383
|
+
Yt(a, {
|
|
384
|
+
x: i.x - g.x,
|
|
385
|
+
y: i.y - g.y
|
|
438
386
|
});
|
|
439
|
-
},
|
|
440
|
-
const
|
|
387
|
+
}, we = () => {
|
|
388
|
+
const i = j();
|
|
441
389
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
} else
|
|
390
|
+
const g = Ie(i);
|
|
391
|
+
be(g, i), M("Applied open panel position after viewport resize", { openPanelPosition: g });
|
|
392
|
+
} else A && M("Applied visible launcher position after viewport resize", { visibleLauncherPosition: i });
|
|
445
393
|
};
|
|
446
|
-
let
|
|
394
|
+
let _e = () => {
|
|
447
395
|
};
|
|
448
|
-
e.movableLauncher && h ? (
|
|
396
|
+
e.movableLauncher && h ? (j(), window.addEventListener("resize", we), _e = Vt({
|
|
449
397
|
root: a,
|
|
450
398
|
launcherDragHandle: h,
|
|
451
|
-
getPosition: () =>
|
|
452
|
-
setPosition: (
|
|
453
|
-
const
|
|
454
|
-
|
|
399
|
+
getPosition: () => ne(),
|
|
400
|
+
setPosition: (i) => {
|
|
401
|
+
const g = i;
|
|
402
|
+
A = Ne(a, i, Te(a)), X(a, A), M("Dragging closed launcher", { requestedPosition: g });
|
|
455
403
|
},
|
|
456
404
|
persist: () => {
|
|
457
|
-
|
|
405
|
+
he = !0, T(), M("Persisted closed launcher drag position");
|
|
458
406
|
}
|
|
459
|
-
})) :
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
const
|
|
463
|
-
|
|
407
|
+
})) : X(a, null);
|
|
408
|
+
const W = (i = "", g = !0) => {
|
|
409
|
+
if (R !== null && (window.clearTimeout(R), R = null), m.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
|
|
410
|
+
const E = j(), H = Ie(E);
|
|
411
|
+
be(H, E), M("Opening launcher at clamped open panel position", { openPanelPosition: H, visibleLauncherPosition: E });
|
|
464
412
|
} else
|
|
465
|
-
|
|
466
|
-
if (!
|
|
467
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
413
|
+
Re(a);
|
|
414
|
+
if (!g) {
|
|
415
|
+
a.classList.add("pluno-pa-widget--open"), u.hidden = !0, i && (p.value = i, V(p)), b.scrollTop = b.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T();
|
|
468
416
|
return;
|
|
469
417
|
}
|
|
470
418
|
window.requestAnimationFrame(() => {
|
|
471
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
472
|
-
|
|
419
|
+
a.classList.add("pluno-pa-widget--open"), i && (p.value = i, V(p)), b.scrollTop = b.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T(), R = window.setTimeout(() => {
|
|
420
|
+
u.hidden = !0, b.scrollTop = b.scrollHeight;
|
|
473
421
|
}, 220);
|
|
474
422
|
});
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
|
|
423
|
+
}, rt = () => {
|
|
424
|
+
R !== null && (window.clearTimeout(R), R = null), u.hidden = !1, A && (j(!1), M("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), T(), R = window.setTimeout(() => {
|
|
425
|
+
m.hidden = !0, y.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
478
426
|
}, 220);
|
|
479
427
|
};
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}), h?.addEventListener("click", (
|
|
483
|
-
|
|
484
|
-
}),
|
|
485
|
-
|
|
486
|
-
}),
|
|
487
|
-
|
|
488
|
-
}),
|
|
489
|
-
if (!
|
|
428
|
+
u.addEventListener("submit", (i) => {
|
|
429
|
+
i.preventDefault(), W(c.value), c.value = "";
|
|
430
|
+
}), h?.addEventListener("click", (i) => {
|
|
431
|
+
i.preventDefault(), i.stopPropagation();
|
|
432
|
+
}), u.addEventListener("click", (i) => {
|
|
433
|
+
i.target !== c && (W(c.value), c.value = "");
|
|
434
|
+
}), c.addEventListener("focus", () => {
|
|
435
|
+
W(c.value), c.value = "";
|
|
436
|
+
}), c.addEventListener("input", () => {
|
|
437
|
+
if (!c.value)
|
|
438
|
+
return;
|
|
439
|
+
const i = c.value;
|
|
440
|
+
W(i), c.value = "";
|
|
441
|
+
}), y.addEventListener("click", rt);
|
|
442
|
+
const N = () => {
|
|
443
|
+
f.disabled = !C.getState().isThinking && p.value.trim().length === 0 && x.length === 0;
|
|
444
|
+
};
|
|
445
|
+
e.loginRequired && (c.readOnly = !0, c.placeholder = e.loginButtonLabel, p.placeholder = e.loginButtonLabel, k.hidden = !0), k.addEventListener("submit", (i) => {
|
|
446
|
+
if (i.preventDefault(), e.loginRequired) {
|
|
447
|
+
e.onLoginClick?.();
|
|
490
448
|
return;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
})
|
|
494
|
-
|
|
495
|
-
|
|
449
|
+
}
|
|
450
|
+
x = pe(C, p, x), F(), N();
|
|
451
|
+
});
|
|
452
|
+
let U = 0;
|
|
453
|
+
const it = () => {
|
|
454
|
+
U = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
455
|
+
}, lt = (i) => {
|
|
456
|
+
P !== null && window.clearTimeout(P), v.textContent = i, v.hidden = !1, P = window.setTimeout(() => {
|
|
457
|
+
v.textContent = "", v.hidden = !0, P = null;
|
|
458
|
+
}, 3e3);
|
|
459
|
+
}, pt = () => {
|
|
460
|
+
P !== null && (window.clearTimeout(P), P = null), v.textContent = "", v.hidden = !0;
|
|
461
|
+
}, st = async (i) => {
|
|
462
|
+
if (i.length === 0)
|
|
463
|
+
return;
|
|
464
|
+
const g = await gn(i);
|
|
465
|
+
if (x.length + g.length > ee)
|
|
466
|
+
throw new Error(`Attach up to ${ee} files per message.`);
|
|
467
|
+
x = [...x, ...g], F(), pt(), N();
|
|
496
468
|
};
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}),
|
|
500
|
-
|
|
501
|
-
|
|
469
|
+
a.addEventListener("dragenter", (i) => {
|
|
470
|
+
!Z(i.dataTransfer) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), U += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
471
|
+
}), a.addEventListener("dragover", (i) => {
|
|
472
|
+
const g = i.dataTransfer;
|
|
473
|
+
!Z(g) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), g.dropEffect = "copy");
|
|
474
|
+
}), a.addEventListener("dragleave", (i) => {
|
|
475
|
+
Z(i.dataTransfer) && (i.stopPropagation(), U = Math.max(0, U - 1), U === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
476
|
+
}), a.addEventListener("drop", (i) => {
|
|
477
|
+
const g = i.dataTransfer;
|
|
478
|
+
!Z(g) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), it(), st(g.files).catch((E) => {
|
|
479
|
+
lt(E instanceof Error ? E.message : "Failed to attach file"), O("web-sdk.widget", "Attachment failed", {
|
|
480
|
+
message: E instanceof Error ? E.message : String(E)
|
|
481
|
+
});
|
|
482
|
+
}));
|
|
483
|
+
}), f.addEventListener("click", () => {
|
|
484
|
+
if (e.loginRequired) {
|
|
485
|
+
e.onLoginClick?.();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (C.getState().isThinking) {
|
|
489
|
+
C.stop();
|
|
502
490
|
return;
|
|
503
491
|
}
|
|
504
|
-
|
|
505
|
-
}),
|
|
506
|
-
|
|
507
|
-
}),
|
|
508
|
-
|
|
509
|
-
}),
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
492
|
+
x = pe(C, p, x), F(), N();
|
|
493
|
+
}), w.addEventListener("click", () => {
|
|
494
|
+
C.startNewSession(), K.clear(), p.value = "", x = [], F(), V(p), T(), N(), p.focus();
|
|
495
|
+
}), p.addEventListener("input", () => {
|
|
496
|
+
V(p), T(), N();
|
|
497
|
+
}), p.addEventListener("keydown", (i) => {
|
|
498
|
+
if (!(i.key !== "Enter" || i.shiftKey)) {
|
|
499
|
+
if (i.preventDefault(), e.loginRequired) {
|
|
500
|
+
e.onLoginClick?.();
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
x = pe(C, p, x), F(), N();
|
|
504
|
+
}
|
|
505
|
+
}), a.addEventListener("click", (i) => {
|
|
506
|
+
(i.target instanceof Element ? i.target : null)?.closest("a[href]") && T();
|
|
507
|
+
}), z.composerValue && (p.value = z.composerValue, V(p)), z.isOpen && W(p.value, !1);
|
|
508
|
+
const Y = () => r;
|
|
509
|
+
let oe = C.getState().appearance !== null;
|
|
510
|
+
return C.on("state", (i) => {
|
|
511
|
+
i.appearance ? (oe = !0, O("web-sdk.widget", "Agent state supplied appearance", {
|
|
512
|
+
appearance: i.appearance
|
|
513
|
+
}), ae(i.appearance, "agent.state.appearance")) : oe && (oe = !1, O("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
520
514
|
fallbackAccentColor: e.accentColor,
|
|
521
515
|
fallbackColorScheme: e.colorScheme,
|
|
522
516
|
fallbackFontFamily: e.fontFamily
|
|
523
|
-
}),
|
|
524
|
-
|
|
525
|
-
}),
|
|
526
|
-
}),
|
|
527
|
-
|
|
528
|
-
}),
|
|
529
|
-
agent:
|
|
530
|
-
updateAppearance: (
|
|
531
|
-
|
|
517
|
+
}), ae({}, "agent.state.appearance-cleared")), e.loginRequired ? Fe(b, f, w, Y, e.loginButtonLabel, e.onLoginClick) : Oe(b, f, w, i, K, T, Y, (g) => {
|
|
518
|
+
C.sendMessage(g);
|
|
519
|
+
}), N();
|
|
520
|
+
}), e.loginRequired ? Fe(b, f, w, Y, e.loginButtonLabel, e.onLoginClick) : Oe(b, f, w, C.getState(), K, T, Y, (i) => {
|
|
521
|
+
C.sendMessage(i);
|
|
522
|
+
}), N(), {
|
|
523
|
+
agent: C,
|
|
524
|
+
updateAppearance: (i) => {
|
|
525
|
+
i.scribbleStyle !== void 0 && (e.scribbleStyle = i.scribbleStyle), ae(i, "widgetHandle.updateAppearance");
|
|
532
526
|
},
|
|
533
527
|
destroy: () => {
|
|
534
|
-
|
|
528
|
+
fe = !0, me.disconnect(), e.movableLauncher && window.removeEventListener("resize", we), _e(), P !== null && window.clearTimeout(P), C.destroy(), n.remove();
|
|
535
529
|
}
|
|
536
530
|
};
|
|
537
|
-
function
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
accentColor:
|
|
541
|
-
colorScheme:
|
|
542
|
-
fontFamily:
|
|
543
|
-
scribbleStyle:
|
|
531
|
+
function ae(i, g) {
|
|
532
|
+
const E = i.accentColor ?? e.accentColor, H = i.colorScheme ?? e.colorScheme, xe = i.fontFamily ?? e.fontFamily, re = i.scribbleStyle ?? e.scribbleStyle;
|
|
533
|
+
r = Pe(E, re), Ae(a, r, {
|
|
534
|
+
accentColor: E,
|
|
535
|
+
colorScheme: H,
|
|
536
|
+
fontFamily: xe,
|
|
537
|
+
scribbleStyle: re
|
|
544
538
|
}), O("web-sdk.widget", "Updated widget appearance", {
|
|
545
|
-
source:
|
|
546
|
-
inputAppearance:
|
|
547
|
-
appliedAccentColor:
|
|
548
|
-
appliedColorScheme:
|
|
549
|
-
appliedFontFamily:
|
|
550
|
-
appliedScribbleStyle:
|
|
539
|
+
source: g,
|
|
540
|
+
inputAppearance: i,
|
|
541
|
+
appliedAccentColor: E,
|
|
542
|
+
appliedColorScheme: H,
|
|
543
|
+
appliedFontFamily: xe,
|
|
544
|
+
appliedScribbleStyle: re,
|
|
551
545
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
552
546
|
});
|
|
553
547
|
}
|
|
554
548
|
}
|
|
555
|
-
function
|
|
556
|
-
return e ?
|
|
549
|
+
function Pe(t, e) {
|
|
550
|
+
return e ? ft(t) : gt(t);
|
|
557
551
|
}
|
|
558
|
-
function
|
|
552
|
+
function Ae(t, e, n) {
|
|
559
553
|
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);
|
|
560
|
-
const o = n.scribbleStyle ?
|
|
561
|
-
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ?
|
|
554
|
+
const o = n.scribbleStyle ? Ve(n.accentColor) : n.accentColor;
|
|
555
|
+
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? Nt : n.fontFamily, n.scribbleStyle && Ht(t.ownerDocument);
|
|
562
556
|
const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
|
|
563
|
-
for (const
|
|
564
|
-
|
|
557
|
+
for (const r of a)
|
|
558
|
+
r.src = e;
|
|
565
559
|
}
|
|
566
|
-
function
|
|
567
|
-
if (t.getElementById(
|
|
560
|
+
function Ht(t) {
|
|
561
|
+
if (t.getElementById(Se))
|
|
568
562
|
return;
|
|
569
563
|
const e = t.createElement("style");
|
|
570
|
-
e.id =
|
|
564
|
+
e.id = Se, e.textContent = `@font-face {
|
|
571
565
|
font-family: "Architects Daughter";
|
|
572
566
|
font-style: normal;
|
|
573
567
|
font-weight: 400;
|
|
@@ -575,107 +569,107 @@ function _t(t) {
|
|
|
575
569
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
576
570
|
}`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
|
|
577
571
|
}
|
|
578
|
-
function
|
|
572
|
+
function Vt({
|
|
579
573
|
root: t,
|
|
580
574
|
launcherDragHandle: e,
|
|
581
575
|
getPosition: n,
|
|
582
576
|
setPosition: o,
|
|
583
577
|
persist: a
|
|
584
578
|
}) {
|
|
585
|
-
let
|
|
579
|
+
let r = null, l = null, d = null, u = !1;
|
|
586
580
|
const h = () => {
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (
|
|
590
|
-
},
|
|
591
|
-
if (
|
|
581
|
+
r = null, l = null, d = null, u = !1, t.classList.remove("pluno-pa-widget--dragging");
|
|
582
|
+
}, c = (s) => {
|
|
583
|
+
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (s.preventDefault(), s.stopPropagation(), r = s.pointerId, l = { x: s.clientX, y: s.clientY }, d = n(), u = !1, e.setPointerCapture?.(s.pointerId));
|
|
584
|
+
}, m = (s) => {
|
|
585
|
+
if (r !== s.pointerId || !l || !d)
|
|
592
586
|
return;
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
!
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
},
|
|
599
|
-
|
|
600
|
-
},
|
|
587
|
+
s.preventDefault();
|
|
588
|
+
const p = s.clientX - l.x, f = s.clientY - l.y;
|
|
589
|
+
!u && Math.hypot(p, f) < Gt || (u = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: d.x + p, y: d.y + f }));
|
|
590
|
+
}, y = (s) => {
|
|
591
|
+
r === s.pointerId && (s.preventDefault(), s.stopPropagation(), u && a(), h());
|
|
592
|
+
}, k = (s) => {
|
|
593
|
+
r === s.pointerId && (s.preventDefault(), h());
|
|
594
|
+
}, v = (s) => {
|
|
601
595
|
if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
|
|
602
596
|
return;
|
|
603
|
-
const
|
|
604
|
-
let
|
|
605
|
-
|
|
597
|
+
const p = s.shiftKey ? $t : Bt, f = n();
|
|
598
|
+
let w = null;
|
|
599
|
+
s.key === "ArrowUp" ? w = { x: f.x, y: f.y - p } : s.key === "ArrowDown" ? w = { x: f.x, y: f.y + p } : s.key === "ArrowLeft" ? w = { x: f.x - p, y: f.y } : s.key === "ArrowRight" && (w = { x: f.x + p, y: f.y }), w && (s.preventDefault(), s.stopPropagation(), o(w), a());
|
|
606
600
|
};
|
|
607
|
-
return e.addEventListener("pointerdown",
|
|
608
|
-
e.removeEventListener("pointerdown",
|
|
601
|
+
return e.addEventListener("pointerdown", c), e.addEventListener("pointermove", m), e.addEventListener("pointerup", y), e.addEventListener("pointercancel", k), e.addEventListener("keydown", v), () => {
|
|
602
|
+
e.removeEventListener("pointerdown", c), e.removeEventListener("pointermove", m), e.removeEventListener("pointerup", y), e.removeEventListener("pointercancel", k), e.removeEventListener("keydown", v);
|
|
609
603
|
};
|
|
610
604
|
}
|
|
611
|
-
function
|
|
612
|
-
const n =
|
|
605
|
+
function Te(t, e = !0) {
|
|
606
|
+
const n = B(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
|
|
613
607
|
return {
|
|
614
|
-
width: e && a && o.width > 0 ? o.width : Math.min(
|
|
615
|
-
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ?
|
|
608
|
+
width: e && a && o.width > 0 ? o.width : Math.min(Ke, n.width - 36),
|
|
609
|
+
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? It : je
|
|
616
610
|
};
|
|
617
611
|
}
|
|
618
|
-
function
|
|
619
|
-
const t =
|
|
612
|
+
function qt() {
|
|
613
|
+
const t = B();
|
|
620
614
|
return {
|
|
621
|
-
width: Math.min(
|
|
622
|
-
height: Math.min(
|
|
615
|
+
width: Math.min(Rt, t.width - 28),
|
|
616
|
+
height: Math.min(Dt, t.height - 28)
|
|
623
617
|
};
|
|
624
618
|
}
|
|
625
|
-
function
|
|
619
|
+
function Kt(t, e, n) {
|
|
626
620
|
const o = Number.parseFloat(t.style.left), a = Number.parseFloat(t.style.top);
|
|
627
621
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
628
622
|
return { x: o, y: a };
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
631
|
-
return { x:
|
|
632
|
-
const
|
|
623
|
+
const r = t.getBoundingClientRect();
|
|
624
|
+
if (r.width > 0 || r.height > 0)
|
|
625
|
+
return { x: r.left, y: r.top };
|
|
626
|
+
const l = B();
|
|
633
627
|
return {
|
|
634
|
-
x: e === "bottom-left" ? 26 :
|
|
635
|
-
y:
|
|
628
|
+
x: e === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
629
|
+
y: l.height - 24 - n.height
|
|
636
630
|
};
|
|
637
631
|
}
|
|
638
|
-
function
|
|
639
|
-
const o =
|
|
632
|
+
function Ne(t, e, n) {
|
|
633
|
+
const o = B(), a = S + jt(t);
|
|
640
634
|
return {
|
|
641
|
-
x:
|
|
642
|
-
y:
|
|
635
|
+
x: te(e.x, S, Math.max(S, o.width - n.width - S)),
|
|
636
|
+
y: te(e.y, a, Math.max(a, o.height - n.height - S))
|
|
643
637
|
};
|
|
644
638
|
}
|
|
645
|
-
function
|
|
646
|
-
return t.classList.contains("pluno-pa-widget--scribble") ?
|
|
639
|
+
function jt(t) {
|
|
640
|
+
return t.classList.contains("pluno-pa-widget--scribble") ? Ft : Ot;
|
|
647
641
|
}
|
|
648
|
-
function
|
|
649
|
-
const e =
|
|
642
|
+
function Ie(t) {
|
|
643
|
+
const e = B(), n = qt();
|
|
650
644
|
return {
|
|
651
|
-
x:
|
|
652
|
-
y:
|
|
645
|
+
x: te(t.x, S, Math.max(S, e.width - n.width - S)),
|
|
646
|
+
y: te(
|
|
653
647
|
t.y,
|
|
654
|
-
|
|
655
|
-
Math.max(
|
|
648
|
+
Le,
|
|
649
|
+
Math.max(Le, e.height - n.height - S)
|
|
656
650
|
)
|
|
657
651
|
};
|
|
658
652
|
}
|
|
659
|
-
function
|
|
653
|
+
function X(t, e) {
|
|
660
654
|
if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), !e) {
|
|
661
655
|
t.style.removeProperty("left"), t.style.removeProperty("top"), t.style.removeProperty("right"), t.style.removeProperty("bottom");
|
|
662
656
|
return;
|
|
663
657
|
}
|
|
664
658
|
t.style.left = `${e.x}px`, t.style.top = `${e.y}px`, t.style.right = "auto", t.style.bottom = "auto";
|
|
665
659
|
}
|
|
666
|
-
function
|
|
660
|
+
function Yt(t, e) {
|
|
667
661
|
t.style.setProperty("--pluno-pa-panel-offset-x", `${e.x}px`), t.style.setProperty("--pluno-pa-panel-offset-y", `${e.y}px`);
|
|
668
662
|
}
|
|
669
|
-
function
|
|
663
|
+
function Re(t) {
|
|
670
664
|
t.style.removeProperty("--pluno-pa-panel-offset-x"), t.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
671
665
|
}
|
|
672
|
-
function
|
|
666
|
+
function B() {
|
|
673
667
|
return {
|
|
674
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
675
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
668
|
+
width: window.innerWidth || document.documentElement.clientWidth || Ke + S * 2,
|
|
669
|
+
height: window.innerHeight || document.documentElement.clientHeight || je + S * 2
|
|
676
670
|
};
|
|
677
671
|
}
|
|
678
|
-
function
|
|
672
|
+
function le(t) {
|
|
679
673
|
const e = t.getBoundingClientRect();
|
|
680
674
|
return {
|
|
681
675
|
x: Math.round(e.x),
|
|
@@ -684,7 +678,7 @@ function J(t) {
|
|
|
684
678
|
height: Math.round(e.height)
|
|
685
679
|
};
|
|
686
680
|
}
|
|
687
|
-
function
|
|
681
|
+
function te(t, e, n) {
|
|
688
682
|
return Math.min(Math.max(t, e), n);
|
|
689
683
|
}
|
|
690
684
|
function O(t, e, n) {
|
|
@@ -695,140 +689,441 @@ function O(t, e, n) {
|
|
|
695
689
|
source: t,
|
|
696
690
|
message: e,
|
|
697
691
|
details: n
|
|
698
|
-
},
|
|
699
|
-
|
|
692
|
+
}, r = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
693
|
+
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(Pt, { detail: a }));
|
|
700
694
|
}
|
|
701
|
-
function
|
|
695
|
+
function Xt(t, e) {
|
|
702
696
|
O("web-sdk.widget.position", t, e);
|
|
703
697
|
}
|
|
704
|
-
function
|
|
705
|
-
const
|
|
706
|
-
|
|
698
|
+
function pe(t, e, n) {
|
|
699
|
+
const o = e.value.trim();
|
|
700
|
+
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 })), []);
|
|
707
701
|
}
|
|
708
|
-
function
|
|
702
|
+
function V(t) {
|
|
709
703
|
t.style.height = "0px";
|
|
710
704
|
const e = Math.max(22, Math.min(t.scrollHeight, 140));
|
|
711
705
|
t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
|
|
712
706
|
}
|
|
713
|
-
function
|
|
707
|
+
function Zt(t, e, n, o) {
|
|
708
|
+
t.appendChild(nn()), t.appendChild(Jt(e, n, o)), t.appendChild(Ze("pluno-pa-widget__close", "Close", on(16), !0)), t.appendChild(Qt(n));
|
|
709
|
+
}
|
|
710
|
+
function Jt(t, e, n) {
|
|
711
|
+
const o = document.createElement("form");
|
|
712
|
+
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
713
|
+
const r = document.createElement("button");
|
|
714
|
+
r.type = "button", r.className = "pluno-pa-widget__launcher-drag-handle", r.setAttribute("aria-label", "Move Pluno launcher"), r.title = "Move Pluno launcher", o.appendChild(r);
|
|
715
|
+
}
|
|
716
|
+
o.appendChild(Xe("pluno-pa-widget__character--launcher", e));
|
|
717
|
+
const a = document.createElement("input");
|
|
718
|
+
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), o.appendChild(a), o;
|
|
719
|
+
}
|
|
720
|
+
function Qt(t) {
|
|
721
|
+
const e = document.createElement("section");
|
|
722
|
+
e.className = "pluno-pa-widget__panel", e.hidden = !0;
|
|
723
|
+
const n = document.createElement("div");
|
|
724
|
+
n.className = "pluno-pa-widget__timeline-wrap";
|
|
725
|
+
const o = document.createElement("main");
|
|
726
|
+
return o.className = "pluno-pa-widget__timeline", o.appendChild(tn(t)), n.appendChild(o), n.appendChild(Ze("pluno-pa-widget__new-chat", "New chat", an(), !0)), e.appendChild(n), e.appendChild(en()), e;
|
|
727
|
+
}
|
|
728
|
+
function en() {
|
|
729
|
+
const t = document.createElement("form");
|
|
730
|
+
t.className = "pluno-pa-widget__composer";
|
|
731
|
+
const e = document.createElement("div");
|
|
732
|
+
e.className = "pluno-pa-widget__attachment-error", e.hidden = !0, t.appendChild(e);
|
|
733
|
+
const n = document.createElement("div");
|
|
734
|
+
n.className = "pluno-pa-widget__attachments", n.hidden = !0, t.appendChild(n);
|
|
735
|
+
const o = document.createElement("div");
|
|
736
|
+
o.className = "pluno-pa-widget__composer-inner";
|
|
737
|
+
const a = document.createElement("textarea");
|
|
738
|
+
a.className = "pluno-pa-widget__input", a.rows = 1, a.placeholder = "Ask for anything...", o.appendChild(a);
|
|
739
|
+
const r = document.createElement("button");
|
|
740
|
+
r.type = "button", r.className = "pluno-pa-widget__send", r.setAttribute("aria-label", "Send"), r.appendChild(Je()), o.appendChild(r), t.appendChild(o);
|
|
741
|
+
const l = document.createElement("a");
|
|
742
|
+
return l.className = "pluno-pa-widget__powered-by", l.href = "https://pluno.ai", l.target = "_blank", l.rel = "noopener noreferrer", l.textContent = "Powered by Pluno.ai", t.appendChild(l), t;
|
|
743
|
+
}
|
|
744
|
+
function tn(t) {
|
|
745
|
+
const e = document.createElement("div");
|
|
746
|
+
return e.className = "pluno-pa-widget__empty-state", e.appendChild(Xe("pluno-pa-widget__character--empty", t)), e.appendChild(Ye()), e;
|
|
747
|
+
}
|
|
748
|
+
function Ye() {
|
|
749
|
+
const t = document.createElement("div");
|
|
750
|
+
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;
|
|
751
|
+
}
|
|
752
|
+
function Xe(t, e) {
|
|
753
|
+
const n = document.createElement("img");
|
|
754
|
+
return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
755
|
+
}
|
|
756
|
+
function Ze(t, e, n, o) {
|
|
757
|
+
const a = document.createElement("button");
|
|
758
|
+
return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
|
|
759
|
+
}
|
|
760
|
+
function nn() {
|
|
761
|
+
const t = _("svg", {
|
|
762
|
+
class: "pluno-pa-widget__scribble-defs",
|
|
763
|
+
"aria-hidden": "true",
|
|
764
|
+
focusable: "false",
|
|
765
|
+
width: "0",
|
|
766
|
+
height: "0"
|
|
767
|
+
}), e = _("defs");
|
|
768
|
+
return e.appendChild(se("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(se("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(se("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
|
|
769
|
+
}
|
|
770
|
+
function se(t, e, n) {
|
|
771
|
+
const o = _("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
772
|
+
return o.appendChild(
|
|
773
|
+
_("feTurbulence", {
|
|
774
|
+
type: "fractalNoise",
|
|
775
|
+
baseFrequency: "0.012 0.028",
|
|
776
|
+
numOctaves: "3",
|
|
777
|
+
seed: e,
|
|
778
|
+
result: "stroke-noise"
|
|
779
|
+
})
|
|
780
|
+
), o.appendChild(
|
|
781
|
+
_("feDisplacementMap", {
|
|
782
|
+
in: "SourceGraphic",
|
|
783
|
+
in2: "stroke-noise",
|
|
784
|
+
scale: "3.5",
|
|
785
|
+
xChannelSelector: "R",
|
|
786
|
+
yChannelSelector: "G",
|
|
787
|
+
result: "warped"
|
|
788
|
+
})
|
|
789
|
+
), o.appendChild(
|
|
790
|
+
_("feTurbulence", {
|
|
791
|
+
type: "fractalNoise",
|
|
792
|
+
baseFrequency: "0.7",
|
|
793
|
+
numOctaves: "1",
|
|
794
|
+
seed: n,
|
|
795
|
+
result: "ink-noise"
|
|
796
|
+
})
|
|
797
|
+
), o.appendChild(
|
|
798
|
+
_("feDisplacementMap", {
|
|
799
|
+
in: "warped",
|
|
800
|
+
in2: "ink-noise",
|
|
801
|
+
scale: "0.9",
|
|
802
|
+
xChannelSelector: "R",
|
|
803
|
+
yChannelSelector: "G"
|
|
804
|
+
})
|
|
805
|
+
), o;
|
|
806
|
+
}
|
|
807
|
+
function on(t) {
|
|
808
|
+
const e = $("0 0 24 24", t, t, "none", "currentColor", "2.25");
|
|
809
|
+
return e.appendChild(_("path", { d: "m6 9 6 6 6-6" })), e;
|
|
810
|
+
}
|
|
811
|
+
function an() {
|
|
812
|
+
const t = $("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
813
|
+
return t.appendChild(_("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(_("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
|
|
814
|
+
}
|
|
815
|
+
function Je() {
|
|
816
|
+
const t = $("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
817
|
+
return t.appendChild(_("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(_("polyline", { points: "5 12 12 5 19 12" })), t;
|
|
818
|
+
}
|
|
819
|
+
function rn() {
|
|
820
|
+
const t = $("0 0 24 24", 18, 18, "currentColor");
|
|
821
|
+
return t.appendChild(_("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
|
|
822
|
+
}
|
|
823
|
+
function ln() {
|
|
824
|
+
const t = $("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
825
|
+
return t.appendChild(_("path", { d: "M18 6 6 18" })), t.appendChild(_("path", { d: "m6 6 12 12" })), t;
|
|
826
|
+
}
|
|
827
|
+
function pn() {
|
|
828
|
+
const t = $("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
829
|
+
return t.appendChild(_("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(_("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
|
|
830
|
+
}
|
|
831
|
+
function $(t, e, n, o, a, r) {
|
|
832
|
+
const l = {
|
|
833
|
+
viewBox: t,
|
|
834
|
+
width: String(e),
|
|
835
|
+
height: String(n),
|
|
836
|
+
fill: o,
|
|
837
|
+
"aria-hidden": "true"
|
|
838
|
+
};
|
|
839
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), _("svg", l);
|
|
840
|
+
}
|
|
841
|
+
function _(t, e = {}) {
|
|
842
|
+
const n = document.createElementNS(Mt, t);
|
|
843
|
+
for (const [o, a] of Object.entries(e))
|
|
844
|
+
n.setAttribute(o, a);
|
|
845
|
+
return n;
|
|
846
|
+
}
|
|
847
|
+
function De(t) {
|
|
714
848
|
for (const e of ["keydown", "keypress", "keyup"])
|
|
715
849
|
t.addEventListener(e, (n) => {
|
|
716
850
|
n.stopPropagation();
|
|
717
851
|
});
|
|
718
852
|
}
|
|
719
|
-
function
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
const l = document.createElement("
|
|
725
|
-
l.
|
|
726
|
-
const
|
|
727
|
-
|
|
853
|
+
function sn(t, e, n) {
|
|
854
|
+
t.replaceChildren(), t.hidden = e.length === 0;
|
|
855
|
+
for (const [o, a] of e.entries()) {
|
|
856
|
+
const r = document.createElement("div");
|
|
857
|
+
r.className = "pluno-pa-widget__attachment", r.appendChild(dn(a));
|
|
858
|
+
const l = document.createElement("span");
|
|
859
|
+
l.textContent = a.name, r.appendChild(l);
|
|
860
|
+
const d = document.createElement("button");
|
|
861
|
+
d.type = "button", d.setAttribute("aria-label", `Remove ${a.name}`), d.appendChild(ln()), d.addEventListener("click", () => n(o)), r.appendChild(d), t.appendChild(r);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function dn(t) {
|
|
865
|
+
if (Qe(t)) {
|
|
866
|
+
const n = document.createElement("img");
|
|
867
|
+
return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
868
|
+
}
|
|
869
|
+
const e = document.createElement("span");
|
|
870
|
+
return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
|
|
871
|
+
}
|
|
872
|
+
function cn(t) {
|
|
873
|
+
if (Qe(t)) {
|
|
874
|
+
const a = document.createElement("img");
|
|
875
|
+
return a.src = t.dataUrl, a.alt = t.name, a;
|
|
876
|
+
}
|
|
877
|
+
const e = document.createElement("div");
|
|
878
|
+
e.className = "pluno-pa-widget__message-attachment-file";
|
|
879
|
+
const n = document.createElement("span");
|
|
880
|
+
n.textContent = "PDF";
|
|
881
|
+
const o = document.createElement("strong");
|
|
882
|
+
return o.textContent = t.name, e.append(n, o), e;
|
|
883
|
+
}
|
|
884
|
+
function Qe(t) {
|
|
885
|
+
return t.mimeType.startsWith("image/");
|
|
886
|
+
}
|
|
887
|
+
function un(t) {
|
|
888
|
+
return t === "application/pdf" ? "document.pdf" : "image";
|
|
889
|
+
}
|
|
890
|
+
async function gn(t) {
|
|
891
|
+
if (!t)
|
|
892
|
+
return [];
|
|
893
|
+
const e = Array.from(t);
|
|
894
|
+
if (e.length > ee)
|
|
895
|
+
throw new Error(`Attach up to ${ee} files per message.`);
|
|
896
|
+
return Promise.all(
|
|
897
|
+
e.map(async (n) => {
|
|
898
|
+
const o = hn(n);
|
|
899
|
+
if (!o)
|
|
900
|
+
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
901
|
+
if (n.size > At)
|
|
902
|
+
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
903
|
+
if (o === "image/gif") {
|
|
904
|
+
const a = new Uint8Array(await wn(n));
|
|
905
|
+
if (mn(a))
|
|
906
|
+
throw new Error("Pluno supports non-animated GIF images.");
|
|
907
|
+
}
|
|
908
|
+
return {
|
|
909
|
+
name: n.name || un(o),
|
|
910
|
+
mimeType: o,
|
|
911
|
+
sizeBytes: n.size,
|
|
912
|
+
dataUrl: fn(await _n(n), o)
|
|
913
|
+
};
|
|
914
|
+
})
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
function hn(t) {
|
|
918
|
+
if (Tt.has(t.type))
|
|
919
|
+
return t.type;
|
|
920
|
+
const e = t.name.toLowerCase();
|
|
921
|
+
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;
|
|
922
|
+
}
|
|
923
|
+
function fn(t, e) {
|
|
924
|
+
const n = `data:${e};base64,`;
|
|
925
|
+
return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
|
|
926
|
+
}
|
|
927
|
+
function mn(t) {
|
|
928
|
+
if (t.length < 14 || !bn(t))
|
|
929
|
+
return !1;
|
|
930
|
+
const e = t[10];
|
|
931
|
+
let n = 13;
|
|
932
|
+
e & 128 && (n += 3 * 2 ** ((e & 7) + 1));
|
|
933
|
+
let o = 0;
|
|
934
|
+
for (; n < t.length; ) {
|
|
935
|
+
const a = t[n];
|
|
936
|
+
if (n += 1, a === 59)
|
|
937
|
+
return !1;
|
|
938
|
+
if (a === 33) {
|
|
939
|
+
n += 1, n = Me(t, n);
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
if (a !== 44)
|
|
943
|
+
return !1;
|
|
944
|
+
if (o += 1, o > 1)
|
|
945
|
+
return !0;
|
|
946
|
+
if (n + 9 >= t.length)
|
|
947
|
+
return !1;
|
|
948
|
+
const r = t[n + 8];
|
|
949
|
+
if (n += 9, r & 128 && (n += 3 * 2 ** ((r & 7) + 1)), n >= t.length)
|
|
950
|
+
return !1;
|
|
951
|
+
n += 1, n = Me(t, n);
|
|
952
|
+
}
|
|
953
|
+
return !1;
|
|
954
|
+
}
|
|
955
|
+
function bn(t) {
|
|
956
|
+
return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
|
|
957
|
+
}
|
|
958
|
+
function Me(t, e) {
|
|
959
|
+
for (; e < t.length; ) {
|
|
960
|
+
const n = t[e];
|
|
961
|
+
if (e += 1, n === 0)
|
|
962
|
+
return e;
|
|
963
|
+
e += n;
|
|
964
|
+
}
|
|
965
|
+
return e;
|
|
966
|
+
}
|
|
967
|
+
function Z(t) {
|
|
968
|
+
return !!(t && Array.from(t.types).includes("Files"));
|
|
969
|
+
}
|
|
970
|
+
function wn(t) {
|
|
971
|
+
return new Promise((e, n) => {
|
|
972
|
+
const o = new FileReader();
|
|
973
|
+
o.addEventListener("load", () => {
|
|
974
|
+
if (o.result instanceof ArrayBuffer) {
|
|
975
|
+
e(o.result);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
n(new Error("Failed to read file"));
|
|
979
|
+
}), o.addEventListener("error", () => {
|
|
980
|
+
n(o.error ?? new Error("Failed to read file"));
|
|
981
|
+
}), o.readAsArrayBuffer(t);
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
function _n(t) {
|
|
985
|
+
return new Promise((e, n) => {
|
|
986
|
+
const o = new FileReader();
|
|
987
|
+
o.addEventListener("load", () => {
|
|
988
|
+
if (typeof o.result == "string") {
|
|
989
|
+
e(o.result);
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
n(new Error("Failed to read file"));
|
|
993
|
+
}), o.addEventListener("error", () => {
|
|
994
|
+
n(o.error ?? new Error("Failed to read file"));
|
|
995
|
+
}), o.readAsDataURL(t);
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
function Oe(t, e, n, o, a, r, l, d) {
|
|
999
|
+
const u = [...o.messages];
|
|
1000
|
+
t.replaceChildren(), tt(e, o.isThinking);
|
|
1001
|
+
const h = u.length > 0 || !!o.assistantDraft || o.isThinking;
|
|
1002
|
+
if (n.hidden = !h, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
|
|
1003
|
+
const s = document.createElement("div");
|
|
1004
|
+
s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1005
|
+
const p = document.createElement("img");
|
|
1006
|
+
p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = l(), p.alt = "", p.setAttribute("aria-hidden", "true"), s.appendChild(p), s.appendChild(Ye());
|
|
728
1007
|
const f = document.createElement("div");
|
|
729
|
-
f.className = "pluno-pa-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}
|
|
738
|
-
l.appendChild(_), t.appendChild(l);
|
|
1008
|
+
f.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 && f.setAttribute("aria-hidden", "true");
|
|
1009
|
+
for (const w of o.starterPrompts) {
|
|
1010
|
+
const b = document.createElement("button");
|
|
1011
|
+
b.type = "button", b.className = "pluno-pa-widget__starter-prompt", b.textContent = `"${w}"`, b.addEventListener("click", () => {
|
|
1012
|
+
d(w);
|
|
1013
|
+
}), f.appendChild(b);
|
|
1014
|
+
}
|
|
1015
|
+
s.appendChild(f), t.appendChild(s);
|
|
739
1016
|
return;
|
|
740
1017
|
}
|
|
741
|
-
let
|
|
742
|
-
const
|
|
743
|
-
if (
|
|
1018
|
+
let c = null, m = null, y = [];
|
|
1019
|
+
const k = () => {
|
|
1020
|
+
if (y.length === 0)
|
|
744
1021
|
return !1;
|
|
745
|
-
const
|
|
746
|
-
return t.appendChild(
|
|
1022
|
+
const s = yn(y, a, r, l());
|
|
1023
|
+
return t.appendChild(s), c = null, m = s, y = [], !0;
|
|
747
1024
|
};
|
|
748
|
-
for (let
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
|
|
1025
|
+
for (let s = 0; s < u.length; s += 1) {
|
|
1026
|
+
const p = u[s];
|
|
1027
|
+
if (p.role === "tool") {
|
|
1028
|
+
y.push(p);
|
|
752
1029
|
continue;
|
|
753
1030
|
}
|
|
754
|
-
if (
|
|
1031
|
+
if (p.role === "system")
|
|
755
1032
|
continue;
|
|
756
|
-
const f =
|
|
757
|
-
if (
|
|
758
|
-
const
|
|
759
|
-
t.appendChild(
|
|
1033
|
+
const f = k(), w = Be(p.content);
|
|
1034
|
+
if (p.role === "assistant" && !f) {
|
|
1035
|
+
const x = ge(l());
|
|
1036
|
+
t.appendChild(x), c = null, m = x;
|
|
760
1037
|
}
|
|
761
|
-
const
|
|
762
|
-
|
|
1038
|
+
const b = document.createElement("div");
|
|
1039
|
+
b.className = `pluno-pa-widget__message pluno-pa-widget__message--${p.role}`, p.role === "assistant" ? ze(b, w) : b.textContent = w, p.role === "user" && p.attachments?.length && b.appendChild(xn(p.attachments)), b.appendChild(Ge(w)), t.appendChild(b), c = b, m = null;
|
|
763
1040
|
}
|
|
764
|
-
const
|
|
1041
|
+
const v = k();
|
|
765
1042
|
if (o.assistantDraft) {
|
|
766
|
-
if (!
|
|
767
|
-
const f =
|
|
768
|
-
t.appendChild(f),
|
|
1043
|
+
if (!v) {
|
|
1044
|
+
const f = ge(l());
|
|
1045
|
+
t.appendChild(f), c = null, m = f;
|
|
769
1046
|
}
|
|
770
|
-
const
|
|
771
|
-
|
|
1047
|
+
const s = Be(o.assistantDraft), p = document.createElement("div");
|
|
1048
|
+
p.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ze(p, s), p.appendChild(Ge(s)), t.appendChild(p), c = p, m = null;
|
|
772
1049
|
}
|
|
773
1050
|
if (o.isThinking && !o.assistantDraft)
|
|
774
|
-
if (
|
|
775
|
-
const
|
|
776
|
-
t.appendChild(
|
|
1051
|
+
if (v) {
|
|
1052
|
+
const s = et();
|
|
1053
|
+
t.appendChild(s), c = null, m = s;
|
|
777
1054
|
} else {
|
|
778
|
-
const
|
|
779
|
-
t.appendChild(
|
|
1055
|
+
const s = vn(l());
|
|
1056
|
+
t.appendChild(s), c = null, m = s;
|
|
780
1057
|
}
|
|
781
1058
|
if (o.lastError) {
|
|
782
|
-
const
|
|
783
|
-
|
|
1059
|
+
const s = document.createElement("div");
|
|
1060
|
+
s.className = "pluno-pa-widget__error", s.textContent = o.lastError, t.appendChild(s), c = s, m = null;
|
|
784
1061
|
}
|
|
785
|
-
|
|
1062
|
+
c?.classList.add("pluno-pa-widget__message--bottom-reserve"), m?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
|
|
1063
|
+
}
|
|
1064
|
+
function Fe(t, e, n, o, a, r) {
|
|
1065
|
+
t.replaceChildren(), tt(e, !1), e.disabled = !0, n.hidden = !0;
|
|
1066
|
+
const l = document.createElement("div");
|
|
1067
|
+
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1068
|
+
const d = document.createElement("img");
|
|
1069
|
+
d.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", d.src = o(), d.alt = "", d.setAttribute("aria-hidden", "true"), l.appendChild(d);
|
|
1070
|
+
const u = document.createElement("div");
|
|
1071
|
+
u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
|
|
1072
|
+
const h = document.createElement("button");
|
|
1073
|
+
h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = a, h.addEventListener("click", () => r?.()), l.appendChild(h), t.appendChild(l);
|
|
1074
|
+
}
|
|
1075
|
+
function xn(t) {
|
|
1076
|
+
const e = document.createElement("div");
|
|
1077
|
+
e.className = "pluno-pa-widget__message-attachments";
|
|
1078
|
+
for (const n of t)
|
|
1079
|
+
e.appendChild(cn(n));
|
|
1080
|
+
return e;
|
|
786
1081
|
}
|
|
787
|
-
function
|
|
1082
|
+
function Ge(t) {
|
|
788
1083
|
const e = document.createElement("button");
|
|
789
|
-
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.
|
|
1084
|
+
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(pn()), e.addEventListener("click", (n) => {
|
|
790
1085
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
|
|
791
1086
|
}), e;
|
|
792
1087
|
}
|
|
793
|
-
function
|
|
1088
|
+
function Be(t) {
|
|
794
1089
|
return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
795
1090
|
}
|
|
796
|
-
function
|
|
1091
|
+
function yn(t, e, n, o) {
|
|
797
1092
|
const a = document.createElement("article");
|
|
798
1093
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
|
|
799
|
-
const
|
|
800
|
-
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
|
|
1094
|
+
const r = document.createElement("img");
|
|
1095
|
+
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);
|
|
1096
|
+
const l = document.createElement("details"), d = Cn(t);
|
|
1097
|
+
l.open = e.has(d), l.addEventListener("toggle", () => {
|
|
1098
|
+
l.open ? e.add(d) : e.delete(d), n();
|
|
804
1099
|
});
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
for (const
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
}
|
|
817
|
-
|
|
1100
|
+
const u = document.createElement("summary");
|
|
1101
|
+
u.className = "pluno-pa-widget__tool-summary", t.some((m) => m.loading) && u.appendChild($e());
|
|
1102
|
+
const c = document.createElement("span");
|
|
1103
|
+
if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = t[t.length - 1].content || "Run tool", u.appendChild(c), l.appendChild(u), t.length > 0) {
|
|
1104
|
+
const m = document.createElement("div");
|
|
1105
|
+
m.className = "pluno-pa-widget__tool-lines";
|
|
1106
|
+
for (const y of t) {
|
|
1107
|
+
const k = document.createElement("div");
|
|
1108
|
+
k.className = "pluno-pa-widget__tool-line", y.loading && k.appendChild($e());
|
|
1109
|
+
const v = document.createElement("span");
|
|
1110
|
+
v.textContent = y.content || "Run tool", k.appendChild(v), m.appendChild(k);
|
|
1111
|
+
}
|
|
1112
|
+
l.appendChild(m);
|
|
818
1113
|
}
|
|
819
|
-
return a.appendChild(
|
|
1114
|
+
return a.appendChild(l), a;
|
|
820
1115
|
}
|
|
821
|
-
function
|
|
1116
|
+
function ge(t) {
|
|
822
1117
|
const e = document.createElement("article");
|
|
823
1118
|
e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
824
1119
|
const n = document.createElement("img");
|
|
825
1120
|
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;
|
|
826
1121
|
}
|
|
827
|
-
function
|
|
828
|
-
const e =
|
|
829
|
-
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(
|
|
1122
|
+
function vn(t) {
|
|
1123
|
+
const e = ge(t);
|
|
1124
|
+
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(et()), e;
|
|
830
1125
|
}
|
|
831
|
-
function
|
|
1126
|
+
function et() {
|
|
832
1127
|
const t = document.createElement("div");
|
|
833
1128
|
t.className = "pluno-pa-widget__status";
|
|
834
1129
|
const e = document.createElement("span");
|
|
@@ -836,17 +1131,17 @@ function $e() {
|
|
|
836
1131
|
const n = document.createElement("span");
|
|
837
1132
|
return n.textContent = "Thinking...", t.appendChild(n), t;
|
|
838
1133
|
}
|
|
839
|
-
function
|
|
1134
|
+
function Cn(t) {
|
|
840
1135
|
return `tools:${t.map((e) => e.id).join("|")}`;
|
|
841
1136
|
}
|
|
842
|
-
function
|
|
1137
|
+
function $e() {
|
|
843
1138
|
const t = document.createElement("span");
|
|
844
1139
|
return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
|
|
845
1140
|
}
|
|
846
|
-
function
|
|
847
|
-
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.
|
|
1141
|
+
function tt(t, e) {
|
|
1142
|
+
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? rn() : Je());
|
|
848
1143
|
}
|
|
849
|
-
function
|
|
1144
|
+
function ze(t, e) {
|
|
850
1145
|
const n = e.replace(/\r\n/g, `
|
|
851
1146
|
`).split(`
|
|
852
1147
|
`);
|
|
@@ -862,22 +1157,22 @@ function Ae(t, e) {
|
|
|
862
1157
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
863
1158
|
h.push(n[o]), o += 1;
|
|
864
1159
|
o += o < n.length ? 1 : 0;
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
`),
|
|
1160
|
+
const c = document.createElement("pre"), m = document.createElement("code");
|
|
1161
|
+
m.textContent = h.join(`
|
|
1162
|
+
`), c.appendChild(m), t.appendChild(c);
|
|
868
1163
|
continue;
|
|
869
1164
|
}
|
|
870
|
-
const
|
|
871
|
-
if (
|
|
872
|
-
const h = document.createElement(`h${
|
|
873
|
-
|
|
1165
|
+
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1166
|
+
if (l) {
|
|
1167
|
+
const h = document.createElement(`h${l[1].length + 2}`);
|
|
1168
|
+
J(h, l[2]), t.appendChild(h), o += 1;
|
|
874
1169
|
continue;
|
|
875
1170
|
}
|
|
876
1171
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
877
1172
|
const h = document.createElement("ul");
|
|
878
1173
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
879
|
-
const
|
|
880
|
-
|
|
1174
|
+
const c = document.createElement("li");
|
|
1175
|
+
J(c, n[o].replace(/^\s*[-*+]\s+/, "")), h.appendChild(c), o += 1;
|
|
881
1176
|
}
|
|
882
1177
|
t.appendChild(h);
|
|
883
1178
|
continue;
|
|
@@ -885,50 +1180,50 @@ function Ae(t, e) {
|
|
|
885
1180
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
886
1181
|
const h = document.createElement("ol");
|
|
887
1182
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
888
|
-
const
|
|
889
|
-
|
|
1183
|
+
const c = document.createElement("li");
|
|
1184
|
+
J(c, n[o].replace(/^\s*\d+\.\s+/, "")), h.appendChild(c), o += 1;
|
|
890
1185
|
}
|
|
891
1186
|
t.appendChild(h);
|
|
892
1187
|
continue;
|
|
893
1188
|
}
|
|
894
|
-
const
|
|
1189
|
+
const d = [a];
|
|
895
1190
|
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]); )
|
|
896
|
-
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}), t.appendChild(
|
|
1191
|
+
d.push(n[o]), o += 1;
|
|
1192
|
+
const u = document.createElement("p");
|
|
1193
|
+
d.forEach((h, c) => {
|
|
1194
|
+
c > 0 && u.appendChild(document.createElement("br")), J(u, h);
|
|
1195
|
+
}), t.appendChild(u);
|
|
901
1196
|
}
|
|
902
1197
|
}
|
|
903
|
-
function
|
|
1198
|
+
function J(t, e) {
|
|
904
1199
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
905
1200
|
let o = 0;
|
|
906
1201
|
for (const a of e.matchAll(n)) {
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
} else if (
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
} else if (
|
|
917
|
-
const
|
|
918
|
-
|
|
1202
|
+
const r = a.index ?? 0;
|
|
1203
|
+
r > o && t.appendChild(document.createTextNode(e.slice(o, r)));
|
|
1204
|
+
const l = a[0];
|
|
1205
|
+
if (l.startsWith("`")) {
|
|
1206
|
+
const d = document.createElement("code");
|
|
1207
|
+
d.textContent = l.slice(1, -1), t.appendChild(d);
|
|
1208
|
+
} else if (l.startsWith("**")) {
|
|
1209
|
+
const d = document.createElement("strong");
|
|
1210
|
+
d.textContent = l.slice(2, -2), t.appendChild(d);
|
|
1211
|
+
} else if (l.startsWith("*")) {
|
|
1212
|
+
const d = document.createElement("em");
|
|
1213
|
+
d.textContent = l.slice(1, -1), t.appendChild(d);
|
|
919
1214
|
} else {
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
922
|
-
const
|
|
923
|
-
|
|
1215
|
+
const d = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1216
|
+
if (d && En(d[2])) {
|
|
1217
|
+
const u = document.createElement("a");
|
|
1218
|
+
u.href = d[2], u.target = "_top", u.rel = "noreferrer", u.textContent = d[1], t.appendChild(u);
|
|
924
1219
|
} else
|
|
925
|
-
t.appendChild(document.createTextNode(
|
|
1220
|
+
t.appendChild(document.createTextNode(l));
|
|
926
1221
|
}
|
|
927
|
-
o =
|
|
1222
|
+
o = r + l.length;
|
|
928
1223
|
}
|
|
929
1224
|
o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
|
|
930
1225
|
}
|
|
931
|
-
function
|
|
1226
|
+
function En(t) {
|
|
932
1227
|
if (t.startsWith("/") || t.startsWith("#"))
|
|
933
1228
|
return !0;
|
|
934
1229
|
try {
|
|
@@ -938,7 +1233,7 @@ function At(t) {
|
|
|
938
1233
|
return !1;
|
|
939
1234
|
}
|
|
940
1235
|
}
|
|
941
|
-
function
|
|
1236
|
+
function We(t, e) {
|
|
942
1237
|
if (t.getElementById("pluno-pa-widget-styles"))
|
|
943
1238
|
return;
|
|
944
1239
|
const n = t.ownerDocument.createElement("style");
|
|
@@ -993,7 +1288,7 @@ function Ne(t, e) {
|
|
|
993
1288
|
--pluno-pa-accent-contrast: #fafafa;
|
|
994
1289
|
position: fixed;
|
|
995
1290
|
z-index: 2147483645;
|
|
996
|
-
font-family: ${
|
|
1291
|
+
font-family: ${D.fontFamily};
|
|
997
1292
|
font-size: 14px;
|
|
998
1293
|
color: var(--pluno-pa-text);
|
|
999
1294
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -1014,6 +1309,31 @@ function Ne(t, e) {
|
|
|
1014
1309
|
.pluno-pa-widget [hidden] {
|
|
1015
1310
|
display: none !important;
|
|
1016
1311
|
}
|
|
1312
|
+
.pluno-pa-widget--drag-over::after {
|
|
1313
|
+
content: "Drop files to attach";
|
|
1314
|
+
position: absolute;
|
|
1315
|
+
inset: -8px;
|
|
1316
|
+
z-index: 12;
|
|
1317
|
+
display: grid;
|
|
1318
|
+
place-items: center;
|
|
1319
|
+
border: 2px dashed var(--pluno-pa-accent);
|
|
1320
|
+
border-radius: 20px;
|
|
1321
|
+
background: color-mix(in srgb, var(--pluno-pa-bg) 82%, transparent);
|
|
1322
|
+
box-shadow: 0 0 0 999px rgba(24, 24, 27, 0.12);
|
|
1323
|
+
color: var(--pluno-pa-text);
|
|
1324
|
+
font-size: 14px;
|
|
1325
|
+
font-weight: 650;
|
|
1326
|
+
pointer-events: none;
|
|
1327
|
+
}
|
|
1328
|
+
.pluno-pa-widget--open.pluno-pa-widget--drag-over::after,
|
|
1329
|
+
.pluno-pa-widget--closing.pluno-pa-widget--drag-over::after {
|
|
1330
|
+
inset: auto;
|
|
1331
|
+
left: calc(var(--pluno-pa-panel-offset-x) - 8px);
|
|
1332
|
+
top: calc(var(--pluno-pa-panel-offset-y) - 8px);
|
|
1333
|
+
width: calc(var(--pluno-pa-panel-width) + 16px);
|
|
1334
|
+
height: calc(var(--pluno-pa-panel-height) + 16px);
|
|
1335
|
+
border-radius: 18px;
|
|
1336
|
+
}
|
|
1017
1337
|
.pluno-pa-widget--bottom-right { right: 26px; bottom: 24px; }
|
|
1018
1338
|
.pluno-pa-widget--bottom-left { left: 26px; bottom: 24px; }
|
|
1019
1339
|
.pluno-pa-widget--bottom-left {
|
|
@@ -1296,6 +1616,50 @@ function Ne(t, e) {
|
|
|
1296
1616
|
border-radius: 16px 16px 4px 16px;
|
|
1297
1617
|
padding: 8px 12px;
|
|
1298
1618
|
}
|
|
1619
|
+
.pluno-pa-widget__message-attachments {
|
|
1620
|
+
display: grid;
|
|
1621
|
+
grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
|
|
1622
|
+
gap: 6px;
|
|
1623
|
+
margin-top: 8px;
|
|
1624
|
+
max-width: 220px;
|
|
1625
|
+
}
|
|
1626
|
+
.pluno-pa-widget__message-attachments img {
|
|
1627
|
+
width: 100%;
|
|
1628
|
+
aspect-ratio: 1;
|
|
1629
|
+
border-radius: 8px;
|
|
1630
|
+
object-fit: cover;
|
|
1631
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
1632
|
+
}
|
|
1633
|
+
.pluno-pa-widget__message-attachment-file {
|
|
1634
|
+
min-width: 0;
|
|
1635
|
+
aspect-ratio: 1;
|
|
1636
|
+
display: grid;
|
|
1637
|
+
align-content: center;
|
|
1638
|
+
gap: 5px;
|
|
1639
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
1640
|
+
border-radius: 8px;
|
|
1641
|
+
background: var(--pluno-pa-surface);
|
|
1642
|
+
padding: 8px;
|
|
1643
|
+
color: var(--pluno-pa-text);
|
|
1644
|
+
}
|
|
1645
|
+
.pluno-pa-widget__message-attachment-file span {
|
|
1646
|
+
width: fit-content;
|
|
1647
|
+
border-radius: 4px;
|
|
1648
|
+
background: var(--pluno-pa-accent-soft);
|
|
1649
|
+
color: var(--pluno-pa-accent);
|
|
1650
|
+
padding: 2px 5px;
|
|
1651
|
+
font-size: 10px;
|
|
1652
|
+
font-weight: 700;
|
|
1653
|
+
line-height: 1;
|
|
1654
|
+
}
|
|
1655
|
+
.pluno-pa-widget__message-attachment-file strong {
|
|
1656
|
+
min-width: 0;
|
|
1657
|
+
overflow: hidden;
|
|
1658
|
+
text-overflow: ellipsis;
|
|
1659
|
+
white-space: nowrap;
|
|
1660
|
+
font-size: 11px;
|
|
1661
|
+
font-weight: 600;
|
|
1662
|
+
}
|
|
1299
1663
|
.pluno-pa-widget__message--assistant {
|
|
1300
1664
|
align-self: stretch;
|
|
1301
1665
|
padding: 0 2px;
|
|
@@ -1506,6 +1870,85 @@ function Ne(t, e) {
|
|
|
1506
1870
|
background: var(--pluno-pa-bg);
|
|
1507
1871
|
border-top: 1px solid var(--pluno-pa-divider);
|
|
1508
1872
|
}
|
|
1873
|
+
.pluno-pa-widget__attachment-error {
|
|
1874
|
+
margin: 0 0 8px;
|
|
1875
|
+
padding: 6px 9px;
|
|
1876
|
+
border-radius: 8px;
|
|
1877
|
+
background: rgba(239, 68, 68, 0.12);
|
|
1878
|
+
color: #dc2626;
|
|
1879
|
+
font-size: 12px;
|
|
1880
|
+
line-height: 1.35;
|
|
1881
|
+
}
|
|
1882
|
+
.pluno-pa-widget__attachment-error[hidden] {
|
|
1883
|
+
display: none;
|
|
1884
|
+
}
|
|
1885
|
+
.pluno-pa-widget__attachments {
|
|
1886
|
+
display: flex;
|
|
1887
|
+
flex-wrap: wrap;
|
|
1888
|
+
gap: 6px;
|
|
1889
|
+
margin: 0 0 8px;
|
|
1890
|
+
}
|
|
1891
|
+
.pluno-pa-widget__attachments[hidden] {
|
|
1892
|
+
display: none;
|
|
1893
|
+
}
|
|
1894
|
+
.pluno-pa-widget__attachment {
|
|
1895
|
+
min-width: 0;
|
|
1896
|
+
max-width: 100%;
|
|
1897
|
+
height: 30px;
|
|
1898
|
+
display: inline-flex;
|
|
1899
|
+
align-items: center;
|
|
1900
|
+
gap: 7px;
|
|
1901
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
1902
|
+
border-radius: 8px;
|
|
1903
|
+
background: var(--pluno-pa-surface);
|
|
1904
|
+
color: var(--pluno-pa-muted);
|
|
1905
|
+
padding: 3px 5px 3px 3px;
|
|
1906
|
+
font-size: 12px;
|
|
1907
|
+
}
|
|
1908
|
+
.pluno-pa-widget__attachment img {
|
|
1909
|
+
width: 22px;
|
|
1910
|
+
height: 22px;
|
|
1911
|
+
border-radius: 5px;
|
|
1912
|
+
object-fit: cover;
|
|
1913
|
+
flex: 0 0 auto;
|
|
1914
|
+
}
|
|
1915
|
+
.pluno-pa-widget__attachment-file {
|
|
1916
|
+
width: 28px;
|
|
1917
|
+
height: 22px;
|
|
1918
|
+
flex: 0 0 auto;
|
|
1919
|
+
display: inline-grid;
|
|
1920
|
+
place-items: center;
|
|
1921
|
+
border-radius: 5px;
|
|
1922
|
+
background: var(--pluno-pa-accent-soft);
|
|
1923
|
+
color: var(--pluno-pa-accent);
|
|
1924
|
+
font-size: 9px;
|
|
1925
|
+
font-weight: 700;
|
|
1926
|
+
line-height: 1;
|
|
1927
|
+
}
|
|
1928
|
+
.pluno-pa-widget__attachment span {
|
|
1929
|
+
overflow: hidden;
|
|
1930
|
+
text-overflow: ellipsis;
|
|
1931
|
+
white-space: nowrap;
|
|
1932
|
+
}
|
|
1933
|
+
.pluno-pa-widget__attachment button {
|
|
1934
|
+
border: 0;
|
|
1935
|
+
background: transparent;
|
|
1936
|
+
color: inherit;
|
|
1937
|
+
padding: 0;
|
|
1938
|
+
cursor: pointer;
|
|
1939
|
+
}
|
|
1940
|
+
.pluno-pa-widget__attachment button {
|
|
1941
|
+
width: 18px;
|
|
1942
|
+
height: 18px;
|
|
1943
|
+
display: inline-flex;
|
|
1944
|
+
align-items: center;
|
|
1945
|
+
justify-content: center;
|
|
1946
|
+
border-radius: 999px;
|
|
1947
|
+
flex: 0 0 auto;
|
|
1948
|
+
}
|
|
1949
|
+
.pluno-pa-widget__attachment button:hover:not(:disabled) {
|
|
1950
|
+
background: var(--pluno-pa-bubble);
|
|
1951
|
+
}
|
|
1509
1952
|
.pluno-pa-widget__composer-inner {
|
|
1510
1953
|
position: relative;
|
|
1511
1954
|
display: flex;
|
|
@@ -1515,11 +1958,16 @@ function Ne(t, e) {
|
|
|
1515
1958
|
border: 1px solid var(--pluno-pa-divider);
|
|
1516
1959
|
border-radius: 14px;
|
|
1517
1960
|
padding: 8px 44px 8px 12px;
|
|
1518
|
-
transition: border-color 150ms ease;
|
|
1961
|
+
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
|
|
1519
1962
|
}
|
|
1520
1963
|
.pluno-pa-widget__composer-inner:focus-within {
|
|
1521
1964
|
border-color: var(--pluno-pa-accent);
|
|
1522
1965
|
}
|
|
1966
|
+
.pluno-pa-widget--drag-over .pluno-pa-widget__composer-inner {
|
|
1967
|
+
border-color: var(--pluno-pa-accent);
|
|
1968
|
+
background: var(--pluno-pa-accent-soft);
|
|
1969
|
+
box-shadow: 0 0 0 3px var(--pluno-pa-accent-soft);
|
|
1970
|
+
}
|
|
1523
1971
|
.pluno-pa-widget__input {
|
|
1524
1972
|
flex: 1;
|
|
1525
1973
|
width: 100%;
|
|
@@ -1660,6 +2108,20 @@ function Ne(t, e) {
|
|
|
1660
2108
|
color: var(--pluno-pa-text);
|
|
1661
2109
|
background: transparent;
|
|
1662
2110
|
}
|
|
2111
|
+
.pluno-pa-widget__login {
|
|
2112
|
+
border: 0;
|
|
2113
|
+
border-radius: 8px;
|
|
2114
|
+
background: #09090b;
|
|
2115
|
+
color: #ffffff;
|
|
2116
|
+
min-height: 38px;
|
|
2117
|
+
padding: 0 14px;
|
|
2118
|
+
font: 650 13px/1 var(--pluno-pa-font);
|
|
2119
|
+
cursor: pointer;
|
|
2120
|
+
box-shadow: 0 8px 18px rgba(9, 9, 11, 0.16);
|
|
2121
|
+
}
|
|
2122
|
+
.pluno-pa-widget__login:hover {
|
|
2123
|
+
background: #18181b;
|
|
2124
|
+
}
|
|
1663
2125
|
.pluno-pa-widget__status {
|
|
1664
2126
|
display: inline-flex;
|
|
1665
2127
|
align-items: center;
|
|
@@ -1757,7 +2219,7 @@ function Ne(t, e) {
|
|
|
1757
2219
|
right: 16px;
|
|
1758
2220
|
height: 36px;
|
|
1759
2221
|
z-index: 3;
|
|
1760
|
-
background-image: url('${
|
|
2222
|
+
background-image: url('${ke}');
|
|
1761
2223
|
background-repeat: repeat-x;
|
|
1762
2224
|
background-size: 104px 36px;
|
|
1763
2225
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -1961,7 +2423,7 @@ function Ne(t, e) {
|
|
|
1961
2423
|
right: 12px;
|
|
1962
2424
|
height: 22px;
|
|
1963
2425
|
z-index: 1;
|
|
1964
|
-
background-image: url('${
|
|
2426
|
+
background-image: url('${ke}');
|
|
1965
2427
|
background-repeat: repeat-x;
|
|
1966
2428
|
background-size: 62px 21.5px;
|
|
1967
2429
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -1975,7 +2437,7 @@ function Ne(t, e) {
|
|
|
1975
2437
|
}
|
|
1976
2438
|
`, t.appendChild(n);
|
|
1977
2439
|
}
|
|
1978
|
-
async function
|
|
2440
|
+
async function kn() {
|
|
1979
2441
|
return document.body ? document.body : await new Promise((t) => {
|
|
1980
2442
|
const e = new MutationObserver(() => {
|
|
1981
2443
|
document.body && (e.disconnect(), t(document.body));
|
|
@@ -1983,16 +2445,12 @@ async function Nt() {
|
|
|
1983
2445
|
e.observe(document.documentElement, { childList: !0 });
|
|
1984
2446
|
});
|
|
1985
2447
|
}
|
|
1986
|
-
function
|
|
1987
|
-
const e = document.createElement("span");
|
|
1988
|
-
return e.textContent = t, e.innerHTML;
|
|
1989
|
-
}
|
|
1990
|
-
function Ge(t) {
|
|
2448
|
+
function nt(t) {
|
|
1991
2449
|
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
1992
2450
|
}
|
|
1993
|
-
function
|
|
2451
|
+
function Sn(t) {
|
|
1994
2452
|
try {
|
|
1995
|
-
const e = window.localStorage.getItem(
|
|
2453
|
+
const e = window.localStorage.getItem(nt(t));
|
|
1996
2454
|
if (!e)
|
|
1997
2455
|
return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
|
|
1998
2456
|
const n = JSON.parse(e);
|
|
@@ -2000,49 +2458,49 @@ function It(t) {
|
|
|
2000
2458
|
isOpen: n.isOpen === !0,
|
|
2001
2459
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
2002
2460
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
2003
|
-
launcherPosition:
|
|
2461
|
+
launcherPosition: Pn(n.launcherPosition) ? n.launcherPosition : null
|
|
2004
2462
|
};
|
|
2005
2463
|
} catch {
|
|
2006
2464
|
return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
|
|
2007
2465
|
}
|
|
2008
2466
|
}
|
|
2009
|
-
function
|
|
2467
|
+
function Ln(t, e) {
|
|
2010
2468
|
try {
|
|
2011
|
-
window.localStorage.setItem(
|
|
2469
|
+
window.localStorage.setItem(nt(t), JSON.stringify(e));
|
|
2012
2470
|
} catch {
|
|
2013
2471
|
return;
|
|
2014
2472
|
}
|
|
2015
2473
|
}
|
|
2016
|
-
function
|
|
2474
|
+
function Pn(t) {
|
|
2017
2475
|
if (!t || typeof t != "object")
|
|
2018
2476
|
return !1;
|
|
2019
2477
|
const e = t;
|
|
2020
2478
|
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
2021
2479
|
}
|
|
2022
|
-
const
|
|
2023
|
-
function
|
|
2480
|
+
const Ue = /* @__PURE__ */ new WeakSet();
|
|
2481
|
+
function An(t) {
|
|
2024
2482
|
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
2025
2483
|
}
|
|
2026
|
-
function
|
|
2484
|
+
function He(t) {
|
|
2027
2485
|
const e = t.pathname.split("/");
|
|
2028
2486
|
return e[e.length - 1] ?? "";
|
|
2029
2487
|
}
|
|
2030
|
-
function
|
|
2488
|
+
function Tn(t, e) {
|
|
2031
2489
|
const n = new URL(t.src, document.baseURI);
|
|
2032
|
-
return n.href === e.href || n.pathname === e.pathname ? !0 :
|
|
2490
|
+
return n.href === e.href || n.pathname === e.pathname ? !0 : He(n) === He(e);
|
|
2033
2491
|
}
|
|
2034
|
-
class
|
|
2492
|
+
class I extends EventTarget {
|
|
2035
2493
|
constructor(e, n) {
|
|
2036
|
-
super(), this.channelId = n, this.url = e, this.addPreviewListener(
|
|
2037
|
-
this.readyState =
|
|
2038
|
-
}), this.addPreviewListener(
|
|
2494
|
+
super(), this.channelId = n, this.url = e, this.addPreviewListener(Et, () => {
|
|
2495
|
+
this.readyState = I.OPEN, this.dispatchEvent(new Event("open"));
|
|
2496
|
+
}), this.addPreviewListener(kt, (o) => {
|
|
2039
2497
|
const a = o;
|
|
2040
2498
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
2041
|
-
}), this.addPreviewListener(
|
|
2042
|
-
this.readyState =
|
|
2043
|
-
}), this.addPreviewListener(
|
|
2499
|
+
}), this.addPreviewListener(St, () => {
|
|
2500
|
+
this.readyState = I.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
2501
|
+
}), this.addPreviewListener(Lt, (o) => {
|
|
2044
2502
|
const a = o;
|
|
2045
|
-
this.readyState =
|
|
2503
|
+
this.readyState = I.CLOSED, this.dispatchEvent(
|
|
2046
2504
|
new CloseEvent("close", {
|
|
2047
2505
|
code: a.detail?.code ?? 1e3,
|
|
2048
2506
|
reason: a.detail?.reason ?? "",
|
|
@@ -2050,7 +2508,7 @@ class L extends EventTarget {
|
|
|
2050
2508
|
})
|
|
2051
2509
|
), this.cleanup();
|
|
2052
2510
|
}), window.dispatchEvent(
|
|
2053
|
-
new CustomEvent(
|
|
2511
|
+
new CustomEvent(Q(yt, this.channelId), {
|
|
2054
2512
|
detail: { socketId: this.socketId, url: e }
|
|
2055
2513
|
})
|
|
2056
2514
|
);
|
|
@@ -2065,28 +2523,28 @@ class L extends EventTarget {
|
|
|
2065
2523
|
extensions = "";
|
|
2066
2524
|
binaryType = "blob";
|
|
2067
2525
|
bufferedAmount = 0;
|
|
2068
|
-
readyState =
|
|
2069
|
-
socketId =
|
|
2526
|
+
readyState = I.CONNECTING;
|
|
2527
|
+
socketId = Nn();
|
|
2070
2528
|
listeners = /* @__PURE__ */ new Map();
|
|
2071
2529
|
send(e) {
|
|
2072
|
-
if (this.readyState !==
|
|
2073
|
-
throw new DOMException("
|
|
2530
|
+
if (this.readyState !== I.OPEN)
|
|
2531
|
+
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
2074
2532
|
window.dispatchEvent(
|
|
2075
|
-
new CustomEvent(
|
|
2533
|
+
new CustomEvent(Q(vt, this.channelId), {
|
|
2076
2534
|
detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
|
|
2077
2535
|
})
|
|
2078
2536
|
);
|
|
2079
2537
|
}
|
|
2080
2538
|
close(e, n) {
|
|
2081
|
-
this.readyState !==
|
|
2082
|
-
new CustomEvent(
|
|
2539
|
+
this.readyState !== I.CLOSED && (this.readyState = I.CLOSING, window.dispatchEvent(
|
|
2540
|
+
new CustomEvent(Q(Ct, this.channelId), {
|
|
2083
2541
|
detail: { socketId: this.socketId, code: e, reason: n }
|
|
2084
2542
|
})
|
|
2085
2543
|
), this.cleanup());
|
|
2086
2544
|
}
|
|
2087
2545
|
addPreviewListener(e, n) {
|
|
2088
|
-
const o =
|
|
2089
|
-
|
|
2546
|
+
const o = Q(e, this.channelId), a = (r) => {
|
|
2547
|
+
r.detail?.socketId === this.socketId && n(r);
|
|
2090
2548
|
};
|
|
2091
2549
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
2092
2550
|
}
|
|
@@ -2096,36 +2554,36 @@ class L extends EventTarget {
|
|
|
2096
2554
|
this.listeners.clear();
|
|
2097
2555
|
}
|
|
2098
2556
|
}
|
|
2099
|
-
function
|
|
2100
|
-
const t = window.sessionStorage.getItem(
|
|
2557
|
+
function Nn() {
|
|
2558
|
+
const t = window.sessionStorage.getItem(Ee);
|
|
2101
2559
|
if (t)
|
|
2102
2560
|
return t;
|
|
2103
2561
|
const e = crypto.randomUUID();
|
|
2104
|
-
return window.sessionStorage.setItem(
|
|
2562
|
+
return window.sessionStorage.setItem(Ee, e), e;
|
|
2105
2563
|
}
|
|
2106
|
-
function
|
|
2564
|
+
function Q(t, e) {
|
|
2107
2565
|
return `${t}:${e}`;
|
|
2108
2566
|
}
|
|
2109
|
-
function
|
|
2567
|
+
function In(t) {
|
|
2110
2568
|
const e = document.currentScript;
|
|
2111
2569
|
if (e instanceof HTMLScriptElement)
|
|
2112
2570
|
return [e];
|
|
2113
2571
|
const n = new URL(t, document.baseURI).href, o = new URL(n);
|
|
2114
2572
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
2115
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
2573
|
+
(a) => a instanceof HTMLScriptElement && An(a) && Tn(a, o)
|
|
2116
2574
|
);
|
|
2117
2575
|
}
|
|
2118
|
-
function
|
|
2119
|
-
for (const e of
|
|
2120
|
-
if (
|
|
2576
|
+
function Rn(t) {
|
|
2577
|
+
for (const e of In(t)) {
|
|
2578
|
+
if (Ue.has(e) || e.dataset.plunoAutoMount === "false")
|
|
2121
2579
|
continue;
|
|
2122
|
-
|
|
2580
|
+
Ue.add(e);
|
|
2123
2581
|
const n = e.dataset.plunoPreviewChannel;
|
|
2124
|
-
|
|
2582
|
+
Ut({
|
|
2125
2583
|
token: e.dataset.plunoToken,
|
|
2126
2584
|
tokenEndpoint: e.dataset.plunoTokenEndpoint,
|
|
2127
2585
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
2128
|
-
webSocketFactory: n ?
|
|
2586
|
+
webSocketFactory: n ? Wt(n) : void 0,
|
|
2129
2587
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
2130
2588
|
accentColor: e.dataset.plunoAccentColor,
|
|
2131
2589
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -2133,12 +2591,12 @@ function Gt(t) {
|
|
|
2133
2591
|
scribbleStyle: e.dataset.plunoScribbleStyle === "true",
|
|
2134
2592
|
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
2135
2593
|
}).catch((o) => {
|
|
2136
|
-
console.error("Failed to mount Pluno
|
|
2594
|
+
console.error("Failed to mount Pluno widget", o);
|
|
2137
2595
|
});
|
|
2138
2596
|
}
|
|
2139
2597
|
}
|
|
2140
|
-
|
|
2598
|
+
Rn(import.meta.url);
|
|
2141
2599
|
export {
|
|
2142
|
-
|
|
2143
|
-
|
|
2600
|
+
Wt as createProductAgentPreviewBridgeWebSocketFactory,
|
|
2601
|
+
Ut as mountPlunoProductAgentWidget
|
|
2144
2602
|
};
|