@pluno/product-agent-web 0.1.133 → 0.1.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/product-agent-sdk.js +125 -115
- package/dist/product-agent-widget.js +217 -205
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -149,11 +149,11 @@ function os(t, e, n) {
|
|
|
149
149
|
t.slice(o, e)
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
|
-
const
|
|
152
|
+
const Zn = "pluno.productAgent.transportId", is = "pluno.productAgent.transportIdentity", Qn = "pluno.productAgent.transportIdentity.event", rs = 50, as = globalThis.setTimeout.bind(globalThis);
|
|
153
153
|
let Ut = null;
|
|
154
|
-
const
|
|
154
|
+
const fn = /* @__PURE__ */ new Set(), eo = /* @__PURE__ */ new Map();
|
|
155
155
|
async function ss(t = Cr()) {
|
|
156
|
-
const e = t.randomUUID(), n = t.storage.getItem(
|
|
156
|
+
const e = t.randomUUID(), n = t.storage.getItem(Zn);
|
|
157
157
|
let o = n ?? t.randomUUID(), i = !1, r = !1;
|
|
158
158
|
const s = t.channel.subscribe((p) => {
|
|
159
159
|
if (!(p.senderId === e || p.transportId !== o)) {
|
|
@@ -171,14 +171,14 @@ async function ss(t = Cr()) {
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
if (!n)
|
|
174
|
-
t.storage.setItem(
|
|
174
|
+
t.storage.setItem(Zn, o), i = !0;
|
|
175
175
|
else
|
|
176
176
|
for (; ; ) {
|
|
177
177
|
if (r = !1, t.channel.postMessage({ type: "probe", transportId: o, senderId: e }), await t.settle(), !r) {
|
|
178
178
|
i = !0;
|
|
179
179
|
break;
|
|
180
180
|
}
|
|
181
|
-
o = t.randomUUID(), t.storage.setItem(
|
|
181
|
+
o = t.randomUUID(), t.storage.setItem(Zn, o);
|
|
182
182
|
}
|
|
183
183
|
let l = !1;
|
|
184
184
|
return {
|
|
@@ -191,24 +191,24 @@ async function ss(t = Cr()) {
|
|
|
191
191
|
async function ls() {
|
|
192
192
|
Ut || (Ut = ss(Cr()), Ut.then((o) => {
|
|
193
193
|
const i = (r) => {
|
|
194
|
-
r.persisted || (o.release(), Ut = null,
|
|
194
|
+
r.persisted || (o.release(), Ut = null, fn.clear(), window.removeEventListener("pagehide", i));
|
|
195
195
|
};
|
|
196
196
|
window.addEventListener("pagehide", i);
|
|
197
197
|
}));
|
|
198
198
|
const t = await Ut, e = ps();
|
|
199
|
-
|
|
199
|
+
fn.add(e);
|
|
200
200
|
let n = !1;
|
|
201
201
|
return {
|
|
202
202
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
203
203
|
transportId: e === 0 ? t.transportId : `${t.transportId}.${e}`,
|
|
204
204
|
release: () => {
|
|
205
|
-
n || (n = !0,
|
|
205
|
+
n || (n = !0, fn.delete(e));
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
function ps() {
|
|
210
210
|
let t = 0;
|
|
211
|
-
for (;
|
|
211
|
+
for (; fn.has(t); )
|
|
212
212
|
t += 1;
|
|
213
213
|
return t;
|
|
214
214
|
}
|
|
@@ -224,13 +224,13 @@ function cs() {
|
|
|
224
224
|
return {
|
|
225
225
|
getItem: (t) => {
|
|
226
226
|
try {
|
|
227
|
-
return window.sessionStorage?.getItem(t) ??
|
|
227
|
+
return window.sessionStorage?.getItem(t) ?? eo.get(t) ?? null;
|
|
228
228
|
} catch {
|
|
229
|
-
return
|
|
229
|
+
return eo.get(t) ?? null;
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
232
|
setItem: (t, e) => {
|
|
233
|
-
|
|
233
|
+
eo.set(t, e);
|
|
234
234
|
try {
|
|
235
235
|
window.sessionStorage?.setItem(t, e);
|
|
236
236
|
} catch {
|
|
@@ -254,7 +254,7 @@ function ds() {
|
|
|
254
254
|
}
|
|
255
255
|
function us() {
|
|
256
256
|
const t = /* @__PURE__ */ new Set(), e = (n) => {
|
|
257
|
-
if (n.key !==
|
|
257
|
+
if (n.key !== Qn || !n.newValue)
|
|
258
258
|
return;
|
|
259
259
|
const o = JSON.parse(n.newValue);
|
|
260
260
|
for (const i of t)
|
|
@@ -263,9 +263,9 @@ function us() {
|
|
|
263
263
|
return window.addEventListener("storage", e), {
|
|
264
264
|
postMessage: (n) => {
|
|
265
265
|
window.localStorage.setItem(
|
|
266
|
-
|
|
266
|
+
Qn,
|
|
267
267
|
JSON.stringify({ ...n, eventId: crypto.randomUUID() })
|
|
268
|
-
), window.localStorage.removeItem(
|
|
268
|
+
), window.localStorage.removeItem(Qn);
|
|
269
269
|
},
|
|
270
270
|
subscribe: (n) => (t.add(n), () => t.delete(n)),
|
|
271
271
|
close: () => {
|
|
@@ -273,12 +273,12 @@ function us() {
|
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
const gs = globalThis.fetch.bind(globalThis), _o = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', hs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', fs = ".pluno-pa-widget__panel", ms = ".pluno-pa-widget__timeline", Ti = `${_o}[data-pluno-sdk-preview-channel]`, ws = "https://app.pluno.ai", bs = "gpt-5.6-terra", _s = 2e4, ys = 1e4, xs = 1e4, vs = 1e4, Ss = 1e4, Es = 1e3, Ii = 3e4, ki = 0.2, Ai = 6e4, Cs = 15e3, ln = 8, Ts = 15e3, Is = 2e3, ks = 1e3, As = 100, Ps = 8e3, Pi = 3, Rs = [300, 1e3], Bo = 64e3,
|
|
276
|
+
const gs = globalThis.fetch.bind(globalThis), _o = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', hs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', fs = ".pluno-pa-widget__panel", ms = ".pluno-pa-widget__timeline", Ti = `${_o}[data-pluno-sdk-preview-channel]`, ws = "https://app.pluno.ai", bs = "gpt-5.6-terra", _s = 2e4, ys = 1e4, xs = 1e4, vs = 1e4, Ss = 1e4, Es = 1e3, Ii = 3e4, ki = 0.2, Ai = 6e4, Cs = 15e3, ln = 8, Ts = 15e3, Is = 2e3, ks = 1e3, As = 100, Ps = 8e3, Pi = 3, Rs = [300, 1e3], Bo = 64e3, to = 4e3, Fo = 30, Ls = 2e3, Ms = 1e3, Tr = "Image is too large for model vision input.", Ns = 100, Ir = "pluno.productAgent.state.", yo = "pluno.productAgent.pendingEvents.", Tn = "pluno.productAgent.activeToolCalls.", Us = 100;
|
|
277
277
|
function pn(t, e = 0) {
|
|
278
278
|
const n = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
279
279
|
return Math.max(e, n);
|
|
280
280
|
}
|
|
281
|
-
const
|
|
281
|
+
const mn = /* @__PURE__ */ new Set();
|
|
282
282
|
let cn = null;
|
|
283
283
|
function Ds(t, e = Math.random) {
|
|
284
284
|
const n = Math.min(Ii, Es * 2 ** t), o = 1 - ki + e() * ki * 2;
|
|
@@ -489,7 +489,7 @@ class Ho {
|
|
|
489
489
|
let r = i.map(Go);
|
|
490
490
|
if (!o && r.length === 0)
|
|
491
491
|
return null;
|
|
492
|
-
const s = Le(), l = n.clientMessageId ??
|
|
492
|
+
const s = Le(), l = n.clientMessageId ?? io(), p = {
|
|
493
493
|
id: `local-${l}`,
|
|
494
494
|
role: "user",
|
|
495
495
|
content: o,
|
|
@@ -556,7 +556,7 @@ class Ho {
|
|
|
556
556
|
return !e || !n ? !1 : (this.retryAttemptsByClientMessageId[n] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: n, automatic: !1 }), !0);
|
|
557
557
|
}
|
|
558
558
|
createLocalAttachment(e) {
|
|
559
|
-
const n =
|
|
559
|
+
const n = io(), o = {
|
|
560
560
|
id: n,
|
|
561
561
|
name: e.name || "attachment",
|
|
562
562
|
mimeType: Wi(e),
|
|
@@ -605,20 +605,30 @@ class Ho {
|
|
|
605
605
|
model: this.options.model,
|
|
606
606
|
metadata: Ri(this.options.metadata),
|
|
607
607
|
entrySurface: this.options.entrySurface
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
608
|
+
};
|
|
609
|
+
let s;
|
|
610
|
+
if (this.options.persistAttachmentUpload)
|
|
611
|
+
s = await un(
|
|
612
|
+
() => this.options.persistAttachmentUpload(r, e),
|
|
613
|
+
"Failed to upload attachment"
|
|
614
|
+
);
|
|
615
|
+
else {
|
|
616
|
+
const p = this.options.prepareAttachmentUpload ? await un(
|
|
617
|
+
() => this.options.prepareAttachmentUpload(r),
|
|
618
|
+
"Failed to prepare attachment upload"
|
|
619
|
+
) : await this.prepareEmbedAttachmentUpload(r);
|
|
620
|
+
await un(async () => {
|
|
621
|
+
const c = await fetch(new URL(p.uploadUrl, this.options.backendUrl), {
|
|
622
|
+
method: p.uploadMethod,
|
|
623
|
+
headers: p.uploadHeaders,
|
|
624
|
+
body: e
|
|
625
|
+
});
|
|
626
|
+
if (!c.ok)
|
|
627
|
+
throw new wn("Failed to upload attachment", c.status);
|
|
628
|
+
return c;
|
|
629
|
+
}, "Failed to upload attachment"), s = p;
|
|
630
|
+
}
|
|
631
|
+
this.setState({ sessionId: s.sessionId });
|
|
622
632
|
const l = Fr(s.attachment, this.options.backendUrl);
|
|
623
633
|
return this.updateAttachmentInState(n.id, l), n.id && Ga(n.id, {
|
|
624
634
|
sessionId: s.sessionId,
|
|
@@ -646,7 +656,7 @@ class Ho {
|
|
|
646
656
|
}
|
|
647
657
|
async prepareEmbedAttachmentUpload(e) {
|
|
648
658
|
let n = !1;
|
|
649
|
-
return await
|
|
659
|
+
return await un(async () => {
|
|
650
660
|
const o = await this.fetchEmbedAttachmentUpload(e);
|
|
651
661
|
if (o.ok)
|
|
652
662
|
return await o.json();
|
|
@@ -655,9 +665,9 @@ class Ho {
|
|
|
655
665
|
const i = await this.fetchEmbedAttachmentUpload(e);
|
|
656
666
|
if (i.ok)
|
|
657
667
|
return await i.json();
|
|
658
|
-
throw new
|
|
668
|
+
throw new wn("Failed to prepare attachment upload", i.status);
|
|
659
669
|
}
|
|
660
|
-
throw new
|
|
670
|
+
throw new wn("Failed to prepare attachment upload", o.status);
|
|
661
671
|
}, "Failed to prepare attachment upload");
|
|
662
672
|
}
|
|
663
673
|
async fetchEmbedAttachmentUpload(e) {
|
|
@@ -694,7 +704,7 @@ class Ho {
|
|
|
694
704
|
});
|
|
695
705
|
}
|
|
696
706
|
listSessions(e = {}) {
|
|
697
|
-
const n =
|
|
707
|
+
const n = io(), o = new Promise((r, s) => {
|
|
698
708
|
const l = window.setTimeout(() => {
|
|
699
709
|
this.pendingSessionHistoryRequests.delete(n), s(new Error("Session history did not respond in time"));
|
|
700
710
|
}, Ps);
|
|
@@ -1402,7 +1412,7 @@ class Ho {
|
|
|
1402
1412
|
this.listeners[e]?.forEach((i) => i(n));
|
|
1403
1413
|
}
|
|
1404
1414
|
}
|
|
1405
|
-
const
|
|
1415
|
+
const no = /* @__PURE__ */ new WeakMap();
|
|
1406
1416
|
function zs(t) {
|
|
1407
1417
|
const e = window.__plunoProductAgentNetworkCapture ?? Bs();
|
|
1408
1418
|
return e.subscribers.add(t), () => {
|
|
@@ -1429,8 +1439,8 @@ function Bs() {
|
|
|
1429
1439
|
const v = _ instanceof Request ? _ : null, y = gp(_, v), I = Hr(f?.headers ?? v?.headers);
|
|
1430
1440
|
if (!wt(y, I, f?.body)) {
|
|
1431
1441
|
const L = {
|
|
1432
|
-
requestId:
|
|
1433
|
-
url: $e(y,
|
|
1442
|
+
requestId: ro("fetch"),
|
|
1443
|
+
url: $e(y, to),
|
|
1434
1444
|
method: (f?.method ?? v?.method ?? "GET").toUpperCase(),
|
|
1435
1445
|
requestHeaders: I,
|
|
1436
1446
|
requestBody: qi(f?.body),
|
|
@@ -1461,21 +1471,21 @@ function Bs() {
|
|
|
1461
1471
|
return g;
|
|
1462
1472
|
}, l = function(_, f, b, g, v) {
|
|
1463
1473
|
const y = o.call(this, _, f, b ?? !0, g ?? void 0, v ?? void 0), I = typeof f == "string" ? f : f.toString();
|
|
1464
|
-
return
|
|
1465
|
-
requestId:
|
|
1474
|
+
return no.set(this, {
|
|
1475
|
+
requestId: ro("xhr"),
|
|
1466
1476
|
method: String(_ ?? "GET").toUpperCase(),
|
|
1467
|
-
url: $e(I,
|
|
1477
|
+
url: $e(I, to),
|
|
1468
1478
|
requestHeaders: {},
|
|
1469
1479
|
startedAtMs: Date.now(),
|
|
1470
1480
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1471
1481
|
excluded: wt(I)
|
|
1472
1482
|
}), y;
|
|
1473
1483
|
}, p = function(_, f) {
|
|
1474
|
-
const b = i.call(this, _, f), g =
|
|
1484
|
+
const b = i.call(this, _, f), g = no.get(this);
|
|
1475
1485
|
return g && Object.keys(g.requestHeaders).length < Fo && (g.requestHeaders[_] = Ko(_, f), g.excluded = g.excluded || wt(g.url, g.requestHeaders)), b;
|
|
1476
1486
|
}, c = function(_) {
|
|
1477
1487
|
try {
|
|
1478
|
-
const f =
|
|
1488
|
+
const f = no.get(this);
|
|
1479
1489
|
f && (f.excluded = f.excluded || wt(f.url, f.requestHeaders, _), f.requestBody = qi(_), f.excluded || this.addEventListener(
|
|
1480
1490
|
"loadend",
|
|
1481
1491
|
() => {
|
|
@@ -1532,8 +1542,8 @@ function Bs() {
|
|
|
1532
1542
|
continue;
|
|
1533
1543
|
const b = performance.timeOrigin + f.startTime;
|
|
1534
1544
|
e({
|
|
1535
|
-
requestId:
|
|
1536
|
-
url: $e(f.name,
|
|
1545
|
+
requestId: ro("resource"),
|
|
1546
|
+
url: $e(f.name, to),
|
|
1537
1547
|
method: "GET",
|
|
1538
1548
|
resourceType: "resource",
|
|
1539
1549
|
responseStatus: f.responseStatus,
|
|
@@ -1842,13 +1852,13 @@ function al() {
|
|
|
1842
1852
|
};
|
|
1843
1853
|
}
|
|
1844
1854
|
function sl(t) {
|
|
1845
|
-
return
|
|
1846
|
-
|
|
1855
|
+
return mn.add(t), cn || (cn = ll()), () => {
|
|
1856
|
+
mn.delete(t), mn.size === 0 && (cn?.(), cn = null);
|
|
1847
1857
|
};
|
|
1848
1858
|
}
|
|
1849
1859
|
function ll() {
|
|
1850
1860
|
const t = () => {
|
|
1851
|
-
for (const r of Array.from(
|
|
1861
|
+
for (const r of Array.from(mn))
|
|
1852
1862
|
r();
|
|
1853
1863
|
}, e = window.history.pushState.bind(window.history), n = window.history.replaceState.bind(window.history), o = ((...r) => {
|
|
1854
1864
|
const s = e(...r);
|
|
@@ -1876,9 +1886,9 @@ function Wo() {
|
|
|
1876
1886
|
(b) => Ar(b) && !b.parentElement?.closest(o)
|
|
1877
1887
|
);
|
|
1878
1888
|
for (const b of i.slice(0, 3))
|
|
1879
|
-
n("Active overlay",
|
|
1880
|
-
const r = cl(), s = r ?
|
|
1881
|
-
n("Main page content", s), n("Additional visible page text",
|
|
1889
|
+
n("Active overlay", oo(Ft(b), e));
|
|
1890
|
+
const r = cl(), s = r ? oo(Ft(r), e) : "";
|
|
1891
|
+
n("Main page content", s), n("Additional visible page text", oo(Ft(document.body), e));
|
|
1882
1892
|
const l = t.map(([b, g]) => `${b}:
|
|
1883
1893
|
${g}`).join(`
|
|
1884
1894
|
|
|
@@ -1900,7 +1910,7 @@ function yt(t) {
|
|
|
1900
1910
|
|
|
1901
1911
|
`).trim();
|
|
1902
1912
|
}
|
|
1903
|
-
function
|
|
1913
|
+
function oo(t, e) {
|
|
1904
1914
|
let n = yt(t);
|
|
1905
1915
|
for (const o of e)
|
|
1906
1916
|
n = n.replace(o, "");
|
|
@@ -2262,7 +2272,7 @@ function xl() {
|
|
|
2262
2272
|
const n = crypto.randomUUID();
|
|
2263
2273
|
return window.localStorage.setItem(t, n), n;
|
|
2264
2274
|
}
|
|
2265
|
-
function
|
|
2275
|
+
function io() {
|
|
2266
2276
|
return crypto.randomUUID();
|
|
2267
2277
|
}
|
|
2268
2278
|
function vl(t) {
|
|
@@ -2595,7 +2605,7 @@ function Or(t) {
|
|
|
2595
2605
|
function Hl(t) {
|
|
2596
2606
|
return xt(t) ? !0 : t.role !== "system" ? !1 : t.dataType === "run_error" ? !0 : t.dataType === "run_status" && t.loading !== !0;
|
|
2597
2607
|
}
|
|
2598
|
-
function
|
|
2608
|
+
function In(t) {
|
|
2599
2609
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
2600
2610
|
const n = t[e];
|
|
2601
2611
|
if (!n || typeof n != "object")
|
|
@@ -2610,7 +2620,7 @@ function Tn(t) {
|
|
|
2610
2620
|
return null;
|
|
2611
2621
|
}
|
|
2612
2622
|
function Wl(t) {
|
|
2613
|
-
const e =
|
|
2623
|
+
const e = In(t);
|
|
2614
2624
|
if (e === null)
|
|
2615
2625
|
return null;
|
|
2616
2626
|
const o = _t(t[e])?.page;
|
|
@@ -2632,7 +2642,7 @@ function zi(t) {
|
|
|
2632
2642
|
return t?.type === "run_status" && t.status === "interrupted" && t.reason === "backend_restart";
|
|
2633
2643
|
}
|
|
2634
2644
|
function ql(t, e) {
|
|
2635
|
-
const n =
|
|
2645
|
+
const n = In(e);
|
|
2636
2646
|
if (n === null)
|
|
2637
2647
|
return !1;
|
|
2638
2648
|
const o = e[n], i = o && typeof o == "object" ? o.id : null;
|
|
@@ -2642,7 +2652,7 @@ function ql(t, e) {
|
|
|
2642
2652
|
return r === -1 ? !1 : t.slice(r + 1).some(Hl);
|
|
2643
2653
|
}
|
|
2644
2654
|
function vo(t) {
|
|
2645
|
-
const e =
|
|
2655
|
+
const e = In(t);
|
|
2646
2656
|
if (e === null)
|
|
2647
2657
|
return null;
|
|
2648
2658
|
const n = t[e];
|
|
@@ -2655,7 +2665,7 @@ function vo(t) {
|
|
|
2655
2665
|
return typeof i == "string" ? i : null;
|
|
2656
2666
|
}
|
|
2657
2667
|
function $l(t) {
|
|
2658
|
-
const e =
|
|
2668
|
+
const e = In(t);
|
|
2659
2669
|
if (e === null)
|
|
2660
2670
|
return null;
|
|
2661
2671
|
for (let n = t.length - 1; n > e; n -= 1) {
|
|
@@ -2749,7 +2759,7 @@ function Xl(t, e) {
|
|
|
2749
2759
|
const i = t[o];
|
|
2750
2760
|
if (i.role === "user")
|
|
2751
2761
|
return !1;
|
|
2752
|
-
if (i.role === "assistant" &&
|
|
2762
|
+
if (i.role === "assistant" && kn(n, i))
|
|
2753
2763
|
return !0;
|
|
2754
2764
|
}
|
|
2755
2765
|
return !1;
|
|
@@ -2770,25 +2780,25 @@ function Yl(t, e) {
|
|
|
2770
2780
|
function Jl(t, e) {
|
|
2771
2781
|
const n = t[e];
|
|
2772
2782
|
for (let o = e + 1; o < t.length; o += 1)
|
|
2773
|
-
if (t[o].role === "assistant" &&
|
|
2783
|
+
if (t[o].role === "assistant" && kn(n, t[o]))
|
|
2774
2784
|
return !0;
|
|
2775
2785
|
return !1;
|
|
2776
2786
|
}
|
|
2777
2787
|
function Zl(t, e) {
|
|
2778
2788
|
const n = t[e];
|
|
2779
2789
|
for (let o = e + 1; o < t.length; o += 1)
|
|
2780
|
-
if (t[o].role === "tool" &&
|
|
2790
|
+
if (t[o].role === "tool" && kn(n, t[o]))
|
|
2781
2791
|
return !0;
|
|
2782
2792
|
return !1;
|
|
2783
2793
|
}
|
|
2784
2794
|
function Ql(t, e) {
|
|
2785
2795
|
const n = t[e];
|
|
2786
2796
|
for (let o = e + 1; o < t.length; o += 1)
|
|
2787
|
-
if ($o(t[o]) &&
|
|
2797
|
+
if ($o(t[o]) && kn(n, t[o]))
|
|
2788
2798
|
return !0;
|
|
2789
2799
|
return !1;
|
|
2790
2800
|
}
|
|
2791
|
-
function
|
|
2801
|
+
function kn(t, e) {
|
|
2792
2802
|
return !t.runId || !e.runId ? !0 : t.runId === e.runId;
|
|
2793
2803
|
}
|
|
2794
2804
|
function me(t, e) {
|
|
@@ -2852,7 +2862,7 @@ function Dt(t, e) {
|
|
|
2852
2862
|
}
|
|
2853
2863
|
function zr(t, e) {
|
|
2854
2864
|
try {
|
|
2855
|
-
const n = `${
|
|
2865
|
+
const n = `${Tn}${t}`, o = location.href, i = location.origin, r = Array.from(e, (s) => ({
|
|
2856
2866
|
...s,
|
|
2857
2867
|
storedAt: Date.now(),
|
|
2858
2868
|
unloadUrl: o,
|
|
@@ -2868,7 +2878,7 @@ function zr(t, e) {
|
|
|
2868
2878
|
}
|
|
2869
2879
|
function op(t, e) {
|
|
2870
2880
|
try {
|
|
2871
|
-
if (window.sessionStorage.getItem(`${
|
|
2881
|
+
if (window.sessionStorage.getItem(`${Tn}${t}`) === null)
|
|
2872
2882
|
return;
|
|
2873
2883
|
} catch {
|
|
2874
2884
|
return;
|
|
@@ -2877,7 +2887,7 @@ function op(t, e) {
|
|
|
2877
2887
|
}
|
|
2878
2888
|
function ip(t) {
|
|
2879
2889
|
try {
|
|
2880
|
-
const e = `${
|
|
2890
|
+
const e = `${Tn}${t}`, n = window.sessionStorage.getItem(e);
|
|
2881
2891
|
if (window.sessionStorage.removeItem(e), !n)
|
|
2882
2892
|
return [];
|
|
2883
2893
|
const o = JSON.parse(n);
|
|
@@ -2925,7 +2935,7 @@ function sp(t, e) {
|
|
|
2925
2935
|
}
|
|
2926
2936
|
function lp(t) {
|
|
2927
2937
|
try {
|
|
2928
|
-
window.sessionStorage.removeItem(`${
|
|
2938
|
+
window.sessionStorage.removeItem(`${Tn}${t}`);
|
|
2929
2939
|
} catch {
|
|
2930
2940
|
return;
|
|
2931
2941
|
}
|
|
@@ -3022,7 +3032,7 @@ function Hr(t) {
|
|
|
3022
3032
|
return e;
|
|
3023
3033
|
}
|
|
3024
3034
|
function Ko(t, e) {
|
|
3025
|
-
return Kr(t) ?
|
|
3035
|
+
return Kr(t) ? An : $e(xn(e), Ls);
|
|
3026
3036
|
}
|
|
3027
3037
|
function gp(t, e) {
|
|
3028
3038
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
@@ -3093,11 +3103,11 @@ function $i(t) {
|
|
|
3093
3103
|
return t;
|
|
3094
3104
|
const e = t.trim();
|
|
3095
3105
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
3096
|
-
return
|
|
3106
|
+
return xn(t);
|
|
3097
3107
|
try {
|
|
3098
3108
|
return JSON.stringify(Te(JSON.parse(t)));
|
|
3099
3109
|
} catch {
|
|
3100
|
-
return
|
|
3110
|
+
return xn(t);
|
|
3101
3111
|
}
|
|
3102
3112
|
}
|
|
3103
3113
|
function Wr(t) {
|
|
@@ -3151,16 +3161,16 @@ function yp(t) {
|
|
|
3151
3161
|
function $e(t, e = Bo) {
|
|
3152
3162
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
3153
3163
|
}
|
|
3154
|
-
function
|
|
3164
|
+
function ro(t) {
|
|
3155
3165
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
3156
3166
|
}
|
|
3157
|
-
class
|
|
3167
|
+
class wn extends Error {
|
|
3158
3168
|
constructor(e, n) {
|
|
3159
3169
|
super(`${e} (${n})`), this.status = n, this.name = "AttachmentUploadHttpError";
|
|
3160
3170
|
}
|
|
3161
3171
|
status;
|
|
3162
3172
|
}
|
|
3163
|
-
async function
|
|
3173
|
+
async function un(t, e) {
|
|
3164
3174
|
let n = null;
|
|
3165
3175
|
for (let o = 0; o < Pi; o += 1)
|
|
3166
3176
|
try {
|
|
@@ -3178,7 +3188,7 @@ function xp(t) {
|
|
|
3178
3188
|
});
|
|
3179
3189
|
}
|
|
3180
3190
|
function vp(t) {
|
|
3181
|
-
return t instanceof
|
|
3191
|
+
return t instanceof wn ? Sp(t.status) : t instanceof TypeError;
|
|
3182
3192
|
}
|
|
3183
3193
|
function Sp(t) {
|
|
3184
3194
|
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
@@ -3186,13 +3196,13 @@ function Sp(t) {
|
|
|
3186
3196
|
function Ep(t) {
|
|
3187
3197
|
return t === 401 || t === 403;
|
|
3188
3198
|
}
|
|
3189
|
-
const
|
|
3199
|
+
const An = "[REDACTED_SECRET]", je = "[REDACTED_TOKEN]", Cp = "[REDACTED_SIGNED_URL]", Tp = 20, Ip = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, qr = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, $r = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, jr = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Gr = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, kp = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ap = /\bhttps?:\/\/[^\s"'<>]+/gi, Pp = /[),.;\]]+$/;
|
|
3190
3200
|
function Te(t) {
|
|
3191
|
-
return
|
|
3201
|
+
return yn(t, 0, /* @__PURE__ */ new WeakSet());
|
|
3192
3202
|
}
|
|
3193
|
-
function
|
|
3203
|
+
function yn(t, e, n) {
|
|
3194
3204
|
if (typeof t == "string")
|
|
3195
|
-
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t :
|
|
3205
|
+
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : xn(t);
|
|
3196
3206
|
if (t === null || typeof t != "object")
|
|
3197
3207
|
return t;
|
|
3198
3208
|
if (e >= Tp)
|
|
@@ -3200,10 +3210,10 @@ function _n(t, e, n) {
|
|
|
3200
3210
|
if (n.has(t))
|
|
3201
3211
|
return "[REDACTED_CIRCULAR]";
|
|
3202
3212
|
if (n.add(t), Array.isArray(t))
|
|
3203
|
-
return t.map((i) =>
|
|
3213
|
+
return t.map((i) => yn(i, e + 1, n));
|
|
3204
3214
|
const o = {};
|
|
3205
3215
|
for (const [i, r] of Object.entries(t))
|
|
3206
|
-
i === "pageContent" ? o[i] = r : Kr(i) ? o[i] =
|
|
3216
|
+
i === "pageContent" ? o[i] = r : Kr(i) ? o[i] = An : o[i] = i.toLowerCase() === "url" ? Rp(r) : yn(r, e + 1, n);
|
|
3207
3217
|
return o;
|
|
3208
3218
|
}
|
|
3209
3219
|
function Kr(t) {
|
|
@@ -3211,7 +3221,7 @@ function Kr(t) {
|
|
|
3211
3221
|
return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
|
|
3212
3222
|
}
|
|
3213
3223
|
function Rp(t) {
|
|
3214
|
-
return typeof t == "string" ? Vr(t) :
|
|
3224
|
+
return typeof t == "string" ? Vr(t) : yn(t, 0, /* @__PURE__ */ new WeakSet());
|
|
3215
3225
|
}
|
|
3216
3226
|
function Vr(t) {
|
|
3217
3227
|
try {
|
|
@@ -3223,23 +3233,23 @@ function Vr(t) {
|
|
|
3223
3233
|
return Lp(t);
|
|
3224
3234
|
}
|
|
3225
3235
|
}
|
|
3226
|
-
function
|
|
3227
|
-
return t.replace(kp, Cp).replace(Ap, Mp).replace(qr, `Bearer ${je}`).replace($r, `Basic ${je}`).replace(jr, je).replace(Gr, (e, n) => `${n}: ${
|
|
3236
|
+
function xn(t) {
|
|
3237
|
+
return t.replace(kp, Cp).replace(Ap, Mp).replace(qr, `Bearer ${je}`).replace($r, `Basic ${je}`).replace(jr, je).replace(Gr, (e, n) => `${n}: ${An}`);
|
|
3228
3238
|
}
|
|
3229
3239
|
function Lp(t) {
|
|
3230
|
-
return t.replace(qr, `Bearer ${je}`).replace($r, `Basic ${je}`).replace(jr, je).replace(Gr, (e, n) => `${n}: ${
|
|
3240
|
+
return t.replace(qr, `Bearer ${je}`).replace($r, `Basic ${je}`).replace(jr, je).replace(Gr, (e, n) => `${n}: ${An}`);
|
|
3231
3241
|
}
|
|
3232
3242
|
function Mp(t) {
|
|
3233
3243
|
const e = t.match(Pp)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
|
|
3234
3244
|
return `${Vr(n)}${e}`;
|
|
3235
3245
|
}
|
|
3236
|
-
const Np = "#7c3aed",
|
|
3246
|
+
const Np = "#7c3aed", vn = "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", Sn = "#2c2a1e", ji = [253, 250, 241], Gi = 3.5;
|
|
3237
3247
|
function Xr(t) {
|
|
3238
3248
|
const e = Yr(t);
|
|
3239
3249
|
if (Ki(Ht(e), ji) >= Gi)
|
|
3240
3250
|
return e;
|
|
3241
3251
|
let o = Ht(e);
|
|
3242
|
-
const i = Ht(
|
|
3252
|
+
const i = Ht(Sn);
|
|
3243
3253
|
for (let r = 0; r < 6; r += 1)
|
|
3244
3254
|
if (o = Op(o, i, 0.22), Ki(o, ji) >= Gi)
|
|
3245
3255
|
return Co(o);
|
|
@@ -3535,7 +3545,7 @@ const Zr = 100, rc = 1e4, ac = 5e3, sc = "product-agent:sdk-preview-socket-conne
|
|
|
3535
3545
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
3536
3546
|
pathStrokeWidth: "2.45"
|
|
3537
3547
|
}
|
|
3538
|
-
], Nc = 11, Uc = 13,
|
|
3548
|
+
], Nc = 11, Uc = 13, En = 4, Yo = 10, Jo = 40, Dc = "movable-launcher-position-v2", ia = "pluno-pa-widget-styles", ra = "data-pluno-pa-widget-styles";
|
|
3539
3549
|
let nr = 0;
|
|
3540
3550
|
function Oc(t) {
|
|
3541
3551
|
return (e) => new qe(e, t);
|
|
@@ -3566,6 +3576,7 @@ async function zc(t = {}) {
|
|
|
3566
3576
|
capturePageContent: t.capturePageContent,
|
|
3567
3577
|
webSocketFactory: t.webSocketFactory,
|
|
3568
3578
|
prepareAttachmentUpload: t.prepareAttachmentUpload,
|
|
3579
|
+
persistAttachmentUpload: t.persistAttachmentUpload,
|
|
3569
3580
|
attachmentPreviewUrlResolver: t.attachmentPreviewUrlResolver,
|
|
3570
3581
|
attachmentsEnabled: t.attachmentsEnabled !== !1,
|
|
3571
3582
|
loginRequired: t.loginRequired === !0,
|
|
@@ -3725,7 +3736,7 @@ async function zc(t = {}) {
|
|
|
3725
3736
|
throw new Error("Failed to mount Pluno widget panel drag handle");
|
|
3726
3737
|
let U = !1;
|
|
3727
3738
|
const k = (a) => {
|
|
3728
|
-
|
|
3739
|
+
Cn(e.billingStatus) || (U = !1), Md(
|
|
3729
3740
|
G,
|
|
3730
3741
|
e.billingStatus,
|
|
3731
3742
|
a,
|
|
@@ -3753,7 +3764,7 @@ async function zc(t = {}) {
|
|
|
3753
3764
|
}, ti = e.loginRequired || e.signupRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (e.tokenEndpoint ? async () => va(e.tokenEndpoint) : void 0);
|
|
3754
3765
|
if (!e.loginRequired && !e.signupRequired && !e.token && !ti && !e.webSocketFactory)
|
|
3755
3766
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
3756
|
-
const Ea = window.fetch.bind(window),
|
|
3767
|
+
const Ea = window.fetch.bind(window), Ln = fu(e.clientId);
|
|
3757
3768
|
let S;
|
|
3758
3769
|
try {
|
|
3759
3770
|
const a = {
|
|
@@ -3766,13 +3777,14 @@ async function zc(t = {}) {
|
|
|
3766
3777
|
}),
|
|
3767
3778
|
entrySurface: e.entrySurface ?? (e.sdkPreviewChannelId ? "extension_widget" : "embedded_widget"),
|
|
3768
3779
|
initialStarterPrompts: e.initialStarterPrompts,
|
|
3769
|
-
clientId:
|
|
3780
|
+
clientId: Ln.clientId,
|
|
3770
3781
|
restorePersistedState: e.restorePersistedState,
|
|
3771
3782
|
expectedPersistedSessionId: e.expectedPersistedSessionId,
|
|
3772
3783
|
keepRunsActiveOnSessionNavigation: e.keepRunsActiveOnSessionNavigation,
|
|
3773
3784
|
capturePageContent: e.capturePageContent,
|
|
3774
3785
|
webSocketFactory: e.webSocketFactory,
|
|
3775
3786
|
prepareAttachmentUpload: e.prepareAttachmentUpload,
|
|
3787
|
+
persistAttachmentUpload: e.persistAttachmentUpload,
|
|
3776
3788
|
// The launcher is useful before a customer token endpoint responds. The widget owns connection
|
|
3777
3789
|
// startup after mounting so credential/network latency never keeps the visible shell detached.
|
|
3778
3790
|
autoConnect: !1,
|
|
@@ -3780,7 +3792,7 @@ async function zc(t = {}) {
|
|
|
3780
3792
|
};
|
|
3781
3793
|
S = await Ho.init(a);
|
|
3782
3794
|
} catch (a) {
|
|
3783
|
-
throw
|
|
3795
|
+
throw Ln.release(), n.remove(), a;
|
|
3784
3796
|
}
|
|
3785
3797
|
m.appendChild(n), he(
|
|
3786
3798
|
"web-sdk.widget",
|
|
@@ -3792,12 +3804,12 @@ async function zc(t = {}) {
|
|
|
3792
3804
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
3793
3805
|
}
|
|
3794
3806
|
);
|
|
3795
|
-
const
|
|
3807
|
+
const Mn = new Set(s.openToolGroupKeys), Qe = new Set(
|
|
3796
3808
|
s.seenShareCandidateIds
|
|
3797
3809
|
), St = new Set(Qe);
|
|
3798
|
-
let
|
|
3810
|
+
let Nn = s.sharePromptsDisabled || await wu(e), xe = null, X = !1, $t = !(e.loginRequired || e.signupRequired), Ke = !1, et = {
|
|
3799
3811
|
enabled: !0
|
|
3800
|
-
}, tt = 0, ni = "", se = !1, ue = !1, Ae = [], Et = null, nt = null, jt = !1, ot = 0, ge = null, oi = location.origin, ii = S.getState().sessionId, ri = S.getState().user?.id ?? null,
|
|
3812
|
+
}, tt = 0, ni = "", se = !1, ue = !1, Ae = [], Et = null, nt = null, jt = !1, ot = 0, ge = null, oi = location.origin, ii = S.getState().sessionId, ri = S.getState().user?.id ?? null, Un = S.getState().status;
|
|
3801
3813
|
const ve = (a, d) => {
|
|
3802
3814
|
et = { enabled: a, reason: d };
|
|
3803
3815
|
}, Se = () => {
|
|
@@ -3875,9 +3887,9 @@ async function zc(t = {}) {
|
|
|
3875
3887
|
}), li();
|
|
3876
3888
|
const Ct = (a = !0) => {
|
|
3877
3889
|
const d = Wt(i, a);
|
|
3878
|
-
return
|
|
3890
|
+
return bn(
|
|
3879
3891
|
i,
|
|
3880
|
-
p ?
|
|
3892
|
+
p ? _n(p, d) : Kc(
|
|
3881
3893
|
i,
|
|
3882
3894
|
e.position,
|
|
3883
3895
|
d
|
|
@@ -3895,13 +3907,13 @@ async function zc(t = {}) {
|
|
|
3895
3907
|
composerValue: x.value,
|
|
3896
3908
|
focusedInput: a,
|
|
3897
3909
|
focusedInputAt: a ? Date.now() : null,
|
|
3898
|
-
openToolGroupKeys: [...
|
|
3910
|
+
openToolGroupKeys: [...Mn],
|
|
3899
3911
|
launcherPosition: c ? p : null,
|
|
3900
3912
|
panelSize: u,
|
|
3901
3913
|
seenShareCandidateIds: [...Qe].slice(
|
|
3902
3914
|
-Zr
|
|
3903
3915
|
),
|
|
3904
|
-
sharePromptsDisabled:
|
|
3916
|
+
sharePromptsDisabled: Nn
|
|
3905
3917
|
});
|
|
3906
3918
|
}, Kt = (a) => {
|
|
3907
3919
|
e.onDisplayStateChange?.(a);
|
|
@@ -3953,7 +3965,7 @@ async function zc(t = {}) {
|
|
|
3953
3965
|
x: a.x - d.x,
|
|
3954
3966
|
y: a.y - d.y
|
|
3955
3967
|
});
|
|
3956
|
-
},
|
|
3968
|
+
}, Dn = () => {
|
|
3957
3969
|
const a = st(u).width;
|
|
3958
3970
|
return e.layout === "page" && y.getBoundingClientRect().width || a;
|
|
3959
3971
|
}, ci = () => {
|
|
@@ -3974,10 +3986,10 @@ async function zc(t = {}) {
|
|
|
3974
3986
|
const d = st(u);
|
|
3975
3987
|
ho(
|
|
3976
3988
|
N,
|
|
3977
|
-
|
|
3989
|
+
Dn()
|
|
3978
3990
|
);
|
|
3979
3991
|
const w = zt(
|
|
3980
|
-
h ?
|
|
3992
|
+
h ? _n(h, d) : uo(
|
|
3981
3993
|
i,
|
|
3982
3994
|
a,
|
|
3983
3995
|
e.position,
|
|
@@ -4002,7 +4014,7 @@ async function zc(t = {}) {
|
|
|
4002
4014
|
launcherDragHandle: b,
|
|
4003
4015
|
getPosition: () => Ct(),
|
|
4004
4016
|
setPosition: (a) => {
|
|
4005
|
-
const d = a, w = Wt(i), C =
|
|
4017
|
+
const d = a, w = Wt(i), C = bn(
|
|
4006
4018
|
i,
|
|
4007
4019
|
a,
|
|
4008
4020
|
w
|
|
@@ -4022,7 +4034,7 @@ async function zc(t = {}) {
|
|
|
4022
4034
|
const a = st(u), d = Ct();
|
|
4023
4035
|
return {
|
|
4024
4036
|
position: zt(
|
|
4025
|
-
h ?
|
|
4037
|
+
h ? _n(h, a) : uo(
|
|
4026
4038
|
i,
|
|
4027
4039
|
d,
|
|
4028
4040
|
e.position,
|
|
@@ -4033,9 +4045,9 @@ async function zc(t = {}) {
|
|
|
4033
4045
|
size: a
|
|
4034
4046
|
};
|
|
4035
4047
|
}, ka = (a) => {
|
|
4036
|
-
u =
|
|
4048
|
+
u = Pn(a.size), lo(i, u), ho(
|
|
4037
4049
|
N,
|
|
4038
|
-
|
|
4050
|
+
Dn()
|
|
4039
4051
|
);
|
|
4040
4052
|
const d = zt(
|
|
4041
4053
|
a.position,
|
|
@@ -4051,7 +4063,7 @@ async function zc(t = {}) {
|
|
|
4051
4063
|
const d = st(u), w = zt(
|
|
4052
4064
|
a,
|
|
4053
4065
|
d
|
|
4054
|
-
), C = Wt(i), E =
|
|
4066
|
+
), C = Wt(i), E = bn(
|
|
4055
4067
|
i,
|
|
4056
4068
|
Jc(
|
|
4057
4069
|
w,
|
|
@@ -4080,10 +4092,10 @@ async function zc(t = {}) {
|
|
|
4080
4092
|
persist: j
|
|
4081
4093
|
}) : () => {
|
|
4082
4094
|
};
|
|
4083
|
-
let
|
|
4095
|
+
let On = !1;
|
|
4084
4096
|
const gi = async () => {
|
|
4085
|
-
if (!(!e.billingStatusLoader ||
|
|
4086
|
-
|
|
4097
|
+
if (!(!e.billingStatusLoader || On)) {
|
|
4098
|
+
On = !0;
|
|
4087
4099
|
try {
|
|
4088
4100
|
const a = await e.billingStatusLoader();
|
|
4089
4101
|
if (X)
|
|
@@ -4100,14 +4112,14 @@ async function zc(t = {}) {
|
|
|
4100
4112
|
{ message: a instanceof Error ? a.message : String(a) }
|
|
4101
4113
|
);
|
|
4102
4114
|
} finally {
|
|
4103
|
-
|
|
4115
|
+
On = !1;
|
|
4104
4116
|
}
|
|
4105
4117
|
}
|
|
4106
4118
|
}, Oe = (a = "", d = !0, w = !0) => {
|
|
4107
4119
|
const C = i.classList.contains("pluno-pa-widget--open");
|
|
4108
|
-
gi(), Rt && (Rt = !1,
|
|
4120
|
+
gi(), Rt && (Rt = !1, Wn()), i.classList.contains("pluno-pa-widget--open") || (h = null), xe !== null && (window.clearTimeout(xe), xe = null), Tt("shown", !1), y.hidden = !1, B.hidden = !1, ho(
|
|
4109
4121
|
N,
|
|
4110
|
-
|
|
4122
|
+
Dn()
|
|
4111
4123
|
), i.classList.remove("pluno-pa-widget--closing");
|
|
4112
4124
|
const E = It(), ne = uo(
|
|
4113
4125
|
i,
|
|
@@ -4127,7 +4139,7 @@ async function zc(t = {}) {
|
|
|
4127
4139
|
f.hidden = !0, Bt(H, () => et.enabled), tt = H.scrollTop;
|
|
4128
4140
|
}, 220);
|
|
4129
4141
|
});
|
|
4130
|
-
},
|
|
4142
|
+
}, zn = () => {
|
|
4131
4143
|
xe !== null && (window.clearTimeout(xe), xe = null), f.hidden = !1, p && (It(!1), it("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), j(), e.onPanelOpenChange?.(!1), xe = window.setTimeout(() => {
|
|
4132
4144
|
y.hidden = !0, B.hidden = !0, h = null, i.classList.remove("pluno-pa-widget--closing");
|
|
4133
4145
|
}, 220);
|
|
@@ -4157,7 +4169,7 @@ async function zc(t = {}) {
|
|
|
4157
4169
|
d = d.parentElement;
|
|
4158
4170
|
}
|
|
4159
4171
|
return null;
|
|
4160
|
-
},
|
|
4172
|
+
}, Bn = (a) => {
|
|
4161
4173
|
if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
|
|
4162
4174
|
return null;
|
|
4163
4175
|
let d = a;
|
|
@@ -4174,7 +4186,7 @@ async function zc(t = {}) {
|
|
|
4174
4186
|
d = E instanceof ShadowRoot ? E.host : null;
|
|
4175
4187
|
}
|
|
4176
4188
|
return null;
|
|
4177
|
-
},
|
|
4189
|
+
}, Fn = () => {
|
|
4178
4190
|
let a = _.activeElement;
|
|
4179
4191
|
for (; a?.shadowRoot?.activeElement; )
|
|
4180
4192
|
a = a.shadowRoot.activeElement;
|
|
@@ -4190,22 +4202,22 @@ async function zc(t = {}) {
|
|
|
4190
4202
|
return a.checkVisibility();
|
|
4191
4203
|
const d = window.getComputedStyle(a);
|
|
4192
4204
|
return d.display !== "none" && d.visibility !== "hidden";
|
|
4193
|
-
},
|
|
4205
|
+
}, Hn = (a, d) => {
|
|
4194
4206
|
d && (Pe !== null && window.clearTimeout(Pe), Pe = window.setTimeout(() => {
|
|
4195
4207
|
Pe = null, ze === a && d.isConnected && d.focus({ preventScroll: !0 });
|
|
4196
4208
|
}, 0));
|
|
4197
4209
|
}, At = (a, d = null) => {
|
|
4198
4210
|
if (ze === a) {
|
|
4199
|
-
a &&
|
|
4211
|
+
a && Hn(a, d);
|
|
4200
4212
|
return;
|
|
4201
4213
|
}
|
|
4202
|
-
ze = a, a !== null ? (
|
|
4214
|
+
ze = a, a !== null ? (Hn(a, d), rt = window.setInterval(() => {
|
|
4203
4215
|
const w = ze;
|
|
4204
4216
|
if (!w || !Ma(w)) {
|
|
4205
4217
|
At(null);
|
|
4206
4218
|
return;
|
|
4207
4219
|
}
|
|
4208
|
-
|
|
4220
|
+
Hn(w, null);
|
|
4209
4221
|
}, xc)) : (rt !== null && (window.clearInterval(rt), rt = null), Pe !== null && (window.clearTimeout(Pe), Pe = null), Xt = null);
|
|
4210
4222
|
}, Na = () => {
|
|
4211
4223
|
rt !== null && (window.clearInterval(rt), rt = null), Pe !== null && (window.clearTimeout(Pe), Pe = null), J !== null && (window.clearTimeout(J), J = null);
|
|
@@ -4215,16 +4227,16 @@ async function zc(t = {}) {
|
|
|
4215
4227
|
return;
|
|
4216
4228
|
const w = Date.now();
|
|
4217
4229
|
Ve = w, kt = w, J !== null && window.clearTimeout(J);
|
|
4218
|
-
const C = ze ??
|
|
4230
|
+
const C = ze ?? Bn(Fn());
|
|
4219
4231
|
C && (At(C, d), a.stopImmediatePropagation()), J = window.setTimeout(() => {
|
|
4220
4232
|
if (J = null, Ve !== w)
|
|
4221
4233
|
return;
|
|
4222
|
-
const E =
|
|
4234
|
+
const E = Fn();
|
|
4223
4235
|
if (E === d) {
|
|
4224
4236
|
Ve = null;
|
|
4225
4237
|
return;
|
|
4226
4238
|
}
|
|
4227
|
-
const ne =
|
|
4239
|
+
const ne = Bn(E);
|
|
4228
4240
|
ne && At(ne, d);
|
|
4229
4241
|
}, 0);
|
|
4230
4242
|
}, Jt = (a) => {
|
|
@@ -4256,7 +4268,7 @@ async function zc(t = {}) {
|
|
|
4256
4268
|
const w = a.target, C = Ve !== null && Date.now() - Ve <= Qi;
|
|
4257
4269
|
Ve = null, J !== null && (window.clearTimeout(J), J = null);
|
|
4258
4270
|
const E = (ne) => {
|
|
4259
|
-
const at =
|
|
4271
|
+
const at = Bn(ne);
|
|
4260
4272
|
if (!at)
|
|
4261
4273
|
return !1;
|
|
4262
4274
|
if (C)
|
|
@@ -4265,7 +4277,7 @@ async function zc(t = {}) {
|
|
|
4265
4277
|
return Xt !== null && Si - Xt <= yc ? (At(at, w), !0) : (Xt = Si, !0);
|
|
4266
4278
|
};
|
|
4267
4279
|
E(a.relatedTarget) || window.setTimeout(() => {
|
|
4268
|
-
ze === null && w.isConnected && E(
|
|
4280
|
+
ze === null && w.isConnected && E(Fn());
|
|
4269
4281
|
}, 0);
|
|
4270
4282
|
}), f.addEventListener("keydown", (a) => {
|
|
4271
4283
|
!i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), Oe());
|
|
@@ -4273,7 +4285,7 @@ async function zc(t = {}) {
|
|
|
4273
4285
|
a.stopPropagation();
|
|
4274
4286
|
}), v?.addEventListener("click", (a) => {
|
|
4275
4287
|
a.preventDefault(), a.stopPropagation(), Tt("minimized");
|
|
4276
|
-
}), B.addEventListener("click",
|
|
4288
|
+
}), B.addEventListener("click", zn), H.addEventListener("scroll", () => {
|
|
4277
4289
|
H.scrollTop < tt - 1 && ve(!1, "userScroll"), tt = H.scrollTop;
|
|
4278
4290
|
}), re.addEventListener("click", () => {
|
|
4279
4291
|
Ta();
|
|
@@ -4295,15 +4307,15 @@ async function zc(t = {}) {
|
|
|
4295
4307
|
q.disabled = Ce() || Ie(e.billingStatus) || ae && !a || !a && x.value.trim().length === 0 && R.length === 0, De.disabled = Pt() || Ce() || Ie(e.billingStatus);
|
|
4296
4308
|
};
|
|
4297
4309
|
ct();
|
|
4298
|
-
const
|
|
4310
|
+
const Wn = () => {
|
|
4299
4311
|
const a = S.getState().isThinking;
|
|
4300
4312
|
i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
|
|
4301
4313
|
"pluno-pa-widget--unread",
|
|
4302
4314
|
!a && Rt
|
|
4303
4315
|
), ct();
|
|
4304
4316
|
};
|
|
4305
|
-
|
|
4306
|
-
const
|
|
4317
|
+
Wn();
|
|
4318
|
+
const qn = () => {
|
|
4307
4319
|
Pt() || X || ($t = !0, ct(), oe(), S.connect().then(
|
|
4308
4320
|
() => {
|
|
4309
4321
|
X || ($t = !1, ct(), oe());
|
|
@@ -4322,7 +4334,7 @@ async function zc(t = {}) {
|
|
|
4322
4334
|
de !== null && window.clearTimeout(de), ie.textContent = a, ie.hidden = !1, de = window.setTimeout(() => {
|
|
4323
4335
|
ie.textContent = "", ie.hidden = !0, de = null;
|
|
4324
4336
|
}, 3e3);
|
|
4325
|
-
},
|
|
4337
|
+
}, $n = () => {
|
|
4326
4338
|
const a = x.value, d = a.trim(), w = [...R];
|
|
4327
4339
|
if (ae || !d && w.length === 0)
|
|
4328
4340
|
return;
|
|
@@ -4356,14 +4368,14 @@ async function zc(t = {}) {
|
|
|
4356
4368
|
e.onSignupClick?.();
|
|
4357
4369
|
return;
|
|
4358
4370
|
}
|
|
4359
|
-
Ce() || Ie(e.billingStatus) || (Ke = !0, ve(!0, "send"), Se(),
|
|
4371
|
+
Ce() || Ie(e.billingStatus) || (Ke = !0, ve(!0, "send"), Se(), $n());
|
|
4360
4372
|
});
|
|
4361
4373
|
let Lt = 0;
|
|
4362
4374
|
const Ua = () => {
|
|
4363
4375
|
Lt = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
4364
4376
|
}, Da = () => {
|
|
4365
4377
|
de !== null && (window.clearTimeout(de), de = null), ie.textContent = "", ie.hidden = !0;
|
|
4366
|
-
},
|
|
4378
|
+
}, jn = async (a) => {
|
|
4367
4379
|
if (!e.attachmentsEnabled || a.length === 0)
|
|
4368
4380
|
return;
|
|
4369
4381
|
const d = Rd(S, a);
|
|
@@ -4373,7 +4385,7 @@ async function zc(t = {}) {
|
|
|
4373
4385
|
}
|
|
4374
4386
|
ye();
|
|
4375
4387
|
}, Oa = async (a) => {
|
|
4376
|
-
await
|
|
4388
|
+
await jn(a), !(a.length === 0 || ze !== null) && x.focus();
|
|
4377
4389
|
};
|
|
4378
4390
|
De.addEventListener("click", () => {
|
|
4379
4391
|
e.loginRequired || Ce() || Ie(e.billingStatus) || z.click();
|
|
@@ -4387,15 +4399,15 @@ async function zc(t = {}) {
|
|
|
4387
4399
|
});
|
|
4388
4400
|
});
|
|
4389
4401
|
}), i.addEventListener("dragenter", (a) => {
|
|
4390
|
-
!e.attachmentsEnabled || !
|
|
4402
|
+
!e.attachmentsEnabled || !gn(a.dataTransfer) || e.loginRequired || Ce() || (a.preventDefault(), a.stopPropagation(), Lt += 1, i.classList.add("pluno-pa-widget--drag-over"));
|
|
4391
4403
|
}), i.addEventListener("dragover", (a) => {
|
|
4392
4404
|
const d = a.dataTransfer;
|
|
4393
|
-
!e.attachmentsEnabled || !
|
|
4405
|
+
!e.attachmentsEnabled || !gn(d) || e.loginRequired || Ce() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
|
|
4394
4406
|
}), i.addEventListener("dragleave", (a) => {
|
|
4395
|
-
|
|
4407
|
+
gn(a.dataTransfer) && (a.stopPropagation(), Lt = Math.max(0, Lt - 1), Lt === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
4396
4408
|
}), i.addEventListener("drop", (a) => {
|
|
4397
4409
|
const d = a.dataTransfer;
|
|
4398
|
-
!e.attachmentsEnabled || !
|
|
4410
|
+
!e.attachmentsEnabled || !gn(d) || e.loginRequired || Ce() || (a.preventDefault(), a.stopPropagation(), Ua(), jn(d.files).catch((w) => {
|
|
4399
4411
|
Zt(
|
|
4400
4412
|
w instanceof Error ? w.message : "Failed to attach file"
|
|
4401
4413
|
), he("web-sdk.widget", "Attachment failed", {
|
|
@@ -4405,7 +4417,7 @@ async function zc(t = {}) {
|
|
|
4405
4417
|
}), i.addEventListener("paste", (a) => {
|
|
4406
4418
|
a.stopPropagation();
|
|
4407
4419
|
const d = a.clipboardData, w = Array.from(d?.files ?? []);
|
|
4408
|
-
!e.attachmentsEnabled || w.length === 0 || e.loginRequired || Ce() || (a.preventDefault(),
|
|
4420
|
+
!e.attachmentsEnabled || w.length === 0 || e.loginRequired || Ce() || (a.preventDefault(), jn(w).catch((C) => {
|
|
4409
4421
|
Zt(
|
|
4410
4422
|
C instanceof Error ? C.message : "Failed to attach file"
|
|
4411
4423
|
), he("web-sdk.widget", "Attachment failed", {
|
|
@@ -4424,7 +4436,7 @@ async function zc(t = {}) {
|
|
|
4424
4436
|
if (Ce())
|
|
4425
4437
|
return;
|
|
4426
4438
|
const a = x.value.trim().length > 0 || R.length > 0;
|
|
4427
|
-
Ke = !0, ve(!0, "send"), Se(),
|
|
4439
|
+
Ke = !0, ve(!0, "send"), Se(), $n(), $(S.getState()), a && ye();
|
|
4428
4440
|
}), Z.addEventListener("click", () => {
|
|
4429
4441
|
se = !se, nt = null, Ee(), se && Ae.length === 0 && !ue && !jt && si(), se || ye();
|
|
4430
4442
|
}), Ge.addEventListener("click", () => {
|
|
@@ -4437,7 +4449,7 @@ async function zc(t = {}) {
|
|
|
4437
4449
|
e.onLoginClick?.();
|
|
4438
4450
|
return;
|
|
4439
4451
|
}
|
|
4440
|
-
Ce() || (Ke = !0, ve(!0, "send"), Se(),
|
|
4452
|
+
Ce() || (Ke = !0, ve(!0, "send"), Se(), $n(), $(S.getState()));
|
|
4441
4453
|
}
|
|
4442
4454
|
}), i.addEventListener("click", (a) => {
|
|
4443
4455
|
const d = a.target instanceof Element ? a.target : null;
|
|
@@ -4464,7 +4476,7 @@ async function zc(t = {}) {
|
|
|
4464
4476
|
a.key !== "Escape" || !se || (se = !1, Ee(), ye());
|
|
4465
4477
|
}), s.composerValue && (x.value = s.composerValue, Ot(x)), e.layout === "page" ? Oe(x.value, !1) : l === "minimized" ? Tt("minimized", !1) : e.initialDisplayState === void 0 && s.isOpen && Oe(x.value, !1, !1), nd(s, i, g, x);
|
|
4466
4478
|
const Qt = () => r;
|
|
4467
|
-
let
|
|
4479
|
+
let Gn = S.getState().appearance !== null, en = null, Mt = null, Kn = S.getState().isThinking, dt = null;
|
|
4468
4480
|
const Nt = e.taskNotifications;
|
|
4469
4481
|
let ut = null, gt = !1;
|
|
4470
4482
|
const bi = () => {
|
|
@@ -4515,8 +4527,8 @@ async function zc(t = {}) {
|
|
|
4515
4527
|
}), rn();
|
|
4516
4528
|
let ft = null, _i = () => {
|
|
4517
4529
|
};
|
|
4518
|
-
const Ba = !!(e.sdkPreviewChannelId && e.referralLinkLoader), an = /* @__PURE__ */ new Map(),
|
|
4519
|
-
const a = ft !== null && mo(S.getState(),
|
|
4530
|
+
const Ba = !!(e.sdkPreviewChannelId && e.referralLinkLoader), an = /* @__PURE__ */ new Map(), Vn = () => x.value.trim().length > 0 || R.length > 0, Fa = () => {
|
|
4531
|
+
const a = ft !== null && mo(S.getState(), Vn());
|
|
4520
4532
|
ce.hidden = !a, a && ft !== null && sa(ce, ft);
|
|
4521
4533
|
};
|
|
4522
4534
|
let mt = null;
|
|
@@ -4533,27 +4545,27 @@ async function zc(t = {}) {
|
|
|
4533
4545
|
}
|
|
4534
4546
|
$(S.getState());
|
|
4535
4547
|
}
|
|
4536
|
-
},
|
|
4537
|
-
Ke = !0, ve(!0, "newSession"), Se(), se = !1, Ee(), S.startNewSession(a),
|
|
4548
|
+
}, Xn = (a = {}) => {
|
|
4549
|
+
Ke = !0, ve(!0, "newSession"), Se(), se = !1, Ee(), S.startNewSession(a), Mn.clear(), Be.clear(), sn.clear(), x.value = "", R = [], vt(), Ot(x), j(), oe(), x.focus(), $(S.getState());
|
|
4538
4550
|
}, yi = () => {
|
|
4539
|
-
e.morningReport !== null && (e.morningReport = null, e.onMorningReportTaskStart?.(),
|
|
4540
|
-
},
|
|
4551
|
+
e.morningReport !== null && (e.morningReport = null, e.onMorningReportTaskStart?.(), Xn());
|
|
4552
|
+
}, Yn = (a) => {
|
|
4541
4553
|
if (!a || e.layout === "page") {
|
|
4542
4554
|
mt?.remove(), mt = null;
|
|
4543
4555
|
return;
|
|
4544
4556
|
}
|
|
4545
|
-
mt || (mt =
|
|
4557
|
+
mt || (mt = Rn(
|
|
4546
4558
|
"pluno-pa-widget__new-chat",
|
|
4547
4559
|
"New chat",
|
|
4548
4560
|
xd(),
|
|
4549
4561
|
!1
|
|
4550
|
-
), mt.addEventListener("click", () =>
|
|
4562
|
+
), mt.addEventListener("click", () => Xn()), le.insertBefore(mt, Z));
|
|
4551
4563
|
}, $ = (a) => {
|
|
4552
4564
|
if (Ee(), Qo(a.lastErrorCode) ? dt = a.lastErrorCode : e.billingStatus?.creditsUsed !== null && !Ie(e.billingStatus) && (dt = null), k(dt), e.loginRequired) {
|
|
4553
4565
|
an.clear(), wr(
|
|
4554
4566
|
H,
|
|
4555
4567
|
q,
|
|
4556
|
-
|
|
4568
|
+
Yn,
|
|
4557
4569
|
Qt,
|
|
4558
4570
|
"Log in to use Pluno on this page.",
|
|
4559
4571
|
e.loginButtonLabel,
|
|
@@ -4566,7 +4578,7 @@ async function zc(t = {}) {
|
|
|
4566
4578
|
an.clear(), wr(
|
|
4567
4579
|
H,
|
|
4568
4580
|
q,
|
|
4569
|
-
|
|
4581
|
+
Yn,
|
|
4570
4582
|
Qt,
|
|
4571
4583
|
"Complete signup to unlock your free trial credits.",
|
|
4572
4584
|
e.signupButtonLabel,
|
|
@@ -4582,14 +4594,14 @@ async function zc(t = {}) {
|
|
|
4582
4594
|
H,
|
|
4583
4595
|
ke,
|
|
4584
4596
|
q,
|
|
4585
|
-
|
|
4597
|
+
Yn,
|
|
4586
4598
|
ce,
|
|
4587
4599
|
a,
|
|
4588
4600
|
ft,
|
|
4589
|
-
ft !== null && mo(a,
|
|
4601
|
+
ft !== null && mo(a, Vn()),
|
|
4590
4602
|
C,
|
|
4591
4603
|
() => et.enabled,
|
|
4592
|
-
|
|
4604
|
+
Mn,
|
|
4593
4605
|
an,
|
|
4594
4606
|
j,
|
|
4595
4607
|
Qt,
|
|
@@ -4601,9 +4613,9 @@ async function zc(t = {}) {
|
|
|
4601
4613
|
},
|
|
4602
4614
|
e.morningReport,
|
|
4603
4615
|
() => {
|
|
4604
|
-
e.morningReport = null, e.onMorningReportSnooze?.(),
|
|
4616
|
+
e.morningReport = null, e.onMorningReportSnooze?.(), zn(), $(S.getState());
|
|
4605
4617
|
},
|
|
4606
|
-
|
|
4618
|
+
qn,
|
|
4607
4619
|
e.attachmentPreviewUrlResolver,
|
|
4608
4620
|
e.integrationAuthHandler ? {
|
|
4609
4621
|
states: Be,
|
|
@@ -4612,7 +4624,7 @@ async function zc(t = {}) {
|
|
|
4612
4624
|
Ha(E);
|
|
4613
4625
|
}
|
|
4614
4626
|
} : void 0,
|
|
4615
|
-
Ba && !
|
|
4627
|
+
Ba && !Nn ? {
|
|
4616
4628
|
dismissedCandidateIds: St,
|
|
4617
4629
|
actionCandidate: en,
|
|
4618
4630
|
error: Mt,
|
|
@@ -4631,7 +4643,7 @@ async function zc(t = {}) {
|
|
|
4631
4643
|
Qe.add(E.id), St.add(E.id), j(), Mt = null, $(S.getState());
|
|
4632
4644
|
},
|
|
4633
4645
|
onDisable: (E) => {
|
|
4634
|
-
|
|
4646
|
+
Nn = !0, Qe.add(E.id), St.add(E.id), j(), bu(e, !0), Mt = null, $(S.getState());
|
|
4635
4647
|
}
|
|
4636
4648
|
} : void 0
|
|
4637
4649
|
), C ? (tt = H.scrollTop, Se()) : w && rd(a) && Ca();
|
|
@@ -4672,7 +4684,7 @@ async function zc(t = {}) {
|
|
|
4672
4684
|
};
|
|
4673
4685
|
return _i = Xp(
|
|
4674
4686
|
(a) => {
|
|
4675
|
-
ft = a, !X && mo(S.getState(),
|
|
4687
|
+
ft = a, !X && mo(S.getState(), Vn()) && $(S.getState());
|
|
4676
4688
|
},
|
|
4677
4689
|
{
|
|
4678
4690
|
backendUrl: e.backendUrl,
|
|
@@ -4681,16 +4693,16 @@ async function zc(t = {}) {
|
|
|
4681
4693
|
}
|
|
4682
4694
|
), S.on("state", (a) => {
|
|
4683
4695
|
rn();
|
|
4684
|
-
const d =
|
|
4685
|
-
oi = location.origin, ii = a.sessionId, ri = a.user?.id ?? null,
|
|
4696
|
+
const d = Kn && !a.isThinking, w = oi !== location.origin || ii !== a.sessionId || ri !== (a.user?.id ?? null), C = Kn !== a.isThinking, E = Un !== "connected" && a.status === "connected", ne = Un === "connected" && a.status !== "connected";
|
|
4697
|
+
oi = location.origin, ii = a.sessionId, ri = a.user?.id ?? null, Un = a.status, Kn = a.isThinking, ne && (ge !== null && (window.clearTimeout(ge), ge = null), ot += 1, ue = !1, Ae = [], Et = null, nt = null, jt = !1, Ee()), i.classList.contains("pluno-pa-widget--open") && a.status === "connected" && (w || C || E) && Gt(), a.isThinking && !nn() && Nt && !gt && ut === null && ee?.hidden !== !1 && (ut = window.setTimeout(() => {
|
|
4686
4698
|
ut = null, za();
|
|
4687
|
-
}, rc)), (!a.isThinking || nn()) && (bi(), tn()), d && !i.classList.contains("pluno-pa-widget--open") && (Rt = !0),
|
|
4699
|
+
}, rc)), (!a.isThinking || nn()) && (bi(), tn()), d && !i.classList.contains("pluno-pa-widget--open") && (Rt = !0), Wn(), a.appearance ? (Gn = !0, he(
|
|
4688
4700
|
"web-sdk.widget",
|
|
4689
4701
|
"Agent state supplied appearance",
|
|
4690
4702
|
{
|
|
4691
4703
|
appearance: a.appearance
|
|
4692
4704
|
}
|
|
4693
|
-
),
|
|
4705
|
+
), Jn(a.appearance, "agent.state.appearance")) : Gn && (Gn = !1, he(
|
|
4694
4706
|
"web-sdk.widget",
|
|
4695
4707
|
"Agent state cleared appearance; reverting to configured widget options",
|
|
4696
4708
|
{
|
|
@@ -4698,13 +4710,13 @@ async function zc(t = {}) {
|
|
|
4698
4710
|
fallbackColorScheme: e.colorScheme,
|
|
4699
4711
|
fallbackFontFamily: e.fontFamily
|
|
4700
4712
|
}
|
|
4701
|
-
),
|
|
4702
|
-
}), $(S.getState()), vi(S.getState()), oe(),
|
|
4713
|
+
), Jn({}, "agent.state.appearance-cleared")), $(a), vi(a), oe(), d && gi();
|
|
4714
|
+
}), $(S.getState()), vi(S.getState()), oe(), qn(), {
|
|
4703
4715
|
agent: S,
|
|
4704
|
-
startNewChat:
|
|
4716
|
+
startNewChat: Xn,
|
|
4705
4717
|
host: n,
|
|
4706
4718
|
updateAppearance: (a) => {
|
|
4707
|
-
a.scribbleStyle !== void 0 && (e.scribbleStyle = a.scribbleStyle),
|
|
4719
|
+
a.scribbleStyle !== void 0 && (e.scribbleStyle = a.scribbleStyle), Jn(a, "widgetHandle.updateAppearance");
|
|
4708
4720
|
},
|
|
4709
4721
|
updateBillingStatus: (a) => {
|
|
4710
4722
|
const d = a ?? null;
|
|
@@ -4716,13 +4728,13 @@ async function zc(t = {}) {
|
|
|
4716
4728
|
},
|
|
4717
4729
|
updateAuthGate: (a) => {
|
|
4718
4730
|
const d = Pt();
|
|
4719
|
-
e.loginRequired = a.loginRequired === !0, e.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (e.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (e.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (e.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (e.signupUrl = a.signupUrl), ct(), $(S.getState()), oe(), i.classList.contains("pluno-pa-widget--open") && Gt(), d && !Pt() &&
|
|
4731
|
+
e.loginRequired = a.loginRequired === !0, e.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (e.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (e.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (e.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (e.signupUrl = a.signupUrl), ct(), $(S.getState()), oe(), i.classList.contains("pluno-pa-widget--open") && Gt(), d && !Pt() && qn();
|
|
4720
4732
|
},
|
|
4721
4733
|
openPanel: (a) => {
|
|
4722
4734
|
const d = typeof a == "string" ? a : x.value, w = typeof a == "object" ? a.focusComposer !== !1 : !0;
|
|
4723
4735
|
Oe(d, !1, w);
|
|
4724
4736
|
},
|
|
4725
|
-
closePanel:
|
|
4737
|
+
closePanel: zn,
|
|
4726
4738
|
updateDisplayState: (a) => {
|
|
4727
4739
|
if (a === "shown") {
|
|
4728
4740
|
Tt("shown", !1);
|
|
@@ -4749,7 +4761,7 @@ async function zc(t = {}) {
|
|
|
4749
4761
|
"focusin",
|
|
4750
4762
|
Jt,
|
|
4751
4763
|
!0
|
|
4752
|
-
), window.removeEventListener("resize", ci), di(), Pa(), Ra(), de !== null && window.clearTimeout(de), ge !== null && (window.clearTimeout(ge), ge = null), bi(), _i(), S.destroy(),
|
|
4764
|
+
), window.removeEventListener("resize", ci), di(), Pa(), Ra(), de !== null && window.clearTimeout(de), ge !== null && (window.clearTimeout(ge), ge = null), bi(), _i(), S.destroy(), Ln.release(), n.remove());
|
|
4753
4765
|
}
|
|
4754
4766
|
};
|
|
4755
4767
|
async function Wa(a) {
|
|
@@ -4785,7 +4797,7 @@ async function zc(t = {}) {
|
|
|
4785
4797
|
w.remove(), d?.isConnected && d.focus({ preventScroll: !0 });
|
|
4786
4798
|
}
|
|
4787
4799
|
}
|
|
4788
|
-
function
|
|
4800
|
+
function Jn(a, d) {
|
|
4789
4801
|
const w = a.accentColor ?? e.accentColor, C = a.colorScheme ?? e.colorScheme, E = a.fontFamily ?? e.fontFamily, ne = a.scribbleStyle ?? e.scribbleStyle;
|
|
4790
4802
|
r = or(
|
|
4791
4803
|
w,
|
|
@@ -4886,7 +4898,7 @@ function qc({
|
|
|
4886
4898
|
return;
|
|
4887
4899
|
y.preventDefault();
|
|
4888
4900
|
const I = y.clientX - l.x, N = y.clientY - l.y;
|
|
4889
|
-
!c && Math.hypot(I, N) <
|
|
4901
|
+
!c && Math.hypot(I, N) < En || (c = !0, t.classList.add("pluno-pa-widget--dragging"), i({ x: p.x + I, y: p.y + N }));
|
|
4890
4902
|
}, f = (y) => {
|
|
4891
4903
|
s === y.pointerId && (y.preventDefault(), y.stopPropagation(), c && (u = { x: y.clientX, y: y.clientY }, r()), h());
|
|
4892
4904
|
}, b = (y) => {
|
|
@@ -4897,7 +4909,7 @@ function qc({
|
|
|
4897
4909
|
const I = Math.hypot(
|
|
4898
4910
|
y.clientX - u.x,
|
|
4899
4911
|
y.clientY - u.y
|
|
4900
|
-
) <=
|
|
4912
|
+
) <= En;
|
|
4901
4913
|
u = null, I && (y.preventDefault(), y.stopPropagation());
|
|
4902
4914
|
}, v = (y) => {
|
|
4903
4915
|
if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
|
|
@@ -4927,7 +4939,7 @@ function $c({
|
|
|
4927
4939
|
return;
|
|
4928
4940
|
b.preventDefault(), b.stopPropagation();
|
|
4929
4941
|
const g = b.clientX - s.x, v = b.clientY - s.y;
|
|
4930
|
-
!p && Math.hypot(g, v) <
|
|
4942
|
+
!p && Math.hypot(g, v) < En || (p = !0, t.classList.add("pluno-pa-widget--panel-dragging"), o({ x: l.x + g, y: l.y + v }));
|
|
4931
4943
|
}, m = (b) => {
|
|
4932
4944
|
r === b.pointerId && (b.preventDefault(), b.stopPropagation(), p && i(), c());
|
|
4933
4945
|
}, _ = (b) => {
|
|
@@ -4959,7 +4971,7 @@ function jc({
|
|
|
4959
4971
|
return;
|
|
4960
4972
|
g.preventDefault(), g.stopPropagation();
|
|
4961
4973
|
const v = g.clientX - l.x, y = g.clientY - l.y;
|
|
4962
|
-
!c && Math.hypot(v, y) <
|
|
4974
|
+
!c && Math.hypot(v, y) < En || (c = !0, t.classList.add("pluno-pa-widget--resizing"), o(
|
|
4963
4975
|
ar(p, s, v, y)
|
|
4964
4976
|
));
|
|
4965
4977
|
}, _ = (g) => {
|
|
@@ -5093,9 +5105,9 @@ function Gc() {
|
|
|
5093
5105
|
};
|
|
5094
5106
|
}
|
|
5095
5107
|
function st(t = null) {
|
|
5096
|
-
return t ?
|
|
5108
|
+
return t ? Pn(t) : Gc();
|
|
5097
5109
|
}
|
|
5098
|
-
function
|
|
5110
|
+
function Pn(t) {
|
|
5099
5111
|
const e = be();
|
|
5100
5112
|
return {
|
|
5101
5113
|
width: we(
|
|
@@ -5127,7 +5139,7 @@ function lo(t, e) {
|
|
|
5127
5139
|
t.style.removeProperty("--pluno-pa-panel-width"), t.style.removeProperty("--pluno-pa-panel-height");
|
|
5128
5140
|
return;
|
|
5129
5141
|
}
|
|
5130
|
-
const n =
|
|
5142
|
+
const n = Pn(e);
|
|
5131
5143
|
t.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), t.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
|
|
5132
5144
|
}
|
|
5133
5145
|
function Kc(t, e, n) {
|
|
@@ -5145,9 +5157,9 @@ function Kc(t, e, n) {
|
|
|
5145
5157
|
}
|
|
5146
5158
|
function po(t, e, n) {
|
|
5147
5159
|
const o = Wt(t, !1);
|
|
5148
|
-
return e ?
|
|
5160
|
+
return e ? bn(
|
|
5149
5161
|
t,
|
|
5150
|
-
|
|
5162
|
+
_n(e, o),
|
|
5151
5163
|
o
|
|
5152
5164
|
) : Vc(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Tc);
|
|
5153
5165
|
}
|
|
@@ -5158,7 +5170,7 @@ function Vc(t, e, n) {
|
|
|
5158
5170
|
y: t.startsWith("bottom") ? Math.max(0, o.height - e.height - n) : n
|
|
5159
5171
|
};
|
|
5160
5172
|
}
|
|
5161
|
-
function
|
|
5173
|
+
function bn(t, e, n) {
|
|
5162
5174
|
const o = be(), i = F + Yc(t);
|
|
5163
5175
|
return {
|
|
5164
5176
|
x: we(
|
|
@@ -5179,7 +5191,7 @@ function wn(t, e, n) {
|
|
|
5179
5191
|
)
|
|
5180
5192
|
};
|
|
5181
5193
|
}
|
|
5182
|
-
function
|
|
5194
|
+
function _n(t, e) {
|
|
5183
5195
|
const n = be();
|
|
5184
5196
|
return {
|
|
5185
5197
|
x: t.anchor.endsWith("right") ? n.width - e.width - t.x : t.x,
|
|
@@ -5363,7 +5375,7 @@ function pd(t, e, n, o, i) {
|
|
|
5363
5375
|
i
|
|
5364
5376
|
)
|
|
5365
5377
|
), t.appendChild(
|
|
5366
|
-
|
|
5378
|
+
Rn(
|
|
5367
5379
|
"pluno-pa-widget__close",
|
|
5368
5380
|
"Close",
|
|
5369
5381
|
yd(16),
|
|
@@ -5420,7 +5432,7 @@ function dd(t, e) {
|
|
|
5420
5432
|
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, o.appendChild(l);
|
|
5421
5433
|
const p = document.createElement("div");
|
|
5422
5434
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
5423
|
-
|
|
5435
|
+
Rn(
|
|
5424
5436
|
"pluno-pa-widget__history",
|
|
5425
5437
|
Ro(),
|
|
5426
5438
|
vd(),
|
|
@@ -5509,7 +5521,7 @@ function fd() {
|
|
|
5509
5521
|
e.className = "pluno-pa-widget__history-header";
|
|
5510
5522
|
const n = document.createElement("strong");
|
|
5511
5523
|
n.textContent = Ro();
|
|
5512
|
-
const o =
|
|
5524
|
+
const o = Rn(
|
|
5513
5525
|
"pluno-pa-widget__history-close",
|
|
5514
5526
|
"Close recent chats",
|
|
5515
5527
|
da(),
|
|
@@ -5685,12 +5697,12 @@ function wd(t, e) {
|
|
|
5685
5697
|
"flood-opacity": "0.22"
|
|
5686
5698
|
});
|
|
5687
5699
|
const b = T(r, "clipPath", { id: o.boltClip });
|
|
5688
|
-
T(b, "path", { d:
|
|
5700
|
+
T(b, "path", { d: vn });
|
|
5689
5701
|
const g = T(i, "g", {
|
|
5690
5702
|
filter: fe(o.softDropShadow)
|
|
5691
5703
|
});
|
|
5692
5704
|
T(g, "path", {
|
|
5693
|
-
d:
|
|
5705
|
+
d: vn,
|
|
5694
5706
|
fill: fe(o.boltEdge)
|
|
5695
5707
|
});
|
|
5696
5708
|
const v = "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";
|
|
@@ -5757,7 +5769,7 @@ function bd(t, e) {
|
|
|
5757
5769
|
clip: `${e}-scribbleBoltClip`,
|
|
5758
5770
|
wobble: `${e}-scribbleBoltWobble`
|
|
5759
5771
|
}, i = la(), r = T(i, "defs"), s = T(r, "clipPath", { id: o.clip });
|
|
5760
|
-
T(s, "path", { d:
|
|
5772
|
+
T(s, "path", { d: vn });
|
|
5761
5773
|
const l = T(r, "filter", {
|
|
5762
5774
|
id: o.wobble,
|
|
5763
5775
|
x: "-10%",
|
|
@@ -5792,9 +5804,9 @@ function bd(t, e) {
|
|
|
5792
5804
|
opacity: "0.9",
|
|
5793
5805
|
transform: "rotate(-14 627 600)"
|
|
5794
5806
|
}), T(p, "path", {
|
|
5795
|
-
d:
|
|
5807
|
+
d: vn,
|
|
5796
5808
|
fill: "none",
|
|
5797
|
-
stroke:
|
|
5809
|
+
stroke: Sn,
|
|
5798
5810
|
"stroke-width": "18",
|
|
5799
5811
|
"stroke-linejoin": "round"
|
|
5800
5812
|
}), cr(
|
|
@@ -5853,14 +5865,14 @@ function cr(t, e, n, o, i, r, s, l) {
|
|
|
5853
5865
|
rx: "73",
|
|
5854
5866
|
ry: "80",
|
|
5855
5867
|
fill: "#ffffff",
|
|
5856
|
-
stroke:
|
|
5868
|
+
stroke: Sn,
|
|
5857
5869
|
"stroke-width": "13"
|
|
5858
5870
|
}), T(p, "ellipse", {
|
|
5859
5871
|
cx: i,
|
|
5860
5872
|
cy: r,
|
|
5861
5873
|
rx: "45",
|
|
5862
5874
|
ry: "53",
|
|
5863
|
-
fill:
|
|
5875
|
+
fill: Sn
|
|
5864
5876
|
}), T(p, "circle", {
|
|
5865
5877
|
cx: s,
|
|
5866
5878
|
cy: l,
|
|
@@ -5879,7 +5891,7 @@ function Y(t, e, n, o) {
|
|
|
5879
5891
|
function fe(t) {
|
|
5880
5892
|
return `url(#${t})`;
|
|
5881
5893
|
}
|
|
5882
|
-
function
|
|
5894
|
+
function Rn(t, e, n, o) {
|
|
5883
5895
|
const i = document.createElement("button");
|
|
5884
5896
|
return i.type = "button", i.className = t, i.setAttribute("aria-label", e), i.title = e, i.hidden = o, i.appendChild(n), i;
|
|
5885
5897
|
}
|
|
@@ -6267,18 +6279,18 @@ function Rd(t, e) {
|
|
|
6267
6279
|
function Ld(t) {
|
|
6268
6280
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(t) : void 0;
|
|
6269
6281
|
}
|
|
6270
|
-
function
|
|
6282
|
+
function gn(t) {
|
|
6271
6283
|
return !!(t && Array.from(t.types).includes("Files"));
|
|
6272
6284
|
}
|
|
6273
6285
|
function Md(t, e, n = null, o = !1, i) {
|
|
6274
|
-
const r = Ie(e) || Qo(n), s = !r && o &&
|
|
6286
|
+
const r = Ie(e) || Qo(n), s = !r && o && Cn(e);
|
|
6275
6287
|
if (!t || !Lo(e, n) || s) {
|
|
6276
6288
|
t && (t.hidden = !0, t.replaceChildren());
|
|
6277
6289
|
return;
|
|
6278
6290
|
}
|
|
6279
6291
|
t.hidden = !1, t.replaceChildren(), t.className = "pluno-pa-widget__billing-status", r ? t.appendChild(
|
|
6280
6292
|
Nd(e, n)
|
|
6281
|
-
) :
|
|
6293
|
+
) : Cn(e) && t.appendChild(
|
|
6282
6294
|
Ud(e, i)
|
|
6283
6295
|
);
|
|
6284
6296
|
}
|
|
@@ -6321,7 +6333,7 @@ function Ud(t, e) {
|
|
|
6321
6333
|
), n;
|
|
6322
6334
|
}
|
|
6323
6335
|
function Lo(t, e) {
|
|
6324
|
-
return t !== null && (Ie(t) ||
|
|
6336
|
+
return t !== null && (Ie(t) || Cn(t) || Qo(e));
|
|
6325
6337
|
}
|
|
6326
6338
|
function gr(t, e, n) {
|
|
6327
6339
|
return Lo(e, n) || Dd(e) ? !0 : !Lo(t, n);
|
|
@@ -6335,7 +6347,7 @@ function Ie(t) {
|
|
|
6335
6347
|
function Qo(t) {
|
|
6336
6348
|
return t === "limit_exceeded" || t === "subscription_required" || t === "subscription_inactive" || t === "payment_issue" || t === "subscription_invalid" || t === "payment_required";
|
|
6337
6349
|
}
|
|
6338
|
-
function
|
|
6350
|
+
function Cn(t) {
|
|
6339
6351
|
return t != null && !Ie(t) && t.creditLimit !== null && t.creditLimit > 0 && t.creditsRemaining !== null && t.creditsRemaining > 0 && t.creditsRemaining / t.creditLimit <= 0.2;
|
|
6340
6352
|
}
|
|
6341
6353
|
function Od(t) {
|
|
@@ -9789,7 +9801,7 @@ function mu(t) {
|
|
|
9789
9801
|
(o) => typeof o == "string"
|
|
9790
9802
|
) : [],
|
|
9791
9803
|
launcherPosition: yu(n.launcherPosition) ? n.launcherPosition : null,
|
|
9792
|
-
panelSize: xu(n.panelSize) ?
|
|
9804
|
+
panelSize: xu(n.panelSize) ? Pn(n.panelSize) : null,
|
|
9793
9805
|
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Zr) : [],
|
|
9794
9806
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
9795
9807
|
};
|
|
@@ -9954,7 +9966,7 @@ class qe extends EventTarget {
|
|
|
9954
9966
|
), this.cleanup();
|
|
9955
9967
|
}), window.dispatchEvent(
|
|
9956
9968
|
new CustomEvent(
|
|
9957
|
-
|
|
9969
|
+
hn(
|
|
9958
9970
|
sc,
|
|
9959
9971
|
this.channelId
|
|
9960
9972
|
),
|
|
@@ -9985,7 +9997,7 @@ class qe extends EventTarget {
|
|
|
9985
9997
|
);
|
|
9986
9998
|
window.dispatchEvent(
|
|
9987
9999
|
new CustomEvent(
|
|
9988
|
-
|
|
10000
|
+
hn(lc, this.channelId),
|
|
9989
10001
|
{
|
|
9990
10002
|
detail: {
|
|
9991
10003
|
socketId: this.socketId,
|
|
@@ -9998,7 +10010,7 @@ class qe extends EventTarget {
|
|
|
9998
10010
|
close(e, n) {
|
|
9999
10011
|
this.readyState !== qe.CLOSED && (this.readyState = qe.CLOSING, window.dispatchEvent(
|
|
10000
10012
|
new CustomEvent(
|
|
10001
|
-
|
|
10013
|
+
hn(pc, this.channelId),
|
|
10002
10014
|
{
|
|
10003
10015
|
detail: { socketId: this.socketId, code: e, reason: n }
|
|
10004
10016
|
}
|
|
@@ -10006,7 +10018,7 @@ class qe extends EventTarget {
|
|
|
10006
10018
|
), this.cleanup());
|
|
10007
10019
|
}
|
|
10008
10020
|
addPreviewListener(e, n) {
|
|
10009
|
-
const o =
|
|
10021
|
+
const o = hn(
|
|
10010
10022
|
e,
|
|
10011
10023
|
this.channelId
|
|
10012
10024
|
), i = (r) => {
|
|
@@ -10029,7 +10041,7 @@ function Cu() {
|
|
|
10029
10041
|
const e = crypto.randomUUID();
|
|
10030
10042
|
return window.sessionStorage.setItem(Yi, e), e;
|
|
10031
10043
|
}
|
|
10032
|
-
function
|
|
10044
|
+
function hn(t, e) {
|
|
10033
10045
|
return `${t}:${e}`;
|
|
10034
10046
|
}
|
|
10035
10047
|
function Tu(t) {
|