@pluno/product-agent-web 0.1.40 → 0.1.41
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/boltIcon.d.ts +16 -0
- package/dist/product-agent-widget.js +984 -862
- package/package.json +1 -1
|
@@ -1,123 +1,17 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
|
|
6
|
-
<defs>
|
|
7
|
-
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
8
|
-
<stop offset="0" stop-color="${t.top}"/>
|
|
9
|
-
<stop offset="0.36" stop-color="${t.middle}"/>
|
|
10
|
-
<stop offset="0.72" stop-color="${t.bottom}"/>
|
|
11
|
-
<stop offset="1" stop-color="${t.bottom}"/>
|
|
12
|
-
</linearGradient>
|
|
13
|
-
<linearGradient id="boltEdge" x1="470" y1="145" x2="900" y2="980" gradientUnits="userSpaceOnUse">
|
|
14
|
-
<stop offset="0" stop-color="${t.edgeStart}"/>
|
|
15
|
-
<stop offset="0.32" stop-color="${t.edgeMiddle}"/>
|
|
16
|
-
<stop offset="0.78" stop-color="${t.edgeEnd}"/>
|
|
17
|
-
<stop offset="1" stop-color="${t.edgeEnd}"/>
|
|
18
|
-
</linearGradient>
|
|
19
|
-
<radialGradient id="boltGlow" cx="50%" cy="22%" r="82%">
|
|
20
|
-
<stop offset="0" stop-color="${t.glow}" stop-opacity="0.72"/>
|
|
21
|
-
<stop offset="0.5" stop-color="${t.middle}" stop-opacity="0.44"/>
|
|
22
|
-
<stop offset="1" stop-color="${t.bottom}" stop-opacity="0"/>
|
|
23
|
-
</radialGradient>
|
|
24
|
-
<radialGradient id="eyeWhite" cx="35%" cy="25%" r="70%">
|
|
25
|
-
<stop offset="0" stop-color="#ffffff"/>
|
|
26
|
-
<stop offset="0.72" stop-color="#ffffff"/>
|
|
27
|
-
<stop offset="1" stop-color="#e5e5e5"/>
|
|
28
|
-
</radialGradient>
|
|
29
|
-
<radialGradient id="pupil" cx="42%" cy="38%" r="65%">
|
|
30
|
-
<stop offset="0" stop-color="#2a1f10"/>
|
|
31
|
-
<stop offset="0.52" stop-color="#080604"/>
|
|
32
|
-
<stop offset="1" stop-color="#000000"/>
|
|
33
|
-
</radialGradient>
|
|
34
|
-
<filter id="softDropShadow" x="-18%" y="-12%" width="136%" height="136%" color-interpolation-filters="sRGB">
|
|
35
|
-
<feDropShadow dx="0" dy="12" stdDeviation="18" flood-color="${t.shadow}" flood-opacity="0.24"/>
|
|
36
|
-
</filter>
|
|
37
|
-
<filter id="innerDepth" x="-8%" y="-8%" width="116%" height="116%" color-interpolation-filters="sRGB">
|
|
38
|
-
<feGaussianBlur in="SourceAlpha" stdDeviation="8" result="blur"/>
|
|
39
|
-
<feOffset dx="-7" dy="-9" result="topLeft"/>
|
|
40
|
-
<feComposite in="topLeft" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="innerShadow"/>
|
|
41
|
-
<feColorMatrix in="innerShadow" type="matrix" values="1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0" result="innerLight"/>
|
|
42
|
-
<feBlend in="SourceGraphic" in2="innerLight" mode="screen"/>
|
|
43
|
-
</filter>
|
|
44
|
-
<filter id="eyeShadow" x="-24%" y="-20%" width="148%" height="148%" color-interpolation-filters="sRGB">
|
|
45
|
-
<feDropShadow dx="0" dy="8" stdDeviation="5" flood-color="${t.shadow}" flood-opacity="0.3"/>
|
|
46
|
-
</filter>
|
|
47
|
-
<filter id="pupilGloss" x="-15%" y="-15%" width="130%" height="130%" color-interpolation-filters="sRGB">
|
|
48
|
-
<feDropShadow dx="0" dy="3" stdDeviation="3" flood-color="#000000" flood-opacity="0.22"/>
|
|
49
|
-
</filter>
|
|
50
|
-
<clipPath id="boltClip">
|
|
51
|
-
<path d="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"/>
|
|
52
|
-
</clipPath>
|
|
53
|
-
</defs>
|
|
54
|
-
<g filter="url(#softDropShadow)">
|
|
55
|
-
<path d="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" fill="url(#boltEdge)"/>
|
|
56
|
-
<path d="M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z" fill="url(#boltFill)" filter="url(#innerDepth)"/>
|
|
57
|
-
<path d="M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z" fill="url(#boltGlow)" opacity="0.74"/>
|
|
58
|
-
<g clip-path="url(#boltClip)" opacity="0.42">
|
|
59
|
-
<path d="M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626" fill="none" stroke="${t.highlight}" stroke-width="22" stroke-linecap="round" opacity="0.65"/>
|
|
60
|
-
<path d="M556 685 L501 994" fill="none" stroke="${t.highlight}" stroke-width="20" stroke-linecap="round" opacity="0.55"/>
|
|
61
|
-
<path d="M858 160 C882 166 893 181 883 204" fill="none" stroke="${t.inner}" stroke-width="18" stroke-linecap="round" opacity="0.48"/>
|
|
62
|
-
</g>
|
|
63
|
-
</g>
|
|
64
|
-
<g filter="url(#eyeShadow)">
|
|
65
|
-
<g transform="rotate(-2 528 463)">
|
|
66
|
-
<ellipse cx="528" cy="463" rx="73" ry="80" fill="url(#eyeWhite)"/>
|
|
67
|
-
<ellipse cx="533" cy="473" rx="49" ry="57" fill="url(#pupil)" filter="url(#pupilGloss)"/>
|
|
68
|
-
<circle cx="557" cy="447" r="18" fill="#ffffff"/>
|
|
69
|
-
</g>
|
|
70
|
-
<g transform="rotate(2 717 462)">
|
|
71
|
-
<ellipse cx="717" cy="462" rx="73" ry="80" fill="url(#eyeWhite)"/>
|
|
72
|
-
<ellipse cx="712" cy="473" rx="49" ry="57" fill="url(#pupil)" filter="url(#pupilGloss)"/>
|
|
73
|
-
<circle cx="728" cy="447" r="18" fill="#ffffff"/>
|
|
74
|
-
</g>
|
|
75
|
-
</g>
|
|
76
|
-
</svg>`;
|
|
77
|
-
}
|
|
78
|
-
const se = "#2c2a1e", st = [253, 250, 241], dt = 3.5;
|
|
79
|
-
function Bt(e) {
|
|
80
|
-
const t = Ot(e);
|
|
81
|
-
if (ct(fe(t), st) >= dt)
|
|
1
|
+
import { PlunoProductAgent as yn } from "./product-agent-sdk.js";
|
|
2
|
+
const Cn = "#7c3aed", Ae = "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", Pe = "#2c2a1e", gt = [253, 250, 241], ht = 3.5;
|
|
3
|
+
function Wt(e) {
|
|
4
|
+
const t = Ht(e);
|
|
5
|
+
if (mt(we(t), gt) >= ht)
|
|
82
6
|
return t;
|
|
83
|
-
let o =
|
|
84
|
-
const a =
|
|
7
|
+
let o = we(t);
|
|
8
|
+
const a = we(Pe);
|
|
85
9
|
for (let i = 0; i < 6; i += 1)
|
|
86
|
-
if (o =
|
|
87
|
-
return
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
function
|
|
91
|
-
const t = Bt(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
|
|
92
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
93
|
-
<defs>
|
|
94
|
-
<clipPath id="scribbleBoltClip">
|
|
95
|
-
<path d="${n}"/>
|
|
96
|
-
</clipPath>
|
|
97
|
-
<filter id="scribbleBoltWobble" x="-10%" y="-10%" width="120%" height="120%" color-interpolation-filters="sRGB">
|
|
98
|
-
<feTurbulence type="fractalNoise" baseFrequency="0.011" numOctaves="3" seed="7" result="noise"/>
|
|
99
|
-
<feDisplacementMap in="SourceGraphic" in2="noise" scale="16" xChannelSelector="R" yChannelSelector="G"/>
|
|
100
|
-
</filter>
|
|
101
|
-
</defs>
|
|
102
|
-
<g filter="url(#scribbleBoltWobble)">
|
|
103
|
-
<g clip-path="url(#scribbleBoltClip)">
|
|
104
|
-
<path d="${wn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
105
|
-
</g>
|
|
106
|
-
<path d="${n}" fill="none" stroke="${se}" stroke-width="18" stroke-linejoin="round"/>
|
|
107
|
-
<g transform="rotate(-2 528 463)">
|
|
108
|
-
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
|
|
109
|
-
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${se}"/>
|
|
110
|
-
<circle cx="557" cy="447" r="16" fill="#ffffff"/>
|
|
111
|
-
</g>
|
|
112
|
-
<g transform="rotate(2 717 462)">
|
|
113
|
-
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
|
|
114
|
-
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${se}"/>
|
|
115
|
-
<circle cx="728" cy="447" r="16" fill="#ffffff"/>
|
|
116
|
-
</g>
|
|
117
|
-
</g>
|
|
118
|
-
</svg>`;
|
|
119
|
-
}
|
|
120
|
-
function wn() {
|
|
10
|
+
if (o = kn(o, a, 0.22), mt(o, gt) >= ht)
|
|
11
|
+
return qe(o);
|
|
12
|
+
return qe(o);
|
|
13
|
+
}
|
|
14
|
+
function En() {
|
|
121
15
|
let n = "M 280 120", o = !1, a = 0;
|
|
122
16
|
for (let i = 150; i <= 1170; i += 62) {
|
|
123
17
|
const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
|
|
@@ -125,8 +19,8 @@ function wn() {
|
|
|
125
19
|
}
|
|
126
20
|
return n;
|
|
127
21
|
}
|
|
128
|
-
function
|
|
129
|
-
const t =
|
|
22
|
+
function Sn(e) {
|
|
23
|
+
const t = Ht(e), n = je(we(t));
|
|
130
24
|
return n > 0.86 ? {
|
|
131
25
|
top: "#ffffff",
|
|
132
26
|
middle: "#f6f6f6",
|
|
@@ -162,34 +56,34 @@ function _n(e) {
|
|
|
162
56
|
shadow: $(t, -0.25, -0.08)
|
|
163
57
|
};
|
|
164
58
|
}
|
|
165
|
-
function
|
|
59
|
+
function Ht(e) {
|
|
166
60
|
const t = e.trim();
|
|
167
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
61
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Cn;
|
|
168
62
|
}
|
|
169
|
-
function
|
|
63
|
+
function we(e) {
|
|
170
64
|
return [
|
|
171
65
|
Number.parseInt(e.slice(1, 3), 16),
|
|
172
66
|
Number.parseInt(e.slice(3, 5), 16),
|
|
173
67
|
Number.parseInt(e.slice(5, 7), 16)
|
|
174
68
|
];
|
|
175
69
|
}
|
|
176
|
-
function
|
|
70
|
+
function qe([e, t, n]) {
|
|
177
71
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
178
72
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
179
73
|
}
|
|
180
|
-
function
|
|
74
|
+
function je([e, t, n]) {
|
|
181
75
|
const o = (a) => {
|
|
182
76
|
const i = a / 255;
|
|
183
77
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
184
78
|
};
|
|
185
79
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
186
80
|
}
|
|
187
|
-
function
|
|
188
|
-
const n =
|
|
81
|
+
function mt(e, t) {
|
|
82
|
+
const n = je(e), o = je(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
189
83
|
return (a + 0.05) / (i + 0.05);
|
|
190
84
|
}
|
|
191
|
-
function
|
|
192
|
-
const o =
|
|
85
|
+
function kn(e, t, n) {
|
|
86
|
+
const o = Ve(n);
|
|
193
87
|
return [
|
|
194
88
|
e[0] + (t[0] - e[0]) * o,
|
|
195
89
|
e[1] + (t[1] - e[1]) * o,
|
|
@@ -197,43 +91,43 @@ function xn(e, t, n) {
|
|
|
197
91
|
];
|
|
198
92
|
}
|
|
199
93
|
function $(e, t, n) {
|
|
200
|
-
const [o, a, i] =
|
|
201
|
-
return
|
|
94
|
+
const [o, a, i] = Ln(we(e));
|
|
95
|
+
return qe(An(o, Ve(a + n), Ve(i + t)));
|
|
202
96
|
}
|
|
203
|
-
function
|
|
204
|
-
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i),
|
|
97
|
+
function Ln([e, t, n]) {
|
|
98
|
+
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), d = (l + s) / 2;
|
|
205
99
|
if (l === s)
|
|
206
|
-
return [0, 0,
|
|
207
|
-
const
|
|
208
|
-
return [(l === o ? (a - i) /
|
|
100
|
+
return [0, 0, d];
|
|
101
|
+
const c = l - s, p = d > 0.5 ? c / (2 - l - s) : c / (l + s);
|
|
102
|
+
return [(l === o ? (a - i) / c + (a < i ? 6 : 0) : l === a ? (i - o) / c + 2 : (o - a) / c + 4) / 6, p, d];
|
|
209
103
|
}
|
|
210
|
-
function
|
|
104
|
+
function An(e, t, n) {
|
|
211
105
|
if (t === 0)
|
|
212
106
|
return [n * 255, n * 255, n * 255];
|
|
213
107
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
214
108
|
return [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
109
|
+
ze(a, o, e + 1 / 3) * 255,
|
|
110
|
+
ze(a, o, e) * 255,
|
|
111
|
+
ze(a, o, e - 1 / 3) * 255
|
|
218
112
|
];
|
|
219
113
|
}
|
|
220
|
-
function
|
|
114
|
+
function ze(e, t, n) {
|
|
221
115
|
let o = n;
|
|
222
116
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
223
117
|
}
|
|
224
|
-
function
|
|
118
|
+
function Ve(e) {
|
|
225
119
|
return Math.max(0, Math.min(1, e));
|
|
226
120
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
121
|
+
const $t = "suggest_share_on_socials";
|
|
122
|
+
function Pn(e) {
|
|
229
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
230
124
|
const n = e[t];
|
|
231
|
-
if (n.role !== "tool" || n.toolName !==
|
|
125
|
+
if (n.role !== "tool" || n.toolName !== $t)
|
|
232
126
|
continue;
|
|
233
|
-
const o =
|
|
127
|
+
const o = bt(e, t, "assistant");
|
|
234
128
|
if (!o)
|
|
235
129
|
return null;
|
|
236
|
-
const a =
|
|
130
|
+
const a = bt(e, o.index, "user");
|
|
237
131
|
return a ? {
|
|
238
132
|
id: `share:${n.callId ?? n.id}`,
|
|
239
133
|
userPrompt: a.content,
|
|
@@ -242,13 +136,13 @@ function Cn(e) {
|
|
|
242
136
|
}
|
|
243
137
|
return null;
|
|
244
138
|
}
|
|
245
|
-
async function
|
|
246
|
-
const t = await
|
|
139
|
+
async function Tn(e) {
|
|
140
|
+
const t = await Nn(e);
|
|
247
141
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
248
142
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
249
143
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
250
144
|
}
|
|
251
|
-
function
|
|
145
|
+
function bt(e, t, n) {
|
|
252
146
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
253
147
|
const a = e[o];
|
|
254
148
|
if (a.role === n && a.content.trim())
|
|
@@ -256,73 +150,73 @@ function ut(e, t, n) {
|
|
|
256
150
|
}
|
|
257
151
|
return null;
|
|
258
152
|
}
|
|
259
|
-
async function
|
|
153
|
+
async function Nn(e) {
|
|
260
154
|
return await (await fetch(e)).blob();
|
|
261
155
|
}
|
|
262
|
-
const
|
|
263
|
-
function
|
|
156
|
+
const In = "https://app.pluno.ai", Dn = "/api/product-agent/embed/active-users", Rn = 1800, Mn = 15e3, Bn = 250, On = 1e3, Un = 3e4;
|
|
157
|
+
function Fn(e, t = {}) {
|
|
264
158
|
let n = !1, o = null, a = null, i = null;
|
|
265
159
|
const l = () => {
|
|
266
160
|
i !== null && (window.clearInterval(i), i = null);
|
|
267
161
|
}, s = (p) => {
|
|
268
162
|
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
},
|
|
163
|
+
c();
|
|
164
|
+
}, Wn(p)));
|
|
165
|
+
}, d = (p) => {
|
|
272
166
|
if (l(), o === null) {
|
|
273
167
|
o = p, e(p);
|
|
274
168
|
return;
|
|
275
169
|
}
|
|
276
|
-
const
|
|
170
|
+
const b = o, x = performance.now();
|
|
277
171
|
i = window.setInterval(() => {
|
|
278
172
|
if (n) {
|
|
279
173
|
l();
|
|
280
174
|
return;
|
|
281
175
|
}
|
|
282
|
-
const A = Math.min(1, (performance.now() - x) /
|
|
283
|
-
o = Math.round(
|
|
284
|
-
},
|
|
285
|
-
},
|
|
176
|
+
const A = Math.min(1, (performance.now() - x) / Rn);
|
|
177
|
+
o = Math.round(b + (p - b) * Hn(A)), e(o), A >= 1 && (o = p, e(p), l());
|
|
178
|
+
}, Bn);
|
|
179
|
+
}, c = async () => {
|
|
286
180
|
try {
|
|
287
|
-
const p = await
|
|
181
|
+
const p = await zn(t);
|
|
288
182
|
if (n)
|
|
289
183
|
return;
|
|
290
|
-
|
|
184
|
+
d(p.count), s(p.refreshAfterMs);
|
|
291
185
|
} catch {
|
|
292
|
-
s(
|
|
186
|
+
s(Mn);
|
|
293
187
|
}
|
|
294
188
|
};
|
|
295
|
-
return
|
|
189
|
+
return c(), () => {
|
|
296
190
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
297
191
|
};
|
|
298
192
|
}
|
|
299
|
-
async function
|
|
193
|
+
async function zn(e) {
|
|
300
194
|
if (e.loader)
|
|
301
195
|
return e.loader();
|
|
302
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
196
|
+
const n = await (e.fetcher ?? fetch)(new URL(Dn, Gn(e.backendUrl ?? In)).toString(), {
|
|
303
197
|
cache: "no-store",
|
|
304
198
|
credentials: "omit"
|
|
305
199
|
});
|
|
306
200
|
if (!n.ok)
|
|
307
201
|
throw new Error("Failed to load active users");
|
|
308
|
-
const o = await n.json(), a =
|
|
202
|
+
const o = await n.json(), a = ft(o.count), i = ft(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
309
203
|
if (a === null || i === null)
|
|
310
204
|
throw new Error("Invalid active users response");
|
|
311
205
|
return { count: a, refreshAfterMs: i };
|
|
312
206
|
}
|
|
313
|
-
function
|
|
207
|
+
function ft(e) {
|
|
314
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
315
209
|
}
|
|
316
|
-
function
|
|
210
|
+
function Gn(e) {
|
|
317
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
318
212
|
}
|
|
319
|
-
function
|
|
320
|
-
return Math.min(
|
|
213
|
+
function Wn(e) {
|
|
214
|
+
return Math.min(Un, Math.max(On, e));
|
|
321
215
|
}
|
|
322
|
-
function
|
|
216
|
+
function Hn(e) {
|
|
323
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
324
218
|
}
|
|
325
|
-
const
|
|
219
|
+
const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-agent:sdk-preview-socket-send", jn = "product-agent:sdk-preview-socket-close", Vn = "product-agent:sdk-preview-socket-open", Yn = "product-agent:sdk-preview-socket-message", Kn = "product-agent:sdk-preview-socket-error", Xn = "product-agent:sdk-preview-socket-closed", wt = "product-agent:sdk-preview-socket-id", Zn = "product-agent:preview-diagnostic", jt = "pluno.productAgent.sharePromptsDisabled", Te = 10, Jn = 10 * 1024 * 1024, Vt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Qn = Array.from(Vt).join(","), eo = 3, q = {
|
|
326
220
|
launcherLabel: "Ask for anything...",
|
|
327
221
|
accentColor: "#7c3aed",
|
|
328
222
|
colorScheme: "light",
|
|
@@ -330,7 +224,7 @@ const Ft = 100, Un = "product-agent:sdk-preview-socket-connect", Fn = "product-a
|
|
|
330
224
|
scribbleStyle: !1,
|
|
331
225
|
position: "bottom-right",
|
|
332
226
|
movableLauncher: !1
|
|
333
|
-
},
|
|
227
|
+
}, to = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', _t = "pluno-pa-scribble-font", Yt = 190, Kt = 41, no = 48, oo = 420, ao = 520, io = 0.24, ro = 680, lo = 800, po = 0.76, F = 8, Ye = 50, Xt = "http://www.w3.org/2000/svg", xt = [
|
|
334
228
|
{
|
|
335
229
|
ellipseCx: "17.5",
|
|
336
230
|
ellipseCy: "24.5",
|
|
@@ -367,20 +261,20 @@ const Ft = 100, Un = "product-agent:sdk-preview-socket-connect", Fn = "product-a
|
|
|
367
261
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
368
262
|
pathStrokeWidth: "2.45"
|
|
369
263
|
}
|
|
370
|
-
],
|
|
371
|
-
let
|
|
372
|
-
function
|
|
373
|
-
return (t) => new
|
|
264
|
+
], so = 11, co = 13, vt = 4, uo = 10, go = 40, ho = "movable-launcher-position-v2", Zt = "pluno-pa-widget-styles", Jt = "data-pluno-pa-widget-styles";
|
|
265
|
+
let yt = 0;
|
|
266
|
+
function mo(e) {
|
|
267
|
+
return (t) => new Z(t, e);
|
|
374
268
|
}
|
|
375
|
-
async function
|
|
269
|
+
async function bo(e = {}) {
|
|
376
270
|
const t = {
|
|
377
|
-
launcherLabel: e.launcherLabel ??
|
|
378
|
-
accentColor: e.accentColor ??
|
|
379
|
-
colorScheme: e.colorScheme ??
|
|
380
|
-
fontFamily: e.fontFamily ??
|
|
381
|
-
scribbleStyle: e.scribbleStyle ??
|
|
382
|
-
position: e.position ??
|
|
383
|
-
movableLauncher: e.movableLauncher ??
|
|
271
|
+
launcherLabel: e.launcherLabel ?? q.launcherLabel,
|
|
272
|
+
accentColor: e.accentColor ?? q.accentColor,
|
|
273
|
+
colorScheme: e.colorScheme ?? q.colorScheme,
|
|
274
|
+
fontFamily: e.fontFamily ?? q.fontFamily,
|
|
275
|
+
scribbleStyle: e.scribbleStyle ?? q.scribbleStyle,
|
|
276
|
+
position: e.position ?? q.position,
|
|
277
|
+
movableLauncher: e.movableLauncher ?? q.movableLauncher,
|
|
384
278
|
token: e.token,
|
|
385
279
|
tokenProvider: e.tokenProvider,
|
|
386
280
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -407,7 +301,7 @@ async function co(e = {}) {
|
|
|
407
301
|
loadSharePromptsDisabled: e.loadSharePromptsDisabled,
|
|
408
302
|
persistSharePromptsDisabled: e.persistSharePromptsDisabled
|
|
409
303
|
};
|
|
410
|
-
|
|
304
|
+
X("web-sdk.widget", "Mounting widget with merged options", {
|
|
411
305
|
accentColor: t.accentColor,
|
|
412
306
|
colorScheme: t.colorScheme,
|
|
413
307
|
fontFamily: t.fontFamily,
|
|
@@ -422,32 +316,32 @@ async function co(e = {}) {
|
|
|
422
316
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
423
317
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
424
318
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
425
|
-
let i =
|
|
426
|
-
|
|
427
|
-
const l = await
|
|
428
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
319
|
+
let i = Ct(t.accentColor, t.scribbleStyle);
|
|
320
|
+
Do(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
321
|
+
const l = await Sa(), s = l.ownerDocument;
|
|
322
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Ut(o, t.accentColor), Et(a, i, {
|
|
429
323
|
accentColor: t.accentColor,
|
|
430
324
|
colorScheme: t.colorScheme,
|
|
431
325
|
fontFamily: t.fontFamily,
|
|
432
326
|
scribbleStyle: t.scribbleStyle
|
|
433
|
-
}),
|
|
327
|
+
}), X("web-sdk.widget", "Applied initial widget appearance", {
|
|
434
328
|
accentColor: t.accentColor,
|
|
435
329
|
colorScheme: t.colorScheme,
|
|
436
330
|
fontFamily: t.fontFamily,
|
|
437
331
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
438
332
|
});
|
|
439
|
-
const
|
|
440
|
-
if (!
|
|
333
|
+
const d = a.querySelector(".pluno-pa-widget__launcher"), c = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), A = a.querySelector(".pluno-pa-widget__composer"), E = a.querySelector(".pluno-pa-widget__attachment-error"), R = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), C = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), ne = a.querySelector(".pluno-pa-widget__timeline-jump"), ge = a.querySelector(".pluno-pa-widget__active-users-counter"), L = a.querySelector(".pluno-pa-widget__timeline"), w = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
334
|
+
if (!d || !p || !b || !x || !A || !E || !R || !v || !y || !h || !g || !C || !N || !ne || !ge || !L || !w)
|
|
441
335
|
throw new Error("Failed to mount Pluno widget");
|
|
442
|
-
if (t.movableLauncher && !
|
|
336
|
+
if (t.movableLauncher && !c)
|
|
443
337
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
444
|
-
|
|
445
|
-
let f = [],
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
f = f.filter((
|
|
338
|
+
Pt(p), Pt(g);
|
|
339
|
+
let f = [], I = null;
|
|
340
|
+
const P = () => {
|
|
341
|
+
Ko(v, f, (r) => {
|
|
342
|
+
f = f.filter((u, k) => k !== r), P(), O(_.getState()), G();
|
|
449
343
|
});
|
|
450
|
-
},
|
|
344
|
+
}, M = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
451
345
|
if (!t.tokenEndpoint)
|
|
452
346
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
453
347
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -458,19 +352,19 @@ async function co(e = {}) {
|
|
|
458
352
|
});
|
|
459
353
|
if (!r.ok)
|
|
460
354
|
throw new Error("Failed to load Pluno token");
|
|
461
|
-
const
|
|
462
|
-
if (!
|
|
355
|
+
const u = await r.json();
|
|
356
|
+
if (!u.token)
|
|
463
357
|
throw new Error("Pluno token endpoint did not return a token");
|
|
464
|
-
return
|
|
465
|
-
}),
|
|
466
|
-
let
|
|
467
|
-
|
|
358
|
+
return u.token;
|
|
359
|
+
}), T = window.fetch.bind(window);
|
|
360
|
+
let _;
|
|
361
|
+
_ = await yn.init({
|
|
468
362
|
token: t.token,
|
|
469
|
-
tokenProvider:
|
|
363
|
+
tokenProvider: M,
|
|
470
364
|
backendUrl: t.backendUrl,
|
|
471
365
|
metadata: () => ({
|
|
472
366
|
...t.metadata ?? {},
|
|
473
|
-
...!
|
|
367
|
+
...!_.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
474
368
|
}),
|
|
475
369
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
476
370
|
clientId: t.clientId,
|
|
@@ -479,42 +373,42 @@ async function co(e = {}) {
|
|
|
479
373
|
webSocketFactory: t.webSocketFactory,
|
|
480
374
|
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
|
|
481
375
|
});
|
|
482
|
-
const
|
|
483
|
-
let
|
|
376
|
+
const oe = ka(t), Ne = new Set(oe.openToolGroupKeys), se = new Set(oe.seenShareCandidateIds), _e = new Set(se);
|
|
377
|
+
let Ie = oe.sharePromptsDisabled || await La(t), V = t.movableLauncher ? oe.launcherPosition : null, et = V !== null, Q = null, De = !1, ae = !1, ie = {
|
|
484
378
|
enabled: !0
|
|
485
|
-
},
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
},
|
|
489
|
-
|
|
490
|
-
},
|
|
491
|
-
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
const
|
|
499
|
-
const
|
|
500
|
-
return
|
|
379
|
+
}, re = 0, tt = "";
|
|
380
|
+
const Y = (r, u) => {
|
|
381
|
+
ie = { enabled: r, reason: u };
|
|
382
|
+
}, K = () => {
|
|
383
|
+
ne.hidden = !0;
|
|
384
|
+
}, hn = () => {
|
|
385
|
+
ne.hidden = !1;
|
|
386
|
+
}, mn = (r = "jump") => {
|
|
387
|
+
Y(!0, r), K(), fe(L, () => ie.enabled), re = L.scrollTop;
|
|
388
|
+
}, bn = () => {
|
|
389
|
+
De || typeof document > "u" || (Ut(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
|
|
390
|
+
}, nt = new MutationObserver(bn);
|
|
391
|
+
nt.observe(s.documentElement, { childList: !0, subtree: !0 });
|
|
392
|
+
const Re = (r = !0) => {
|
|
393
|
+
const u = Ke(a, r);
|
|
394
|
+
return St(
|
|
501
395
|
a,
|
|
502
|
-
|
|
503
|
-
|
|
396
|
+
V ? Co(V, u) : yo(a, t.position, u),
|
|
397
|
+
u
|
|
504
398
|
);
|
|
505
|
-
},
|
|
506
|
-
|
|
399
|
+
}, z = () => {
|
|
400
|
+
Pa(t, {
|
|
507
401
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
508
402
|
composerValue: g.value,
|
|
509
|
-
openToolGroupKeys: [...
|
|
510
|
-
launcherPosition:
|
|
511
|
-
seenShareCandidateIds: [...
|
|
512
|
-
sharePromptsDisabled:
|
|
403
|
+
openToolGroupKeys: [...Ne],
|
|
404
|
+
launcherPosition: et ? V : null,
|
|
405
|
+
seenShareCandidateIds: [...se].slice(-qt),
|
|
406
|
+
sharePromptsDisabled: Ie
|
|
513
407
|
});
|
|
514
|
-
},
|
|
515
|
-
|
|
516
|
-
debugVersion:
|
|
517
|
-
launcherPosition:
|
|
408
|
+
}, le = (r, u = {}) => {
|
|
409
|
+
To(r, {
|
|
410
|
+
debugVersion: ho,
|
|
411
|
+
launcherPosition: V,
|
|
518
412
|
rootClasses: a.className,
|
|
519
413
|
rootStyle: {
|
|
520
414
|
left: a.style.left,
|
|
@@ -522,110 +416,110 @@ async function co(e = {}) {
|
|
|
522
416
|
right: a.style.right,
|
|
523
417
|
bottom: a.style.bottom
|
|
524
418
|
},
|
|
525
|
-
rootRect:
|
|
526
|
-
launcherRect:
|
|
527
|
-
panelRect:
|
|
528
|
-
viewport:
|
|
529
|
-
panelHidden:
|
|
419
|
+
rootRect: Ge(a),
|
|
420
|
+
launcherRect: Ge(d),
|
|
421
|
+
panelRect: Ge(b),
|
|
422
|
+
viewport: J(),
|
|
423
|
+
panelHidden: b.hidden,
|
|
530
424
|
closeHidden: x.hidden,
|
|
531
|
-
...
|
|
425
|
+
...u
|
|
532
426
|
});
|
|
533
|
-
},
|
|
534
|
-
if (!
|
|
535
|
-
return
|
|
536
|
-
const
|
|
537
|
-
return
|
|
538
|
-
},
|
|
539
|
-
if (!r || !
|
|
540
|
-
|
|
427
|
+
}, xe = (r = !0) => {
|
|
428
|
+
if (!V)
|
|
429
|
+
return Ee(a, null), Re(r);
|
|
430
|
+
const u = Re(r);
|
|
431
|
+
return Ee(a, u), le("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
|
|
432
|
+
}, ot = (r, u) => {
|
|
433
|
+
if (!r || !u) {
|
|
434
|
+
Po(a);
|
|
541
435
|
return;
|
|
542
436
|
}
|
|
543
|
-
|
|
544
|
-
x: r.x -
|
|
545
|
-
y: r.y -
|
|
437
|
+
Ao(a, {
|
|
438
|
+
x: r.x - u.x,
|
|
439
|
+
y: r.y - u.y
|
|
546
440
|
});
|
|
547
|
-
},
|
|
548
|
-
const r =
|
|
441
|
+
}, at = () => {
|
|
442
|
+
const r = xe();
|
|
549
443
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
} else
|
|
444
|
+
const u = kt(a, r, t.position);
|
|
445
|
+
ot(u, r), le("Applied open panel position after viewport resize", { openPanelPosition: u });
|
|
446
|
+
} else V && le("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
553
447
|
};
|
|
554
|
-
let
|
|
448
|
+
let it = () => {
|
|
555
449
|
};
|
|
556
|
-
window.addEventListener("resize",
|
|
450
|
+
window.addEventListener("resize", at), t.movableLauncher && c ? (xe(), it = vo({
|
|
557
451
|
root: a,
|
|
558
|
-
launcher:
|
|
559
|
-
launcherDragHandle:
|
|
560
|
-
getPosition: () =>
|
|
452
|
+
launcher: d,
|
|
453
|
+
launcherDragHandle: c,
|
|
454
|
+
getPosition: () => Re(),
|
|
561
455
|
setPosition: (r) => {
|
|
562
|
-
const
|
|
563
|
-
|
|
456
|
+
const u = r, k = Ke(a), H = St(a, r, k);
|
|
457
|
+
V = Eo(H, k), Ee(a, H), le("Dragging closed launcher", { requestedPosition: u });
|
|
564
458
|
},
|
|
565
459
|
persist: () => {
|
|
566
|
-
|
|
460
|
+
et = !0, z(), le("Persisted closed launcher drag position");
|
|
567
461
|
}
|
|
568
|
-
})) :
|
|
569
|
-
let
|
|
570
|
-
const
|
|
571
|
-
if (!(!t.billingStatusLoader ||
|
|
572
|
-
|
|
462
|
+
})) : Ee(a, null);
|
|
463
|
+
let Me = !1;
|
|
464
|
+
const rt = async () => {
|
|
465
|
+
if (!(!t.billingStatusLoader || Me)) {
|
|
466
|
+
Me = !0;
|
|
573
467
|
try {
|
|
574
468
|
const r = await t.billingStatusLoader();
|
|
575
|
-
|
|
469
|
+
Nt(t.billingStatus, r, _.getState().lastErrorCode) && (t.billingStatus = r, $e(R, t.billingStatus, _.getState().lastErrorCode), G());
|
|
576
470
|
} finally {
|
|
577
|
-
|
|
471
|
+
Me = !1;
|
|
578
472
|
}
|
|
579
473
|
}
|
|
580
|
-
},
|
|
581
|
-
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
584
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
474
|
+
}, pe = (r = "", u = !0) => {
|
|
475
|
+
rt(), Q !== null && (window.clearTimeout(Q), Q = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
476
|
+
const k = xe(), H = kt(a, k, t.position);
|
|
477
|
+
if (ot(H, k), le("Opening launcher at clamped open panel position", { openPanelPosition: H, visibleLauncherPosition: k }), Y(!0, "open"), K(), !u) {
|
|
478
|
+
a.classList.add("pluno-pa-widget--open"), d.hidden = !0, r && (g.value = r, be(g)), fe(L, () => ie.enabled), re = L.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), z();
|
|
585
479
|
return;
|
|
586
480
|
}
|
|
587
481
|
window.requestAnimationFrame(() => {
|
|
588
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r,
|
|
589
|
-
|
|
482
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, be(g)), fe(L, () => ie.enabled), re = L.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), z(), Q = window.setTimeout(() => {
|
|
483
|
+
d.hidden = !0, fe(L, () => ie.enabled), re = L.scrollTop;
|
|
590
484
|
}, 220);
|
|
591
485
|
});
|
|
592
|
-
},
|
|
593
|
-
|
|
594
|
-
|
|
486
|
+
}, fn = () => {
|
|
487
|
+
Q !== null && (window.clearTimeout(Q), Q = null), d.hidden = !1, V && (xe(!1), le("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), z(), Q = window.setTimeout(() => {
|
|
488
|
+
b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
595
489
|
}, 220);
|
|
596
490
|
};
|
|
597
|
-
|
|
598
|
-
r.preventDefault(),
|
|
599
|
-
}),
|
|
491
|
+
d.addEventListener("submit", (r) => {
|
|
492
|
+
r.preventDefault(), pe(p.value), p.value = "";
|
|
493
|
+
}), c?.addEventListener("click", (r) => {
|
|
600
494
|
r.preventDefault(), r.stopPropagation();
|
|
601
|
-
}),
|
|
602
|
-
r.target === p && !
|
|
495
|
+
}), d.addEventListener("click", (r) => {
|
|
496
|
+
r.target === p && !c || (pe(p.value), p.value = "");
|
|
603
497
|
}), p.addEventListener("focus", () => {
|
|
604
|
-
|
|
498
|
+
pe(p.value), p.value = "";
|
|
605
499
|
}), p.addEventListener("input", () => {
|
|
606
500
|
if (!p.value)
|
|
607
501
|
return;
|
|
608
502
|
const r = p.value;
|
|
609
|
-
|
|
610
|
-
}), x.addEventListener("click",
|
|
611
|
-
|
|
612
|
-
}),
|
|
613
|
-
|
|
503
|
+
pe(r), p.value = "";
|
|
504
|
+
}), x.addEventListener("click", fn), L.addEventListener("scroll", () => {
|
|
505
|
+
L.scrollTop < re - 1 && Y(!1, "userScroll"), re = L.scrollTop;
|
|
506
|
+
}), ne.addEventListener("click", () => {
|
|
507
|
+
mn();
|
|
614
508
|
});
|
|
615
|
-
const
|
|
509
|
+
const lt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
616
510
|
([r]) => {
|
|
617
|
-
r?.isIntersecting && (
|
|
511
|
+
r?.isIntersecting && (Y(!0, "bottom"), K());
|
|
618
512
|
},
|
|
619
|
-
{ root:
|
|
513
|
+
{ root: L, threshold: 0 }
|
|
620
514
|
);
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
const r =
|
|
624
|
-
p.readOnly = r, p.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel :
|
|
625
|
-
},
|
|
626
|
-
|
|
515
|
+
lt?.observe(w);
|
|
516
|
+
const ve = () => t.loginRequired || t.signupRequired, pt = () => {
|
|
517
|
+
const r = ve();
|
|
518
|
+
p.readOnly = r, p.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : q.launcherLabel, A.hidden = r;
|
|
519
|
+
}, G = () => {
|
|
520
|
+
C.disabled = j(t.billingStatus) || !_.getState().isThinking && g.value.trim().length === 0 && f.length === 0, h.disabled = ve() || j(t.billingStatus);
|
|
627
521
|
};
|
|
628
|
-
|
|
522
|
+
pt(), A.addEventListener("submit", (r) => {
|
|
629
523
|
if (r.preventDefault(), t.loginRequired) {
|
|
630
524
|
t.onLoginClick?.();
|
|
631
525
|
return;
|
|
@@ -634,83 +528,83 @@ async function co(e = {}) {
|
|
|
634
528
|
t.onSignupClick?.();
|
|
635
529
|
return;
|
|
636
530
|
}
|
|
637
|
-
|
|
531
|
+
j(t.billingStatus) || (ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G());
|
|
638
532
|
});
|
|
639
|
-
let
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
},
|
|
643
|
-
|
|
644
|
-
|
|
533
|
+
let he = 0;
|
|
534
|
+
const wn = () => {
|
|
535
|
+
he = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
536
|
+
}, st = (r) => {
|
|
537
|
+
I !== null && window.clearTimeout(I), E.textContent = r, E.hidden = !1, I = window.setTimeout(() => {
|
|
538
|
+
E.textContent = "", E.hidden = !0, I = null;
|
|
645
539
|
}, 3e3);
|
|
646
|
-
},
|
|
647
|
-
|
|
648
|
-
},
|
|
540
|
+
}, _n = () => {
|
|
541
|
+
I !== null && (window.clearTimeout(I), I = null), E.textContent = "", E.hidden = !0;
|
|
542
|
+
}, dt = async (r) => {
|
|
649
543
|
if (r.length === 0)
|
|
650
544
|
return;
|
|
651
|
-
const
|
|
652
|
-
if (f.length +
|
|
653
|
-
throw new Error(`Attach up to ${
|
|
654
|
-
f = [...f, ...
|
|
545
|
+
const u = await Qo(r);
|
|
546
|
+
if (f.length + u.length > Te)
|
|
547
|
+
throw new Error(`Attach up to ${Te} files per message.`);
|
|
548
|
+
f = [...f, ...u], P(), _n(), G(), O(_.getState()), a.classList.contains("pluno-pa-widget--open") || pe();
|
|
655
549
|
};
|
|
656
550
|
h.addEventListener("click", () => {
|
|
657
|
-
t.loginRequired ||
|
|
551
|
+
t.loginRequired || j(t.billingStatus) || y.click();
|
|
658
552
|
}), y.addEventListener("change", () => {
|
|
659
553
|
const r = Array.from(y.files ?? []);
|
|
660
|
-
y.value = "",
|
|
661
|
-
|
|
662
|
-
message:
|
|
554
|
+
y.value = "", dt(r).catch((u) => {
|
|
555
|
+
st(u instanceof Error ? u.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
|
|
556
|
+
message: u instanceof Error ? u.message : String(u)
|
|
663
557
|
});
|
|
664
558
|
});
|
|
665
559
|
}), a.addEventListener("dragenter", (r) => {
|
|
666
|
-
!
|
|
560
|
+
!Se(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), he += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
667
561
|
}), a.addEventListener("dragover", (r) => {
|
|
668
|
-
const
|
|
669
|
-
!
|
|
562
|
+
const u = r.dataTransfer;
|
|
563
|
+
!Se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
|
|
670
564
|
}), a.addEventListener("dragleave", (r) => {
|
|
671
|
-
|
|
565
|
+
Se(r.dataTransfer) && (r.stopPropagation(), he = Math.max(0, he - 1), he === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
672
566
|
}), a.addEventListener("drop", (r) => {
|
|
673
|
-
const
|
|
674
|
-
!
|
|
675
|
-
|
|
676
|
-
message:
|
|
567
|
+
const u = r.dataTransfer;
|
|
568
|
+
!Se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), wn(), dt(u.files).catch((k) => {
|
|
569
|
+
st(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
|
|
570
|
+
message: k instanceof Error ? k.message : String(k)
|
|
677
571
|
});
|
|
678
572
|
}));
|
|
679
|
-
}),
|
|
573
|
+
}), C.addEventListener("click", () => {
|
|
680
574
|
if (t.loginRequired) {
|
|
681
575
|
t.onLoginClick?.();
|
|
682
576
|
return;
|
|
683
577
|
}
|
|
684
|
-
if (
|
|
685
|
-
|
|
578
|
+
if (_.getState().isThinking) {
|
|
579
|
+
_.stop();
|
|
686
580
|
return;
|
|
687
581
|
}
|
|
688
|
-
|
|
689
|
-
}),
|
|
690
|
-
|
|
582
|
+
ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G(), O(_.getState());
|
|
583
|
+
}), N.addEventListener("click", () => {
|
|
584
|
+
ae = !0, Y(!0, "newSession"), K(), _.startNewSession(), Ne.clear(), g.value = "", f = [], P(), be(g), z(), G(), g.focus(), O(_.getState());
|
|
691
585
|
}), g.addEventListener("input", () => {
|
|
692
|
-
|
|
586
|
+
be(g), z(), G(), O(_.getState());
|
|
693
587
|
}), g.addEventListener("keydown", (r) => {
|
|
694
588
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
695
589
|
if (r.preventDefault(), t.loginRequired) {
|
|
696
590
|
t.onLoginClick?.();
|
|
697
591
|
return;
|
|
698
592
|
}
|
|
699
|
-
|
|
593
|
+
ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G(), O(_.getState());
|
|
700
594
|
}
|
|
701
595
|
}), a.addEventListener("click", (r) => {
|
|
702
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
703
|
-
}),
|
|
704
|
-
const
|
|
705
|
-
let
|
|
596
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && z();
|
|
597
|
+
}), oe.composerValue && (g.value = oe.composerValue, be(g)), oe.isOpen && pe(g.value, !1);
|
|
598
|
+
const ye = () => i;
|
|
599
|
+
let Be = _.getState().appearance !== null, Ce = null, me = null, de = null, ct = _.getState().isThinking, ce = null, Oe = null, ut = () => {
|
|
706
600
|
};
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
601
|
+
const xn = !!t.socialPostDraftHandler, O = (r) => {
|
|
602
|
+
if (Qe(r.lastErrorCode) ? ce = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !j(t.billingStatus) && (ce = null), $e(R, t.billingStatus, ce), t.loginRequired) {
|
|
603
|
+
Rt(
|
|
604
|
+
L,
|
|
605
|
+
C,
|
|
606
|
+
N,
|
|
607
|
+
ye,
|
|
714
608
|
"Log in to use Pluno on this page.",
|
|
715
609
|
t.loginButtonLabel,
|
|
716
610
|
t.loginUrl,
|
|
@@ -719,11 +613,11 @@ async function co(e = {}) {
|
|
|
719
613
|
return;
|
|
720
614
|
}
|
|
721
615
|
if (t.signupRequired) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
616
|
+
Rt(
|
|
617
|
+
L,
|
|
618
|
+
C,
|
|
619
|
+
N,
|
|
620
|
+
ye,
|
|
727
621
|
"Complete signup to unlock your free trial credits.",
|
|
728
622
|
t.signupButtonLabel,
|
|
729
623
|
t.signupUrl,
|
|
@@ -731,133 +625,133 @@ async function co(e = {}) {
|
|
|
731
625
|
);
|
|
732
626
|
return;
|
|
733
627
|
}
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
628
|
+
const u = No(r), k = u !== tt;
|
|
629
|
+
tt = u;
|
|
630
|
+
const H = ae || ie.enabled;
|
|
631
|
+
ae = !1, ca(
|
|
632
|
+
L,
|
|
633
|
+
w,
|
|
634
|
+
C,
|
|
635
|
+
N,
|
|
636
|
+
ge,
|
|
743
637
|
r,
|
|
744
|
-
|
|
745
|
-
|
|
638
|
+
Oe,
|
|
639
|
+
Oe !== null && Dt(r, g.value.trim().length > 0 || f.length > 0),
|
|
640
|
+
H,
|
|
641
|
+
() => ie.enabled,
|
|
642
|
+
Ne,
|
|
746
643
|
z,
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
xe,
|
|
751
|
-
(M) => {
|
|
752
|
-
te = !0, q(!0, "send"), j(), w.sendMessage(M);
|
|
644
|
+
ye,
|
|
645
|
+
(U) => {
|
|
646
|
+
ae = !0, Y(!0, "send"), K(), _.sendMessage(U);
|
|
753
647
|
},
|
|
754
|
-
|
|
755
|
-
dismissedCandidateIds:
|
|
756
|
-
draftingCandidateId:
|
|
757
|
-
error:
|
|
758
|
-
|
|
759
|
-
onSeen: (
|
|
760
|
-
|
|
648
|
+
xn && !Ie ? {
|
|
649
|
+
dismissedCandidateIds: _e,
|
|
650
|
+
draftingCandidateId: Ce,
|
|
651
|
+
error: me,
|
|
652
|
+
characterIconOptions: ye(),
|
|
653
|
+
onSeen: (U) => {
|
|
654
|
+
se.add(U.id), z();
|
|
761
655
|
},
|
|
762
|
-
onDraft: (
|
|
763
|
-
|
|
656
|
+
onDraft: (U) => {
|
|
657
|
+
vn(U);
|
|
764
658
|
},
|
|
765
|
-
onDismiss: (
|
|
766
|
-
|
|
659
|
+
onDismiss: (U) => {
|
|
660
|
+
se.add(U.id), _e.add(U.id), z(), me = null, O(_.getState());
|
|
767
661
|
},
|
|
768
|
-
onDisable: (
|
|
769
|
-
|
|
662
|
+
onDisable: (U) => {
|
|
663
|
+
Ie = !0, se.add(U.id), _e.add(U.id), z(), Aa(t, !0), me = null, O(_.getState());
|
|
770
664
|
}
|
|
771
665
|
} : void 0
|
|
772
|
-
),
|
|
666
|
+
), H ? (re = L.scrollTop, K()) : k && Io(r) && hn();
|
|
773
667
|
};
|
|
774
|
-
return
|
|
775
|
-
|
|
776
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
777
|
-
const
|
|
778
|
-
|
|
668
|
+
return ut = Fn((r) => {
|
|
669
|
+
Oe = r, !De && Dt(_.getState(), g.value.trim().length > 0 || f.length > 0) && O(_.getState());
|
|
670
|
+
}, { backendUrl: t.backendUrl, fetcher: T, loader: t.activeUsersLoader }), _.on("state", (r) => {
|
|
671
|
+
const u = ct && !r.isThinking;
|
|
672
|
+
ct = r.isThinking, r.appearance ? (Be = !0, X("web-sdk.widget", "Agent state supplied appearance", {
|
|
779
673
|
appearance: r.appearance
|
|
780
|
-
}),
|
|
674
|
+
}), Ue(r.appearance, "agent.state.appearance")) : Be && (Be = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
781
675
|
fallbackAccentColor: t.accentColor,
|
|
782
676
|
fallbackColorScheme: t.colorScheme,
|
|
783
677
|
fallbackFontFamily: t.fontFamily
|
|
784
|
-
}),
|
|
785
|
-
}),
|
|
786
|
-
agent:
|
|
678
|
+
}), Ue({}, "agent.state.appearance-cleared")), O(r), G(), u && rt();
|
|
679
|
+
}), O(_.getState()), G(), {
|
|
680
|
+
agent: _,
|
|
787
681
|
updateAppearance: (r) => {
|
|
788
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
682
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ue(r, "widgetHandle.updateAppearance");
|
|
789
683
|
},
|
|
790
684
|
updateBillingStatus: (r) => {
|
|
791
|
-
const
|
|
792
|
-
|
|
685
|
+
const u = r ?? null;
|
|
686
|
+
Nt(t.billingStatus, u, ce) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !j(t.billingStatus) && (ce = null), $e(
|
|
793
687
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
794
688
|
t.billingStatus,
|
|
795
|
-
|
|
796
|
-
),
|
|
689
|
+
ce
|
|
690
|
+
), G());
|
|
797
691
|
},
|
|
798
692
|
updateAuthGate: (r) => {
|
|
799
|
-
const
|
|
800
|
-
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl),
|
|
801
|
-
|
|
802
|
-
message:
|
|
693
|
+
const u = ve();
|
|
694
|
+
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), pt(), O(_.getState()), G(), u && !ve() && _.connect().catch((k) => {
|
|
695
|
+
X("web-sdk.widget", "Failed to connect after auth gate cleared", {
|
|
696
|
+
message: k instanceof Error ? k.message : String(k)
|
|
803
697
|
});
|
|
804
698
|
});
|
|
805
699
|
},
|
|
806
700
|
openPanel: () => {
|
|
807
|
-
|
|
701
|
+
pe(g.value, !1);
|
|
808
702
|
},
|
|
809
703
|
destroy: () => {
|
|
810
|
-
|
|
704
|
+
De = !0, nt.disconnect(), lt?.disconnect(), window.removeEventListener("resize", at), it(), I !== null && window.clearTimeout(I), ut(), de?.remove(), _.destroy(), n.remove();
|
|
811
705
|
}
|
|
812
706
|
};
|
|
813
|
-
async function
|
|
814
|
-
if (!
|
|
815
|
-
|
|
707
|
+
async function vn(r) {
|
|
708
|
+
if (!Ce) {
|
|
709
|
+
Ce = r.id, me = null, O(_.getState());
|
|
816
710
|
try {
|
|
817
711
|
if (!t.socialPostDraftHandler)
|
|
818
712
|
throw new Error("Social post drafting is not available here.");
|
|
819
|
-
const
|
|
820
|
-
if (!
|
|
713
|
+
const u = await t.socialPostDraftHandler(r);
|
|
714
|
+
if (!u.linkedinPost || !u.xPost)
|
|
821
715
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
822
|
-
|
|
716
|
+
se.add(r.id), _e.add(r.id), z(), de?.remove(), de = ha(u, {
|
|
823
717
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
824
718
|
onClose: () => {
|
|
825
|
-
|
|
719
|
+
de?.remove(), de = null;
|
|
826
720
|
}
|
|
827
|
-
}), a.appendChild(
|
|
828
|
-
} catch (
|
|
829
|
-
|
|
721
|
+
}), a.appendChild(de);
|
|
722
|
+
} catch (u) {
|
|
723
|
+
me = u instanceof Error ? u.message : "Could not draft social post.";
|
|
830
724
|
} finally {
|
|
831
|
-
|
|
725
|
+
Ce = null, O(_.getState());
|
|
832
726
|
}
|
|
833
727
|
}
|
|
834
728
|
}
|
|
835
|
-
function
|
|
836
|
-
const
|
|
837
|
-
i =
|
|
838
|
-
accentColor:
|
|
839
|
-
colorScheme:
|
|
840
|
-
fontFamily:
|
|
841
|
-
scribbleStyle:
|
|
842
|
-
}),
|
|
843
|
-
source:
|
|
729
|
+
function Ue(r, u) {
|
|
730
|
+
const k = r.accentColor ?? t.accentColor, H = r.colorScheme ?? t.colorScheme, U = r.fontFamily ?? t.fontFamily, Fe = r.scribbleStyle ?? t.scribbleStyle;
|
|
731
|
+
i = Ct(k, Fe), Et(a, i, {
|
|
732
|
+
accentColor: k,
|
|
733
|
+
colorScheme: H,
|
|
734
|
+
fontFamily: U,
|
|
735
|
+
scribbleStyle: Fe
|
|
736
|
+
}), X("web-sdk.widget", "Updated widget appearance", {
|
|
737
|
+
source: u,
|
|
844
738
|
inputAppearance: r,
|
|
845
|
-
appliedAccentColor:
|
|
846
|
-
appliedColorScheme:
|
|
847
|
-
appliedFontFamily:
|
|
848
|
-
appliedScribbleStyle:
|
|
739
|
+
appliedAccentColor: k,
|
|
740
|
+
appliedColorScheme: H,
|
|
741
|
+
appliedFontFamily: U,
|
|
742
|
+
appliedScribbleStyle: Fe,
|
|
849
743
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
850
744
|
});
|
|
851
745
|
}
|
|
852
746
|
}
|
|
853
|
-
function
|
|
854
|
-
return
|
|
747
|
+
function Ct(e, t) {
|
|
748
|
+
return { accentColor: e, scribbleStyle: t };
|
|
855
749
|
}
|
|
856
|
-
function
|
|
857
|
-
const t =
|
|
858
|
-
return t === null ? "#fafafa" :
|
|
750
|
+
function fo(e) {
|
|
751
|
+
const t = wo(e);
|
|
752
|
+
return t === null ? "#fafafa" : _o(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
859
753
|
}
|
|
860
|
-
function
|
|
754
|
+
function wo(e) {
|
|
861
755
|
const t = e.trim();
|
|
862
756
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
863
757
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -869,26 +763,26 @@ function go(e) {
|
|
|
869
763
|
Number.parseInt(t[3] + t[3], 16)
|
|
870
764
|
] : null;
|
|
871
765
|
}
|
|
872
|
-
function
|
|
766
|
+
function _o([e, t, n]) {
|
|
873
767
|
const o = (a) => {
|
|
874
768
|
const i = a / 255;
|
|
875
769
|
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
876
770
|
};
|
|
877
771
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
878
772
|
}
|
|
879
|
-
function
|
|
773
|
+
function Et(e, t, n) {
|
|
880
774
|
e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
881
|
-
const o = n.scribbleStyle ?
|
|
882
|
-
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast",
|
|
775
|
+
const o = n.scribbleStyle ? Wt(n.accentColor) : n.accentColor;
|
|
776
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", fo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? to : n.fontFamily, n.scribbleStyle && xo(e.ownerDocument);
|
|
883
777
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
884
778
|
for (const i of a)
|
|
885
|
-
i.replaceWith(
|
|
779
|
+
i.replaceWith(ee(Array.from(i.classList).join(" "), t));
|
|
886
780
|
}
|
|
887
|
-
function
|
|
888
|
-
if (e.getElementById(
|
|
781
|
+
function xo(e) {
|
|
782
|
+
if (e.getElementById(_t))
|
|
889
783
|
return;
|
|
890
784
|
const t = e.createElement("style");
|
|
891
|
-
t.id =
|
|
785
|
+
t.id = _t, t.textContent = `@font-face {
|
|
892
786
|
font-family: "Architects Daughter";
|
|
893
787
|
font-style: normal;
|
|
894
788
|
font-weight: 400;
|
|
@@ -896,7 +790,7 @@ function mo(e) {
|
|
|
896
790
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
897
791
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
898
792
|
}
|
|
899
|
-
function
|
|
793
|
+
function vo({
|
|
900
794
|
root: e,
|
|
901
795
|
launcher: t,
|
|
902
796
|
launcherDragHandle: n,
|
|
@@ -904,137 +798,137 @@ function fo({
|
|
|
904
798
|
setPosition: a,
|
|
905
799
|
persist: i
|
|
906
800
|
}) {
|
|
907
|
-
let l = null, s = null,
|
|
908
|
-
const
|
|
909
|
-
l = null, s = null,
|
|
801
|
+
let l = null, s = null, d = null, c = !1, p = null;
|
|
802
|
+
const b = () => {
|
|
803
|
+
l = null, s = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
910
804
|
}, x = (h) => {
|
|
911
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY },
|
|
805
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
|
|
912
806
|
}, A = (h) => {
|
|
913
|
-
if (l !== h.pointerId || !s || !
|
|
807
|
+
if (l !== h.pointerId || !s || !d)
|
|
914
808
|
return;
|
|
915
809
|
h.preventDefault();
|
|
916
|
-
const g = h.clientX - s.x,
|
|
917
|
-
!
|
|
918
|
-
},
|
|
919
|
-
l === h.pointerId && (h.preventDefault(), h.stopPropagation(),
|
|
920
|
-
},
|
|
921
|
-
l === h.pointerId && (h.preventDefault(),
|
|
810
|
+
const g = h.clientX - s.x, C = h.clientY - s.y;
|
|
811
|
+
!c && Math.hypot(g, C) < vt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: d.x + g, y: d.y + C }));
|
|
812
|
+
}, E = (h) => {
|
|
813
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (p = { x: h.clientX, y: h.clientY }, i()), b());
|
|
814
|
+
}, R = (h) => {
|
|
815
|
+
l === h.pointerId && (h.preventDefault(), b());
|
|
922
816
|
}, v = (h) => {
|
|
923
817
|
if (!p)
|
|
924
818
|
return;
|
|
925
|
-
const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <=
|
|
819
|
+
const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= vt;
|
|
926
820
|
p = null, g && (h.preventDefault(), h.stopPropagation());
|
|
927
821
|
}, y = (h) => {
|
|
928
822
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
929
823
|
return;
|
|
930
|
-
const g = h.shiftKey ?
|
|
931
|
-
let
|
|
932
|
-
h.key === "ArrowUp" ?
|
|
824
|
+
const g = h.shiftKey ? go : uo, C = o();
|
|
825
|
+
let N = null;
|
|
826
|
+
h.key === "ArrowUp" ? N = { x: C.x, y: C.y - g } : h.key === "ArrowDown" ? N = { x: C.x, y: C.y + g } : h.key === "ArrowLeft" ? N = { x: C.x - g, y: C.y } : h.key === "ArrowRight" && (N = { x: C.x + g, y: C.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
|
|
933
827
|
};
|
|
934
|
-
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup",
|
|
935
|
-
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup",
|
|
828
|
+
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", E), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
|
|
829
|
+
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", E), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
|
|
936
830
|
};
|
|
937
831
|
}
|
|
938
|
-
function
|
|
939
|
-
const n =
|
|
832
|
+
function Ke(e, t = !0) {
|
|
833
|
+
const n = J(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
940
834
|
return {
|
|
941
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
942
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
835
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Yt, n.width - 36),
|
|
836
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? no : Kt
|
|
943
837
|
};
|
|
944
838
|
}
|
|
945
|
-
function
|
|
946
|
-
const e =
|
|
839
|
+
function Qt() {
|
|
840
|
+
const e = J();
|
|
947
841
|
return {
|
|
948
842
|
width: Math.min(
|
|
949
|
-
|
|
950
|
-
e.width -
|
|
843
|
+
ue(e.width * io, oo, ao),
|
|
844
|
+
e.width - F * 2
|
|
951
845
|
),
|
|
952
846
|
height: Math.min(
|
|
953
|
-
|
|
954
|
-
e.height -
|
|
847
|
+
ue(e.height * po, ro, lo),
|
|
848
|
+
e.height - Ye - F
|
|
955
849
|
)
|
|
956
850
|
};
|
|
957
851
|
}
|
|
958
|
-
function
|
|
852
|
+
function yo(e, t, n) {
|
|
959
853
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
960
854
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
961
855
|
return { x: o, y: a };
|
|
962
856
|
const i = e.getBoundingClientRect();
|
|
963
857
|
if (i.width > 0 || i.height > 0)
|
|
964
858
|
return { x: i.left, y: i.top };
|
|
965
|
-
const l =
|
|
859
|
+
const l = J();
|
|
966
860
|
return {
|
|
967
861
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
968
862
|
y: l.height - 24 - n.height
|
|
969
863
|
};
|
|
970
864
|
}
|
|
971
|
-
function
|
|
972
|
-
const o =
|
|
865
|
+
function St(e, t, n) {
|
|
866
|
+
const o = J(), a = F + ko(e);
|
|
973
867
|
return {
|
|
974
|
-
x:
|
|
975
|
-
y:
|
|
868
|
+
x: ue(t.x, F, Math.max(F, o.width - n.width - F)),
|
|
869
|
+
y: ue(t.y, a, Math.max(a, o.height - n.height - F))
|
|
976
870
|
};
|
|
977
871
|
}
|
|
978
|
-
function
|
|
979
|
-
const n =
|
|
872
|
+
function Co(e, t) {
|
|
873
|
+
const n = J();
|
|
980
874
|
return {
|
|
981
875
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
982
876
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
983
877
|
};
|
|
984
878
|
}
|
|
985
|
-
function
|
|
986
|
-
const n =
|
|
879
|
+
function Eo(e, t) {
|
|
880
|
+
const n = So(e, t), o = J();
|
|
987
881
|
return {
|
|
988
882
|
anchor: n,
|
|
989
883
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
990
884
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
991
885
|
};
|
|
992
886
|
}
|
|
993
|
-
function
|
|
994
|
-
const n =
|
|
887
|
+
function So(e, t) {
|
|
888
|
+
const n = J(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
995
889
|
return `${i}-${l}`;
|
|
996
890
|
}
|
|
997
|
-
function
|
|
998
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
891
|
+
function ko(e) {
|
|
892
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? co : so;
|
|
999
893
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const o =
|
|
894
|
+
function kt(e, t, n) {
|
|
895
|
+
const o = Ke(e), a = Qt(), i = {
|
|
1002
896
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
1003
897
|
y: t.y + o.height - a.height
|
|
1004
898
|
};
|
|
1005
|
-
return
|
|
899
|
+
return Lo(i);
|
|
1006
900
|
}
|
|
1007
|
-
function
|
|
1008
|
-
const t =
|
|
901
|
+
function Lo(e) {
|
|
902
|
+
const t = J(), n = Qt();
|
|
1009
903
|
return {
|
|
1010
|
-
x:
|
|
1011
|
-
y:
|
|
904
|
+
x: ue(e.x, F, Math.max(F, t.width - n.width - F)),
|
|
905
|
+
y: ue(
|
|
1012
906
|
e.y,
|
|
1013
|
-
|
|
1014
|
-
Math.max(
|
|
907
|
+
Ye,
|
|
908
|
+
Math.max(Ye, t.height - n.height - F)
|
|
1015
909
|
)
|
|
1016
910
|
};
|
|
1017
911
|
}
|
|
1018
|
-
function
|
|
912
|
+
function Ee(e, t) {
|
|
1019
913
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1020
914
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1021
915
|
return;
|
|
1022
916
|
}
|
|
1023
917
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1024
918
|
}
|
|
1025
|
-
function
|
|
919
|
+
function Ao(e, t) {
|
|
1026
920
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1027
921
|
}
|
|
1028
|
-
function
|
|
922
|
+
function Po(e) {
|
|
1029
923
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1030
924
|
}
|
|
1031
|
-
function
|
|
925
|
+
function J() {
|
|
1032
926
|
return {
|
|
1033
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1034
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
927
|
+
width: window.innerWidth || document.documentElement.clientWidth || Yt + F * 2,
|
|
928
|
+
height: window.innerHeight || document.documentElement.clientHeight || Kt + F * 2
|
|
1035
929
|
};
|
|
1036
930
|
}
|
|
1037
|
-
function
|
|
931
|
+
function Ge(e) {
|
|
1038
932
|
const t = e.getBoundingClientRect();
|
|
1039
933
|
return {
|
|
1040
934
|
x: Math.round(t.x),
|
|
@@ -1043,10 +937,10 @@ function Oe(e) {
|
|
|
1043
937
|
height: Math.round(t.height)
|
|
1044
938
|
};
|
|
1045
939
|
}
|
|
1046
|
-
function
|
|
940
|
+
function ue(e, t, n) {
|
|
1047
941
|
return Math.min(Math.max(e, t), n);
|
|
1048
942
|
}
|
|
1049
|
-
function
|
|
943
|
+
function X(e, t, n) {
|
|
1050
944
|
if (typeof window > "u")
|
|
1051
945
|
return;
|
|
1052
946
|
const o = window, a = {
|
|
@@ -1055,26 +949,26 @@ function V(e, t, n) {
|
|
|
1055
949
|
message: t,
|
|
1056
950
|
details: n
|
|
1057
951
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1058
|
-
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(
|
|
952
|
+
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Zn, { detail: a }));
|
|
1059
953
|
}
|
|
1060
|
-
function
|
|
1061
|
-
|
|
954
|
+
function To(e, t) {
|
|
955
|
+
X("web-sdk.widget.position", e, t);
|
|
1062
956
|
}
|
|
1063
|
-
function
|
|
957
|
+
function We(e, t, n) {
|
|
1064
958
|
const o = t.value.trim();
|
|
1065
959
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1066
960
|
}
|
|
1067
|
-
function
|
|
961
|
+
function be(e) {
|
|
1068
962
|
e.style.height = "0px";
|
|
1069
963
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1070
964
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1071
965
|
}
|
|
1072
|
-
function
|
|
966
|
+
function fe(e, t = () => !0) {
|
|
1073
967
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1074
968
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1075
969
|
});
|
|
1076
970
|
}
|
|
1077
|
-
function
|
|
971
|
+
function No(e) {
|
|
1078
972
|
const t = e.messages[e.messages.length - 1];
|
|
1079
973
|
return [
|
|
1080
974
|
e.messages.length,
|
|
@@ -1085,37 +979,37 @@ function ko(e) {
|
|
|
1085
979
|
e.lastError ?? ""
|
|
1086
980
|
].join(":");
|
|
1087
981
|
}
|
|
1088
|
-
function
|
|
982
|
+
function Io(e) {
|
|
1089
983
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1090
984
|
}
|
|
1091
|
-
function
|
|
1092
|
-
e.appendChild(
|
|
985
|
+
function Do(e, t, n, o) {
|
|
986
|
+
e.appendChild(Go()), e.appendChild(Ro(t, n, o)), e.appendChild(nn("pluno-pa-widget__close", "Close", Wo(16), !0)), e.appendChild(Mo(n));
|
|
1093
987
|
}
|
|
1094
|
-
function
|
|
988
|
+
function Ro(e, t, n) {
|
|
1095
989
|
const o = document.createElement("form");
|
|
1096
990
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
1097
991
|
const i = document.createElement("button");
|
|
1098
992
|
i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
|
|
1099
993
|
}
|
|
1100
|
-
o.appendChild(
|
|
994
|
+
o.appendChild(on("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ee("pluno-pa-widget__character--launcher", t));
|
|
1101
995
|
const a = document.createElement("input");
|
|
1102
996
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
1103
997
|
}
|
|
1104
|
-
function
|
|
998
|
+
function Mo(e) {
|
|
1105
999
|
const t = document.createElement("section");
|
|
1106
|
-
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1000
|
+
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(on("pluno-pa-widget__scribble-spirals--panel", 16));
|
|
1107
1001
|
const n = document.createElement("div");
|
|
1108
1002
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1109
1003
|
const o = document.createElement("main");
|
|
1110
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1004
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(Oo(e));
|
|
1111
1005
|
const a = document.createElement("div");
|
|
1112
1006
|
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
1113
1007
|
const i = document.createElement("div");
|
|
1114
1008
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
1115
1009
|
const l = document.createElement("button");
|
|
1116
|
-
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(
|
|
1010
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(nn("pluno-pa-widget__new-chat", "New chat", Ho(), !0)), t.appendChild(n), t.appendChild(Bo()), t;
|
|
1117
1011
|
}
|
|
1118
|
-
function
|
|
1012
|
+
function Bo() {
|
|
1119
1013
|
const e = document.createElement("form");
|
|
1120
1014
|
e.className = "pluno-pa-widget__composer";
|
|
1121
1015
|
const t = document.createElement("div");
|
|
@@ -1127,64 +1021,292 @@ function No() {
|
|
|
1127
1021
|
const a = document.createElement("div");
|
|
1128
1022
|
a.className = "pluno-pa-widget__composer-inner";
|
|
1129
1023
|
const i = document.createElement("input");
|
|
1130
|
-
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept =
|
|
1024
|
+
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Qn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1131
1025
|
const l = document.createElement("button");
|
|
1132
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1026
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild($o()), l.appendChild(qo()), a.appendChild(l);
|
|
1133
1027
|
const s = document.createElement("textarea");
|
|
1134
1028
|
s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1029
|
+
const d = document.createElement("button");
|
|
1030
|
+
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(an()), a.appendChild(d), e.appendChild(a);
|
|
1031
|
+
const c = document.createElement("div");
|
|
1032
|
+
c.className = "pluno-pa-widget__composer-meta";
|
|
1139
1033
|
const p = document.createElement("a");
|
|
1140
|
-
p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.",
|
|
1141
|
-
const
|
|
1142
|
-
return
|
|
1034
|
+
p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", c.appendChild(p);
|
|
1035
|
+
const b = document.createElement("span");
|
|
1036
|
+
return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(b), e.appendChild(c), e;
|
|
1143
1037
|
}
|
|
1144
|
-
function
|
|
1038
|
+
function Oo(e) {
|
|
1145
1039
|
const t = document.createElement("div");
|
|
1146
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1040
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(ee("pluno-pa-widget__character--empty", e)), t.appendChild(en()), t;
|
|
1147
1041
|
}
|
|
1148
|
-
function
|
|
1042
|
+
function en() {
|
|
1149
1043
|
const e = document.createElement("div");
|
|
1150
1044
|
return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
|
|
1151
1045
|
}
|
|
1152
|
-
function
|
|
1046
|
+
function Uo(e, t) {
|
|
1153
1047
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1154
1048
|
const n = document.createElement("span");
|
|
1155
1049
|
n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
|
|
1156
1050
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const n =
|
|
1159
|
-
|
|
1160
|
-
const a = e.split(/\s+/).filter(Boolean);
|
|
1051
|
+
function ee(e, t) {
|
|
1052
|
+
const n = `pluno-pa-character-${yt}`;
|
|
1053
|
+
yt += 1;
|
|
1054
|
+
const o = t.scribbleStyle ? zo(t.accentColor, n) : Fo(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
|
|
1161
1055
|
return o.setAttribute(
|
|
1162
1056
|
"class",
|
|
1163
1057
|
a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1164
1058
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1165
1059
|
}
|
|
1166
|
-
function
|
|
1167
|
-
const n =
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1060
|
+
function Fo(e, t) {
|
|
1061
|
+
const n = Sn(e), o = {
|
|
1062
|
+
boltFill: `${t}-boltFill`,
|
|
1063
|
+
boltEdge: `${t}-boltEdge`,
|
|
1064
|
+
boltGlow: `${t}-boltGlow`,
|
|
1065
|
+
eyeWhite: `${t}-eyeWhite`,
|
|
1066
|
+
pupil: `${t}-pupil`,
|
|
1067
|
+
softDropShadow: `${t}-softDropShadow`,
|
|
1068
|
+
innerDepth: `${t}-innerDepth`,
|
|
1069
|
+
eyeShadow: `${t}-eyeShadow`,
|
|
1070
|
+
pupilGloss: `${t}-pupilGloss`,
|
|
1071
|
+
boltClip: `${t}-boltClip`
|
|
1072
|
+
}, a = tn(), i = m(a, "defs"), l = m(i, "linearGradient", {
|
|
1073
|
+
id: o.boltFill,
|
|
1074
|
+
x1: "420",
|
|
1075
|
+
y1: "180",
|
|
1076
|
+
x2: "790",
|
|
1077
|
+
y2: "1040",
|
|
1078
|
+
gradientUnits: "userSpaceOnUse"
|
|
1079
|
+
});
|
|
1080
|
+
D(l, "0", n.top), D(l, "0.36", n.middle), D(l, "0.72", n.bottom), D(l, "1", n.bottom);
|
|
1081
|
+
const s = m(i, "linearGradient", {
|
|
1082
|
+
id: o.boltEdge,
|
|
1083
|
+
x1: "470",
|
|
1084
|
+
y1: "145",
|
|
1085
|
+
x2: "900",
|
|
1086
|
+
y2: "980",
|
|
1087
|
+
gradientUnits: "userSpaceOnUse"
|
|
1088
|
+
});
|
|
1089
|
+
D(s, "0", n.edgeStart), D(s, "0.32", n.edgeMiddle), D(s, "0.78", n.edgeEnd), D(s, "1", n.edgeEnd);
|
|
1090
|
+
const d = m(i, "radialGradient", {
|
|
1091
|
+
id: o.boltGlow,
|
|
1092
|
+
cx: "50%",
|
|
1093
|
+
cy: "22%",
|
|
1094
|
+
r: "82%"
|
|
1095
|
+
});
|
|
1096
|
+
D(d, "0", n.glow, "0.72"), D(d, "0.5", n.middle, "0.44"), D(d, "1", n.bottom, "0");
|
|
1097
|
+
const c = m(i, "radialGradient", {
|
|
1098
|
+
id: o.eyeWhite,
|
|
1099
|
+
cx: "35%",
|
|
1100
|
+
cy: "25%",
|
|
1101
|
+
r: "70%"
|
|
1102
|
+
});
|
|
1103
|
+
D(c, "0", "#ffffff"), D(c, "0.72", "#ffffff"), D(c, "1", "#e5e5e5");
|
|
1104
|
+
const p = m(i, "radialGradient", {
|
|
1105
|
+
id: o.pupil,
|
|
1106
|
+
cx: "42%",
|
|
1107
|
+
cy: "38%",
|
|
1108
|
+
r: "65%"
|
|
1109
|
+
});
|
|
1110
|
+
D(p, "0", "#2a1f10"), D(p, "0.52", "#080604"), D(p, "1", "#000000");
|
|
1111
|
+
const b = m(i, "filter", {
|
|
1112
|
+
id: o.softDropShadow,
|
|
1113
|
+
x: "-18%",
|
|
1114
|
+
y: "-12%",
|
|
1115
|
+
width: "136%",
|
|
1116
|
+
height: "136%",
|
|
1117
|
+
"color-interpolation-filters": "sRGB"
|
|
1118
|
+
});
|
|
1119
|
+
m(b, "feDropShadow", {
|
|
1120
|
+
dx: "0",
|
|
1121
|
+
dy: "12",
|
|
1122
|
+
stdDeviation: "18",
|
|
1123
|
+
"flood-color": n.shadow,
|
|
1124
|
+
"flood-opacity": "0.24"
|
|
1125
|
+
});
|
|
1126
|
+
const x = m(i, "filter", {
|
|
1127
|
+
id: o.innerDepth,
|
|
1128
|
+
x: "-8%",
|
|
1129
|
+
y: "-8%",
|
|
1130
|
+
width: "116%",
|
|
1131
|
+
height: "116%",
|
|
1132
|
+
"color-interpolation-filters": "sRGB"
|
|
1133
|
+
});
|
|
1134
|
+
m(x, "feGaussianBlur", { in: "SourceAlpha", stdDeviation: "8", result: "blur" }), m(x, "feOffset", { dx: "-7", dy: "-9", result: "topLeft" }), m(x, "feComposite", {
|
|
1135
|
+
in: "topLeft",
|
|
1136
|
+
in2: "SourceAlpha",
|
|
1137
|
+
operator: "arithmetic",
|
|
1138
|
+
k2: "-1",
|
|
1139
|
+
k3: "1",
|
|
1140
|
+
result: "innerShadow"
|
|
1141
|
+
}), m(x, "feColorMatrix", {
|
|
1142
|
+
in: "innerShadow",
|
|
1143
|
+
type: "matrix",
|
|
1144
|
+
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1145
|
+
result: "innerLight"
|
|
1146
|
+
}), m(x, "feBlend", { in: "SourceGraphic", in2: "innerLight", mode: "screen" });
|
|
1147
|
+
const A = m(i, "filter", {
|
|
1148
|
+
id: o.eyeShadow,
|
|
1149
|
+
x: "-24%",
|
|
1150
|
+
y: "-20%",
|
|
1151
|
+
width: "148%",
|
|
1152
|
+
height: "148%",
|
|
1153
|
+
"color-interpolation-filters": "sRGB"
|
|
1154
|
+
});
|
|
1155
|
+
m(A, "feDropShadow", {
|
|
1156
|
+
dx: "0",
|
|
1157
|
+
dy: "8",
|
|
1158
|
+
stdDeviation: "5",
|
|
1159
|
+
"flood-color": n.shadow,
|
|
1160
|
+
"flood-opacity": "0.3"
|
|
1161
|
+
});
|
|
1162
|
+
const E = m(i, "filter", {
|
|
1163
|
+
id: o.pupilGloss,
|
|
1164
|
+
x: "-15%",
|
|
1165
|
+
y: "-15%",
|
|
1166
|
+
width: "130%",
|
|
1167
|
+
height: "130%",
|
|
1168
|
+
"color-interpolation-filters": "sRGB"
|
|
1169
|
+
});
|
|
1170
|
+
m(E, "feDropShadow", {
|
|
1171
|
+
dx: "0",
|
|
1172
|
+
dy: "3",
|
|
1173
|
+
stdDeviation: "3",
|
|
1174
|
+
"flood-color": "#000000",
|
|
1175
|
+
"flood-opacity": "0.22"
|
|
1176
|
+
});
|
|
1177
|
+
const R = m(i, "clipPath", { id: o.boltClip });
|
|
1178
|
+
m(R, "path", { d: Ae });
|
|
1179
|
+
const v = m(a, "g", { filter: W(o.softDropShadow) });
|
|
1180
|
+
m(v, "path", { d: Ae, fill: W(o.boltEdge) });
|
|
1181
|
+
const y = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
|
|
1182
|
+
m(v, "path", {
|
|
1183
|
+
d: y,
|
|
1184
|
+
fill: W(o.boltFill),
|
|
1185
|
+
filter: W(o.innerDepth)
|
|
1186
|
+
}), m(v, "path", {
|
|
1187
|
+
d: y,
|
|
1188
|
+
fill: W(o.boltGlow),
|
|
1189
|
+
opacity: "0.74"
|
|
1190
|
+
});
|
|
1191
|
+
const h = m(v, "g", {
|
|
1192
|
+
"clip-path": W(o.boltClip),
|
|
1193
|
+
opacity: "0.42"
|
|
1194
|
+
});
|
|
1195
|
+
m(h, "path", {
|
|
1196
|
+
d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
|
|
1197
|
+
fill: "none",
|
|
1198
|
+
stroke: n.highlight,
|
|
1199
|
+
"stroke-width": "22",
|
|
1200
|
+
"stroke-linecap": "round",
|
|
1201
|
+
opacity: "0.65"
|
|
1202
|
+
}), m(h, "path", {
|
|
1203
|
+
d: "M556 685 L501 994",
|
|
1204
|
+
fill: "none",
|
|
1205
|
+
stroke: n.highlight,
|
|
1206
|
+
"stroke-width": "20",
|
|
1207
|
+
"stroke-linecap": "round",
|
|
1208
|
+
opacity: "0.55"
|
|
1209
|
+
}), m(h, "path", {
|
|
1210
|
+
d: "M858 160 C882 166 893 181 883 204",
|
|
1211
|
+
fill: "none",
|
|
1212
|
+
stroke: n.inner,
|
|
1213
|
+
"stroke-width": "18",
|
|
1214
|
+
"stroke-linecap": "round",
|
|
1215
|
+
opacity: "0.48"
|
|
1216
|
+
});
|
|
1217
|
+
const g = m(a, "g", { filter: W(o.eyeShadow) });
|
|
1218
|
+
return Lt(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Lt(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
|
|
1219
|
+
}
|
|
1220
|
+
function zo(e, t) {
|
|
1221
|
+
const n = Wt(e), o = {
|
|
1222
|
+
clip: `${t}-scribbleBoltClip`,
|
|
1223
|
+
wobble: `${t}-scribbleBoltWobble`
|
|
1224
|
+
}, a = tn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
|
|
1225
|
+
m(l, "path", { d: Ae });
|
|
1226
|
+
const s = m(i, "filter", {
|
|
1227
|
+
id: o.wobble,
|
|
1228
|
+
x: "-10%",
|
|
1229
|
+
y: "-10%",
|
|
1230
|
+
width: "120%",
|
|
1231
|
+
height: "120%",
|
|
1232
|
+
"color-interpolation-filters": "sRGB"
|
|
1233
|
+
});
|
|
1234
|
+
m(s, "feTurbulence", {
|
|
1235
|
+
type: "fractalNoise",
|
|
1236
|
+
baseFrequency: "0.011",
|
|
1237
|
+
numOctaves: "3",
|
|
1238
|
+
seed: "7",
|
|
1239
|
+
result: "noise"
|
|
1240
|
+
}), m(s, "feDisplacementMap", {
|
|
1241
|
+
in: "SourceGraphic",
|
|
1242
|
+
in2: "noise",
|
|
1243
|
+
scale: "16",
|
|
1244
|
+
xChannelSelector: "R",
|
|
1245
|
+
yChannelSelector: "G"
|
|
1246
|
+
});
|
|
1247
|
+
const d = m(a, "g", { filter: W(o.wobble) }), c = m(d, "g", { "clip-path": W(o.clip) });
|
|
1248
|
+
return m(c, "path", {
|
|
1249
|
+
d: En(),
|
|
1250
|
+
fill: "none",
|
|
1251
|
+
stroke: n,
|
|
1252
|
+
"stroke-width": "56",
|
|
1253
|
+
"stroke-linecap": "round",
|
|
1254
|
+
"stroke-linejoin": "round",
|
|
1255
|
+
opacity: "0.9",
|
|
1256
|
+
transform: "rotate(-14 627 600)"
|
|
1257
|
+
}), m(d, "path", {
|
|
1258
|
+
d: Ae,
|
|
1259
|
+
fill: "none",
|
|
1260
|
+
stroke: Pe,
|
|
1261
|
+
"stroke-width": "18",
|
|
1262
|
+
"stroke-linejoin": "round"
|
|
1263
|
+
}), At(d, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), At(d, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
|
|
1264
|
+
}
|
|
1265
|
+
function tn() {
|
|
1266
|
+
return S("svg", {
|
|
1267
|
+
xmlns: Xt,
|
|
1268
|
+
viewBox: "0 0 1254 1254"
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
function Lt(e, t, n, o, a, i, l, s, d) {
|
|
1272
|
+
const c = m(e, "g", { transform: t });
|
|
1273
|
+
m(c, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: W(d.eyeWhite) }), m(c, "ellipse", {
|
|
1274
|
+
cx: a,
|
|
1275
|
+
cy: i,
|
|
1276
|
+
rx: "49",
|
|
1277
|
+
ry: "57",
|
|
1278
|
+
fill: W(d.pupil),
|
|
1279
|
+
filter: W(d.pupilGloss)
|
|
1280
|
+
}), m(c, "circle", { cx: l, cy: s, r: "18", fill: "#ffffff" });
|
|
1281
|
+
}
|
|
1282
|
+
function At(e, t, n, o, a, i, l, s) {
|
|
1283
|
+
const d = m(e, "g", { transform: t });
|
|
1284
|
+
m(d, "ellipse", {
|
|
1285
|
+
cx: n,
|
|
1286
|
+
cy: o,
|
|
1287
|
+
rx: "73",
|
|
1288
|
+
ry: "80",
|
|
1289
|
+
fill: "#ffffff",
|
|
1290
|
+
stroke: Pe,
|
|
1291
|
+
"stroke-width": "13"
|
|
1292
|
+
}), m(d, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Pe }), m(d, "circle", { cx: l, cy: s, r: "16", fill: "#ffffff" });
|
|
1293
|
+
}
|
|
1294
|
+
function m(e, t, n = {}) {
|
|
1295
|
+
const o = S(t, n);
|
|
1296
|
+
return e.appendChild(o), o;
|
|
1297
|
+
}
|
|
1298
|
+
function D(e, t, n, o) {
|
|
1299
|
+
const a = { offset: t, "stop-color": n };
|
|
1300
|
+
o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
|
|
1301
|
+
}
|
|
1302
|
+
function W(e) {
|
|
1303
|
+
return `url(#${e})`;
|
|
1182
1304
|
}
|
|
1183
|
-
function
|
|
1305
|
+
function nn(e, t, n, o) {
|
|
1184
1306
|
const a = document.createElement("button");
|
|
1185
1307
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1186
1308
|
}
|
|
1187
|
-
function
|
|
1309
|
+
function Go() {
|
|
1188
1310
|
const e = S("svg", {
|
|
1189
1311
|
class: "pluno-pa-widget__scribble-defs",
|
|
1190
1312
|
"aria-hidden": "true",
|
|
@@ -1192,9 +1314,9 @@ function Mo() {
|
|
|
1192
1314
|
width: "0",
|
|
1193
1315
|
height: "0"
|
|
1194
1316
|
}), t = S("defs");
|
|
1195
|
-
return t.appendChild(
|
|
1317
|
+
return t.appendChild(He("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(He("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(He("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1196
1318
|
}
|
|
1197
|
-
function
|
|
1319
|
+
function on(e, t) {
|
|
1198
1320
|
const n = S("svg", {
|
|
1199
1321
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1200
1322
|
viewBox: `0 0 ${t * 26} 36`,
|
|
@@ -1203,7 +1325,7 @@ function Kt(e, t) {
|
|
|
1203
1325
|
focusable: "false"
|
|
1204
1326
|
});
|
|
1205
1327
|
for (let o = 0; o < t; o += 1) {
|
|
1206
|
-
const a =
|
|
1328
|
+
const a = xt[o % xt.length], i = S("g", { transform: `translate(${o * 26} 0)` });
|
|
1207
1329
|
i.appendChild(
|
|
1208
1330
|
S("ellipse", {
|
|
1209
1331
|
cx: a.ellipseCx,
|
|
@@ -1227,7 +1349,7 @@ function Kt(e, t) {
|
|
|
1227
1349
|
}
|
|
1228
1350
|
return n;
|
|
1229
1351
|
}
|
|
1230
|
-
function
|
|
1352
|
+
function He(e, t, n) {
|
|
1231
1353
|
const o = S("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1232
1354
|
return o.appendChild(
|
|
1233
1355
|
S("feTurbulence", {
|
|
@@ -1264,28 +1386,28 @@ function Fe(e, t, n) {
|
|
|
1264
1386
|
})
|
|
1265
1387
|
), o;
|
|
1266
1388
|
}
|
|
1267
|
-
function
|
|
1268
|
-
const t =
|
|
1389
|
+
function Wo(e) {
|
|
1390
|
+
const t = te("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1269
1391
|
return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1270
1392
|
}
|
|
1271
|
-
function
|
|
1272
|
-
const e =
|
|
1393
|
+
function Ho() {
|
|
1394
|
+
const e = te("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1273
1395
|
return e.appendChild(S("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1274
1396
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const e =
|
|
1397
|
+
function an() {
|
|
1398
|
+
const e = te("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1277
1399
|
return e.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1278
1400
|
}
|
|
1279
|
-
function
|
|
1280
|
-
const e =
|
|
1401
|
+
function $o() {
|
|
1402
|
+
const e = te("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1281
1403
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1282
1404
|
S("path", {
|
|
1283
1405
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
1284
1406
|
})
|
|
1285
1407
|
), e;
|
|
1286
1408
|
}
|
|
1287
|
-
function
|
|
1288
|
-
const e =
|
|
1409
|
+
function qo() {
|
|
1410
|
+
const e = te("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1289
1411
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1290
1412
|
S("path", {
|
|
1291
1413
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
@@ -1296,19 +1418,19 @@ function Fo() {
|
|
|
1296
1418
|
})
|
|
1297
1419
|
), e;
|
|
1298
1420
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const e =
|
|
1421
|
+
function jo() {
|
|
1422
|
+
const e = te("0 0 24 24", 18, 18, "currentColor");
|
|
1301
1423
|
return e.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1302
1424
|
}
|
|
1303
|
-
function
|
|
1304
|
-
const e =
|
|
1425
|
+
function Vo() {
|
|
1426
|
+
const e = te("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1305
1427
|
return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
|
|
1306
1428
|
}
|
|
1307
|
-
function
|
|
1308
|
-
const e =
|
|
1429
|
+
function Yo() {
|
|
1430
|
+
const e = te("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1309
1431
|
return e.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1310
1432
|
}
|
|
1311
|
-
function
|
|
1433
|
+
function te(e, t, n, o, a, i) {
|
|
1312
1434
|
const l = {
|
|
1313
1435
|
viewBox: e,
|
|
1314
1436
|
width: String(t),
|
|
@@ -1319,38 +1441,38 @@ function J(e, t, n, o, a, i) {
|
|
|
1319
1441
|
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
|
|
1320
1442
|
}
|
|
1321
1443
|
function S(e, t = {}) {
|
|
1322
|
-
const n = document.createElementNS(
|
|
1444
|
+
const n = document.createElementNS(Xt, e);
|
|
1323
1445
|
for (const [o, a] of Object.entries(t))
|
|
1324
1446
|
n.setAttribute(o, a);
|
|
1325
1447
|
return n;
|
|
1326
1448
|
}
|
|
1327
|
-
function
|
|
1449
|
+
function Pt(e) {
|
|
1328
1450
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1329
1451
|
e.addEventListener(t, (n) => {
|
|
1330
1452
|
n.stopPropagation();
|
|
1331
1453
|
});
|
|
1332
1454
|
}
|
|
1333
|
-
function
|
|
1455
|
+
function Ko(e, t, n) {
|
|
1334
1456
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1335
1457
|
for (const [o, a] of t.entries()) {
|
|
1336
1458
|
const i = document.createElement("div");
|
|
1337
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1459
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Xo(a));
|
|
1338
1460
|
const l = document.createElement("span");
|
|
1339
1461
|
l.textContent = a.name, i.appendChild(l);
|
|
1340
1462
|
const s = document.createElement("button");
|
|
1341
|
-
s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(
|
|
1463
|
+
s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Vo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
|
|
1342
1464
|
}
|
|
1343
1465
|
}
|
|
1344
|
-
function
|
|
1345
|
-
if (
|
|
1466
|
+
function Xo(e) {
|
|
1467
|
+
if (rn(e)) {
|
|
1346
1468
|
const n = document.createElement("img");
|
|
1347
1469
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1348
1470
|
}
|
|
1349
1471
|
const t = document.createElement("span");
|
|
1350
1472
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1351
1473
|
}
|
|
1352
|
-
function
|
|
1353
|
-
if (
|
|
1474
|
+
function Zo(e) {
|
|
1475
|
+
if (rn(e)) {
|
|
1354
1476
|
const a = document.createElement("img");
|
|
1355
1477
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1356
1478
|
}
|
|
@@ -1361,51 +1483,51 @@ function qo(e) {
|
|
|
1361
1483
|
const o = document.createElement("strong");
|
|
1362
1484
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1363
1485
|
}
|
|
1364
|
-
function
|
|
1486
|
+
function rn(e) {
|
|
1365
1487
|
return e.mimeType.startsWith("image/");
|
|
1366
1488
|
}
|
|
1367
|
-
function
|
|
1489
|
+
function Jo(e) {
|
|
1368
1490
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1369
1491
|
}
|
|
1370
|
-
async function
|
|
1492
|
+
async function Qo(e) {
|
|
1371
1493
|
if (!e)
|
|
1372
1494
|
return [];
|
|
1373
1495
|
const t = Array.from(e);
|
|
1374
|
-
if (t.length >
|
|
1375
|
-
throw new Error(`Attach up to ${
|
|
1496
|
+
if (t.length > Te)
|
|
1497
|
+
throw new Error(`Attach up to ${Te} files per message.`);
|
|
1376
1498
|
return Promise.all(
|
|
1377
1499
|
t.map(async (n) => {
|
|
1378
|
-
const o =
|
|
1500
|
+
const o = ea(n);
|
|
1379
1501
|
if (!o)
|
|
1380
1502
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1381
|
-
if (n.size >
|
|
1503
|
+
if (n.size > Jn)
|
|
1382
1504
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1383
1505
|
if (o === "image/gif") {
|
|
1384
|
-
const a = new Uint8Array(await
|
|
1385
|
-
if (
|
|
1506
|
+
const a = new Uint8Array(await sa(n));
|
|
1507
|
+
if (na(a))
|
|
1386
1508
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1387
1509
|
}
|
|
1388
1510
|
return {
|
|
1389
|
-
name: n.name ||
|
|
1511
|
+
name: n.name || Jo(o),
|
|
1390
1512
|
mimeType: o,
|
|
1391
1513
|
sizeBytes: n.size,
|
|
1392
|
-
dataUrl:
|
|
1514
|
+
dataUrl: ta(await da(n), o)
|
|
1393
1515
|
};
|
|
1394
1516
|
})
|
|
1395
1517
|
);
|
|
1396
1518
|
}
|
|
1397
|
-
function
|
|
1398
|
-
if (
|
|
1519
|
+
function ea(e) {
|
|
1520
|
+
if (Vt.has(e.type))
|
|
1399
1521
|
return e.type;
|
|
1400
1522
|
const t = e.name.toLowerCase();
|
|
1401
1523
|
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
1402
1524
|
}
|
|
1403
|
-
function
|
|
1525
|
+
function ta(e, t) {
|
|
1404
1526
|
const n = `data:${t};base64,`;
|
|
1405
1527
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1406
1528
|
}
|
|
1407
|
-
function
|
|
1408
|
-
if (e.length < 14 || !
|
|
1529
|
+
function na(e) {
|
|
1530
|
+
if (e.length < 14 || !oa(e))
|
|
1409
1531
|
return !1;
|
|
1410
1532
|
const t = e[10];
|
|
1411
1533
|
let n = 13;
|
|
@@ -1416,7 +1538,7 @@ function Xo(e) {
|
|
|
1416
1538
|
if (n += 1, a === 59)
|
|
1417
1539
|
return !1;
|
|
1418
1540
|
if (a === 33) {
|
|
1419
|
-
n += 1, n =
|
|
1541
|
+
n += 1, n = Tt(e, n);
|
|
1420
1542
|
continue;
|
|
1421
1543
|
}
|
|
1422
1544
|
if (a !== 44)
|
|
@@ -1428,14 +1550,14 @@ function Xo(e) {
|
|
|
1428
1550
|
const i = e[n + 8];
|
|
1429
1551
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1430
1552
|
return !1;
|
|
1431
|
-
n += 1, n =
|
|
1553
|
+
n += 1, n = Tt(e, n);
|
|
1432
1554
|
}
|
|
1433
1555
|
return !1;
|
|
1434
1556
|
}
|
|
1435
|
-
function
|
|
1557
|
+
function oa(e) {
|
|
1436
1558
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1437
1559
|
}
|
|
1438
|
-
function
|
|
1560
|
+
function Tt(e, t) {
|
|
1439
1561
|
for (; t < e.length; ) {
|
|
1440
1562
|
const n = e[t];
|
|
1441
1563
|
if (t += 1, n === 0)
|
|
@@ -1444,63 +1566,63 @@ function Et(e, t) {
|
|
|
1444
1566
|
}
|
|
1445
1567
|
return t;
|
|
1446
1568
|
}
|
|
1447
|
-
function
|
|
1569
|
+
function Se(e) {
|
|
1448
1570
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1449
1571
|
}
|
|
1450
|
-
function
|
|
1451
|
-
if (!e || !
|
|
1572
|
+
function $e(e, t, n = null) {
|
|
1573
|
+
if (!e || !Xe(t, n)) {
|
|
1452
1574
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1453
1575
|
return;
|
|
1454
1576
|
}
|
|
1455
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1577
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", j(t) || Qe(n) ? e.appendChild(aa(t, n)) : ln(t) && e.appendChild(ia(t));
|
|
1456
1578
|
}
|
|
1457
|
-
function
|
|
1579
|
+
function aa(e, t) {
|
|
1458
1580
|
const n = document.createElement("div");
|
|
1459
1581
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1460
1582
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1461
1583
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1462
1584
|
const i = document.createElement("span");
|
|
1463
|
-
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(
|
|
1585
|
+
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(pn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1464
1586
|
}
|
|
1465
|
-
function
|
|
1587
|
+
function ia(e) {
|
|
1466
1588
|
const t = document.createElement("div");
|
|
1467
1589
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1468
1590
|
const n = document.createElement("strong");
|
|
1469
1591
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1470
1592
|
const o = document.createElement("span");
|
|
1471
|
-
return o.textContent =
|
|
1593
|
+
return o.textContent = la(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(pn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1472
1594
|
}
|
|
1473
|
-
function
|
|
1474
|
-
return e !== null && (
|
|
1595
|
+
function Xe(e, t) {
|
|
1596
|
+
return e !== null && (j(e) || ln(e) || Qe(t));
|
|
1475
1597
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return
|
|
1598
|
+
function Nt(e, t, n) {
|
|
1599
|
+
return Xe(t, n) || ra(t) ? !0 : !Xe(e, n);
|
|
1478
1600
|
}
|
|
1479
|
-
function
|
|
1480
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1601
|
+
function ra(e) {
|
|
1602
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || j(e));
|
|
1481
1603
|
}
|
|
1482
|
-
function
|
|
1604
|
+
function j(e) {
|
|
1483
1605
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1484
1606
|
}
|
|
1485
|
-
function
|
|
1607
|
+
function Qe(e) {
|
|
1486
1608
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1487
1609
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return !
|
|
1610
|
+
function ln(e) {
|
|
1611
|
+
return !j(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1490
1612
|
}
|
|
1491
|
-
function
|
|
1492
|
-
return e.creditsRemaining === null ? null : `${
|
|
1613
|
+
function la(e) {
|
|
1614
|
+
return e.creditsRemaining === null ? null : `${pa(e.creditsRemaining)} credits left`;
|
|
1493
1615
|
}
|
|
1494
|
-
function
|
|
1616
|
+
function pa(e) {
|
|
1495
1617
|
return new Intl.NumberFormat("en-US", {
|
|
1496
1618
|
maximumFractionDigits: 0
|
|
1497
1619
|
}).format(Math.ceil(e));
|
|
1498
1620
|
}
|
|
1499
|
-
function
|
|
1621
|
+
function pn(e, t, n) {
|
|
1500
1622
|
const o = document.createElement("div");
|
|
1501
|
-
return o.className = n, o.appendChild(
|
|
1623
|
+
return o.className = n, o.appendChild(It(t, e.pricingUrl)), o.appendChild(It("Earn credits", e.earnCreditsUrl)), o;
|
|
1502
1624
|
}
|
|
1503
|
-
function
|
|
1625
|
+
function It(e, t) {
|
|
1504
1626
|
const n = document.createElement("button");
|
|
1505
1627
|
if (n.type = "button", e === "Earn credits") {
|
|
1506
1628
|
const o = document.createElement("span");
|
|
@@ -1511,7 +1633,7 @@ function kt(e, t) {
|
|
|
1511
1633
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1512
1634
|
}), n;
|
|
1513
1635
|
}
|
|
1514
|
-
function
|
|
1636
|
+
function sa(e) {
|
|
1515
1637
|
return new Promise((t, n) => {
|
|
1516
1638
|
const o = new FileReader();
|
|
1517
1639
|
o.addEventListener("load", () => {
|
|
@@ -1525,7 +1647,7 @@ function oa(e) {
|
|
|
1525
1647
|
}), o.readAsArrayBuffer(e);
|
|
1526
1648
|
});
|
|
1527
1649
|
}
|
|
1528
|
-
function
|
|
1650
|
+
function da(e) {
|
|
1529
1651
|
return new Promise((t, n) => {
|
|
1530
1652
|
const o = new FileReader();
|
|
1531
1653
|
o.addEventListener("load", () => {
|
|
@@ -1539,132 +1661,132 @@ function aa(e) {
|
|
|
1539
1661
|
}), o.readAsDataURL(e);
|
|
1540
1662
|
});
|
|
1541
1663
|
}
|
|
1542
|
-
function
|
|
1543
|
-
return e.messages.filter((o) => !
|
|
1664
|
+
function Dt(e, t) {
|
|
1665
|
+
return e.messages.filter((o) => !sn(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1544
1666
|
}
|
|
1545
|
-
function
|
|
1546
|
-
const
|
|
1547
|
-
e.replaceChildren(),
|
|
1667
|
+
function ca(e, t, n, o, a, i, l, s, d, c, p, b, x, A, E) {
|
|
1668
|
+
const R = [...i.messages], v = R.filter((w) => !sn(w)), y = e.scrollTop;
|
|
1669
|
+
e.replaceChildren(), cn(n, i.isThinking), a.hidden = !s, s && l !== null && Uo(a, l);
|
|
1548
1670
|
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1549
1671
|
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1672
|
+
const w = document.createElement("div");
|
|
1673
|
+
w.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1552
1674
|
const f = document.createElement("div");
|
|
1553
1675
|
f.className = "pluno-pa-widget__empty-hero";
|
|
1554
|
-
const
|
|
1555
|
-
f.appendChild(
|
|
1556
|
-
const
|
|
1557
|
-
if (
|
|
1558
|
-
for (const
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1561
|
-
A(
|
|
1562
|
-
}),
|
|
1676
|
+
const I = ee("pluno-pa-widget__character--empty", x());
|
|
1677
|
+
f.appendChild(I), w.appendChild(f), w.appendChild(en());
|
|
1678
|
+
const P = document.createElement("div");
|
|
1679
|
+
if (P.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && P.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1680
|
+
for (const M of i.starterPrompts) {
|
|
1681
|
+
const T = document.createElement("button");
|
|
1682
|
+
T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${M}"`, T.addEventListener("click", () => {
|
|
1683
|
+
A(M);
|
|
1684
|
+
}), P.appendChild(T);
|
|
1563
1685
|
}
|
|
1564
1686
|
else
|
|
1565
|
-
for (let
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1687
|
+
for (let M = 0; M < eo; M += 1) {
|
|
1688
|
+
const T = document.createElement("button");
|
|
1689
|
+
T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.innerHTML = " ", P.appendChild(T);
|
|
1568
1690
|
}
|
|
1569
|
-
|
|
1691
|
+
w.appendChild(P), e.appendChild(w), e.appendChild(t);
|
|
1570
1692
|
return;
|
|
1571
1693
|
}
|
|
1572
|
-
let g = null,
|
|
1573
|
-
const
|
|
1574
|
-
if (
|
|
1694
|
+
let g = null, C = null, N = [];
|
|
1695
|
+
const ne = () => {
|
|
1696
|
+
if (N.length === 0)
|
|
1575
1697
|
return !1;
|
|
1576
|
-
const
|
|
1577
|
-
return e.appendChild(
|
|
1698
|
+
const w = _a(N, p, b, x());
|
|
1699
|
+
return e.appendChild(w), g = null, C = w, N = [], !0;
|
|
1578
1700
|
};
|
|
1579
|
-
for (let
|
|
1580
|
-
const f = v[
|
|
1701
|
+
for (let w = 0; w < v.length; w += 1) {
|
|
1702
|
+
const f = v[w];
|
|
1581
1703
|
if (f.role === "tool") {
|
|
1582
|
-
|
|
1704
|
+
N.push(f);
|
|
1583
1705
|
continue;
|
|
1584
1706
|
}
|
|
1585
1707
|
if (f.role === "system")
|
|
1586
1708
|
continue;
|
|
1587
|
-
const
|
|
1588
|
-
if (f.role === "assistant" && !
|
|
1589
|
-
const
|
|
1590
|
-
e.appendChild(
|
|
1591
|
-
}
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1709
|
+
const I = ne(), P = Bt(f.content);
|
|
1710
|
+
if (f.role === "assistant" && !I) {
|
|
1711
|
+
const _ = Ze(x());
|
|
1712
|
+
e.appendChild(_), g = null, C = _;
|
|
1713
|
+
}
|
|
1714
|
+
const M = document.createElement("div");
|
|
1715
|
+
M.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Ot(M, P) : M.textContent = P, f.role === "user" && f.attachments?.length && M.appendChild(ua(f.attachments));
|
|
1716
|
+
const T = document.createElement("div");
|
|
1717
|
+
T.className = "pluno-pa-widget__message-actions", T.appendChild(Mt(P)), M.appendChild(T), e.appendChild(M), g = M, C = null;
|
|
1596
1718
|
}
|
|
1597
|
-
const
|
|
1719
|
+
const ge = ne();
|
|
1598
1720
|
if (i.assistantDraft) {
|
|
1599
|
-
if (!
|
|
1600
|
-
const
|
|
1601
|
-
e.appendChild(
|
|
1602
|
-
}
|
|
1603
|
-
const
|
|
1604
|
-
f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1721
|
+
if (!ge) {
|
|
1722
|
+
const P = Ze(x());
|
|
1723
|
+
e.appendChild(P), g = null, C = P;
|
|
1724
|
+
}
|
|
1725
|
+
const w = Bt(i.assistantDraft), f = document.createElement("div");
|
|
1726
|
+
f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ot(f, w);
|
|
1727
|
+
const I = document.createElement("div");
|
|
1728
|
+
I.className = "pluno-pa-widget__message-actions", I.appendChild(Mt(w)), f.appendChild(I), e.appendChild(f), g = f, C = null;
|
|
1607
1729
|
}
|
|
1608
1730
|
if (i.isThinking && !i.assistantDraft)
|
|
1609
|
-
if (
|
|
1610
|
-
const
|
|
1611
|
-
e.appendChild(
|
|
1731
|
+
if (ge) {
|
|
1732
|
+
const w = dn();
|
|
1733
|
+
e.appendChild(w), g = null, C = w;
|
|
1612
1734
|
} else {
|
|
1613
|
-
const
|
|
1614
|
-
e.appendChild(
|
|
1735
|
+
const w = xa(x());
|
|
1736
|
+
e.appendChild(w), g = null, C = w;
|
|
1615
1737
|
}
|
|
1616
1738
|
if (i.lastError) {
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1739
|
+
const w = document.createElement("div");
|
|
1740
|
+
w.className = "pluno-pa-widget__error", w.textContent = i.lastError, e.appendChild(w), g = w, C = null;
|
|
1619
1741
|
}
|
|
1620
|
-
const
|
|
1621
|
-
if (
|
|
1622
|
-
const
|
|
1623
|
-
isDrafting:
|
|
1624
|
-
error:
|
|
1625
|
-
|
|
1626
|
-
onDraft:
|
|
1627
|
-
onDismiss:
|
|
1628
|
-
onDisable:
|
|
1742
|
+
const L = E && !i.isThinking ? Pn(R) : null;
|
|
1743
|
+
if (E && L && !E.dismissedCandidateIds.has(L.id)) {
|
|
1744
|
+
const w = ga(L, {
|
|
1745
|
+
isDrafting: E.draftingCandidateId === L.id,
|
|
1746
|
+
error: E.error,
|
|
1747
|
+
characterIconOptions: E.characterIconOptions,
|
|
1748
|
+
onDraft: E.onDraft,
|
|
1749
|
+
onDismiss: E.onDismiss,
|
|
1750
|
+
onDisable: E.onDisable
|
|
1629
1751
|
});
|
|
1630
|
-
e.appendChild(
|
|
1752
|
+
e.appendChild(w), E.onSeen(L), g = null, C = w;
|
|
1631
1753
|
}
|
|
1632
|
-
g?.classList.add("pluno-pa-widget__message--bottom-reserve"),
|
|
1633
|
-
}
|
|
1634
|
-
function
|
|
1635
|
-
e.replaceChildren(),
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1754
|
+
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), C?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), d ? fe(e, c) : e.scrollTop = y;
|
|
1755
|
+
}
|
|
1756
|
+
function Rt(e, t, n, o, a, i, l, s) {
|
|
1757
|
+
e.replaceChildren(), cn(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1758
|
+
const d = document.createElement("div");
|
|
1759
|
+
d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1760
|
+
const c = ee("pluno-pa-widget__character--empty", o());
|
|
1761
|
+
d.appendChild(c);
|
|
1640
1762
|
const p = document.createElement("div");
|
|
1641
|
-
if (p.className = "pluno-pa-widget__empty", p.textContent = a,
|
|
1642
|
-
const
|
|
1643
|
-
|
|
1763
|
+
if (p.className = "pluno-pa-widget__empty", p.textContent = a, d.appendChild(p), l) {
|
|
1764
|
+
const b = document.createElement("a");
|
|
1765
|
+
b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, d.appendChild(b);
|
|
1644
1766
|
} else {
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1767
|
+
const b = document.createElement("button");
|
|
1768
|
+
b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => s?.()), d.appendChild(b);
|
|
1647
1769
|
}
|
|
1648
|
-
e.appendChild(
|
|
1770
|
+
e.appendChild(d);
|
|
1649
1771
|
}
|
|
1650
|
-
function
|
|
1772
|
+
function ua(e) {
|
|
1651
1773
|
const t = document.createElement("div");
|
|
1652
1774
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1653
1775
|
for (const n of e)
|
|
1654
|
-
t.appendChild(
|
|
1776
|
+
t.appendChild(Zo(n));
|
|
1655
1777
|
return t;
|
|
1656
1778
|
}
|
|
1657
|
-
function
|
|
1779
|
+
function Mt(e) {
|
|
1658
1780
|
const t = document.createElement("button");
|
|
1659
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1781
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Yo()), t.addEventListener("click", (n) => {
|
|
1660
1782
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1661
1783
|
}), t;
|
|
1662
1784
|
}
|
|
1663
|
-
function
|
|
1785
|
+
function ga(e, t) {
|
|
1664
1786
|
const n = document.createElement("article");
|
|
1665
1787
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1666
1788
|
const o = document.createElement("div");
|
|
1667
|
-
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
|
|
1789
|
+
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(ee("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
|
|
1668
1790
|
const a = document.createElement("div");
|
|
1669
1791
|
a.className = "pluno-pa-widget__share-prompt-copy";
|
|
1670
1792
|
const i = document.createElement("strong");
|
|
@@ -1677,26 +1799,26 @@ function la(e, t) {
|
|
|
1677
1799
|
o.appendChild(a);
|
|
1678
1800
|
const s = document.createElement("div");
|
|
1679
1801
|
s.className = "pluno-pa-widget__share-prompt-actions";
|
|
1680
|
-
const
|
|
1681
|
-
|
|
1682
|
-
const
|
|
1683
|
-
if (
|
|
1802
|
+
const d = document.createElement("div");
|
|
1803
|
+
d.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
1804
|
+
const c = document.createElement("button");
|
|
1805
|
+
if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
|
|
1684
1806
|
t.onDraft(e);
|
|
1685
|
-
}), t.isDrafting ? (
|
|
1686
|
-
s.appendChild(
|
|
1807
|
+
}), t.isDrafting ? (c.appendChild(Je()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
|
|
1808
|
+
s.appendChild(d);
|
|
1687
1809
|
else {
|
|
1688
1810
|
const p = document.createElement("button");
|
|
1689
1811
|
p.type = "button", p.className = "pluno-pa-widget__share-prompt-dismiss", p.setAttribute("aria-label", "Dismiss share prompt"), p.title = "Dismiss", p.textContent = "Dismiss", p.addEventListener("click", () => {
|
|
1690
1812
|
t.onDismiss(e);
|
|
1691
|
-
}),
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1813
|
+
}), d.appendChild(p), s.appendChild(d);
|
|
1814
|
+
const b = document.createElement("button");
|
|
1815
|
+
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1694
1816
|
t.onDisable(e);
|
|
1695
|
-
}), s.appendChild(
|
|
1817
|
+
}), s.appendChild(b);
|
|
1696
1818
|
}
|
|
1697
1819
|
return o.appendChild(s), n.appendChild(o), n;
|
|
1698
1820
|
}
|
|
1699
|
-
function
|
|
1821
|
+
function ha(e, t) {
|
|
1700
1822
|
const n = document.createElement("div");
|
|
1701
1823
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1702
1824
|
v.target === n && t.onClose();
|
|
@@ -1709,55 +1831,55 @@ function pa(e, t) {
|
|
|
1709
1831
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
|
|
1710
1832
|
const s = document.createElement("p");
|
|
1711
1833
|
s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
|
|
1834
|
+
const d = document.createElement("div");
|
|
1835
|
+
d.className = "pluno-pa-widget__share-dialog-step";
|
|
1712
1836
|
const c = document.createElement("div");
|
|
1713
|
-
c.className = "pluno-pa-widget__share-dialog-step";
|
|
1714
|
-
const u = document.createElement("div");
|
|
1715
|
-
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1837
|
+
c.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1716
1838
|
const p = document.createElement("strong");
|
|
1717
|
-
p.textContent = "1) Copy Screenshot",
|
|
1718
|
-
const
|
|
1839
|
+
p.textContent = "1) Copy Screenshot", c.appendChild(p);
|
|
1840
|
+
const b = ma("Copy Screenshot", async () => {
|
|
1719
1841
|
try {
|
|
1720
|
-
return await
|
|
1842
|
+
return await Tn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
|
|
1721
1843
|
} catch {
|
|
1722
1844
|
return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
|
|
1723
1845
|
}
|
|
1724
1846
|
});
|
|
1725
|
-
if (
|
|
1847
|
+
if (c.appendChild(b), d.appendChild(c), e.screenshotDataUrl) {
|
|
1726
1848
|
const v = document.createElement("div");
|
|
1727
1849
|
v.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1728
1850
|
const y = document.createElement("img");
|
|
1729
|
-
y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y),
|
|
1851
|
+
y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), d.appendChild(v);
|
|
1730
1852
|
}
|
|
1731
|
-
o.appendChild(
|
|
1853
|
+
o.appendChild(d), o.appendChild(s);
|
|
1732
1854
|
const x = document.createElement("div");
|
|
1733
1855
|
x.className = "pluno-pa-widget__share-dialog-step";
|
|
1734
1856
|
const A = document.createElement("strong");
|
|
1735
1857
|
A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1738
|
-
const
|
|
1739
|
-
|
|
1740
|
-
for (const v of
|
|
1858
|
+
const E = document.createElement("p");
|
|
1859
|
+
E.className = "pluno-pa-widget__share-dialog-hint", E.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(E);
|
|
1860
|
+
const R = document.createElement("footer");
|
|
1861
|
+
R.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1862
|
+
for (const v of ba(e)) {
|
|
1741
1863
|
const y = document.createElement("a");
|
|
1742
|
-
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(
|
|
1864
|
+
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(fa(v.id)), R.appendChild(y);
|
|
1743
1865
|
}
|
|
1744
|
-
if (x.appendChild(
|
|
1866
|
+
if (x.appendChild(R), o.appendChild(x), t.socialPostRewardsUrl) {
|
|
1745
1867
|
const v = document.createElement("div");
|
|
1746
1868
|
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1747
1869
|
const y = document.createElement("strong");
|
|
1748
1870
|
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
|
|
1749
1871
|
const h = document.createElement("a");
|
|
1750
|
-
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(
|
|
1872
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(wa()), v.appendChild(h), o.appendChild(v);
|
|
1751
1873
|
}
|
|
1752
1874
|
return n.appendChild(o), n;
|
|
1753
1875
|
}
|
|
1754
|
-
function
|
|
1876
|
+
function ma(e, t) {
|
|
1755
1877
|
const n = document.createElement("button");
|
|
1756
1878
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1757
1879
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1758
1880
|
}), n;
|
|
1759
1881
|
}
|
|
1760
|
-
function
|
|
1882
|
+
function ba(e) {
|
|
1761
1883
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1762
1884
|
return [
|
|
1763
1885
|
{
|
|
@@ -1777,56 +1899,56 @@ function da(e) {
|
|
|
1777
1899
|
}
|
|
1778
1900
|
];
|
|
1779
1901
|
}
|
|
1780
|
-
function
|
|
1902
|
+
function fa(e) {
|
|
1781
1903
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1782
|
-
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (
|
|
1904
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), B(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), B(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), B(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
|
|
1783
1905
|
}
|
|
1784
|
-
function
|
|
1906
|
+
function B(e, t, n) {
|
|
1785
1907
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1786
1908
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1787
1909
|
}
|
|
1788
|
-
function
|
|
1910
|
+
function wa() {
|
|
1789
1911
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1790
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
1912
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1791
1913
|
}
|
|
1792
|
-
function
|
|
1793
|
-
return e.role === "tool" && e.toolName ===
|
|
1914
|
+
function sn(e) {
|
|
1915
|
+
return e.role === "tool" && e.toolName === $t;
|
|
1794
1916
|
}
|
|
1795
|
-
function
|
|
1917
|
+
function Bt(e) {
|
|
1796
1918
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1797
1919
|
}
|
|
1798
|
-
function
|
|
1920
|
+
function _a(e, t, n, o) {
|
|
1799
1921
|
const a = document.createElement("article");
|
|
1800
|
-
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(
|
|
1801
|
-
const i = document.createElement("details"), l =
|
|
1922
|
+
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ee("pluno-pa-widget__character--tool-group", o));
|
|
1923
|
+
const i = document.createElement("details"), l = va(e);
|
|
1802
1924
|
i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
|
|
1803
1925
|
a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
|
|
1804
1926
|
});
|
|
1805
1927
|
const s = document.createElement("summary");
|
|
1806
|
-
s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(
|
|
1807
|
-
const
|
|
1808
|
-
if (
|
|
1928
|
+
s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Je());
|
|
1929
|
+
const c = document.createElement("span");
|
|
1930
|
+
if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", s.appendChild(c), i.appendChild(s), e.length > 0) {
|
|
1809
1931
|
const p = document.createElement("div");
|
|
1810
1932
|
p.className = "pluno-pa-widget__tool-lines";
|
|
1811
|
-
for (const
|
|
1933
|
+
for (const b of e) {
|
|
1812
1934
|
const x = document.createElement("div");
|
|
1813
|
-
x.className = "pluno-pa-widget__tool-line",
|
|
1935
|
+
x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(Je());
|
|
1814
1936
|
const A = document.createElement("span");
|
|
1815
|
-
A.textContent =
|
|
1937
|
+
A.textContent = b.content || "Run tool", x.appendChild(A), p.appendChild(x);
|
|
1816
1938
|
}
|
|
1817
1939
|
i.appendChild(p);
|
|
1818
1940
|
}
|
|
1819
1941
|
return a.appendChild(i), a;
|
|
1820
1942
|
}
|
|
1821
|
-
function
|
|
1943
|
+
function Ze(e) {
|
|
1822
1944
|
const t = document.createElement("article");
|
|
1823
|
-
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
1945
|
+
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ee("pluno-pa-widget__character--tool-group", e)), t;
|
|
1824
1946
|
}
|
|
1825
|
-
function
|
|
1826
|
-
const t =
|
|
1827
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1947
|
+
function xa(e) {
|
|
1948
|
+
const t = Ze(e);
|
|
1949
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(dn()), t;
|
|
1828
1950
|
}
|
|
1829
|
-
function
|
|
1951
|
+
function dn() {
|
|
1830
1952
|
const e = document.createElement("div");
|
|
1831
1953
|
e.className = "pluno-pa-widget__status";
|
|
1832
1954
|
const t = document.createElement("span");
|
|
@@ -1834,17 +1956,17 @@ function tn() {
|
|
|
1834
1956
|
const n = document.createElement("span");
|
|
1835
1957
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1836
1958
|
}
|
|
1837
|
-
function
|
|
1959
|
+
function va(e) {
|
|
1838
1960
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1839
1961
|
}
|
|
1840
|
-
function
|
|
1962
|
+
function Je() {
|
|
1841
1963
|
const e = document.createElement("span");
|
|
1842
1964
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1843
1965
|
}
|
|
1844
|
-
function
|
|
1845
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1966
|
+
function cn(e, t) {
|
|
1967
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? jo() : an());
|
|
1846
1968
|
}
|
|
1847
|
-
function
|
|
1969
|
+
function Ot(e, t) {
|
|
1848
1970
|
const n = t.replace(/\r\n/g, `
|
|
1849
1971
|
`).split(`
|
|
1850
1972
|
`);
|
|
@@ -1856,49 +1978,49 @@ function Nt(e, t) {
|
|
|
1856
1978
|
continue;
|
|
1857
1979
|
}
|
|
1858
1980
|
if (a.match(/^```(\w+)?\s*$/)) {
|
|
1859
|
-
const
|
|
1981
|
+
const c = [];
|
|
1860
1982
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1861
|
-
|
|
1983
|
+
c.push(n[o]), o += 1;
|
|
1862
1984
|
o += o < n.length ? 1 : 0;
|
|
1863
|
-
const p = document.createElement("pre"),
|
|
1864
|
-
|
|
1865
|
-
`), p.appendChild(
|
|
1985
|
+
const p = document.createElement("pre"), b = document.createElement("code");
|
|
1986
|
+
b.textContent = c.join(`
|
|
1987
|
+
`), p.appendChild(b), e.appendChild(p);
|
|
1866
1988
|
continue;
|
|
1867
1989
|
}
|
|
1868
1990
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1869
1991
|
if (l) {
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1992
|
+
const c = document.createElement(`h${l[1].length + 2}`);
|
|
1993
|
+
ke(c, l[2]), e.appendChild(c), o += 1;
|
|
1872
1994
|
continue;
|
|
1873
1995
|
}
|
|
1874
1996
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1875
|
-
const
|
|
1997
|
+
const c = document.createElement("ul");
|
|
1876
1998
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1877
1999
|
const p = document.createElement("li");
|
|
1878
|
-
|
|
2000
|
+
ke(p, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(p), o += 1;
|
|
1879
2001
|
}
|
|
1880
|
-
e.appendChild(
|
|
2002
|
+
e.appendChild(c);
|
|
1881
2003
|
continue;
|
|
1882
2004
|
}
|
|
1883
2005
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1884
|
-
const
|
|
2006
|
+
const c = document.createElement("ol");
|
|
1885
2007
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1886
2008
|
const p = document.createElement("li");
|
|
1887
|
-
|
|
2009
|
+
ke(p, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(p), o += 1;
|
|
1888
2010
|
}
|
|
1889
|
-
e.appendChild(
|
|
2011
|
+
e.appendChild(c);
|
|
1890
2012
|
continue;
|
|
1891
2013
|
}
|
|
1892
2014
|
const s = [a];
|
|
1893
2015
|
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]); )
|
|
1894
2016
|
s.push(n[o]), o += 1;
|
|
1895
|
-
const
|
|
1896
|
-
s.forEach((
|
|
1897
|
-
p > 0 &&
|
|
1898
|
-
}), e.appendChild(
|
|
2017
|
+
const d = document.createElement("p");
|
|
2018
|
+
s.forEach((c, p) => {
|
|
2019
|
+
p > 0 && d.appendChild(document.createElement("br")), ke(d, c);
|
|
2020
|
+
}), e.appendChild(d);
|
|
1899
2021
|
}
|
|
1900
2022
|
}
|
|
1901
|
-
function
|
|
2023
|
+
function ke(e, t) {
|
|
1902
2024
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1903
2025
|
let o = 0;
|
|
1904
2026
|
for (const a of t.matchAll(n)) {
|
|
@@ -1916,9 +2038,9 @@ function Ee(e, t) {
|
|
|
1916
2038
|
s.textContent = l.slice(1, -1), e.appendChild(s);
|
|
1917
2039
|
} else {
|
|
1918
2040
|
const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1919
|
-
if (s &&
|
|
1920
|
-
const
|
|
1921
|
-
|
|
2041
|
+
if (s && ya(s[2])) {
|
|
2042
|
+
const d = document.createElement("a");
|
|
2043
|
+
d.href = s[2], d.target = "_top", d.rel = "noreferrer", d.textContent = s[1], e.appendChild(d);
|
|
1922
2044
|
} else
|
|
1923
2045
|
e.appendChild(document.createTextNode(l));
|
|
1924
2046
|
}
|
|
@@ -1926,7 +2048,7 @@ function Ee(e, t) {
|
|
|
1926
2048
|
}
|
|
1927
2049
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1928
2050
|
}
|
|
1929
|
-
function
|
|
2051
|
+
function ya(e) {
|
|
1930
2052
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1931
2053
|
return !0;
|
|
1932
2054
|
try {
|
|
@@ -1936,8 +2058,8 @@ function fa(e) {
|
|
|
1936
2058
|
return !1;
|
|
1937
2059
|
}
|
|
1938
2060
|
}
|
|
1939
|
-
function
|
|
1940
|
-
if (
|
|
2061
|
+
function Ut(e, t) {
|
|
2062
|
+
if (Ca(e))
|
|
1941
2063
|
return;
|
|
1942
2064
|
const n = `
|
|
1943
2065
|
:host {
|
|
@@ -1990,7 +2112,7 @@ function It(e, t) {
|
|
|
1990
2112
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1991
2113
|
position: fixed;
|
|
1992
2114
|
z-index: 2147483645;
|
|
1993
|
-
font-family: ${
|
|
2115
|
+
font-family: ${q.fontFamily};
|
|
1994
2116
|
font-size: 14px;
|
|
1995
2117
|
color: var(--pluno-pa-text);
|
|
1996
2118
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -2742,7 +2864,7 @@ function It(e, t) {
|
|
|
2742
2864
|
place-items: center;
|
|
2743
2865
|
padding: 18px;
|
|
2744
2866
|
background: rgba(24, 24, 27, 0.28);
|
|
2745
|
-
font-family: var(--pluno-pa-font, ${
|
|
2867
|
+
font-family: var(--pluno-pa-font, ${q.fontFamily});
|
|
2746
2868
|
color: var(--pluno-pa-text);
|
|
2747
2869
|
}
|
|
2748
2870
|
.pluno-pa-widget__share-dialog {
|
|
@@ -3760,28 +3882,28 @@ function It(e, t) {
|
|
|
3760
3882
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3761
3883
|
}
|
|
3762
3884
|
`;
|
|
3763
|
-
if (
|
|
3885
|
+
if (Ea(e, n))
|
|
3764
3886
|
return;
|
|
3765
3887
|
const o = e.ownerDocument.createElement("style");
|
|
3766
|
-
o.id =
|
|
3888
|
+
o.id = Zt, o.textContent = n, e.appendChild(o), un(e);
|
|
3767
3889
|
}
|
|
3768
|
-
function
|
|
3769
|
-
return e.getElementById(
|
|
3890
|
+
function Ca(e) {
|
|
3891
|
+
return e.getElementById(Zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Jt) === "true";
|
|
3770
3892
|
}
|
|
3771
|
-
function
|
|
3772
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3893
|
+
function un(e) {
|
|
3894
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Jt, "true");
|
|
3773
3895
|
}
|
|
3774
|
-
function
|
|
3896
|
+
function Ea(e, t) {
|
|
3775
3897
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3776
3898
|
return !1;
|
|
3777
3899
|
try {
|
|
3778
3900
|
const n = new CSSStyleSheet();
|
|
3779
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3901
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], un(e), !0;
|
|
3780
3902
|
} catch {
|
|
3781
3903
|
return !1;
|
|
3782
3904
|
}
|
|
3783
3905
|
}
|
|
3784
|
-
async function
|
|
3906
|
+
async function Sa() {
|
|
3785
3907
|
return document.body ? document.body : await new Promise((e) => {
|
|
3786
3908
|
const t = new MutationObserver(() => {
|
|
3787
3909
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3789,49 +3911,49 @@ async function _a() {
|
|
|
3789
3911
|
t.observe(document.documentElement, { childList: !0 });
|
|
3790
3912
|
});
|
|
3791
3913
|
}
|
|
3792
|
-
function
|
|
3914
|
+
function gn(e) {
|
|
3793
3915
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3794
3916
|
}
|
|
3795
|
-
function
|
|
3917
|
+
function ka(e) {
|
|
3796
3918
|
try {
|
|
3797
|
-
const t = window.localStorage.getItem(
|
|
3919
|
+
const t = window.localStorage.getItem(gn(e));
|
|
3798
3920
|
if (!t)
|
|
3799
|
-
return
|
|
3921
|
+
return Ft();
|
|
3800
3922
|
const n = JSON.parse(t);
|
|
3801
3923
|
return {
|
|
3802
3924
|
isOpen: n.isOpen === !0,
|
|
3803
3925
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3804
3926
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3805
|
-
launcherPosition:
|
|
3806
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3927
|
+
launcherPosition: Ta(n.launcherPosition) ? n.launcherPosition : null,
|
|
3928
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-qt) : [],
|
|
3807
3929
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3808
3930
|
};
|
|
3809
3931
|
} catch {
|
|
3810
|
-
return
|
|
3932
|
+
return Ft();
|
|
3811
3933
|
}
|
|
3812
3934
|
}
|
|
3813
|
-
async function
|
|
3935
|
+
async function La(e) {
|
|
3814
3936
|
if (e.loadSharePromptsDisabled)
|
|
3815
3937
|
return e.loadSharePromptsDisabled();
|
|
3816
3938
|
try {
|
|
3817
|
-
return window.localStorage.getItem(
|
|
3939
|
+
return window.localStorage.getItem(jt) === "true";
|
|
3818
3940
|
} catch {
|
|
3819
3941
|
return !1;
|
|
3820
3942
|
}
|
|
3821
3943
|
}
|
|
3822
|
-
function
|
|
3944
|
+
function Aa(e, t) {
|
|
3823
3945
|
if (e.persistSharePromptsDisabled) {
|
|
3824
3946
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3825
3947
|
});
|
|
3826
3948
|
return;
|
|
3827
3949
|
}
|
|
3828
3950
|
try {
|
|
3829
|
-
t && window.localStorage.setItem(
|
|
3951
|
+
t && window.localStorage.setItem(jt, "true");
|
|
3830
3952
|
} catch {
|
|
3831
3953
|
return;
|
|
3832
3954
|
}
|
|
3833
3955
|
}
|
|
3834
|
-
function
|
|
3956
|
+
function Ft() {
|
|
3835
3957
|
return {
|
|
3836
3958
|
isOpen: !1,
|
|
3837
3959
|
composerValue: "",
|
|
@@ -3841,43 +3963,43 @@ function Dt() {
|
|
|
3841
3963
|
sharePromptsDisabled: !1
|
|
3842
3964
|
};
|
|
3843
3965
|
}
|
|
3844
|
-
function
|
|
3966
|
+
function Pa(e, t) {
|
|
3845
3967
|
try {
|
|
3846
|
-
window.localStorage.setItem(
|
|
3968
|
+
window.localStorage.setItem(gn(e), JSON.stringify(t));
|
|
3847
3969
|
} catch {
|
|
3848
3970
|
return;
|
|
3849
3971
|
}
|
|
3850
3972
|
}
|
|
3851
|
-
function
|
|
3973
|
+
function Ta(e) {
|
|
3852
3974
|
if (!e || typeof e != "object")
|
|
3853
3975
|
return !1;
|
|
3854
3976
|
const t = e;
|
|
3855
3977
|
return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
|
|
3856
3978
|
}
|
|
3857
|
-
const
|
|
3858
|
-
function
|
|
3979
|
+
const zt = /* @__PURE__ */ new WeakSet();
|
|
3980
|
+
function Na(e) {
|
|
3859
3981
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3860
3982
|
}
|
|
3861
|
-
function
|
|
3983
|
+
function Gt(e) {
|
|
3862
3984
|
const t = e.pathname.split("/");
|
|
3863
3985
|
return t[t.length - 1] ?? "";
|
|
3864
3986
|
}
|
|
3865
|
-
function
|
|
3987
|
+
function Ia(e, t) {
|
|
3866
3988
|
const n = new URL(e.src, document.baseURI);
|
|
3867
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3989
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Gt(n) === Gt(t);
|
|
3868
3990
|
}
|
|
3869
|
-
class
|
|
3991
|
+
class Z extends EventTarget {
|
|
3870
3992
|
constructor(t, n) {
|
|
3871
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3872
|
-
this.readyState =
|
|
3873
|
-
}), this.addPreviewListener(
|
|
3993
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Vn, () => {
|
|
3994
|
+
this.readyState = Z.OPEN, this.dispatchEvent(new Event("open"));
|
|
3995
|
+
}), this.addPreviewListener(Yn, (o) => {
|
|
3874
3996
|
const a = o;
|
|
3875
3997
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3876
|
-
}), this.addPreviewListener(
|
|
3877
|
-
this.readyState =
|
|
3878
|
-
}), this.addPreviewListener(
|
|
3998
|
+
}), this.addPreviewListener(Kn, () => {
|
|
3999
|
+
this.readyState = Z.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
4000
|
+
}), this.addPreviewListener(Xn, (o) => {
|
|
3879
4001
|
const a = o;
|
|
3880
|
-
this.readyState =
|
|
4002
|
+
this.readyState = Z.CLOSED, this.dispatchEvent(
|
|
3881
4003
|
new CloseEvent("close", {
|
|
3882
4004
|
code: a.detail?.code ?? 1e3,
|
|
3883
4005
|
reason: a.detail?.reason ?? "",
|
|
@@ -3885,7 +4007,7 @@ class Y extends EventTarget {
|
|
|
3885
4007
|
})
|
|
3886
4008
|
), this.cleanup();
|
|
3887
4009
|
}), window.dispatchEvent(
|
|
3888
|
-
new CustomEvent(
|
|
4010
|
+
new CustomEvent(Le($n, this.channelId), {
|
|
3889
4011
|
detail: { socketId: this.socketId, url: t }
|
|
3890
4012
|
})
|
|
3891
4013
|
);
|
|
@@ -3900,27 +4022,27 @@ class Y extends EventTarget {
|
|
|
3900
4022
|
extensions = "";
|
|
3901
4023
|
binaryType = "blob";
|
|
3902
4024
|
bufferedAmount = 0;
|
|
3903
|
-
readyState =
|
|
3904
|
-
socketId =
|
|
4025
|
+
readyState = Z.CONNECTING;
|
|
4026
|
+
socketId = Da();
|
|
3905
4027
|
listeners = /* @__PURE__ */ new Map();
|
|
3906
4028
|
send(t) {
|
|
3907
|
-
if (this.readyState !==
|
|
4029
|
+
if (this.readyState !== Z.OPEN)
|
|
3908
4030
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3909
4031
|
window.dispatchEvent(
|
|
3910
|
-
new CustomEvent(
|
|
4032
|
+
new CustomEvent(Le(qn, this.channelId), {
|
|
3911
4033
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3912
4034
|
})
|
|
3913
4035
|
);
|
|
3914
4036
|
}
|
|
3915
4037
|
close(t, n) {
|
|
3916
|
-
this.readyState !==
|
|
3917
|
-
new CustomEvent(
|
|
4038
|
+
this.readyState !== Z.CLOSED && (this.readyState = Z.CLOSING, window.dispatchEvent(
|
|
4039
|
+
new CustomEvent(Le(jn, this.channelId), {
|
|
3918
4040
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3919
4041
|
})
|
|
3920
4042
|
), this.cleanup());
|
|
3921
4043
|
}
|
|
3922
4044
|
addPreviewListener(t, n) {
|
|
3923
|
-
const o =
|
|
4045
|
+
const o = Le(t, this.channelId), a = (i) => {
|
|
3924
4046
|
i.detail?.socketId === this.socketId && n(i);
|
|
3925
4047
|
};
|
|
3926
4048
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -3931,36 +4053,36 @@ class Y extends EventTarget {
|
|
|
3931
4053
|
this.listeners.clear();
|
|
3932
4054
|
}
|
|
3933
4055
|
}
|
|
3934
|
-
function
|
|
3935
|
-
const e = window.sessionStorage.getItem(
|
|
4056
|
+
function Da() {
|
|
4057
|
+
const e = window.sessionStorage.getItem(wt);
|
|
3936
4058
|
if (e)
|
|
3937
4059
|
return e;
|
|
3938
4060
|
const t = crypto.randomUUID();
|
|
3939
|
-
return window.sessionStorage.setItem(
|
|
4061
|
+
return window.sessionStorage.setItem(wt, t), t;
|
|
3940
4062
|
}
|
|
3941
|
-
function
|
|
4063
|
+
function Le(e, t) {
|
|
3942
4064
|
return `${e}:${t}`;
|
|
3943
4065
|
}
|
|
3944
|
-
function
|
|
4066
|
+
function Ra(e) {
|
|
3945
4067
|
const t = document.currentScript;
|
|
3946
4068
|
if (t instanceof HTMLScriptElement)
|
|
3947
4069
|
return [t];
|
|
3948
4070
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3949
4071
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3950
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
4072
|
+
(a) => a instanceof HTMLScriptElement && Na(a) && Ia(a, o)
|
|
3951
4073
|
);
|
|
3952
4074
|
}
|
|
3953
|
-
function
|
|
3954
|
-
for (const t of
|
|
3955
|
-
if (
|
|
4075
|
+
function Ma(e) {
|
|
4076
|
+
for (const t of Ra(e)) {
|
|
4077
|
+
if (zt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3956
4078
|
continue;
|
|
3957
|
-
|
|
4079
|
+
zt.add(t);
|
|
3958
4080
|
const n = t.dataset.plunoPreviewChannel;
|
|
3959
|
-
|
|
4081
|
+
bo({
|
|
3960
4082
|
token: t.dataset.plunoToken,
|
|
3961
4083
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3962
4084
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3963
|
-
webSocketFactory: n ?
|
|
4085
|
+
webSocketFactory: n ? mo(n) : void 0,
|
|
3964
4086
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3965
4087
|
accentColor: t.dataset.plunoAccentColor,
|
|
3966
4088
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3972,8 +4094,8 @@ function Pa(e) {
|
|
|
3972
4094
|
});
|
|
3973
4095
|
}
|
|
3974
4096
|
}
|
|
3975
|
-
|
|
4097
|
+
Ma(import.meta.url);
|
|
3976
4098
|
export {
|
|
3977
|
-
|
|
3978
|
-
|
|
4099
|
+
mo as createProductAgentPreviewBridgeWebSocketFactory,
|
|
4100
|
+
bo as mountPlunoProductAgentWidget
|
|
3979
4101
|
};
|