@pluno/product-agent-web 0.1.12 → 0.1.14

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.
@@ -1,7 +1,7 @@
1
- import { PlunoProductAgent as se } from "./product-agent-sdk.js";
2
- const de = "#7c3aed";
3
- function ce(t) {
4
- const e = ue(t);
1
+ import { PlunoProductAgent as xe } from "./product-agent-sdk.js";
2
+ const ye = "#7c3aed";
3
+ function ve(t) {
4
+ const e = Le(t);
5
5
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
6
6
  <defs>
7
7
  <linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
@@ -75,11 +75,64 @@ function ce(t) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- function j(t) {
79
- return `data:image/svg+xml,${encodeURIComponent(ce(t))}`;
78
+ function ke(t) {
79
+ return `data:image/svg+xml,${encodeURIComponent(ve(t))}`;
80
80
  }
81
- function ue(t) {
82
- const e = ge(t), o = me(ie(e));
81
+ const N = "#2c2a1e", J = [253, 250, 241], Q = 3.5;
82
+ function he(t) {
83
+ const e = be(t);
84
+ if (ee(M(e), J) >= Q)
85
+ return e;
86
+ let n = M(e);
87
+ const a = M(N);
88
+ for (let r = 0; r < 6; r += 1)
89
+ if (n = Te(n, a, 0.22), ee(n, J) >= Q)
90
+ return W(n);
91
+ return W(n);
92
+ }
93
+ function Ce(t) {
94
+ const e = he(t), o = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
95
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
96
+ <defs>
97
+ <clipPath id="scribbleBoltClip">
98
+ <path d="${o}"/>
99
+ </clipPath>
100
+ <filter id="scribbleBoltWobble" x="-10%" y="-10%" width="120%" height="120%" color-interpolation-filters="sRGB">
101
+ <feTurbulence type="fractalNoise" baseFrequency="0.011" numOctaves="3" seed="7" result="noise"/>
102
+ <feDisplacementMap in="SourceGraphic" in2="noise" scale="16" xChannelSelector="R" yChannelSelector="G"/>
103
+ </filter>
104
+ </defs>
105
+ <g filter="url(#scribbleBoltWobble)">
106
+ <g clip-path="url(#scribbleBoltClip)">
107
+ <path d="${Ee()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
108
+ </g>
109
+ <path d="${o}" fill="none" stroke="${N}" stroke-width="18" stroke-linejoin="round"/>
110
+ <g transform="rotate(-2 528 463)">
111
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${N}" stroke-width="13"/>
112
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${N}"/>
113
+ <circle cx="557" cy="447" r="16" fill="#ffffff"/>
114
+ </g>
115
+ <g transform="rotate(2 717 462)">
116
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${N}" stroke-width="13"/>
117
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${N}"/>
118
+ <circle cx="728" cy="447" r="16" fill="#ffffff"/>
119
+ </g>
120
+ </g>
121
+ </svg>`;
122
+ }
123
+ function Se(t) {
124
+ return `data:image/svg+xml,${encodeURIComponent(Ce(t))}`;
125
+ }
126
+ function Ee() {
127
+ let o = "M 280 120", n = !1, a = 0;
128
+ for (let r = 150; r <= 1170; r += 62) {
129
+ const i = (a % 3 - 1) * 18, d = n ? 280 - i : 1020 + i;
130
+ o += ` L ${d} ${r}`, n = !n, a += 1;
131
+ }
132
+ return o;
133
+ }
134
+ function Le(t) {
135
+ const e = be(t), o = H(M(e));
83
136
  return o > 0.86 ? {
84
137
  top: "#ffffff",
85
138
  middle: "#f6f6f6",
@@ -103,84 +156,98 @@ function ue(t) {
103
156
  inner: "#4b4b4b",
104
157
  shadow: "#000000"
105
158
  } : {
106
- top: y(e, 0.28, -0.03),
107
- middle: y(e, 0.08, 0.04),
108
- bottom: y(e, -0.1, 0.02),
109
- edgeStart: y(e, 0.08, 0.08),
110
- edgeMiddle: y(e, -0.08, 0.08),
111
- edgeEnd: y(e, -0.18, 0.05),
112
- glow: y(e, 0.32, -0.12),
113
- highlight: y(e, 0.38, -0.18),
114
- inner: y(e, 0.24, -0.1),
115
- shadow: y(e, -0.25, -0.08)
159
+ top: v(e, 0.28, -0.03),
160
+ middle: v(e, 0.08, 0.04),
161
+ bottom: v(e, -0.1, 0.02),
162
+ edgeStart: v(e, 0.08, 0.08),
163
+ edgeMiddle: v(e, -0.08, 0.08),
164
+ edgeEnd: v(e, -0.18, 0.05),
165
+ glow: v(e, 0.32, -0.12),
166
+ highlight: v(e, 0.38, -0.18),
167
+ inner: v(e, 0.24, -0.1),
168
+ shadow: v(e, -0.25, -0.08)
116
169
  };
117
170
  }
118
- function ge(t) {
171
+ function be(t) {
119
172
  const e = t.trim();
120
- return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : de;
173
+ return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : ye;
121
174
  }
122
- function ie(t) {
175
+ function M(t) {
123
176
  return [
124
177
  Number.parseInt(t.slice(1, 3), 16),
125
178
  Number.parseInt(t.slice(3, 5), 16),
126
179
  Number.parseInt(t.slice(5, 7), 16)
127
180
  ];
128
181
  }
129
- function he([t, e, o]) {
182
+ function W([t, e, o]) {
130
183
  const n = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
131
184
  return `#${n(t)}${n(e)}${n(o)}`;
132
185
  }
133
- function me([t, e, o]) {
186
+ function H([t, e, o]) {
134
187
  const n = (a) => {
135
- const i = a / 255;
136
- return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
188
+ const r = a / 255;
189
+ return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
137
190
  };
138
191
  return 0.2126 * n(t) + 0.7152 * n(e) + 0.0722 * n(o);
139
192
  }
140
- function y(t, e, o) {
141
- const [n, a, i] = fe(ie(t));
142
- return he(we(n, q(a + o), q(i + e)));
193
+ function ee(t, e) {
194
+ const o = H(t), n = H(e), [a, r] = o > n ? [o, n] : [n, o];
195
+ return (a + 0.05) / (r + 0.05);
143
196
  }
144
- function fe([t, e, o]) {
145
- const n = t / 255, a = e / 255, i = o / 255, l = Math.max(n, a, i), d = Math.min(n, a, i), g = (l + d) / 2;
146
- if (l === d)
147
- return [0, 0, g];
148
- const p = l - d, c = g > 0.5 ? p / (2 - l - d) : p / (l + d);
149
- return [(l === n ? (a - i) / p + (a < i ? 6 : 0) : l === a ? (i - n) / p + 2 : (n - a) / p + 4) / 6, c, g];
197
+ function Te(t, e, o) {
198
+ const n = V(o);
199
+ return [
200
+ t[0] + (e[0] - t[0]) * n,
201
+ t[1] + (e[1] - t[1]) * n,
202
+ t[2] + (e[2] - t[2]) * n
203
+ ];
204
+ }
205
+ function v(t, e, o) {
206
+ const [n, a, r] = Ne(M(t));
207
+ return W(Pe(n, V(a + o), V(r + e)));
208
+ }
209
+ function Ne([t, e, o]) {
210
+ const n = t / 255, a = e / 255, r = o / 255, i = Math.max(n, a, r), d = Math.min(n, a, r), u = (i + d) / 2;
211
+ if (i === d)
212
+ return [0, 0, u];
213
+ const p = i - d, g = u > 0.5 ? p / (2 - i - d) : p / (i + d);
214
+ return [(i === n ? (a - r) / p + (a < r ? 6 : 0) : i === a ? (r - n) / p + 2 : (n - a) / p + 4) / 6, g, u];
150
215
  }
151
- function we(t, e, o) {
216
+ function Pe(t, e, o) {
152
217
  if (e === 0)
153
218
  return [o * 255, o * 255, o * 255];
154
219
  const n = o < 0.5 ? o * (1 + e) : o + e - o * e, a = 2 * o - n;
155
220
  return [
156
- F(a, n, t + 1 / 3) * 255,
157
- F(a, n, t) * 255,
158
- F(a, n, t - 1 / 3) * 255
221
+ B(a, n, t + 1 / 3) * 255,
222
+ B(a, n, t) * 255,
223
+ B(a, n, t - 1 / 3) * 255
159
224
  ];
160
225
  }
161
- function F(t, e, o) {
226
+ function B(t, e, o) {
162
227
  let n = o;
163
228
  return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
164
229
  }
165
- function q(t) {
230
+ function V(t) {
166
231
  return Math.max(0, Math.min(1, t));
167
232
  }
168
- const _e = "product-agent:sdk-preview-socket-connect", be = "product-agent:sdk-preview-socket-send", xe = "product-agent:sdk-preview-socket-close", ve = "product-agent:sdk-preview-socket-open", ye = "product-agent:sdk-preview-socket-message", ke = "product-agent:sdk-preview-socket-error", Ce = "product-agent:sdk-preview-socket-closed", Y = "product-agent:sdk-preview-socket-id", Ee = "product-agent:preview-diagnostic", T = {
233
+ const Ae = "product-agent:sdk-preview-socket-connect", Ie = "product-agent:sdk-preview-socket-send", Me = "product-agent:sdk-preview-socket-close", Oe = "product-agent:sdk-preview-socket-open", $e = "product-agent:sdk-preview-socket-message", De = "product-agent:sdk-preview-socket-error", Fe = "product-agent:sdk-preview-socket-closed", te = "product-agent:sdk-preview-socket-id", Re = "product-agent:preview-diagnostic", T = {
169
234
  launcherLabel: "Ask for anything...",
170
235
  accentColor: "#7c3aed",
171
236
  colorScheme: "light",
172
237
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif',
238
+ scribbleStyle: !1,
173
239
  position: "bottom-right"
174
- };
175
- function Se(t) {
240
+ }, ne = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Ge = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', oe = "pluno-pa-scribble-font";
241
+ function ze(t) {
176
242
  return (e) => new C(e, t);
177
243
  }
178
- async function Le(t = {}) {
244
+ async function Be(t = {}) {
179
245
  const e = {
180
246
  launcherLabel: t.launcherLabel ?? T.launcherLabel,
181
247
  accentColor: t.accentColor ?? T.accentColor,
182
248
  colorScheme: t.colorScheme ?? T.colorScheme,
183
249
  fontFamily: t.fontFamily ?? T.fontFamily,
250
+ scribbleStyle: t.scribbleStyle ?? T.scribbleStyle,
184
251
  position: t.position ?? T.position,
185
252
  token: t.token,
186
253
  tokenProvider: t.tokenProvider,
@@ -189,7 +256,7 @@ async function Le(t = {}) {
189
256
  initialStarterPrompts: t.initialStarterPrompts,
190
257
  webSocketFactory: t.webSocketFactory
191
258
  };
192
- N("web-sdk.widget", "Mounting widget with merged options", {
259
+ A("web-sdk.widget", "Mounting widget with merged options", {
193
260
  accentColor: e.accentColor,
194
261
  colorScheme: e.colorScheme,
195
262
  fontFamily: e.fontFamily,
@@ -204,11 +271,33 @@ async function Le(t = {}) {
204
271
  o.className = "pluno-pa-widget-host";
205
272
  const n = o.attachShadow({ mode: "open" }), a = document.createElement("div");
206
273
  a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`;
207
- let i = j(e.accentColor);
274
+ let r = ae(e.accentColor, e.scribbleStyle);
208
275
  a.innerHTML = `
276
+ <svg class="pluno-pa-widget__scribble-defs" aria-hidden="true" focusable="false" width="0" height="0">
277
+ <defs>
278
+ <filter id="pluno-pa-scribble-wobble" x="-8%" y="-8%" width="116%" height="116%">
279
+ <feTurbulence type="fractalNoise" baseFrequency="0.012 0.028" numOctaves="3" seed="2" result="stroke-noise" />
280
+ <feDisplacementMap in="SourceGraphic" in2="stroke-noise" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="warped" />
281
+ <feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="1" seed="12" result="ink-noise" />
282
+ <feDisplacementMap in="warped" in2="ink-noise" scale="0.9" xChannelSelector="R" yChannelSelector="G" />
283
+ </filter>
284
+ <filter id="pluno-pa-scribble-wobble-2" x="-8%" y="-8%" width="116%" height="116%">
285
+ <feTurbulence type="fractalNoise" baseFrequency="0.012 0.028" numOctaves="3" seed="5" result="stroke-noise" />
286
+ <feDisplacementMap in="SourceGraphic" in2="stroke-noise" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="warped" />
287
+ <feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="1" seed="15" result="ink-noise" />
288
+ <feDisplacementMap in="warped" in2="ink-noise" scale="0.9" xChannelSelector="R" yChannelSelector="G" />
289
+ </filter>
290
+ <filter id="pluno-pa-scribble-wobble-3" x="-8%" y="-8%" width="116%" height="116%">
291
+ <feTurbulence type="fractalNoise" baseFrequency="0.012 0.028" numOctaves="3" seed="9" result="stroke-noise" />
292
+ <feDisplacementMap in="SourceGraphic" in2="stroke-noise" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="warped" />
293
+ <feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="1" seed="19" result="ink-noise" />
294
+ <feDisplacementMap in="warped" in2="ink-noise" scale="0.9" xChannelSelector="R" yChannelSelector="G" />
295
+ </filter>
296
+ </defs>
297
+ </svg>
209
298
  <form class="pluno-pa-widget__launcher">
210
- <img class="pluno-pa-widget__character pluno-pa-widget__character--launcher" src="${M(i)}" alt="" aria-hidden="true" />
211
- <input class="pluno-pa-widget__launcher-input" type="text" placeholder="${M(e.launcherLabel)}" aria-label="${M(e.launcherLabel)}" />
299
+ <img class="pluno-pa-widget__character pluno-pa-widget__character--launcher" src="${D(r)}" alt="" aria-hidden="true" />
300
+ <input class="pluno-pa-widget__launcher-input" type="text" placeholder="${D(e.launcherLabel)}" aria-label="${D(e.launcherLabel)}" />
212
301
  </form>
213
302
  <button type="button" class="pluno-pa-widget__close" aria-label="Close" hidden>
214
303
  <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
@@ -219,7 +308,7 @@ async function Le(t = {}) {
219
308
  <div class="pluno-pa-widget__timeline-wrap">
220
309
  <main class="pluno-pa-widget__timeline">
221
310
  <div class="pluno-pa-widget__empty-state">
222
- <img class="pluno-pa-widget__character pluno-pa-widget__character--empty" src="${M(i)}" alt="" aria-hidden="true" />
311
+ <img class="pluno-pa-widget__character pluno-pa-widget__character--empty" src="${D(r)}" alt="" aria-hidden="true" />
223
312
  <div class="pluno-pa-widget__empty">Hey there, I'm Pluno 👋<br />What do you want to do today?</div>
224
313
  </div>
225
314
  </main>
@@ -244,150 +333,166 @@ async function Le(t = {}) {
244
333
  </form>
245
334
  </section>
246
335
  `, n.appendChild(a);
247
- const l = await Me(), d = l.ownerDocument;
248
- l.appendChild(o), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), ne(n, e.accentColor), Z(a, i, {
336
+ const i = await qe(), d = i.ownerDocument;
337
+ i.appendChild(o), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), ce(n, e.accentColor), re(a, r, {
249
338
  accentColor: e.accentColor,
250
339
  colorScheme: e.colorScheme,
251
- fontFamily: e.fontFamily
252
- }), N("web-sdk.widget", "Applied initial widget appearance", {
340
+ fontFamily: e.fontFamily,
341
+ scribbleStyle: e.scribbleStyle
342
+ }), A("web-sdk.widget", "Applied initial widget appearance", {
253
343
  accentColor: e.accentColor,
254
344
  colorScheme: e.colorScheme,
255
345
  fontFamily: e.fontFamily,
256
346
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
257
347
  });
258
- const g = a.querySelector(".pluno-pa-widget__launcher"), p = a.querySelector(".pluno-pa-widget__launcher-input"), c = a.querySelector(".pluno-pa-widget__panel"), h = a.querySelector(".pluno-pa-widget__close"), b = a.querySelector(".pluno-pa-widget__composer"), s = a.querySelector(".pluno-pa-widget__input"), x = a.querySelector(".pluno-pa-widget__send"), u = a.querySelector(".pluno-pa-widget__new-chat"), m = a.querySelector(".pluno-pa-widget__timeline");
259
- if (!g || !p || !c || !h || !b || !s || !x || !u || !m)
348
+ const u = a.querySelector(".pluno-pa-widget__launcher"), p = a.querySelector(".pluno-pa-widget__launcher-input"), g = a.querySelector(".pluno-pa-widget__panel"), b = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), s = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), c = a.querySelector(".pluno-pa-widget__new-chat"), h = a.querySelector(".pluno-pa-widget__timeline");
349
+ if (!u || !p || !g || !b || !x || !s || !_ || !c || !h)
260
350
  throw new Error("Failed to mount Product Agent widget");
261
- const v = e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
351
+ const y = e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
262
352
  if (!e.tokenEndpoint)
263
353
  throw new Error("Product Agent widget requires token or tokenEndpoint");
264
- const r = await fetch(e.tokenEndpoint, {
354
+ const l = await fetch(e.tokenEndpoint, {
265
355
  method: "POST",
266
356
  credentials: "include",
267
357
  headers: { "content-type": "application/json" },
268
358
  body: JSON.stringify({ origin: location.origin, url: location.href })
269
359
  });
270
- if (!r.ok)
360
+ if (!l.ok)
271
361
  throw new Error("Failed to load Product Agent token");
272
- const k = await r.json();
362
+ const k = await l.json();
273
363
  if (!k.token)
274
364
  throw new Error("Product Agent token endpoint did not return a token");
275
365
  return k.token;
276
- }), f = await se.init({
366
+ }), f = await xe.init({
277
367
  token: e.token,
278
- tokenProvider: v,
368
+ tokenProvider: y,
279
369
  backendUrl: e.backendUrl,
280
370
  initialStarterPrompts: e.initialStarterPrompts,
281
371
  webSocketFactory: e.webSocketFactory
282
- }), w = Oe(e), _ = new Set(w.openToolGroupKeys);
283
- let E = null, R = !1;
284
- const pe = () => {
285
- R || typeof document > "u" || (ne(n, e.accentColor), o.isConnected || d.body?.appendChild(o));
286
- }, U = new MutationObserver(pe);
287
- U.observe(d.documentElement, { childList: !0, subtree: !0 });
288
- const S = () => {
289
- $e(e, {
372
+ }), w = Ye(e), m = new Set(w.openToolGroupKeys);
373
+ let S = null, j = !1;
374
+ const me = () => {
375
+ j || typeof document > "u" || (ce(n, e.accentColor), o.isConnected || d.body?.appendChild(o));
376
+ }, q = new MutationObserver(me);
377
+ q.observe(d.documentElement, { childList: !0, subtree: !0 });
378
+ const E = () => {
379
+ Ze(e, {
290
380
  isOpen: a.classList.contains("pluno-pa-widget--open"),
291
381
  composerValue: s.value,
292
- openToolGroupKeys: [..._]
382
+ openToolGroupKeys: [...m]
293
383
  });
294
- }, L = (r = "", k = !0) => {
295
- if (E !== null && (window.clearTimeout(E), E = null), c.hidden = !1, h.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), !k) {
296
- a.classList.add("pluno-pa-widget--open"), g.hidden = !0, r && (s.value = r, P(s)), s.focus(), s.setSelectionRange(s.value.length, s.value.length), S();
384
+ }, P = (l = "", k = !0) => {
385
+ if (S !== null && (window.clearTimeout(S), S = null), g.hidden = !1, b.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), !k) {
386
+ a.classList.add("pluno-pa-widget--open"), u.hidden = !0, l && (s.value = l, I(s)), h.scrollTop = h.scrollHeight, s.focus(), s.setSelectionRange(s.value.length, s.value.length), E();
297
387
  return;
298
388
  }
299
389
  window.requestAnimationFrame(() => {
300
- a.classList.add("pluno-pa-widget--open"), r && (s.value = r, P(s)), s.focus(), s.setSelectionRange(s.value.length, s.value.length), S(), E = window.setTimeout(() => {
301
- g.hidden = !0;
390
+ a.classList.add("pluno-pa-widget--open"), l && (s.value = l, I(s)), h.scrollTop = h.scrollHeight, s.focus(), s.setSelectionRange(s.value.length, s.value.length), E(), S = window.setTimeout(() => {
391
+ u.hidden = !0, h.scrollTop = h.scrollHeight;
302
392
  }, 220);
303
393
  });
304
- }, V = () => {
305
- E !== null && (window.clearTimeout(E), E = null), g.hidden = !1, a.classList.add("pluno-pa-widget--closing"), a.classList.remove("pluno-pa-widget--open"), S(), E = window.setTimeout(() => {
306
- c.hidden = !0, h.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
394
+ }, _e = () => {
395
+ S !== null && (window.clearTimeout(S), S = null), u.hidden = !1, a.classList.add("pluno-pa-widget--closing"), a.classList.remove("pluno-pa-widget--open"), E(), S = window.setTimeout(() => {
396
+ g.hidden = !0, b.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
307
397
  }, 220);
308
398
  };
309
- g.addEventListener("submit", (r) => {
310
- r.preventDefault(), L(p.value), p.value = "";
311
- }), g.addEventListener("click", (r) => {
312
- r.target !== p && (L(p.value), p.value = "");
399
+ u.addEventListener("submit", (l) => {
400
+ l.preventDefault(), P(p.value), p.value = "";
401
+ }), u.addEventListener("click", (l) => {
402
+ l.target !== p && (P(p.value), p.value = "");
313
403
  }), p.addEventListener("focus", () => {
314
- L(p.value), p.value = "";
404
+ P(p.value), p.value = "";
315
405
  }), p.addEventListener("input", () => {
316
406
  if (!p.value)
317
407
  return;
318
- const r = p.value;
319
- L(r), p.value = "";
320
- }), h.addEventListener("click", V);
321
- const W = (r) => {
322
- if (!(!r.metaKey || r.key.toLowerCase() !== "k")) {
323
- if (r.preventDefault(), c.hidden || !a.classList.contains("pluno-pa-widget--open")) {
324
- L();
325
- return;
326
- }
327
- V();
328
- }
408
+ const l = p.value;
409
+ P(l), p.value = "";
410
+ }), b.addEventListener("click", _e);
411
+ const L = () => {
412
+ _.disabled = !f.getState().isThinking && s.value.trim().length === 0;
329
413
  };
330
- d.addEventListener("keydown", W), b.addEventListener("submit", (r) => {
331
- r.preventDefault(), G(f, s);
332
- }), x.addEventListener("click", () => {
414
+ x.addEventListener("submit", (l) => {
415
+ l.preventDefault(), U(f, s), L();
416
+ }), _.addEventListener("click", () => {
333
417
  if (f.getState().isThinking) {
334
418
  f.stop();
335
419
  return;
336
420
  }
337
- G(f, s);
338
- }), u.addEventListener("click", () => {
339
- f.startNewSession(), _.clear(), s.value = "", P(s), S(), s.focus();
421
+ U(f, s), L();
422
+ }), c.addEventListener("click", () => {
423
+ f.startNewSession(), m.clear(), s.value = "", I(s), E(), L(), s.focus();
340
424
  }), s.addEventListener("input", () => {
341
- P(s), S();
342
- }), s.addEventListener("keydown", (r) => {
343
- r.key !== "Enter" || r.shiftKey || (r.preventDefault(), G(f, s));
344
- }), a.addEventListener("click", (r) => {
345
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && S();
346
- }), w.composerValue && (s.value = w.composerValue, P(s)), w.isOpen && L(s.value, !1);
347
- const B = () => i;
348
- let $ = f.getState().appearance !== null;
349
- return f.on("state", (r) => {
350
- r.appearance ? ($ = !0, N("web-sdk.widget", "Agent state supplied appearance", {
351
- appearance: r.appearance
352
- }), D(r.appearance, "agent.state.appearance")) : $ && ($ = !1, N("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
425
+ I(s), E(), L();
426
+ }), s.addEventListener("keydown", (l) => {
427
+ l.key !== "Enter" || l.shiftKey || (l.preventDefault(), U(f, s), L());
428
+ }), a.addEventListener("click", (l) => {
429
+ (l.target instanceof Element ? l.target : null)?.closest("a[href]") && E();
430
+ }), w.composerValue && (s.value = w.composerValue, I(s)), w.isOpen && P(s.value, !1);
431
+ const Y = () => r;
432
+ let R = f.getState().appearance !== null;
433
+ return f.on("state", (l) => {
434
+ l.appearance ? (R = !0, A("web-sdk.widget", "Agent state supplied appearance", {
435
+ appearance: l.appearance
436
+ }), G(l.appearance, "agent.state.appearance")) : R && (R = !1, A("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
353
437
  fallbackAccentColor: e.accentColor,
354
438
  fallbackColorScheme: e.colorScheme,
355
439
  fallbackFontFamily: e.fontFamily
356
- }), D({}, "agent.state.appearance-cleared")), J(m, x, u, r, _, S, B, (k) => {
440
+ }), G({}, "agent.state.appearance-cleared")), ie(h, _, c, l, m, E, Y, (k) => {
357
441
  f.sendMessage(k);
358
- });
359
- }), J(m, x, u, f.getState(), _, S, B, (r) => {
360
- f.sendMessage(r);
361
- }), {
442
+ }), L();
443
+ }), ie(h, _, c, f.getState(), m, E, Y, (l) => {
444
+ f.sendMessage(l);
445
+ }), L(), {
362
446
  agent: f,
363
- updateAppearance: (r) => D(r, "widgetHandle.updateAppearance"),
447
+ updateAppearance: (l) => {
448
+ l.scribbleStyle !== void 0 && (e.scribbleStyle = l.scribbleStyle), G(l, "widgetHandle.updateAppearance");
449
+ },
364
450
  destroy: () => {
365
- R = !0, U.disconnect(), f.destroy(), d.removeEventListener("keydown", W), o.remove();
451
+ j = !0, q.disconnect(), f.destroy(), o.remove();
366
452
  }
367
453
  };
368
- function D(r, k) {
369
- const A = r.accentColor ?? e.accentColor, H = r.colorScheme ?? e.colorScheme, K = r.fontFamily ?? e.fontFamily;
370
- i = j(A), Z(a, i, {
371
- accentColor: A,
372
- colorScheme: H,
373
- fontFamily: K
374
- }), N("web-sdk.widget", "Updated widget appearance", {
454
+ function G(l, k) {
455
+ const O = l.accentColor ?? e.accentColor, Z = l.colorScheme ?? e.colorScheme, X = l.fontFamily ?? e.fontFamily, z = l.scribbleStyle ?? e.scribbleStyle;
456
+ r = ae(O, z), re(a, r, {
457
+ accentColor: O,
458
+ colorScheme: Z,
459
+ fontFamily: X,
460
+ scribbleStyle: z
461
+ }), A("web-sdk.widget", "Updated widget appearance", {
375
462
  source: k,
376
- inputAppearance: r,
377
- appliedAccentColor: A,
378
- appliedColorScheme: H,
379
- appliedFontFamily: K,
463
+ inputAppearance: l,
464
+ appliedAccentColor: O,
465
+ appliedColorScheme: Z,
466
+ appliedFontFamily: X,
467
+ appliedScribbleStyle: z,
380
468
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
381
469
  });
382
470
  }
383
471
  }
384
- function Z(t, e, o) {
385
- t.classList.toggle("pluno-pa-widget--dark", o.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", o.colorScheme !== "dark"), t.style.setProperty("--pluno-pa-accent", o.accentColor), t.style.fontFamily = o.fontFamily;
386
- const n = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
387
- for (const a of n)
388
- a.src = e;
472
+ function ae(t, e) {
473
+ return e ? Se(t) : ke(t);
474
+ }
475
+ function re(t, e, o) {
476
+ t.classList.toggle("pluno-pa-widget--dark", o.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", o.colorScheme !== "dark"), t.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
477
+ const n = o.scribbleStyle ? he(o.accentColor) : o.accentColor;
478
+ t.style.setProperty("--pluno-pa-accent", n), t.style.fontFamily = o.scribbleStyle ? Ge : o.fontFamily, o.scribbleStyle && Ue(t.ownerDocument);
479
+ const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
480
+ for (const r of a)
481
+ r.src = e;
482
+ }
483
+ function Ue(t) {
484
+ if (t.getElementById(oe))
485
+ return;
486
+ const e = t.createElement("style");
487
+ e.id = oe, e.textContent = `@font-face {
488
+ font-family: "Architects Daughter";
489
+ font-style: normal;
490
+ font-weight: 400;
491
+ font-display: swap;
492
+ src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
493
+ }`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
389
494
  }
390
- function N(t, e, o) {
495
+ function A(t, e, o) {
391
496
  if (typeof window > "u")
392
497
  return;
393
498
  const n = window, a = {
@@ -395,131 +500,131 @@ function N(t, e, o) {
395
500
  source: t,
396
501
  message: e,
397
502
  details: o
398
- }, i = n.__plunoProductAgentDiagnostics__ ?? [];
399
- i.push(a), i.length > 120 && i.splice(0, i.length - 120), n.__plunoProductAgentDiagnostics__ = i, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Ee, { detail: a }));
503
+ }, r = n.__plunoProductAgentDiagnostics__ ?? [];
504
+ r.push(a), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent(Re, { detail: a }));
400
505
  }
401
- function G(t, e) {
506
+ function U(t, e) {
402
507
  const o = e.value.trim();
403
508
  o && (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(o), e.dispatchEvent(new Event("input", { bubbles: !0 })));
404
509
  }
405
- function P(t) {
510
+ function I(t) {
406
511
  t.style.height = "0px";
407
512
  const e = Math.max(22, Math.min(t.scrollHeight, 140));
408
513
  t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
409
514
  }
410
- function J(t, e, o, n, a, i, l, d) {
411
- const g = [...n.messages];
412
- t.innerHTML = "", Ae(e, n.isThinking);
413
- const p = g.length > 0 || !!n.assistantDraft || n.isThinking;
414
- if (o.hidden = !p, g.length === 0 && !n.assistantDraft && !n.lastError && !n.isThinking) {
415
- const u = document.createElement("div");
416
- u.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
417
- const m = document.createElement("img");
418
- m.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", m.src = l(), m.alt = "", m.setAttribute("aria-hidden", "true"), u.appendChild(m);
419
- const v = document.createElement("div");
420
- v.className = "pluno-pa-widget__empty", v.innerHTML = "Hey there, I'm Pluno 👋<br />What do you want to do today?", u.appendChild(v);
515
+ function ie(t, e, o, n, a, r, i, d) {
516
+ const u = [...n.messages];
517
+ t.innerHTML = "", Ke(e, n.isThinking);
518
+ const p = u.length > 0 || !!n.assistantDraft || n.isThinking;
519
+ if (o.hidden = !p, u.length === 0 && !n.assistantDraft && !n.lastError && !n.isThinking) {
520
+ const c = document.createElement("div");
521
+ c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
522
+ const h = document.createElement("img");
523
+ h.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", h.src = i(), h.alt = "", h.setAttribute("aria-hidden", "true"), c.appendChild(h);
524
+ const y = document.createElement("div");
525
+ y.className = "pluno-pa-widget__empty", y.innerHTML = "Hey there, I'm Pluno 👋<br />What do you want to do today?", c.appendChild(y);
421
526
  const f = document.createElement("div");
422
527
  f.className = n.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", n.starterPrompts.length === 0 && f.setAttribute("aria-hidden", "true");
423
528
  for (const w of n.starterPrompts) {
424
- const _ = document.createElement("button");
425
- _.type = "button", _.className = "pluno-pa-widget__starter-prompt", _.textContent = `"${w}"`, _.addEventListener("click", () => {
529
+ const m = document.createElement("button");
530
+ m.type = "button", m.className = "pluno-pa-widget__starter-prompt", m.textContent = `"${w}"`, m.addEventListener("click", () => {
426
531
  d(w);
427
- }), f.appendChild(_);
532
+ }), f.appendChild(m);
428
533
  }
429
- u.appendChild(f), t.appendChild(u);
534
+ c.appendChild(f), t.appendChild(c);
430
535
  return;
431
536
  }
432
- let c = null, h = null, b = [];
537
+ let g = null, b = null, x = [];
433
538
  const s = () => {
434
- if (b.length === 0)
539
+ if (x.length === 0)
435
540
  return !1;
436
- const u = Te(b, a, i, l());
437
- return t.appendChild(u), c = null, h = u, b = [], !0;
541
+ const c = We(x, a, r, i());
542
+ return t.appendChild(c), g = null, b = c, x = [], !0;
438
543
  };
439
- for (let u = 0; u < g.length; u += 1) {
440
- const m = g[u];
441
- if (m.role === "tool") {
442
- b.push(m);
544
+ for (let c = 0; c < u.length; c += 1) {
545
+ const h = u[c];
546
+ if (h.role === "tool") {
547
+ x.push(h);
443
548
  continue;
444
549
  }
445
- if (m.role === "system")
550
+ if (h.role === "system")
446
551
  continue;
447
- const v = s(), f = X(m.content);
448
- if (m.role === "assistant" && !v) {
449
- const _ = z(l());
450
- t.appendChild(_), c = null, h = _;
552
+ const y = s(), f = pe(h.content);
553
+ if (h.role === "assistant" && !y) {
554
+ const m = K(i());
555
+ t.appendChild(m), g = null, b = m;
451
556
  }
452
557
  const w = document.createElement("div");
453
- w.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? te(w, f) : w.textContent = f, w.appendChild(Q(f)), t.appendChild(w), c = w, h = null;
558
+ w.className = `pluno-pa-widget__message pluno-pa-widget__message--${h.role}`, h.role === "assistant" ? de(w, f) : w.textContent = f, w.appendChild(le(f)), t.appendChild(w), g = w, b = null;
454
559
  }
455
- const x = s();
560
+ const _ = s();
456
561
  if (n.assistantDraft) {
457
- if (!x) {
458
- const v = z(l());
459
- t.appendChild(v), c = null, h = v;
562
+ if (!_) {
563
+ const y = K(i());
564
+ t.appendChild(y), g = null, b = y;
460
565
  }
461
- const u = X(n.assistantDraft), m = document.createElement("div");
462
- m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", te(m, u), m.appendChild(Q(u)), t.appendChild(m), c = m, h = null;
566
+ const c = pe(n.assistantDraft), h = document.createElement("div");
567
+ h.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", de(h, c), h.appendChild(le(c)), t.appendChild(h), g = h, b = null;
463
568
  }
464
569
  if (n.isThinking && !n.assistantDraft)
465
- if (x) {
466
- const u = re();
467
- t.appendChild(u), c = null, h = u;
570
+ if (_) {
571
+ const c = fe();
572
+ t.appendChild(c), g = null, b = c;
468
573
  } else {
469
- const u = Ne(l());
470
- t.appendChild(u), c = null, h = u;
574
+ const c = He(i());
575
+ t.appendChild(c), g = null, b = c;
471
576
  }
472
577
  if (n.lastError) {
473
- const u = document.createElement("div");
474
- u.className = "pluno-pa-widget__error", u.textContent = n.lastError, t.appendChild(u), c = u, h = null;
578
+ const c = document.createElement("div");
579
+ c.className = "pluno-pa-widget__error", c.textContent = n.lastError, t.appendChild(c), g = c, b = null;
475
580
  }
476
- c?.classList.add("pluno-pa-widget__message--bottom-reserve"), h?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
581
+ g?.classList.add("pluno-pa-widget__message--bottom-reserve"), b?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
477
582
  }
478
- function Q(t) {
583
+ function le(t) {
479
584
  const e = document.createElement("button");
480
585
  return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.innerHTML = '<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>', e.addEventListener("click", (o) => {
481
586
  o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(t);
482
587
  }), e;
483
588
  }
484
- function X(t) {
589
+ function pe(t) {
485
590
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
486
591
  }
487
- function Te(t, e, o, n) {
592
+ function We(t, e, o, n) {
488
593
  const a = document.createElement("article");
489
594
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
490
- const i = document.createElement("img");
491
- i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
492
- const l = document.createElement("details"), d = Pe(t);
493
- l.open = e.has(d), l.addEventListener("toggle", () => {
494
- l.open ? e.add(d) : e.delete(d), o();
595
+ const r = document.createElement("img");
596
+ r.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", r.src = n, r.alt = "", r.setAttribute("aria-hidden", "true"), a.appendChild(r);
597
+ const i = document.createElement("details"), d = Ve(t);
598
+ i.open = e.has(d), i.addEventListener("toggle", () => {
599
+ i.open ? e.add(d) : e.delete(d), o();
495
600
  });
496
- const g = document.createElement("summary");
497
- g.className = "pluno-pa-widget__tool-summary", t.some((h) => h.loading) && g.appendChild(ee());
498
- const c = document.createElement("span");
499
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = t[t.length - 1].content || "Run tool", g.appendChild(c), l.appendChild(g), t.length > 0) {
500
- const h = document.createElement("div");
501
- h.className = "pluno-pa-widget__tool-lines";
502
- for (const b of t) {
601
+ const u = document.createElement("summary");
602
+ u.className = "pluno-pa-widget__tool-summary", t.some((b) => b.loading) && u.appendChild(se());
603
+ const g = document.createElement("span");
604
+ if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = t[t.length - 1].content || "Run tool", u.appendChild(g), i.appendChild(u), t.length > 0) {
605
+ const b = document.createElement("div");
606
+ b.className = "pluno-pa-widget__tool-lines";
607
+ for (const x of t) {
503
608
  const s = document.createElement("div");
504
- s.className = "pluno-pa-widget__tool-line", b.loading && s.appendChild(ee());
505
- const x = document.createElement("span");
506
- x.textContent = b.content || "Run tool", s.appendChild(x), h.appendChild(s);
609
+ s.className = "pluno-pa-widget__tool-line", x.loading && s.appendChild(se());
610
+ const _ = document.createElement("span");
611
+ _.textContent = x.content || "Run tool", s.appendChild(_), b.appendChild(s);
507
612
  }
508
- l.appendChild(h);
613
+ i.appendChild(b);
509
614
  }
510
- return a.appendChild(l), a;
615
+ return a.appendChild(i), a;
511
616
  }
512
- function z(t) {
617
+ function K(t) {
513
618
  const e = document.createElement("article");
514
619
  e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
515
620
  const o = document.createElement("img");
516
621
  return o.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", o.src = t, o.alt = "", o.setAttribute("aria-hidden", "true"), e.appendChild(o), e;
517
622
  }
518
- function Ne(t) {
519
- const e = z(t);
520
- return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(re()), e;
623
+ function He(t) {
624
+ const e = K(t);
625
+ return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(fe()), e;
521
626
  }
522
- function re() {
627
+ function fe() {
523
628
  const t = document.createElement("div");
524
629
  t.className = "pluno-pa-widget__status";
525
630
  const e = document.createElement("span");
@@ -527,17 +632,17 @@ function re() {
527
632
  const o = document.createElement("span");
528
633
  return o.textContent = "Thinking...", t.appendChild(o), t;
529
634
  }
530
- function Pe(t) {
635
+ function Ve(t) {
531
636
  return `tools:${t.map((e) => e.id).join("|")}`;
532
637
  }
533
- function ee() {
638
+ function se() {
534
639
  const t = document.createElement("span");
535
640
  return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
536
641
  }
537
- function Ae(t, e) {
642
+ function Ke(t, e) {
538
643
  t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.innerHTML = e ? '<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true"><rect x="6" y="6" width="12" height="12" rx="2" /></svg>' : '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="19" x2="12" y2="5" /><polyline points="5 12 12 5 19 12" /></svg>';
539
644
  }
540
- function te(t, e) {
645
+ function de(t, e) {
541
646
  const o = e.replace(/\r\n/g, `
542
647
  `).split(`
543
648
  `);
@@ -553,22 +658,22 @@ function te(t, e) {
553
658
  for (n += 1; n < o.length && !/^```\s*$/.test(o[n]); )
554
659
  p.push(o[n]), n += 1;
555
660
  n += n < o.length ? 1 : 0;
556
- const c = document.createElement("pre"), h = document.createElement("code");
557
- h.textContent = p.join(`
558
- `), c.appendChild(h), t.appendChild(c);
661
+ const g = document.createElement("pre"), b = document.createElement("code");
662
+ b.textContent = p.join(`
663
+ `), g.appendChild(b), t.appendChild(g);
559
664
  continue;
560
665
  }
561
- const l = a.match(/^(#{1,3})\s+(.+)$/);
562
- if (l) {
563
- const p = document.createElement(`h${l[1].length + 2}`);
564
- I(p, l[2]), t.appendChild(p), n += 1;
666
+ const i = a.match(/^(#{1,3})\s+(.+)$/);
667
+ if (i) {
668
+ const p = document.createElement(`h${i[1].length + 2}`);
669
+ $(p, i[2]), t.appendChild(p), n += 1;
565
670
  continue;
566
671
  }
567
672
  if (/^\s*[-*+]\s+/.test(a)) {
568
673
  const p = document.createElement("ul");
569
674
  for (; n < o.length && /^\s*[-*+]\s+/.test(o[n]); ) {
570
- const c = document.createElement("li");
571
- I(c, o[n].replace(/^\s*[-*+]\s+/, "")), p.appendChild(c), n += 1;
675
+ const g = document.createElement("li");
676
+ $(g, o[n].replace(/^\s*[-*+]\s+/, "")), p.appendChild(g), n += 1;
572
677
  }
573
678
  t.appendChild(p);
574
679
  continue;
@@ -576,8 +681,8 @@ function te(t, e) {
576
681
  if (/^\s*\d+\.\s+/.test(a)) {
577
682
  const p = document.createElement("ol");
578
683
  for (; n < o.length && /^\s*\d+\.\s+/.test(o[n]); ) {
579
- const c = document.createElement("li");
580
- I(c, o[n].replace(/^\s*\d+\.\s+/, "")), p.appendChild(c), n += 1;
684
+ const g = document.createElement("li");
685
+ $(g, o[n].replace(/^\s*\d+\.\s+/, "")), p.appendChild(g), n += 1;
581
686
  }
582
687
  t.appendChild(p);
583
688
  continue;
@@ -585,41 +690,41 @@ function te(t, e) {
585
690
  const d = [a];
586
691
  for (n += 1; n < o.length && o[n].trim() && !/^```/.test(o[n]) && !/^(#{1,3})\s+/.test(o[n]) && !/^\s*[-*+]\s+/.test(o[n]) && !/^\s*\d+\.\s+/.test(o[n]); )
587
692
  d.push(o[n]), n += 1;
588
- const g = document.createElement("p");
589
- d.forEach((p, c) => {
590
- c > 0 && g.appendChild(document.createElement("br")), I(g, p);
591
- }), t.appendChild(g);
693
+ const u = document.createElement("p");
694
+ d.forEach((p, g) => {
695
+ g > 0 && u.appendChild(document.createElement("br")), $(u, p);
696
+ }), t.appendChild(u);
592
697
  }
593
698
  }
594
- function I(t, e) {
699
+ function $(t, e) {
595
700
  const o = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
596
701
  let n = 0;
597
702
  for (const a of e.matchAll(o)) {
598
- const i = a.index ?? 0;
599
- i > n && t.appendChild(document.createTextNode(e.slice(n, i)));
600
- const l = a[0];
601
- if (l.startsWith("`")) {
703
+ const r = a.index ?? 0;
704
+ r > n && t.appendChild(document.createTextNode(e.slice(n, r)));
705
+ const i = a[0];
706
+ if (i.startsWith("`")) {
602
707
  const d = document.createElement("code");
603
- d.textContent = l.slice(1, -1), t.appendChild(d);
604
- } else if (l.startsWith("**")) {
708
+ d.textContent = i.slice(1, -1), t.appendChild(d);
709
+ } else if (i.startsWith("**")) {
605
710
  const d = document.createElement("strong");
606
- d.textContent = l.slice(2, -2), t.appendChild(d);
607
- } else if (l.startsWith("*")) {
711
+ d.textContent = i.slice(2, -2), t.appendChild(d);
712
+ } else if (i.startsWith("*")) {
608
713
  const d = document.createElement("em");
609
- d.textContent = l.slice(1, -1), t.appendChild(d);
714
+ d.textContent = i.slice(1, -1), t.appendChild(d);
610
715
  } else {
611
- const d = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
612
- if (d && Ie(d[2])) {
613
- const g = document.createElement("a");
614
- g.href = d[2], g.target = "_top", g.rel = "noreferrer", g.textContent = d[1], t.appendChild(g);
716
+ const d = i.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
717
+ if (d && je(d[2])) {
718
+ const u = document.createElement("a");
719
+ u.href = d[2], u.target = "_top", u.rel = "noreferrer", u.textContent = d[1], t.appendChild(u);
615
720
  } else
616
- t.appendChild(document.createTextNode(l));
721
+ t.appendChild(document.createTextNode(i));
617
722
  }
618
- n = i + l.length;
723
+ n = r + i.length;
619
724
  }
620
725
  n < e.length && t.appendChild(document.createTextNode(e.slice(n)));
621
726
  }
622
- function Ie(t) {
727
+ function je(t) {
623
728
  if (t.startsWith("/") || t.startsWith("#"))
624
729
  return !0;
625
730
  try {
@@ -629,7 +734,7 @@ function Ie(t) {
629
734
  return !1;
630
735
  }
631
736
  }
632
- function ne(t, e) {
737
+ function ce(t, e) {
633
738
  if (t.getElementById("pluno-pa-widget-styles"))
634
739
  return;
635
740
  const o = t.ownerDocument.createElement("style");
@@ -714,6 +819,7 @@ function ne(t, e) {
714
819
  position: absolute;
715
820
  display: flex;
716
821
  align-items: center;
822
+ cursor: text;
717
823
  right: 0;
718
824
  bottom: 0;
719
825
  width: var(--pluno-pa-launcher-width);
@@ -1366,9 +1472,267 @@ function ne(t, e) {
1366
1472
  .pluno-pa-widget__error.pluno-pa-widget__message--bottom-reserve {
1367
1473
  margin-bottom: 46px;
1368
1474
  }
1475
+
1476
+ /* ── Scribble style (hand-drawn diary look, opt-in) ─────────── */
1477
+ .pluno-pa-widget__scribble-defs {
1478
+ position: absolute;
1479
+ width: 0;
1480
+ height: 0;
1481
+ overflow: hidden;
1482
+ }
1483
+ .pluno-pa-widget--scribble {
1484
+ /* Paper is always light; scribble ignores the configured color scheme */
1485
+ --pluno-pa-bg: #fdfaf1;
1486
+ --pluno-pa-surface: #f7f2e3;
1487
+ --pluno-pa-bubble: #f3ecd8;
1488
+ --pluno-pa-text: #18181b;
1489
+ --pluno-pa-muted: #5c5c63;
1490
+ --pluno-pa-faint: #8e8e95;
1491
+ --pluno-pa-divider: rgba(40, 36, 20, 0.45);
1492
+ --pluno-pa-launcher-hairline: rgba(40, 36, 20, 0.45);
1493
+ --pluno-pa-accent-soft: rgba(44, 42, 30, 0.14);
1494
+ --pluno-pa-scribble-grid-line: rgba(96, 138, 188, 0.22);
1495
+ --pluno-pa-scribble-wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;
1496
+ --pluno-pa-scribble-wobble-alt: 15px 225px 15px 255px / 255px 15px 225px 15px;
1497
+ font-size: 17px;
1498
+ }
1499
+ .pluno-pa-widget--scribble .pluno-pa-widget__panel {
1500
+ /* The paper sheet and border live on ::before so the wobble filter can
1501
+ bend them; overflow must stay visible for the spiral binding on top */
1502
+ overflow: visible;
1503
+ isolation: isolate;
1504
+ background: transparent;
1505
+ border: 2px solid transparent;
1506
+ border-radius: 18px 15px 20px 14px / 15px 19px 14px 20px;
1507
+ box-shadow: none;
1508
+ }
1509
+ .pluno-pa-widget--scribble .pluno-pa-widget__panel::before {
1510
+ content: "";
1511
+ position: absolute;
1512
+ inset: -2px;
1513
+ z-index: -1;
1514
+ border: 2px solid var(--pluno-pa-divider);
1515
+ border-radius: inherit;
1516
+ background-color: var(--pluno-pa-bg);
1517
+ background-image:
1518
+ linear-gradient(var(--pluno-pa-scribble-grid-line) 1px, transparent 1px),
1519
+ linear-gradient(90deg, var(--pluno-pa-scribble-grid-line) 1px, transparent 1px);
1520
+ background-size: 22px 22px;
1521
+ filter: url(#pluno-pa-scribble-wobble);
1522
+ pointer-events: none;
1523
+ }
1524
+ .pluno-pa-widget--scribble .pluno-pa-widget__panel::after {
1525
+ content: "";
1526
+ position: absolute;
1527
+ top: -16px;
1528
+ left: 16px;
1529
+ right: 16px;
1530
+ height: 36px;
1531
+ z-index: 3;
1532
+ background-image: url('${ne}');
1533
+ background-repeat: repeat-x;
1534
+ background-size: 104px 36px;
1535
+ filter: url(#pluno-pa-scribble-wobble-2);
1536
+ pointer-events: none;
1537
+ }
1538
+ .pluno-pa-widget--scribble .pluno-pa-widget__timeline {
1539
+ padding-top: 34px;
1540
+ }
1541
+ /* The top text fade paints a square-cornered bg gradient; with the panel
1542
+ overflow visible for the spiral it would poke past the rounded border */
1543
+ .pluno-pa-widget--scribble .pluno-pa-widget__timeline-wrap::before {
1544
+ display: none;
1545
+ }
1546
+ .pluno-pa-widget--scribble .pluno-pa-widget__composer {
1547
+ background: transparent;
1548
+ border-top: 2px dashed var(--pluno-pa-divider);
1549
+ }
1550
+ .pluno-pa-widget--scribble .pluno-pa-widget__message--assistant code,
1551
+ .pluno-pa-widget--scribble .pluno-pa-widget__message--assistant pre {
1552
+ font-family: inherit;
1553
+ }
1554
+ .pluno-pa-widget--scribble .pluno-pa-widget__message {
1555
+ font-size: 17px;
1556
+ }
1557
+ .pluno-pa-widget--scribble .pluno-pa-widget__input {
1558
+ font-size: 17px;
1559
+ line-height: 26px;
1560
+ height: 26px;
1561
+ min-height: 26px;
1562
+ }
1563
+ .pluno-pa-widget--scribble .pluno-pa-widget__starter-prompt {
1564
+ font-size: 17px;
1565
+ }
1566
+ .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__empty {
1567
+ font-size: 28px;
1568
+ }
1569
+ .pluno-pa-widget--scribble .pluno-pa-widget__character--empty {
1570
+ width: 132px;
1571
+ height: 132px;
1572
+ }
1573
+ .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
1574
+ margin-bottom: -36px;
1575
+ }
1576
+ .pluno-pa-widget--scribble .pluno-pa-widget__character--tool-group {
1577
+ width: 50px;
1578
+ height: 50px;
1579
+ margin-top: -11px;
1580
+ }
1581
+ .pluno-pa-widget--scribble .pluno-pa-widget__tool-group {
1582
+ margin-bottom: -16px;
1583
+ }
1584
+ /* Wobbly outlines: the filter runs on a ::before layer that draws each
1585
+ box's fill and border, so text glyphs stay crisp */
1586
+ .pluno-pa-widget--scribble .pluno-pa-widget__message--user {
1587
+ border-radius: var(--pluno-pa-scribble-wobble-alt);
1588
+ transform: rotate(-0.6deg);
1589
+ }
1590
+ .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner {
1591
+ border-radius: var(--pluno-pa-scribble-wobble);
1592
+ }
1593
+ .pluno-pa-widget--scribble .pluno-pa-widget__message--user,
1594
+ .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
1595
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
1596
+ .pluno-pa-widget--scribble .pluno-pa-widget__send,
1597
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
1598
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
1599
+ .pluno-pa-widget--scribble .pluno-pa-widget__close {
1600
+ isolation: isolate;
1601
+ border: 2px solid transparent;
1602
+ background: transparent;
1603
+ box-shadow: none;
1604
+ }
1605
+ .pluno-pa-widget--scribble .pluno-pa-widget__message--user::before,
1606
+ .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner::before,
1607
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher::before,
1608
+ .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
1609
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
1610
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
1611
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
1612
+ content: "";
1613
+ position: absolute;
1614
+ inset: -2px;
1615
+ z-index: -1;
1616
+ border: 2px solid var(--pluno-pa-divider);
1617
+ border-radius: inherit;
1618
+ background: var(--pluno-pa-surface);
1619
+ filter: url(#pluno-pa-scribble-wobble-3);
1620
+ pointer-events: none;
1621
+ }
1622
+ .pluno-pa-widget--scribble .pluno-pa-widget__message--user::before {
1623
+ background: var(--pluno-pa-bubble);
1624
+ filter: url(#pluno-pa-scribble-wobble-2);
1625
+ }
1626
+ .pluno-pa-widget--scribble .pluno-pa-widget__send::before {
1627
+ background: var(--pluno-pa-accent);
1628
+ }
1629
+ .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
1630
+ background: var(--pluno-pa-surface);
1631
+ }
1632
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
1633
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
1634
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
1635
+ background: var(--pluno-pa-bg);
1636
+ }
1637
+ .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within {
1638
+ border-color: transparent;
1639
+ }
1640
+ .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within::before {
1641
+ border-color: var(--pluno-pa-accent);
1642
+ }
1643
+ .pluno-pa-widget--scribble .pluno-pa-widget__send,
1644
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
1645
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
1646
+ .pluno-pa-widget--scribble .pluno-pa-widget__close {
1647
+ border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
1648
+ }
1649
+ .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
1650
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
1651
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
1652
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::after {
1653
+ content: "";
1654
+ position: absolute;
1655
+ inset: -3px;
1656
+ z-index: -1;
1657
+ border: 2px solid var(--pluno-pa-divider);
1658
+ border-radius: 58% 42% 56% 44% / 43% 57% 45% 55%;
1659
+ filter: url(#pluno-pa-scribble-wobble-2);
1660
+ pointer-events: none;
1661
+ opacity: 0.6;
1662
+ transform: rotate(12deg);
1663
+ }
1664
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
1665
+ transform: rotate(-10deg);
1666
+ filter: url(#pluno-pa-scribble-wobble);
1667
+ }
1668
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after {
1669
+ transform: rotate(14deg);
1670
+ filter: url(#pluno-pa-scribble-wobble-3);
1671
+ }
1672
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::after {
1673
+ transform: rotate(-13deg);
1674
+ filter: url(#pluno-pa-scribble-wobble-3);
1675
+ }
1676
+ .pluno-pa-widget--scribble .pluno-pa-widget__send::before {
1677
+ transform: rotate(-7deg);
1678
+ filter: url(#pluno-pa-scribble-wobble);
1679
+ }
1680
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before {
1681
+ transform: rotate(6deg);
1682
+ filter: url(#pluno-pa-scribble-wobble-2);
1683
+ }
1684
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before {
1685
+ transform: rotate(-9deg);
1686
+ }
1687
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
1688
+ transform: rotate(8deg);
1689
+ filter: url(#pluno-pa-scribble-wobble-2);
1690
+ }
1691
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher {
1692
+ /* A paper strip, not a chat capsule */
1693
+ border-radius: 14px 11px 15px 10px / 12px 15px 10px 14px;
1694
+ /* Taller strip so the bolt clears the spiral ring stubs */
1695
+ height: 48px;
1696
+ }
1697
+ .pluno-pa-widget--scribble:not(.pluno-pa-widget--open):not(.pluno-pa-widget--closing) {
1698
+ height: 48px;
1699
+ }
1700
+ .pluno-pa-widget--scribble .pluno-pa-widget__character--launcher {
1701
+ margin-top: 3px;
1702
+ }
1703
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-input {
1704
+ margin-top: 2px;
1705
+ }
1706
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher::before {
1707
+ background-color: var(--pluno-pa-bg);
1708
+ background-image:
1709
+ linear-gradient(var(--pluno-pa-scribble-grid-line) 1px, transparent 1px),
1710
+ linear-gradient(90deg, var(--pluno-pa-scribble-grid-line) 1px, transparent 1px);
1711
+ background-size: 22px 22px;
1712
+ }
1713
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher::after {
1714
+ content: "";
1715
+ position: absolute;
1716
+ top: -11px;
1717
+ left: 12px;
1718
+ right: 12px;
1719
+ height: 22px;
1720
+ z-index: 1;
1721
+ background-image: url('${ne}');
1722
+ background-repeat: repeat-x;
1723
+ background-size: 62px 21.5px;
1724
+ filter: url(#pluno-pa-scribble-wobble-2);
1725
+ pointer-events: none;
1726
+ }
1727
+ .pluno-pa-widget--scribble .pluno-pa-widget__send svg,
1728
+ .pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
1729
+ .pluno-pa-widget--scribble .pluno-pa-widget__message-copy svg,
1730
+ .pluno-pa-widget--scribble .pluno-pa-widget__close svg {
1731
+ filter: url(#pluno-pa-scribble-wobble-2);
1732
+ }
1369
1733
  `, t.appendChild(o);
1370
1734
  }
1371
- async function Me() {
1735
+ async function qe() {
1372
1736
  return document.body ? document.body : await new Promise((t) => {
1373
1737
  const e = new MutationObserver(() => {
1374
1738
  document.body && (e.disconnect(), t(document.body));
@@ -1376,16 +1740,16 @@ async function Me() {
1376
1740
  e.observe(document.documentElement, { childList: !0 });
1377
1741
  });
1378
1742
  }
1379
- function M(t) {
1743
+ function D(t) {
1380
1744
  const e = document.createElement("span");
1381
1745
  return e.textContent = t, e.innerHTML;
1382
1746
  }
1383
- function le(t) {
1747
+ function we(t) {
1384
1748
  return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
1385
1749
  }
1386
- function Oe(t) {
1750
+ function Ye(t) {
1387
1751
  try {
1388
- const e = window.localStorage.getItem(le(t));
1752
+ const e = window.localStorage.getItem(we(t));
1389
1753
  if (!e)
1390
1754
  return { isOpen: !1, composerValue: "", openToolGroupKeys: [] };
1391
1755
  const o = JSON.parse(e);
@@ -1398,35 +1762,35 @@ function Oe(t) {
1398
1762
  return { isOpen: !1, composerValue: "", openToolGroupKeys: [] };
1399
1763
  }
1400
1764
  }
1401
- function $e(t, e) {
1765
+ function Ze(t, e) {
1402
1766
  try {
1403
- window.localStorage.setItem(le(t), JSON.stringify(e));
1767
+ window.localStorage.setItem(we(t), JSON.stringify(e));
1404
1768
  } catch {
1405
1769
  return;
1406
1770
  }
1407
1771
  }
1408
- const oe = /* @__PURE__ */ new WeakSet();
1409
- function De(t) {
1772
+ const ue = /* @__PURE__ */ new WeakSet();
1773
+ function Xe(t) {
1410
1774
  return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
1411
1775
  }
1412
- function ae(t) {
1776
+ function ge(t) {
1413
1777
  const e = t.pathname.split("/");
1414
1778
  return e[e.length - 1] ?? "";
1415
1779
  }
1416
- function Fe(t, e) {
1780
+ function Je(t, e) {
1417
1781
  const o = new URL(t.src, document.baseURI);
1418
- return o.href === e.href || o.pathname === e.pathname ? !0 : ae(o) === ae(e);
1782
+ return o.href === e.href || o.pathname === e.pathname ? !0 : ge(o) === ge(e);
1419
1783
  }
1420
1784
  class C extends EventTarget {
1421
1785
  constructor(e, o) {
1422
- super(), this.channelId = o, this.url = e, this.addPreviewListener(ve, () => {
1786
+ super(), this.channelId = o, this.url = e, this.addPreviewListener(Oe, () => {
1423
1787
  this.readyState = C.OPEN, this.dispatchEvent(new Event("open"));
1424
- }), this.addPreviewListener(ye, (n) => {
1788
+ }), this.addPreviewListener($e, (n) => {
1425
1789
  const a = n;
1426
1790
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
1427
- }), this.addPreviewListener(ke, () => {
1791
+ }), this.addPreviewListener(De, () => {
1428
1792
  this.readyState = C.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
1429
- }), this.addPreviewListener(Ce, (n) => {
1793
+ }), this.addPreviewListener(Fe, (n) => {
1430
1794
  const a = n;
1431
1795
  this.readyState = C.CLOSED, this.dispatchEvent(
1432
1796
  new CloseEvent("close", {
@@ -1436,7 +1800,7 @@ class C extends EventTarget {
1436
1800
  })
1437
1801
  ), this.cleanup();
1438
1802
  }), window.dispatchEvent(
1439
- new CustomEvent(O(_e, this.channelId), {
1803
+ new CustomEvent(F(Ae, this.channelId), {
1440
1804
  detail: { socketId: this.socketId, url: e }
1441
1805
  })
1442
1806
  );
@@ -1452,27 +1816,27 @@ class C extends EventTarget {
1452
1816
  binaryType = "blob";
1453
1817
  bufferedAmount = 0;
1454
1818
  readyState = C.CONNECTING;
1455
- socketId = Ge();
1819
+ socketId = Qe();
1456
1820
  listeners = /* @__PURE__ */ new Map();
1457
1821
  send(e) {
1458
1822
  if (this.readyState !== C.OPEN)
1459
1823
  throw new DOMException("Product Agent preview websocket is not open", "InvalidStateError");
1460
1824
  window.dispatchEvent(
1461
- new CustomEvent(O(be, this.channelId), {
1825
+ new CustomEvent(F(Ie, this.channelId), {
1462
1826
  detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
1463
1827
  })
1464
1828
  );
1465
1829
  }
1466
1830
  close(e, o) {
1467
1831
  this.readyState !== C.CLOSED && (this.readyState = C.CLOSING, window.dispatchEvent(
1468
- new CustomEvent(O(xe, this.channelId), {
1832
+ new CustomEvent(F(Me, this.channelId), {
1469
1833
  detail: { socketId: this.socketId, code: e, reason: o }
1470
1834
  })
1471
1835
  ), this.cleanup());
1472
1836
  }
1473
1837
  addPreviewListener(e, o) {
1474
- const n = O(e, this.channelId), a = (i) => {
1475
- i.detail?.socketId === this.socketId && o(i);
1838
+ const n = F(e, this.channelId), a = (r) => {
1839
+ r.detail?.socketId === this.socketId && o(r);
1476
1840
  };
1477
1841
  this.listeners.set(n, a), window.addEventListener(n, a);
1478
1842
  }
@@ -1482,48 +1846,49 @@ class C extends EventTarget {
1482
1846
  this.listeners.clear();
1483
1847
  }
1484
1848
  }
1485
- function Ge() {
1486
- const t = window.sessionStorage.getItem(Y);
1849
+ function Qe() {
1850
+ const t = window.sessionStorage.getItem(te);
1487
1851
  if (t)
1488
1852
  return t;
1489
1853
  const e = crypto.randomUUID();
1490
- return window.sessionStorage.setItem(Y, e), e;
1854
+ return window.sessionStorage.setItem(te, e), e;
1491
1855
  }
1492
- function O(t, e) {
1856
+ function F(t, e) {
1493
1857
  return `${t}:${e}`;
1494
1858
  }
1495
- function ze(t) {
1859
+ function et(t) {
1496
1860
  const e = document.currentScript;
1497
1861
  if (e instanceof HTMLScriptElement)
1498
1862
  return [e];
1499
1863
  const o = new URL(t, document.baseURI).href, n = new URL(o);
1500
1864
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
1501
- (a) => a instanceof HTMLScriptElement && De(a) && Fe(a, n)
1865
+ (a) => a instanceof HTMLScriptElement && Xe(a) && Je(a, n)
1502
1866
  );
1503
1867
  }
1504
- function Re(t) {
1505
- for (const e of ze(t)) {
1506
- if (oe.has(e) || e.dataset.plunoAutoMount === "false")
1868
+ function tt(t) {
1869
+ for (const e of et(t)) {
1870
+ if (ue.has(e) || e.dataset.plunoAutoMount === "false")
1507
1871
  continue;
1508
- oe.add(e);
1872
+ ue.add(e);
1509
1873
  const o = e.dataset.plunoPreviewChannel;
1510
- Le({
1874
+ Be({
1511
1875
  token: e.dataset.plunoToken,
1512
1876
  tokenEndpoint: e.dataset.plunoTokenEndpoint,
1513
1877
  backendUrl: e.dataset.plunoBackendUrl,
1514
- webSocketFactory: o ? Se(o) : void 0,
1878
+ webSocketFactory: o ? ze(o) : void 0,
1515
1879
  launcherLabel: e.dataset.plunoLauncherLabel,
1516
1880
  accentColor: e.dataset.plunoAccentColor,
1517
1881
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
1518
1882
  fontFamily: e.dataset.plunoFontFamily,
1883
+ scribbleStyle: e.dataset.plunoScribbleStyle === "true",
1519
1884
  position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
1520
1885
  }).catch((n) => {
1521
1886
  console.error("Failed to mount Pluno Product Agent widget", n);
1522
1887
  });
1523
1888
  }
1524
1889
  }
1525
- Re(import.meta.url);
1890
+ tt(import.meta.url);
1526
1891
  export {
1527
- Se as createProductAgentPreviewBridgeWebSocketFactory,
1528
- Le as mountPlunoProductAgentWidget
1892
+ ze as createProductAgentPreviewBridgeWebSocketFactory,
1893
+ Be as mountPlunoProductAgentWidget
1529
1894
  };