@doderasoftware/restify-ai 0.1.0-beta.1 → 0.1.0-beta.3
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/restify-ai.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var zs = Object.defineProperty;
|
|
2
2
|
var Hs = (n, e, t) => e in n ? zs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var W = (n, e, t) => Hs(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { ref as q, nextTick as Oe, onUnmounted as yt, computed as O, onMounted as xt, watch as Ue, isRef as Fs, onBeforeUnmount as Bs, defineComponent as he, createElementBlock as v, openBlock as k, normalizeClass as T, renderSlot as me, createElementVNode as p, createCommentVNode as B, Fragment as
|
|
5
|
-
import { defineStore as
|
|
4
|
+
import { ref as q, nextTick as Oe, onUnmounted as yt, computed as O, onMounted as xt, watch as Ue, isRef as Fs, onBeforeUnmount as Bs, defineComponent as he, createElementBlock as v, openBlock as k, normalizeClass as T, renderSlot as me, createElementVNode as p, createCommentVNode as B, Fragment as be, renderList as Ne, toDisplayString as N, createBlock as Me, resolveDynamicComponent as nn, withCtx as Ce, createVNode as ge, normalizeStyle as un, Transition as mt, withModifiers as et, unref as D, withDirectives as Us, vModelText as qs, createStaticVNode as Nn, createTextVNode as js, Teleport as Ws, normalizeProps as Pn, guardReactiveProps as zn } from "vue";
|
|
5
|
+
import { defineStore as Ks } from "pinia";
|
|
6
6
|
let qe = null;
|
|
7
|
-
const
|
|
7
|
+
const Vs = q(null), rs = {
|
|
8
8
|
title: "AI Assistant",
|
|
9
9
|
aiName: "AI Assistant",
|
|
10
10
|
you: "You",
|
|
@@ -58,8 +58,8 @@ const Gs = q(null), rs = {
|
|
|
58
58
|
setupBackendDescription: "Configure your backend endpoint",
|
|
59
59
|
setupCompleteTitle: "Setup Complete!"
|
|
60
60
|
};
|
|
61
|
-
function
|
|
62
|
-
qe = n,
|
|
61
|
+
function Gs(n) {
|
|
62
|
+
qe = n, Vs.value = n;
|
|
63
63
|
}
|
|
64
64
|
function ee() {
|
|
65
65
|
return qe;
|
|
@@ -86,7 +86,7 @@ function le(n, e) {
|
|
|
86
86
|
o = o.replace(`{${i}}`, String(a));
|
|
87
87
|
}), o;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Hn(n) {
|
|
90
90
|
return {
|
|
91
91
|
chatHistoryLimit: 15,
|
|
92
92
|
maxAttachments: 5,
|
|
@@ -98,11 +98,11 @@ function zn(n) {
|
|
|
98
98
|
enableSupportMode: !1
|
|
99
99
|
}[n];
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function tt(n) {
|
|
102
102
|
const e = qe;
|
|
103
|
-
return e ? e[n] ??
|
|
103
|
+
return e ? e[n] ?? Hn(n) : Hn(n);
|
|
104
104
|
}
|
|
105
|
-
const
|
|
105
|
+
const nt = {
|
|
106
106
|
Assistant: "assistant",
|
|
107
107
|
User: "user",
|
|
108
108
|
System: "system"
|
|
@@ -141,11 +141,11 @@ function Zs(n) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
function Ys(n, e, t) {
|
|
144
|
-
let s =
|
|
144
|
+
let s = Fn();
|
|
145
145
|
const r = new TextDecoder();
|
|
146
146
|
return function(i, a) {
|
|
147
147
|
if (i.length === 0)
|
|
148
|
-
t == null || t(s), s =
|
|
148
|
+
t == null || t(s), s = Fn();
|
|
149
149
|
else if (a > 0) {
|
|
150
150
|
const c = r.decode(i.subarray(0, a)), u = a + (i[a + 1] === 32 ? 2 : 1), d = r.decode(i.subarray(u));
|
|
151
151
|
switch (c) {
|
|
@@ -160,8 +160,8 @@ function Ys(n, e, t) {
|
|
|
160
160
|
n(s.id = d);
|
|
161
161
|
break;
|
|
162
162
|
case "retry":
|
|
163
|
-
const
|
|
164
|
-
isNaN(
|
|
163
|
+
const g = parseInt(d, 10);
|
|
164
|
+
isNaN(g) || e(s.retry = g);
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -171,7 +171,7 @@ function Xs(n, e) {
|
|
|
171
171
|
const t = new Uint8Array(n.length + e.length);
|
|
172
172
|
return t.set(n), t.set(e, n.length), t;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Fn() {
|
|
175
175
|
return {
|
|
176
176
|
data: "",
|
|
177
177
|
event: "",
|
|
@@ -187,10 +187,10 @@ var Js = function(n, e) {
|
|
|
187
187
|
e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (t[s[r]] = n[s[r]]);
|
|
188
188
|
return t;
|
|
189
189
|
};
|
|
190
|
-
const sn = "text/event-stream", er = 1e3,
|
|
190
|
+
const sn = "text/event-stream", er = 1e3, Bn = "last-event-id";
|
|
191
191
|
function tr(n, e) {
|
|
192
192
|
var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = e, d = Js(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
193
|
-
return new Promise((
|
|
193
|
+
return new Promise((g, b) => {
|
|
194
194
|
const y = Object.assign({}, s);
|
|
195
195
|
y.accept || (y.accept = sn);
|
|
196
196
|
let h;
|
|
@@ -198,31 +198,31 @@ function tr(n, e) {
|
|
|
198
198
|
h.abort(), document.hidden || z();
|
|
199
199
|
}
|
|
200
200
|
c || document.addEventListener("visibilitychange", A);
|
|
201
|
-
let
|
|
201
|
+
let m = er, f = 0;
|
|
202
202
|
function S() {
|
|
203
203
|
document.removeEventListener("visibilitychange", A), window.clearTimeout(f), h.abort();
|
|
204
204
|
}
|
|
205
205
|
t == null || t.addEventListener("abort", () => {
|
|
206
|
-
S(),
|
|
206
|
+
S(), g();
|
|
207
207
|
});
|
|
208
|
-
const C = u ?? window.fetch,
|
|
208
|
+
const C = u ?? window.fetch, w = r ?? nr;
|
|
209
209
|
async function z() {
|
|
210
210
|
var F;
|
|
211
211
|
h = new AbortController();
|
|
212
212
|
try {
|
|
213
|
-
const
|
|
214
|
-
await
|
|
215
|
-
E ? y[
|
|
213
|
+
const V = await C(n, Object.assign(Object.assign({}, d), { headers: y, signal: h.signal }));
|
|
214
|
+
await w(V), await Qs(V.body, Zs(Ys((E) => {
|
|
215
|
+
E ? y[Bn] = E : delete y[Bn];
|
|
216
216
|
}, (E) => {
|
|
217
|
-
|
|
218
|
-
}, o))), i == null || i(), S(),
|
|
219
|
-
} catch (
|
|
217
|
+
m = E;
|
|
218
|
+
}, o))), i == null || i(), S(), g();
|
|
219
|
+
} catch (V) {
|
|
220
220
|
if (!h.signal.aborted)
|
|
221
221
|
try {
|
|
222
|
-
const E = (F = a == null ? void 0 : a(
|
|
222
|
+
const E = (F = a == null ? void 0 : a(V)) !== null && F !== void 0 ? F : m;
|
|
223
223
|
window.clearTimeout(f), f = window.setTimeout(z, E);
|
|
224
224
|
} catch (E) {
|
|
225
|
-
S(),
|
|
225
|
+
S(), b(E);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -295,7 +295,7 @@ function lr() {
|
|
|
295
295
|
if (n) {
|
|
296
296
|
const e = JSON.parse(n), t = e.filter((o) => {
|
|
297
297
|
var i;
|
|
298
|
-
return !(o.role ===
|
|
298
|
+
return !(o.role === nt.Assistant && o.loading || o.role === nt.Assistant && !((i = o.message) != null && i.trim()));
|
|
299
299
|
}).map((o) => ({
|
|
300
300
|
...o,
|
|
301
301
|
// Reset streaming flag in case page was refreshed mid-stream
|
|
@@ -303,7 +303,7 @@ function lr() {
|
|
|
303
303
|
loading: !1
|
|
304
304
|
}));
|
|
305
305
|
t.length !== e.length && sessionStorage.setItem(Pe("chatHistory"), JSON.stringify(t));
|
|
306
|
-
const s = t[t.length - 1], r = (s == null ? void 0 : s.role) ===
|
|
306
|
+
const s = t[t.length - 1], r = (s == null ? void 0 : s.role) === nt.User;
|
|
307
307
|
return {
|
|
308
308
|
history: t,
|
|
309
309
|
hasOrphanedUserMessage: r,
|
|
@@ -349,7 +349,7 @@ function dr() {
|
|
|
349
349
|
return !1;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Un() {
|
|
353
353
|
try {
|
|
354
354
|
localStorage.setItem(Pe("setupComplete"), "true");
|
|
355
355
|
} catch (n) {
|
|
@@ -365,7 +365,7 @@ function pr(n) {
|
|
|
365
365
|
});
|
|
366
366
|
}), e;
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function qn() {
|
|
369
369
|
return {
|
|
370
370
|
isActive: !1,
|
|
371
371
|
currentStep: "welcome",
|
|
@@ -375,7 +375,7 @@ function Un() {
|
|
|
375
375
|
lastError: null
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
|
-
const
|
|
378
|
+
const We = Ks("restifyAiStore", {
|
|
379
379
|
state: () => {
|
|
380
380
|
const n = lr(), e = ir();
|
|
381
381
|
let t = {
|
|
@@ -398,7 +398,7 @@ const nt = Vs("restifyAiStore", {
|
|
|
398
398
|
timestamp: Date.now(),
|
|
399
399
|
quotaExceeded: !1
|
|
400
400
|
}), {
|
|
401
|
-
chatHistoryLimit:
|
|
401
|
+
chatHistoryLimit: tt("chatHistoryLimit") || 15,
|
|
402
402
|
chatHistory: n.history,
|
|
403
403
|
uploadedFiles: pr(n.history),
|
|
404
404
|
loading: !1,
|
|
@@ -413,7 +413,7 @@ const nt = Vs("restifyAiStore", {
|
|
|
413
413
|
},
|
|
414
414
|
error: t,
|
|
415
415
|
supportRequestMode: !1,
|
|
416
|
-
setupState: !os() && !dr() ? { ...
|
|
416
|
+
setupState: !os() && !dr() ? { ...qn(), isActive: !0 } : qn()
|
|
417
417
|
};
|
|
418
418
|
},
|
|
419
419
|
getters: {
|
|
@@ -439,7 +439,7 @@ const nt = Vs("restifyAiStore", {
|
|
|
439
439
|
let o = "", i = !1;
|
|
440
440
|
const a = r.retry || {}, c = a.maxRetries ?? 0, u = a.retryDelay ?? 1e3;
|
|
441
441
|
let d = 0;
|
|
442
|
-
const
|
|
442
|
+
const g = e.map((h) => ({
|
|
443
443
|
id: h.id,
|
|
444
444
|
name: h.name,
|
|
445
445
|
url: h.url,
|
|
@@ -449,15 +449,15 @@ const nt = Vs("restifyAiStore", {
|
|
|
449
449
|
}));
|
|
450
450
|
this.chatHistory.push({
|
|
451
451
|
id: crypto.randomUUID(),
|
|
452
|
-
role:
|
|
452
|
+
role: nt.User,
|
|
453
453
|
message: n,
|
|
454
454
|
loading: !1,
|
|
455
|
-
attachments:
|
|
455
|
+
attachments: g,
|
|
456
456
|
mentions: t,
|
|
457
457
|
timestamp: Date.now()
|
|
458
|
-
}),
|
|
459
|
-
const
|
|
460
|
-
var h, A,
|
|
458
|
+
}), g.forEach((h) => this.registerUploadedFile(h)), $t(this.chatHistory), this.sending = !0, this.chatHistory.length >= this.chatHistoryLimit && ((y = r.onError) == null || y.call(r, new Error("Chat history limit reached")));
|
|
459
|
+
const b = async () => {
|
|
460
|
+
var h, A, m;
|
|
461
461
|
try {
|
|
462
462
|
const f = this.chatHistory.map((L) => ({
|
|
463
463
|
role: L.role,
|
|
@@ -475,11 +475,11 @@ const nt = Vs("restifyAiStore", {
|
|
|
475
475
|
Object.values(this.uploadedFiles).forEach(C), this.chatHistory.forEach((L) => {
|
|
476
476
|
var ne;
|
|
477
477
|
(ne = L.attachments) == null || ne.forEach(C);
|
|
478
|
-
}),
|
|
479
|
-
const
|
|
478
|
+
}), g.forEach(C);
|
|
479
|
+
const w = Object.values(S), z = this.chatHistory.length;
|
|
480
480
|
this.chatHistory.push({
|
|
481
481
|
id: crypto.randomUUID(),
|
|
482
|
-
role:
|
|
482
|
+
role: nt.Assistant,
|
|
483
483
|
message: "",
|
|
484
484
|
loading: !0,
|
|
485
485
|
timestamp: Date.now()
|
|
@@ -495,7 +495,7 @@ const nt = Vs("restifyAiStore", {
|
|
|
495
495
|
question: n,
|
|
496
496
|
history: f,
|
|
497
497
|
stream: !0,
|
|
498
|
-
...
|
|
498
|
+
...w.length > 0 && { files: w },
|
|
499
499
|
...t.length > 0 && { mentions: t },
|
|
500
500
|
...this.supportRequestMode && { contact_support: !0 }
|
|
501
501
|
};
|
|
@@ -515,11 +515,11 @@ const nt = Vs("restifyAiStore", {
|
|
|
515
515
|
async onopen(L) {
|
|
516
516
|
if (!L.ok) {
|
|
517
517
|
if (L.status === 429) {
|
|
518
|
-
const ne =
|
|
518
|
+
const ne = We();
|
|
519
519
|
throw ne.error = {
|
|
520
520
|
message: le("noQuota"),
|
|
521
521
|
failedQuestion: n,
|
|
522
|
-
failedAttachments:
|
|
522
|
+
failedAttachments: g,
|
|
523
523
|
timestamp: Date.now(),
|
|
524
524
|
quotaExceeded: !0
|
|
525
525
|
}, await ne.fetchQuota(), new Error("Quota exceeded");
|
|
@@ -546,21 +546,21 @@ const nt = Vs("restifyAiStore", {
|
|
|
546
546
|
} catch (f) {
|
|
547
547
|
i = !0;
|
|
548
548
|
const S = this.chatHistory.length - 1;
|
|
549
|
-
return this.chatHistory.splice(S, 1), f.name === "AbortError" ? !0 : d < c && (a.shouldRetry ? a.shouldRetry(f, d) : !0) ? (d++, await rr(u * d),
|
|
549
|
+
return this.chatHistory.splice(S, 1), f.name === "AbortError" ? !0 : d < c && (a.shouldRetry ? a.shouldRetry(f, d) : !0) ? (d++, await rr(u * d), b()) : (this.error = {
|
|
550
550
|
message: f.message || "Network error occurred. Please try again.",
|
|
551
551
|
failedQuestion: n,
|
|
552
|
-
failedAttachments:
|
|
552
|
+
failedAttachments: g,
|
|
553
553
|
timestamp: Date.now()
|
|
554
554
|
}, or({
|
|
555
555
|
message: this.error.message,
|
|
556
556
|
failedQuestion: this.error.failedQuestion,
|
|
557
557
|
failedAttachments: this.error.failedAttachments || null
|
|
558
|
-
}), (
|
|
558
|
+
}), (m = r.onError) == null || m.call(r, f), !1);
|
|
559
559
|
} finally {
|
|
560
560
|
this.sending = !1;
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
|
-
return
|
|
563
|
+
return b();
|
|
564
564
|
},
|
|
565
565
|
cancelRequest() {
|
|
566
566
|
it == null || it.abort(), this.chatHistory = this.chatHistory.map((n) => ({
|
|
@@ -578,7 +578,7 @@ const nt = Vs("restifyAiStore", {
|
|
|
578
578
|
if (!this.error.failedQuestion)
|
|
579
579
|
return !1;
|
|
580
580
|
const n = this.error.failedQuestion, e = this.error.failedAttachments || [], t = this.chatHistory[this.chatHistory.length - 1];
|
|
581
|
-
return (t == null ? void 0 : t.role) ===
|
|
581
|
+
return (t == null ? void 0 : t.role) === nt.User && t.message === n && (this.chatHistory.pop(), $t(this.chatHistory)), this.clearError(), await this.askQuestion(n, e);
|
|
582
582
|
},
|
|
583
583
|
clearError() {
|
|
584
584
|
this.error = {
|
|
@@ -631,38 +631,38 @@ const nt = Vs("restifyAiStore", {
|
|
|
631
631
|
};
|
|
632
632
|
(o = e.onFileUploadStart) == null || o.call(e, s);
|
|
633
633
|
try {
|
|
634
|
-
const u = await e.getAuthToken(), d = e.getCustomHeaders ? await e.getCustomHeaders() : {},
|
|
635
|
-
|
|
634
|
+
const u = await e.getAuthToken(), d = e.getCustomHeaders ? await e.getCustomHeaders() : {}, g = It(e.endpoints.uploadFile), b = new FormData();
|
|
635
|
+
b.append("file", n);
|
|
636
636
|
const y = await new Promise((h, A) => {
|
|
637
|
-
const
|
|
638
|
-
|
|
637
|
+
const m = new XMLHttpRequest();
|
|
638
|
+
m.upload.addEventListener("progress", (f) => {
|
|
639
639
|
var S;
|
|
640
640
|
if (f.lengthComputable) {
|
|
641
641
|
const C = Math.round(f.loaded / f.total * 100);
|
|
642
642
|
s.progress = C, (S = e.onFileUploadProgress) == null || S.call(e, s, C);
|
|
643
643
|
}
|
|
644
|
-
}),
|
|
644
|
+
}), m.addEventListener("load", () => {
|
|
645
645
|
var f, S;
|
|
646
|
-
if (
|
|
646
|
+
if (m.status >= 200 && m.status < 300)
|
|
647
647
|
try {
|
|
648
|
-
const C = JSON.parse(
|
|
648
|
+
const C = JSON.parse(m.responseText), w = {
|
|
649
649
|
...s,
|
|
650
650
|
url: C.url || ((f = C.data) == null ? void 0 : f.url),
|
|
651
651
|
extractedText: C.extracted_text || ((S = C.data) == null ? void 0 : S.extracted_text),
|
|
652
652
|
uploading: !1,
|
|
653
653
|
progress: 100
|
|
654
654
|
};
|
|
655
|
-
h(
|
|
655
|
+
h(w);
|
|
656
656
|
} catch {
|
|
657
657
|
A(new Error("Failed to parse upload response"));
|
|
658
658
|
}
|
|
659
659
|
else
|
|
660
|
-
A(new Error(`Upload failed: ${
|
|
661
|
-
}),
|
|
660
|
+
A(new Error(`Upload failed: ${m.status}`));
|
|
661
|
+
}), m.addEventListener("error", () => {
|
|
662
662
|
A(new Error("Upload failed"));
|
|
663
|
-
}),
|
|
664
|
-
|
|
665
|
-
}),
|
|
663
|
+
}), m.open("POST", g), u && m.setRequestHeader("Authorization", `Bearer ${u}`), Object.entries(d).forEach(([f, S]) => {
|
|
664
|
+
m.setRequestHeader(f, S);
|
|
665
|
+
}), m.send(b);
|
|
666
666
|
});
|
|
667
667
|
return (i = e.onFileUploadComplete) == null || i.call(e, y), y;
|
|
668
668
|
} catch (u) {
|
|
@@ -736,10 +736,10 @@ const nt = Vs("restifyAiStore", {
|
|
|
736
736
|
},
|
|
737
737
|
completeSetup() {
|
|
738
738
|
var n, e;
|
|
739
|
-
this.setupState.isActive = !1, this.setupState.currentStep = "complete",
|
|
739
|
+
this.setupState.isActive = !1, this.setupState.currentStep = "complete", Un(), (e = (n = ee()) == null ? void 0 : n.onSetupComplete) == null || e.call(n);
|
|
740
740
|
},
|
|
741
741
|
skipSetup() {
|
|
742
|
-
this.setupState.isActive = !1,
|
|
742
|
+
this.setupState.isActive = !1, Un();
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
});
|
|
@@ -781,7 +781,7 @@ function ls(n, e) {
|
|
|
781
781
|
startPos: -1
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function cn(n, e) {
|
|
785
785
|
var t, s;
|
|
786
786
|
return e != null && e.getDisplayName ? e.getDisplayName(n) : n.name || n.title || ((t = n.attributes) == null ? void 0 : t.name) || ((s = n.attributes) == null ? void 0 : s.title) || "Unknown";
|
|
787
787
|
}
|
|
@@ -790,7 +790,7 @@ function us(n, e) {
|
|
|
790
790
|
return e != null && e.getSubtitle ? e.getSubtitle(n) : ((t = n.attributes) == null ? void 0 : t.email) || ((s = n.attributes) == null ? void 0 : s.description) || null;
|
|
791
791
|
}
|
|
792
792
|
function fr(n, e) {
|
|
793
|
-
return e != null && e.buildMentionText ? e.buildMentionText(n) : `@[${
|
|
793
|
+
return e != null && e.buildMentionText ? e.buildMentionText(n) : `@[${cn(n, e)}](${n.type}:${n.id})`;
|
|
794
794
|
}
|
|
795
795
|
function cs(n) {
|
|
796
796
|
var t;
|
|
@@ -820,7 +820,7 @@ function ka() {
|
|
|
820
820
|
parseAndCleanMessage: hr,
|
|
821
821
|
renderMentionsInHtml: as,
|
|
822
822
|
detectMentionContext: ls,
|
|
823
|
-
getMentionDisplayName:
|
|
823
|
+
getMentionDisplayName: cn,
|
|
824
824
|
getMentionSubtitle: us,
|
|
825
825
|
buildMentionText: fr,
|
|
826
826
|
getMentionProvider: cs,
|
|
@@ -829,7 +829,7 @@ function ka() {
|
|
|
829
829
|
groupMentionsByType: mr
|
|
830
830
|
};
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function dn() {
|
|
833
833
|
return {
|
|
834
834
|
async: !1,
|
|
835
835
|
breaks: !1,
|
|
@@ -843,9 +843,9 @@ function cn() {
|
|
|
843
843
|
walkTokens: null
|
|
844
844
|
};
|
|
845
845
|
}
|
|
846
|
-
let
|
|
846
|
+
let Ke = dn();
|
|
847
847
|
function ps(n) {
|
|
848
|
-
|
|
848
|
+
Ke = n;
|
|
849
849
|
}
|
|
850
850
|
const hs = /[&<>"']/, yr = new RegExp(hs.source, "g"), fs = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, xr = new RegExp(fs.source, "g"), kr = {
|
|
851
851
|
"&": "&",
|
|
@@ -853,29 +853,29 @@ const hs = /[&<>"']/, yr = new RegExp(hs.source, "g"), fs = /[<>"']|&(?!(#\d{1,7
|
|
|
853
853
|
">": ">",
|
|
854
854
|
'"': """,
|
|
855
855
|
"'": "'"
|
|
856
|
-
},
|
|
856
|
+
}, jn = (n) => kr[n];
|
|
857
857
|
function ye(n, e) {
|
|
858
858
|
if (e) {
|
|
859
859
|
if (hs.test(n))
|
|
860
|
-
return n.replace(yr,
|
|
860
|
+
return n.replace(yr, jn);
|
|
861
861
|
} else if (fs.test(n))
|
|
862
|
-
return n.replace(xr,
|
|
862
|
+
return n.replace(xr, jn);
|
|
863
863
|
return n;
|
|
864
864
|
}
|
|
865
|
-
const
|
|
865
|
+
const br = /(^|[^\[])\^/g;
|
|
866
866
|
function j(n, e) {
|
|
867
867
|
let t = typeof n == "string" ? n : n.source;
|
|
868
868
|
e = e || "";
|
|
869
869
|
const s = {
|
|
870
870
|
replace: (r, o) => {
|
|
871
871
|
let i = typeof o == "string" ? o : o.source;
|
|
872
|
-
return i = i.replace(
|
|
872
|
+
return i = i.replace(br, "$1"), t = t.replace(r, i), s;
|
|
873
873
|
},
|
|
874
874
|
getRegex: () => new RegExp(t, e)
|
|
875
875
|
};
|
|
876
876
|
return s;
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function Wn(n) {
|
|
879
879
|
try {
|
|
880
880
|
n = encodeURI(n).replace(/%25/g, "%");
|
|
881
881
|
} catch {
|
|
@@ -884,7 +884,7 @@ function jn(n) {
|
|
|
884
884
|
return n;
|
|
885
885
|
}
|
|
886
886
|
const ft = { exec: () => null };
|
|
887
|
-
function
|
|
887
|
+
function Kn(n, e) {
|
|
888
888
|
const t = n.replace(/\|/g, (o, i, a) => {
|
|
889
889
|
let c = !1, u = i;
|
|
890
890
|
for (; --u >= 0 && a[u] === "\\"; )
|
|
@@ -911,7 +911,7 @@ function at(n, e, t) {
|
|
|
911
911
|
r++;
|
|
912
912
|
return n.slice(0, s - r);
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function wr(n, e) {
|
|
915
915
|
if (n.indexOf(e[1]) === -1)
|
|
916
916
|
return -1;
|
|
917
917
|
let t = 0;
|
|
@@ -968,7 +968,7 @@ class Pt {
|
|
|
968
968
|
W(this, "rules");
|
|
969
969
|
// set by the lexer
|
|
970
970
|
W(this, "lexer");
|
|
971
|
-
this.options = e ||
|
|
971
|
+
this.options = e || Ke;
|
|
972
972
|
}
|
|
973
973
|
space(e) {
|
|
974
974
|
const t = this.rules.block.newline.exec(e);
|
|
@@ -1049,13 +1049,13 @@ class Pt {
|
|
|
1049
1049
|
break;
|
|
1050
1050
|
s = s.slice(u);
|
|
1051
1051
|
const d = c.join(`
|
|
1052
|
-
`),
|
|
1052
|
+
`), g = d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
|
|
1053
1053
|
$1`).replace(/^ {0,3}>[ \t]?/gm, "");
|
|
1054
1054
|
r = r ? `${r}
|
|
1055
1055
|
${d}` : d, o = o ? `${o}
|
|
1056
|
-
${
|
|
1057
|
-
const
|
|
1058
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1056
|
+
${g}` : g;
|
|
1057
|
+
const b = this.lexer.state.top;
|
|
1058
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(g, i, !0), this.lexer.state.top = b, s.length === 0)
|
|
1059
1059
|
break;
|
|
1060
1060
|
const y = i[i.length - 1];
|
|
1061
1061
|
if ((y == null ? void 0 : y.type) === "code")
|
|
@@ -1063,14 +1063,14 @@ ${m}` : m;
|
|
|
1063
1063
|
if ((y == null ? void 0 : y.type) === "blockquote") {
|
|
1064
1064
|
const h = y, A = h.raw + `
|
|
1065
1065
|
` + s.join(`
|
|
1066
|
-
`),
|
|
1067
|
-
i[i.length - 1] =
|
|
1066
|
+
`), m = this.blockquote(A);
|
|
1067
|
+
i[i.length - 1] = m, r = r.substring(0, r.length - h.raw.length) + m.raw, o = o.substring(0, o.length - h.text.length) + m.text;
|
|
1068
1068
|
break;
|
|
1069
1069
|
} else if ((y == null ? void 0 : y.type) === "list") {
|
|
1070
1070
|
const h = y, A = h.raw + `
|
|
1071
1071
|
` + s.join(`
|
|
1072
|
-
`),
|
|
1073
|
-
i[i.length - 1] =
|
|
1072
|
+
`), m = this.list(A);
|
|
1073
|
+
i[i.length - 1] = m, r = r.substring(0, r.length - y.raw.length) + m.raw, o = o.substring(0, o.length - h.raw.length) + m.raw, s = A.substring(i[i.length - 1].raw.length).split(`
|
|
1074
1074
|
`);
|
|
1075
1075
|
continue;
|
|
1076
1076
|
}
|
|
@@ -1103,38 +1103,38 @@ ${m}` : m;
|
|
|
1103
1103
|
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
1104
1104
|
break;
|
|
1105
1105
|
u = t[0], e = e.substring(u.length);
|
|
1106
|
-
let
|
|
1107
|
-
`, 1)[0].replace(/^\t+/, (f) => " ".repeat(3 * f.length)),
|
|
1108
|
-
`, 1)[0], y = !
|
|
1109
|
-
if (this.options.pedantic ? (h = 2, d =
|
|
1110
|
-
`, e = e.substring(
|
|
1111
|
-
const f = new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, h - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:\`\`\`|~~~)`),
|
|
1106
|
+
let g = t[2].split(`
|
|
1107
|
+
`, 1)[0].replace(/^\t+/, (f) => " ".repeat(3 * f.length)), b = e.split(`
|
|
1108
|
+
`, 1)[0], y = !g.trim(), h = 0;
|
|
1109
|
+
if (this.options.pedantic ? (h = 2, d = g.trimStart()) : y ? h = t[1].length + 1 : (h = t[2].search(/[^ ]/), h = h > 4 ? 1 : h, d = g.slice(h), h += t[1].length), y && /^[ \t]*$/.test(b) && (u += b + `
|
|
1110
|
+
`, e = e.substring(b.length + 1), c = !0), !c) {
|
|
1111
|
+
const f = new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, h - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:\`\`\`|~~~)`), w = new RegExp(`^ {0,${Math.min(3, h - 1)}}#`), z = new RegExp(`^ {0,${Math.min(3, h - 1)}}<(?:[a-z].*>|!--)`, "i");
|
|
1112
1112
|
for (; e; ) {
|
|
1113
1113
|
const F = e.split(`
|
|
1114
1114
|
`, 1)[0];
|
|
1115
|
-
let
|
|
1116
|
-
if (
|
|
1115
|
+
let V;
|
|
1116
|
+
if (b = F, this.options.pedantic ? (b = b.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "), V = b) : V = b.replace(/\t/g, " "), C.test(b) || w.test(b) || z.test(b) || f.test(b) || S.test(b))
|
|
1117
1117
|
break;
|
|
1118
|
-
if (
|
|
1118
|
+
if (V.search(/[^ ]/) >= h || !b.trim())
|
|
1119
1119
|
d += `
|
|
1120
|
-
` +
|
|
1120
|
+
` + V.slice(h);
|
|
1121
1121
|
else {
|
|
1122
|
-
if (y ||
|
|
1122
|
+
if (y || g.replace(/\t/g, " ").search(/[^ ]/) >= 4 || C.test(g) || w.test(g) || S.test(g))
|
|
1123
1123
|
break;
|
|
1124
1124
|
d += `
|
|
1125
|
-
` +
|
|
1125
|
+
` + b;
|
|
1126
1126
|
}
|
|
1127
|
-
!y && !
|
|
1128
|
-
`, e = e.substring(F.length + 1),
|
|
1127
|
+
!y && !b.trim() && (y = !0), u += F + `
|
|
1128
|
+
`, e = e.substring(F.length + 1), g = V.slice(h);
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
1131
|
o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(u) && (a = !0));
|
|
1132
|
-
let A = null,
|
|
1133
|
-
this.options.gfm && (A = /^\[[ xX]\] /.exec(d), A && (
|
|
1132
|
+
let A = null, m;
|
|
1133
|
+
this.options.gfm && (A = /^\[[ xX]\] /.exec(d), A && (m = A[0] !== "[ ] ", d = d.replace(/^\[[ xX]\] +/, ""))), o.items.push({
|
|
1134
1134
|
type: "list_item",
|
|
1135
1135
|
raw: u,
|
|
1136
1136
|
task: !!A,
|
|
1137
|
-
checked:
|
|
1137
|
+
checked: m,
|
|
1138
1138
|
loose: !1,
|
|
1139
1139
|
text: d,
|
|
1140
1140
|
tokens: []
|
|
@@ -1143,7 +1143,7 @@ ${m}` : m;
|
|
|
1143
1143
|
o.items[o.items.length - 1].raw = o.items[o.items.length - 1].raw.trimEnd(), o.items[o.items.length - 1].text = o.items[o.items.length - 1].text.trimEnd(), o.raw = o.raw.trimEnd();
|
|
1144
1144
|
for (let c = 0; c < o.items.length; c++)
|
|
1145
1145
|
if (this.lexer.state.top = !1, o.items[c].tokens = this.lexer.blockTokens(o.items[c].text, []), !o.loose) {
|
|
1146
|
-
const u = o.items[c].tokens.filter((
|
|
1146
|
+
const u = o.items[c].tokens.filter((g) => g.type === "space"), d = u.length > 0 && u.some((g) => /\n.*\n/.test(g.raw));
|
|
1147
1147
|
o.loose = d;
|
|
1148
1148
|
}
|
|
1149
1149
|
if (o.loose)
|
|
@@ -1180,7 +1180,7 @@ ${m}` : m;
|
|
|
1180
1180
|
const t = this.rules.block.table.exec(e);
|
|
1181
1181
|
if (!t || !/[:|]/.test(t[2]))
|
|
1182
1182
|
return;
|
|
1183
|
-
const s =
|
|
1183
|
+
const s = Kn(t[1]), r = t[2].replace(/^\||\| *$/g, "").split("|"), o = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
|
|
1184
1184
|
`) : [], i = {
|
|
1185
1185
|
type: "table",
|
|
1186
1186
|
raw: t[0],
|
|
@@ -1199,7 +1199,7 @@ ${m}` : m;
|
|
|
1199
1199
|
align: i.align[a]
|
|
1200
1200
|
});
|
|
1201
1201
|
for (const a of o)
|
|
1202
|
-
i.rows.push(
|
|
1202
|
+
i.rows.push(Kn(a, i.header.length).map((c, u) => ({
|
|
1203
1203
|
text: c,
|
|
1204
1204
|
tokens: this.lexer.inline(c),
|
|
1205
1205
|
header: !1,
|
|
@@ -1274,7 +1274,7 @@ ${m}` : m;
|
|
|
1274
1274
|
if ((s.length - i.length) % 2 === 0)
|
|
1275
1275
|
return;
|
|
1276
1276
|
} else {
|
|
1277
|
-
const i =
|
|
1277
|
+
const i = wr(t[2], "()");
|
|
1278
1278
|
if (i > -1) {
|
|
1279
1279
|
const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
1280
1280
|
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, c).trim(), t[3] = "";
|
|
@@ -1314,8 +1314,8 @@ ${m}` : m;
|
|
|
1314
1314
|
if (!(r[1] || r[2] || "") || !s || this.rules.inline.punctuation.exec(s)) {
|
|
1315
1315
|
const i = [...r[0]].length - 1;
|
|
1316
1316
|
let a, c, u = i, d = 0;
|
|
1317
|
-
const
|
|
1318
|
-
for (
|
|
1317
|
+
const g = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1318
|
+
for (g.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = g.exec(t)) != null; ) {
|
|
1319
1319
|
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a)
|
|
1320
1320
|
continue;
|
|
1321
1321
|
if (c = [...a].length, r[3] || r[4]) {
|
|
@@ -1328,7 +1328,7 @@ ${m}` : m;
|
|
|
1328
1328
|
if (u -= c, u > 0)
|
|
1329
1329
|
continue;
|
|
1330
1330
|
c = Math.min(c, c + u + d);
|
|
1331
|
-
const
|
|
1331
|
+
const b = [...r[0]][0].length, y = e.slice(0, i + r.index + b + c);
|
|
1332
1332
|
if (Math.min(i, c) % 2) {
|
|
1333
1333
|
const A = y.slice(1, -1);
|
|
1334
1334
|
return {
|
|
@@ -1438,7 +1438,7 @@ ${m}` : m;
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
|
-
const Tr = /^(?:[ \t]*(?:\n|$))+/, Sr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ar = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, kt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Cr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, gs = /(?:[*+-]|\d{1,9}[.)])/, ms = j(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, gs).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(),
|
|
1441
|
+
const Tr = /^(?:[ \t]*(?:\n|$))+/, Sr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ar = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, kt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Cr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, gs = /(?:[*+-]|\d{1,9}[.)])/, ms = j(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, gs).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), pn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Er = /^[^\n]+/, hn = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Mr = j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", hn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Rr = j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, gs).getRegex(), Ft = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", fn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Lr = j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", fn).replace("tag", Ft).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ys = j(pn).replace("hr", kt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ft).getRegex(), Ir = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ys).getRegex(), gn = {
|
|
1442
1442
|
blockquote: Ir,
|
|
1443
1443
|
code: Sr,
|
|
1444
1444
|
def: Mr,
|
|
@@ -1453,20 +1453,20 @@ const Tr = /^(?:[ \t]*(?:\n|$))+/, Sr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1453
1453
|
table: ft,
|
|
1454
1454
|
text: Er
|
|
1455
1455
|
}, Gn = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", kt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ft).getRegex(), $r = {
|
|
1456
|
-
...
|
|
1456
|
+
...gn,
|
|
1457
1457
|
table: Gn,
|
|
1458
|
-
paragraph: j(
|
|
1458
|
+
paragraph: j(pn).replace("hr", kt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Gn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ft).getRegex()
|
|
1459
1459
|
}, Dr = {
|
|
1460
|
-
...
|
|
1461
|
-
html: j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",
|
|
1460
|
+
...gn,
|
|
1461
|
+
html: j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", fn).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
1462
1462
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1463
1463
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1464
1464
|
fences: ft,
|
|
1465
1465
|
// fences not supported
|
|
1466
1466
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1467
|
-
paragraph: j(
|
|
1467
|
+
paragraph: j(pn).replace("hr", kt).replace("heading", ` *#{1,6} *[^
|
|
1468
1468
|
]`).replace("lheading", ms).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1469
|
-
}, xs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, _r = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ks = /^( {2,}|\\)\n(?!\s*$)/, Or = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1469
|
+
}, xs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, _r = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ks = /^( {2,}|\\)\n(?!\s*$)/, Or = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, bt = "\\p{P}\\p{S}", Nr = j(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, bt).getRegex(), Pr = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, zr = j(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, bt).getRegex(), Hr = j("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, bt).getRegex(), Fr = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, bt).getRegex(), Br = j(/\\([punct])/, "gu").replace(/punct/g, bt).getRegex(), Ur = j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), qr = j(fn).replace("(?:-->|$)", "-->").getRegex(), jr = j("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", qr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), zt = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Wr = j(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", zt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bs = j(/^!?\[(label)\]\[(ref)\]/).replace("label", zt).replace("ref", hn).getRegex(), ws = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", hn).getRegex(), Kr = j("reflink|nolink(?!\\()", "g").replace("reflink", bs).replace("nolink", ws).getRegex(), mn = {
|
|
1470
1470
|
_backpedal: ft,
|
|
1471
1471
|
// only used for GFM url
|
|
1472
1472
|
anyPunctuation: Br,
|
|
@@ -1480,37 +1480,37 @@ const Tr = /^(?:[ \t]*(?:\n|$))+/, Sr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1480
1480
|
emStrongRDelimUnd: Fr,
|
|
1481
1481
|
escape: xs,
|
|
1482
1482
|
link: Wr,
|
|
1483
|
-
nolink:
|
|
1483
|
+
nolink: ws,
|
|
1484
1484
|
punctuation: Nr,
|
|
1485
|
-
reflink:
|
|
1486
|
-
reflinkSearch:
|
|
1485
|
+
reflink: bs,
|
|
1486
|
+
reflinkSearch: Kr,
|
|
1487
1487
|
tag: jr,
|
|
1488
1488
|
text: Or,
|
|
1489
1489
|
url: ft
|
|
1490
|
-
},
|
|
1491
|
-
...
|
|
1490
|
+
}, Vr = {
|
|
1491
|
+
...mn,
|
|
1492
1492
|
link: j(/^!?\[(label)\]\((.*?)\)/).replace("label", zt).getRegex(),
|
|
1493
1493
|
reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", zt).getRegex()
|
|
1494
1494
|
}, rn = {
|
|
1495
|
-
...
|
|
1495
|
+
...mn,
|
|
1496
1496
|
escape: j(xs).replace("])", "~|])").getRegex(),
|
|
1497
1497
|
url: j(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1498
1498
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1499
1499
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1500
1500
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1501
|
-
},
|
|
1501
|
+
}, Gr = {
|
|
1502
1502
|
...rn,
|
|
1503
1503
|
br: j(ks).replace("{2,}", "*").getRegex(),
|
|
1504
1504
|
text: j(rn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1505
1505
|
}, Dt = {
|
|
1506
|
-
normal:
|
|
1506
|
+
normal: gn,
|
|
1507
1507
|
gfm: $r,
|
|
1508
1508
|
pedantic: Dr
|
|
1509
1509
|
}, lt = {
|
|
1510
|
-
normal:
|
|
1510
|
+
normal: mn,
|
|
1511
1511
|
gfm: rn,
|
|
1512
|
-
breaks:
|
|
1513
|
-
pedantic:
|
|
1512
|
+
breaks: Gr,
|
|
1513
|
+
pedantic: Vr
|
|
1514
1514
|
};
|
|
1515
1515
|
class xe {
|
|
1516
1516
|
constructor(e) {
|
|
@@ -1519,7 +1519,7 @@ class xe {
|
|
|
1519
1519
|
W(this, "state");
|
|
1520
1520
|
W(this, "tokenizer");
|
|
1521
1521
|
W(this, "inlineQueue");
|
|
1522
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
1522
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Ke, this.options.tokenizer = this.options.tokenizer || new Pt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
1523
1523
|
inLink: !1,
|
|
1524
1524
|
inRawBlock: !1,
|
|
1525
1525
|
top: !0
|
|
@@ -1713,10 +1713,10 @@ class xe {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
if (o = e, this.options.extensions && this.options.extensions.startInline) {
|
|
1715
1715
|
let d = 1 / 0;
|
|
1716
|
-
const
|
|
1717
|
-
let
|
|
1716
|
+
const g = e.slice(1);
|
|
1717
|
+
let b;
|
|
1718
1718
|
this.options.extensions.startInline.forEach((y) => {
|
|
1719
|
-
|
|
1719
|
+
b = y.call({ lexer: this }, g), typeof b == "number" && b >= 0 && (d = Math.min(d, b));
|
|
1720
1720
|
}), d < 1 / 0 && d >= 0 && (o = e.substring(0, d + 1));
|
|
1721
1721
|
}
|
|
1722
1722
|
if (s = this.tokenizer.inlineText(o)) {
|
|
@@ -1740,7 +1740,7 @@ class Ht {
|
|
|
1740
1740
|
constructor(e) {
|
|
1741
1741
|
W(this, "options");
|
|
1742
1742
|
W(this, "parser");
|
|
1743
|
-
this.options = e ||
|
|
1743
|
+
this.options = e || Ke;
|
|
1744
1744
|
}
|
|
1745
1745
|
space(e) {
|
|
1746
1746
|
return "";
|
|
@@ -1849,7 +1849,7 @@ ${e}</tr>
|
|
|
1849
1849
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1850
1850
|
}
|
|
1851
1851
|
link({ href: e, title: t, tokens: s }) {
|
|
1852
|
-
const r = this.parser.parseInline(s), o =
|
|
1852
|
+
const r = this.parser.parseInline(s), o = Wn(e);
|
|
1853
1853
|
if (o === null)
|
|
1854
1854
|
return r;
|
|
1855
1855
|
e = o;
|
|
@@ -1857,7 +1857,7 @@ ${e}</tr>
|
|
|
1857
1857
|
return t && (i += ' title="' + t + '"'), i += ">" + r + "</a>", i;
|
|
1858
1858
|
}
|
|
1859
1859
|
image({ href: e, title: t, text: s }) {
|
|
1860
|
-
const r =
|
|
1860
|
+
const r = Wn(e);
|
|
1861
1861
|
if (r === null)
|
|
1862
1862
|
return s;
|
|
1863
1863
|
e = r;
|
|
@@ -1868,7 +1868,7 @@ ${e}</tr>
|
|
|
1868
1868
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : e.text;
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
|
-
class
|
|
1871
|
+
class yn {
|
|
1872
1872
|
// no need for block level renderers
|
|
1873
1873
|
strong({ text: e }) {
|
|
1874
1874
|
return e;
|
|
@@ -1903,7 +1903,7 @@ class ke {
|
|
|
1903
1903
|
W(this, "options");
|
|
1904
1904
|
W(this, "renderer");
|
|
1905
1905
|
W(this, "textRenderer");
|
|
1906
|
-
this.options = e ||
|
|
1906
|
+
this.options = e || Ke, this.options.renderer = this.options.renderer || new Ht(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new yn();
|
|
1907
1907
|
}
|
|
1908
1908
|
/**
|
|
1909
1909
|
* Static Parse Method
|
|
@@ -2064,7 +2064,7 @@ class gt {
|
|
|
2064
2064
|
constructor(e) {
|
|
2065
2065
|
W(this, "options");
|
|
2066
2066
|
W(this, "block");
|
|
2067
|
-
this.options = e ||
|
|
2067
|
+
this.options = e || Ke;
|
|
2068
2068
|
}
|
|
2069
2069
|
/**
|
|
2070
2070
|
* Process markdown before marked
|
|
@@ -2104,13 +2104,13 @@ W(gt, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
|
2104
2104
|
]));
|
|
2105
2105
|
class Qr {
|
|
2106
2106
|
constructor(...e) {
|
|
2107
|
-
W(this, "defaults",
|
|
2107
|
+
W(this, "defaults", dn());
|
|
2108
2108
|
W(this, "options", this.setOptions);
|
|
2109
2109
|
W(this, "parse", this.parseMarkdown(!0));
|
|
2110
2110
|
W(this, "parseInline", this.parseMarkdown(!1));
|
|
2111
2111
|
W(this, "Parser", ke);
|
|
2112
2112
|
W(this, "Renderer", Ht);
|
|
2113
|
-
W(this, "TextRenderer",
|
|
2113
|
+
W(this, "TextRenderer", yn);
|
|
2114
2114
|
W(this, "Lexer", xe);
|
|
2115
2115
|
W(this, "Tokenizer", Pt);
|
|
2116
2116
|
W(this, "Hooks", gt);
|
|
@@ -2178,8 +2178,8 @@ class Qr {
|
|
|
2178
2178
|
continue;
|
|
2179
2179
|
const a = i, c = s.renderer[a], u = o[a];
|
|
2180
2180
|
o[a] = (...d) => {
|
|
2181
|
-
let
|
|
2182
|
-
return
|
|
2181
|
+
let g = c.apply(o, d);
|
|
2182
|
+
return g === !1 && (g = u.apply(o, d)), g || "";
|
|
2183
2183
|
};
|
|
2184
2184
|
}
|
|
2185
2185
|
r.renderer = o;
|
|
@@ -2193,8 +2193,8 @@ class Qr {
|
|
|
2193
2193
|
continue;
|
|
2194
2194
|
const a = i, c = s.tokenizer[a], u = o[a];
|
|
2195
2195
|
o[a] = (...d) => {
|
|
2196
|
-
let
|
|
2197
|
-
return
|
|
2196
|
+
let g = c.apply(o, d);
|
|
2197
|
+
return g === !1 && (g = u.apply(o, d)), g;
|
|
2198
2198
|
};
|
|
2199
2199
|
}
|
|
2200
2200
|
r.tokenizer = o;
|
|
@@ -2209,12 +2209,12 @@ class Qr {
|
|
|
2209
2209
|
const a = i, c = s.hooks[a], u = o[a];
|
|
2210
2210
|
gt.passThroughHooks.has(i) ? o[a] = (d) => {
|
|
2211
2211
|
if (this.defaults.async)
|
|
2212
|
-
return Promise.resolve(c.call(o, d)).then((
|
|
2213
|
-
const
|
|
2214
|
-
return u.call(o,
|
|
2212
|
+
return Promise.resolve(c.call(o, d)).then((b) => u.call(o, b));
|
|
2213
|
+
const g = c.call(o, d);
|
|
2214
|
+
return u.call(o, g);
|
|
2215
2215
|
} : o[a] = (...d) => {
|
|
2216
|
-
let
|
|
2217
|
-
return
|
|
2216
|
+
let g = c.apply(o, d);
|
|
2217
|
+
return g === !1 && (g = u.apply(o, d)), g;
|
|
2218
2218
|
};
|
|
2219
2219
|
}
|
|
2220
2220
|
r.hooks = o;
|
|
@@ -2255,8 +2255,8 @@ class Qr {
|
|
|
2255
2255
|
i.hooks && (s = i.hooks.preprocess(s));
|
|
2256
2256
|
let d = c(s, i);
|
|
2257
2257
|
i.hooks && (d = i.hooks.processAllTokens(d)), i.walkTokens && this.walkTokens(d, i.walkTokens);
|
|
2258
|
-
let
|
|
2259
|
-
return i.hooks && (
|
|
2258
|
+
let g = u(d, i);
|
|
2259
|
+
return i.hooks && (g = i.hooks.postprocess(g)), g;
|
|
2260
2260
|
} catch (d) {
|
|
2261
2261
|
return a(d);
|
|
2262
2262
|
}
|
|
@@ -2282,8 +2282,8 @@ function U(n, e) {
|
|
|
2282
2282
|
U.options = U.setOptions = function(n) {
|
|
2283
2283
|
return je.setOptions(n), U.defaults = je.defaults, ps(U.defaults), U;
|
|
2284
2284
|
};
|
|
2285
|
-
U.getDefaults =
|
|
2286
|
-
U.defaults =
|
|
2285
|
+
U.getDefaults = dn;
|
|
2286
|
+
U.defaults = Ke;
|
|
2287
2287
|
U.use = function(...n) {
|
|
2288
2288
|
return je.use(...n), U.defaults = je.defaults, ps(U.defaults), U;
|
|
2289
2289
|
};
|
|
@@ -2294,7 +2294,7 @@ U.parseInline = je.parseInline;
|
|
|
2294
2294
|
U.Parser = ke;
|
|
2295
2295
|
U.parser = ke.parse;
|
|
2296
2296
|
U.Renderer = Ht;
|
|
2297
|
-
U.TextRenderer =
|
|
2297
|
+
U.TextRenderer = yn;
|
|
2298
2298
|
U.Lexer = xe;
|
|
2299
2299
|
U.lexer = xe.lex;
|
|
2300
2300
|
U.Tokenizer = Pt;
|
|
@@ -2310,14 +2310,14 @@ xe.lex;
|
|
|
2310
2310
|
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
|
|
2311
2311
|
const {
|
|
2312
2312
|
entries: vs,
|
|
2313
|
-
setPrototypeOf:
|
|
2313
|
+
setPrototypeOf: Qn,
|
|
2314
2314
|
isFrozen: Zr,
|
|
2315
2315
|
getPrototypeOf: Yr,
|
|
2316
2316
|
getOwnPropertyDescriptor: Xr
|
|
2317
2317
|
} = Object;
|
|
2318
2318
|
let {
|
|
2319
2319
|
freeze: de,
|
|
2320
|
-
seal:
|
|
2320
|
+
seal: we,
|
|
2321
2321
|
create: on
|
|
2322
2322
|
} = Object, {
|
|
2323
2323
|
apply: an,
|
|
@@ -2326,7 +2326,7 @@ let {
|
|
|
2326
2326
|
de || (de = function(e) {
|
|
2327
2327
|
return e;
|
|
2328
2328
|
});
|
|
2329
|
-
|
|
2329
|
+
we || (we = function(e) {
|
|
2330
2330
|
return e;
|
|
2331
2331
|
});
|
|
2332
2332
|
an || (an = function(e, t) {
|
|
@@ -2339,7 +2339,7 @@ ln || (ln = function(e) {
|
|
|
2339
2339
|
s[r - 1] = arguments[r];
|
|
2340
2340
|
return new e(...s);
|
|
2341
2341
|
});
|
|
2342
|
-
const _t = pe(Array.prototype.forEach), Jr = pe(Array.prototype.lastIndexOf),
|
|
2342
|
+
const _t = pe(Array.prototype.forEach), Jr = pe(Array.prototype.lastIndexOf), Zn = pe(Array.prototype.pop), ut = pe(Array.prototype.push), eo = pe(Array.prototype.splice), Nt = pe(String.prototype.toLowerCase), Zt = pe(String.prototype.toString), Yt = pe(String.prototype.match), ct = pe(String.prototype.replace), to = pe(String.prototype.indexOf), no = pe(String.prototype.trim), ve = pe(Object.prototype.hasOwnProperty), ce = pe(RegExp.prototype.test), dt = so(TypeError);
|
|
2343
2343
|
function pe(n) {
|
|
2344
2344
|
return function(e) {
|
|
2345
2345
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
@@ -2357,7 +2357,7 @@ function so(n) {
|
|
|
2357
2357
|
}
|
|
2358
2358
|
function H(n, e) {
|
|
2359
2359
|
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Nt;
|
|
2360
|
-
|
|
2360
|
+
Qn && Qn(n, null);
|
|
2361
2361
|
let s = e.length;
|
|
2362
2362
|
for (; s--; ) {
|
|
2363
2363
|
let r = e[s];
|
|
@@ -2396,14 +2396,14 @@ function pt(n, e) {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
return t;
|
|
2398
2398
|
}
|
|
2399
|
-
const
|
|
2399
|
+
const Yn = de(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Xt = de(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Jt = de(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), oo = de(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), en = de(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), io = de(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Xn = de(["#text"]), Jn = de(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), tn = de(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), es = de(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ot = de(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), ao = we(/\{\{[\w\W]*|[\w\W]*\}\}/gm), lo = we(/<%[\w\W]*|[\w\W]*%>/gm), uo = we(/\$\{[\w\W]*/gm), co = we(/^data-[\-\w.\u00B7-\uFFFF]+$/), po = we(/^aria-[\-\w]+$/), Ts = we(
|
|
2400
2400
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
2401
2401
|
// eslint-disable-line no-useless-escape
|
|
2402
|
-
), ho =
|
|
2402
|
+
), ho = we(/^(?:\w+script|data):/i), fo = we(
|
|
2403
2403
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
2404
2404
|
// eslint-disable-line no-control-regex
|
|
2405
|
-
), Ss =
|
|
2406
|
-
var
|
|
2405
|
+
), Ss = we(/^html$/i), go = we(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
2406
|
+
var ts = /* @__PURE__ */ Object.freeze({
|
|
2407
2407
|
__proto__: null,
|
|
2408
2408
|
ARIA_ATTR: po,
|
|
2409
2409
|
ATTR_WHITESPACE: fo,
|
|
@@ -2444,7 +2444,7 @@ const ht = {
|
|
|
2444
2444
|
} catch {
|
|
2445
2445
|
return console.warn("TrustedTypes policy " + o + " could not be created."), null;
|
|
2446
2446
|
}
|
|
2447
|
-
},
|
|
2447
|
+
}, ns = function() {
|
|
2448
2448
|
return {
|
|
2449
2449
|
afterSanitizeAttributes: [],
|
|
2450
2450
|
afterSanitizeElements: [],
|
|
@@ -2472,24 +2472,24 @@ function As() {
|
|
|
2472
2472
|
Element: c,
|
|
2473
2473
|
NodeFilter: u,
|
|
2474
2474
|
NamedNodeMap: d = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
2475
|
-
HTMLFormElement:
|
|
2476
|
-
DOMParser:
|
|
2475
|
+
HTMLFormElement: g,
|
|
2476
|
+
DOMParser: b,
|
|
2477
2477
|
trustedTypes: y
|
|
2478
|
-
} = n, h = c.prototype, A = pt(h, "cloneNode"),
|
|
2478
|
+
} = n, h = c.prototype, A = pt(h, "cloneNode"), m = pt(h, "remove"), f = pt(h, "nextSibling"), S = pt(h, "childNodes"), C = pt(h, "parentNode");
|
|
2479
2479
|
if (typeof i == "function") {
|
|
2480
2480
|
const $ = t.createElement("template");
|
|
2481
2481
|
$.content && $.content.ownerDocument && (t = $.content.ownerDocument);
|
|
2482
2482
|
}
|
|
2483
|
-
let
|
|
2483
|
+
let w, z = "";
|
|
2484
2484
|
const {
|
|
2485
2485
|
implementation: F,
|
|
2486
|
-
createNodeIterator:
|
|
2486
|
+
createNodeIterator: V,
|
|
2487
2487
|
createDocumentFragment: E,
|
|
2488
2488
|
getElementsByTagName: M
|
|
2489
2489
|
} = t, {
|
|
2490
2490
|
importNode: I
|
|
2491
2491
|
} = s;
|
|
2492
|
-
let P =
|
|
2492
|
+
let P = ns();
|
|
2493
2493
|
e.isSupported = typeof vs == "function" && typeof C == "function" && F && F.createHTMLDocument !== void 0;
|
|
2494
2494
|
const {
|
|
2495
2495
|
MUSTACHE_EXPR: L,
|
|
@@ -2498,15 +2498,15 @@ function As() {
|
|
|
2498
2498
|
DATA_ATTR: ze,
|
|
2499
2499
|
ARIA_ATTR: Re,
|
|
2500
2500
|
IS_SCRIPT_OR_DATA: He,
|
|
2501
|
-
ATTR_WHITESPACE:
|
|
2501
|
+
ATTR_WHITESPACE: wt,
|
|
2502
2502
|
CUSTOM_ELEMENT: Bt
|
|
2503
|
-
} =
|
|
2503
|
+
} = ts;
|
|
2504
2504
|
let {
|
|
2505
2505
|
IS_ALLOWED_URI: vt
|
|
2506
|
-
} =
|
|
2507
|
-
const st = H({}, [...
|
|
2506
|
+
} = ts, Y = null;
|
|
2507
|
+
const st = H({}, [...Yn, ...Xt, ...Jt, ...en, ...Xn]);
|
|
2508
2508
|
let se = null;
|
|
2509
|
-
const Tt = H({}, [...
|
|
2509
|
+
const Tt = H({}, [...Jn, ...tn, ...es, ...Ot]);
|
|
2510
2510
|
let Z = Object.seal(on(null, {
|
|
2511
2511
|
tagNameCheck: {
|
|
2512
2512
|
writable: !0,
|
|
@@ -2541,45 +2541,45 @@ function As() {
|
|
|
2541
2541
|
value: null
|
|
2542
2542
|
}
|
|
2543
2543
|
}));
|
|
2544
|
-
let St = !0, Ge = !0, _ = !1,
|
|
2544
|
+
let St = !0, Ge = !0, _ = !1, K = !0, G = !1, te = !0, X = !1, J = !1, ue = !1, Se = !1, At = !1, Ct = !1, xn = !0, kn = !1;
|
|
2545
2545
|
const Ls = "user-content-";
|
|
2546
|
-
let Ut = !0, rt = !1,
|
|
2547
|
-
const
|
|
2546
|
+
let Ut = !0, rt = !1, Qe = {}, Ze = null;
|
|
2547
|
+
const bn = H({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
2548
2548
|
let wn = null;
|
|
2549
|
-
const
|
|
2549
|
+
const vn = H({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
2550
2550
|
let qt = null;
|
|
2551
|
-
const
|
|
2552
|
-
let
|
|
2551
|
+
const Tn = H({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Et = "http://www.w3.org/1998/Math/MathML", Mt = "http://www.w3.org/2000/svg", Ie = "http://www.w3.org/1999/xhtml";
|
|
2552
|
+
let Ye = Ie, jt = !1, Wt = null;
|
|
2553
2553
|
const Is = H({}, [Et, Mt, Ie], Zt);
|
|
2554
2554
|
let Rt = H({}, ["mi", "mo", "mn", "ms", "mtext"]), Lt = H({}, ["annotation-xml"]);
|
|
2555
2555
|
const $s = H({}, ["title", "style", "font", "a", "script"]);
|
|
2556
2556
|
let ot = null;
|
|
2557
2557
|
const Ds = ["application/xhtml+xml", "text/html"], _s = "text/html";
|
|
2558
|
-
let oe = null,
|
|
2559
|
-
const Os = t.createElement("form"),
|
|
2558
|
+
let oe = null, Xe = null;
|
|
2559
|
+
const Os = t.createElement("form"), Sn = function(l) {
|
|
2560
2560
|
return l instanceof RegExp || l instanceof Function;
|
|
2561
|
-
},
|
|
2561
|
+
}, Kt = function() {
|
|
2562
2562
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2563
|
-
if (!(
|
|
2563
|
+
if (!(Xe && Xe === l)) {
|
|
2564
2564
|
if ((!l || typeof l != "object") && (l = {}), l = _e(l), ot = // eslint-disable-next-line unicorn/prefer-includes
|
|
2565
|
-
Ds.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? _s : l.PARSER_MEDIA_TYPE, oe = ot === "application/xhtml+xml" ? Zt : Nt, Y = ve(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, oe) : st, se = ve(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, oe) : Tt, Wt = ve(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : Is, qt = ve(l, "ADD_URI_SAFE_ATTR") ? H(_e(
|
|
2565
|
+
Ds.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? _s : l.PARSER_MEDIA_TYPE, oe = ot === "application/xhtml+xml" ? Zt : Nt, Y = ve(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, oe) : st, se = ve(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, oe) : Tt, Wt = ve(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : Is, qt = ve(l, "ADD_URI_SAFE_ATTR") ? H(_e(Tn), l.ADD_URI_SAFE_ATTR, oe) : Tn, wn = ve(l, "ADD_DATA_URI_TAGS") ? H(_e(vn), l.ADD_DATA_URI_TAGS, oe) : vn, Ze = ve(l, "FORBID_CONTENTS") ? H({}, l.FORBID_CONTENTS, oe) : bn, Fe = ve(l, "FORBID_TAGS") ? H({}, l.FORBID_TAGS, oe) : _e({}), Ve = ve(l, "FORBID_ATTR") ? H({}, l.FORBID_ATTR, oe) : _e({}), Qe = ve(l, "USE_PROFILES") ? l.USE_PROFILES : !1, St = l.ALLOW_ARIA_ATTR !== !1, Ge = l.ALLOW_DATA_ATTR !== !1, _ = l.ALLOW_UNKNOWN_PROTOCOLS || !1, K = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, G = l.SAFE_FOR_TEMPLATES || !1, te = l.SAFE_FOR_XML !== !1, X = l.WHOLE_DOCUMENT || !1, Se = l.RETURN_DOM || !1, At = l.RETURN_DOM_FRAGMENT || !1, Ct = l.RETURN_TRUSTED_TYPE || !1, ue = l.FORCE_BODY || !1, xn = l.SANITIZE_DOM !== !1, kn = l.SANITIZE_NAMED_PROPS || !1, Ut = l.KEEP_CONTENT !== !1, rt = l.IN_PLACE || !1, vt = l.ALLOWED_URI_REGEXP || Ts, Ye = l.NAMESPACE || Ie, Rt = l.MATHML_TEXT_INTEGRATION_POINTS || Rt, Lt = l.HTML_INTEGRATION_POINTS || Lt, Z = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && Sn(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Z.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && Sn(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Z.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Z.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), G && (Ge = !1), At && (Se = !0), Qe && (Y = H({}, Xn), se = [], Qe.html === !0 && (H(Y, Yn), H(se, Jn)), Qe.svg === !0 && (H(Y, Xt), H(se, tn), H(se, Ot)), Qe.svgFilters === !0 && (H(Y, Jt), H(se, tn), H(se, Ot)), Qe.mathMl === !0 && (H(Y, en), H(se, es), H(se, Ot))), l.ADD_TAGS && (typeof l.ADD_TAGS == "function" ? Le.tagCheck = l.ADD_TAGS : (Y === st && (Y = _e(Y)), H(Y, l.ADD_TAGS, oe))), l.ADD_ATTR && (typeof l.ADD_ATTR == "function" ? Le.attributeCheck = l.ADD_ATTR : (se === Tt && (se = _e(se)), H(se, l.ADD_ATTR, oe))), l.ADD_URI_SAFE_ATTR && H(qt, l.ADD_URI_SAFE_ATTR, oe), l.FORBID_CONTENTS && (Ze === bn && (Ze = _e(Ze)), H(Ze, l.FORBID_CONTENTS, oe)), Ut && (Y["#text"] = !0), X && H(Y, ["html", "head", "body"]), Y.table && (H(Y, ["tbody"]), delete Fe.tbody), l.TRUSTED_TYPES_POLICY) {
|
|
2566
2566
|
if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
2567
2567
|
throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
2568
2568
|
if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
2569
2569
|
throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
2570
|
-
|
|
2570
|
+
w = l.TRUSTED_TYPES_POLICY, z = w.createHTML("");
|
|
2571
2571
|
} else
|
|
2572
|
-
|
|
2573
|
-
de && de(l),
|
|
2572
|
+
w === void 0 && (w = yo(y, r)), w !== null && typeof z == "string" && (z = w.createHTML(""));
|
|
2573
|
+
de && de(l), Xe = l;
|
|
2574
2574
|
}
|
|
2575
|
-
},
|
|
2575
|
+
}, An = H({}, [...Xt, ...Jt, ...oo]), Cn = H({}, [...en, ...io]), Ns = function(l) {
|
|
2576
2576
|
let x = C(l);
|
|
2577
2577
|
(!x || !x.tagName) && (x = {
|
|
2578
|
-
namespaceURI:
|
|
2578
|
+
namespaceURI: Ye,
|
|
2579
2579
|
tagName: "template"
|
|
2580
2580
|
});
|
|
2581
2581
|
const R = Nt(l.tagName), Q = Nt(x.tagName);
|
|
2582
|
-
return Wt[l.namespaceURI] ? l.namespaceURI === Mt ? x.namespaceURI === Ie ? R === "svg" : x.namespaceURI === Et ? R === "svg" && (Q === "annotation-xml" || Rt[Q]) : !!
|
|
2582
|
+
return Wt[l.namespaceURI] ? l.namespaceURI === Mt ? x.namespaceURI === Ie ? R === "svg" : x.namespaceURI === Et ? R === "svg" && (Q === "annotation-xml" || Rt[Q]) : !!An[R] : l.namespaceURI === Et ? x.namespaceURI === Ie ? R === "math" : x.namespaceURI === Mt ? R === "math" && Lt[Q] : !!Cn[R] : l.namespaceURI === Ie ? x.namespaceURI === Mt && !Lt[Q] || x.namespaceURI === Et && !Rt[Q] ? !1 : !Cn[R] && ($s[R] || !An[R]) : !!(ot === "application/xhtml+xml" && Wt[l.namespaceURI]) : !1;
|
|
2583
2583
|
}, Ae = function(l) {
|
|
2584
2584
|
ut(e.removed, {
|
|
2585
2585
|
element: l
|
|
@@ -2587,7 +2587,7 @@ function As() {
|
|
|
2587
2587
|
try {
|
|
2588
2588
|
C(l).removeChild(l);
|
|
2589
2589
|
} catch {
|
|
2590
|
-
|
|
2590
|
+
m(l);
|
|
2591
2591
|
}
|
|
2592
2592
|
}, Be = function(l, x) {
|
|
2593
2593
|
try {
|
|
@@ -2612,7 +2612,7 @@ function As() {
|
|
|
2612
2612
|
x.setAttribute(l, "");
|
|
2613
2613
|
} catch {
|
|
2614
2614
|
}
|
|
2615
|
-
},
|
|
2615
|
+
}, En = function(l) {
|
|
2616
2616
|
let x = null, R = null;
|
|
2617
2617
|
if (ue)
|
|
2618
2618
|
l = "<remove></remove>" + l;
|
|
@@ -2620,54 +2620,54 @@ function As() {
|
|
|
2620
2620
|
const re = Yt(l, /^[\r\n\t ]+/);
|
|
2621
2621
|
R = re && re[0];
|
|
2622
2622
|
}
|
|
2623
|
-
ot === "application/xhtml+xml" &&
|
|
2624
|
-
const Q =
|
|
2625
|
-
if (
|
|
2623
|
+
ot === "application/xhtml+xml" && Ye === Ie && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
|
|
2624
|
+
const Q = w ? w.createHTML(l) : l;
|
|
2625
|
+
if (Ye === Ie)
|
|
2626
2626
|
try {
|
|
2627
|
-
x = new
|
|
2627
|
+
x = new b().parseFromString(Q, ot);
|
|
2628
2628
|
} catch {
|
|
2629
2629
|
}
|
|
2630
2630
|
if (!x || !x.documentElement) {
|
|
2631
|
-
x = F.createDocument(
|
|
2631
|
+
x = F.createDocument(Ye, "template", null);
|
|
2632
2632
|
try {
|
|
2633
2633
|
x.documentElement.innerHTML = jt ? z : Q;
|
|
2634
2634
|
} catch {
|
|
2635
2635
|
}
|
|
2636
2636
|
}
|
|
2637
2637
|
const ae = x.body || x.documentElement;
|
|
2638
|
-
return l && R && ae.insertBefore(t.createTextNode(R), ae.childNodes[0] || null),
|
|
2639
|
-
},
|
|
2640
|
-
return
|
|
2638
|
+
return l && R && ae.insertBefore(t.createTextNode(R), ae.childNodes[0] || null), Ye === Ie ? M.call(x, X ? "html" : "body")[0] : X ? x.documentElement : ae;
|
|
2639
|
+
}, Mn = function(l) {
|
|
2640
|
+
return V.call(
|
|
2641
2641
|
l.ownerDocument || l,
|
|
2642
2642
|
l,
|
|
2643
2643
|
// eslint-disable-next-line no-bitwise
|
|
2644
2644
|
u.SHOW_ELEMENT | u.SHOW_COMMENT | u.SHOW_TEXT | u.SHOW_PROCESSING_INSTRUCTION | u.SHOW_CDATA_SECTION,
|
|
2645
2645
|
null
|
|
2646
2646
|
);
|
|
2647
|
-
},
|
|
2648
|
-
return l instanceof
|
|
2649
|
-
},
|
|
2647
|
+
}, Vt = function(l) {
|
|
2648
|
+
return l instanceof g && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof d) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
|
|
2649
|
+
}, Rn = function(l) {
|
|
2650
2650
|
return typeof a == "function" && l instanceof a;
|
|
2651
2651
|
};
|
|
2652
2652
|
function $e($, l, x) {
|
|
2653
2653
|
_t($, (R) => {
|
|
2654
|
-
R.call(e, l, x,
|
|
2654
|
+
R.call(e, l, x, Xe);
|
|
2655
2655
|
});
|
|
2656
2656
|
}
|
|
2657
|
-
const
|
|
2657
|
+
const Ln = function(l) {
|
|
2658
2658
|
let x = null;
|
|
2659
|
-
if ($e(P.beforeSanitizeElements, l, null),
|
|
2659
|
+
if ($e(P.beforeSanitizeElements, l, null), Vt(l))
|
|
2660
2660
|
return Ae(l), !0;
|
|
2661
2661
|
const R = oe(l.nodeName);
|
|
2662
2662
|
if ($e(P.uponSanitizeElement, l, {
|
|
2663
2663
|
tagName: R,
|
|
2664
2664
|
allowedTags: Y
|
|
2665
|
-
}), te && l.hasChildNodes() && !
|
|
2665
|
+
}), te && l.hasChildNodes() && !Rn(l.firstElementChild) && ce(/<[/\w!]/g, l.innerHTML) && ce(/<[/\w!]/g, l.textContent) || l.nodeType === ht.progressingInstruction || te && l.nodeType === ht.comment && ce(/<[/\w]/g, l.data))
|
|
2666
2666
|
return Ae(l), !0;
|
|
2667
2667
|
if (!(Le.tagCheck instanceof Function && Le.tagCheck(R)) && (!Y[R] || Fe[R])) {
|
|
2668
|
-
if (!Fe[R] &&
|
|
2668
|
+
if (!Fe[R] && $n(R) && (Z.tagNameCheck instanceof RegExp && ce(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
|
|
2669
2669
|
return !1;
|
|
2670
|
-
if (Ut && !
|
|
2670
|
+
if (Ut && !Ze[R]) {
|
|
2671
2671
|
const Q = C(l) || l.parentNode, ae = S(l) || l.childNodes;
|
|
2672
2672
|
if (ae && Q) {
|
|
2673
2673
|
const re = ae.length;
|
|
@@ -2679,13 +2679,13 @@ function As() {
|
|
|
2679
2679
|
}
|
|
2680
2680
|
return Ae(l), !0;
|
|
2681
2681
|
}
|
|
2682
|
-
return l instanceof c && !Ns(l) || (R === "noscript" || R === "noembed" || R === "noframes") && ce(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Ae(l), !0) : (
|
|
2682
|
+
return l instanceof c && !Ns(l) || (R === "noscript" || R === "noembed" || R === "noframes") && ce(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Ae(l), !0) : (G && l.nodeType === ht.text && (x = l.textContent, _t([L, ne, Te], (Q) => {
|
|
2683
2683
|
x = ct(x, Q, " ");
|
|
2684
2684
|
}), l.textContent !== x && (ut(e.removed, {
|
|
2685
2685
|
element: l.cloneNode()
|
|
2686
2686
|
}), l.textContent = x)), $e(P.afterSanitizeElements, l, null), !1);
|
|
2687
|
-
},
|
|
2688
|
-
if (
|
|
2687
|
+
}, In = function(l, x, R) {
|
|
2688
|
+
if (xn && (x === "id" || x === "name") && (R in t || R in Os))
|
|
2689
2689
|
return !1;
|
|
2690
2690
|
if (!(Ge && !Ve[x] && ce(ze, x))) {
|
|
2691
2691
|
if (!(St && ce(Re, x))) {
|
|
@@ -2695,14 +2695,14 @@ function As() {
|
|
|
2695
2695
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
2696
2696
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2697
2697
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
2698
|
-
!(
|
|
2698
|
+
!($n(l) && (Z.tagNameCheck instanceof RegExp && ce(Z.tagNameCheck, l) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(l)) && (Z.attributeNameCheck instanceof RegExp && ce(Z.attributeNameCheck, x) || Z.attributeNameCheck instanceof Function && Z.attributeNameCheck(x, l)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
2699
2699
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2700
2700
|
x === "is" && Z.allowCustomizedBuiltInElements && (Z.tagNameCheck instanceof RegExp && ce(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
|
|
2701
2701
|
) return !1;
|
|
2702
2702
|
} else if (!qt[x]) {
|
|
2703
|
-
if (!ce(vt, ct(R,
|
|
2703
|
+
if (!ce(vt, ct(R, wt, ""))) {
|
|
2704
2704
|
if (!((x === "src" || x === "xlink:href" || x === "href") && l !== "script" && to(R, "data:") === 0 && wn[l])) {
|
|
2705
|
-
if (!(_ && !ce(He, ct(R,
|
|
2705
|
+
if (!(_ && !ce(He, ct(R, wt, "")))) {
|
|
2706
2706
|
if (R)
|
|
2707
2707
|
return !1;
|
|
2708
2708
|
}
|
|
@@ -2713,14 +2713,14 @@ function As() {
|
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
2715
|
return !0;
|
|
2716
|
-
}, In = function(l) {
|
|
2717
|
-
return l !== "annotation-xml" && Yt(l, Bt);
|
|
2718
2716
|
}, $n = function(l) {
|
|
2717
|
+
return l !== "annotation-xml" && Yt(l, Bt);
|
|
2718
|
+
}, Dn = function(l) {
|
|
2719
2719
|
$e(P.beforeSanitizeAttributes, l, null);
|
|
2720
2720
|
const {
|
|
2721
2721
|
attributes: x
|
|
2722
2722
|
} = l;
|
|
2723
|
-
if (!x ||
|
|
2723
|
+
if (!x || Vt(l))
|
|
2724
2724
|
return;
|
|
2725
2725
|
const R = {
|
|
2726
2726
|
attrName: "",
|
|
@@ -2735,13 +2735,13 @@ function As() {
|
|
|
2735
2735
|
name: re,
|
|
2736
2736
|
namespaceURI: fe,
|
|
2737
2737
|
value: De
|
|
2738
|
-
} = ae,
|
|
2739
|
-
let ie = re === "value" ?
|
|
2740
|
-
if (R.attrName =
|
|
2738
|
+
} = ae, Je = oe(re), Gt = De;
|
|
2739
|
+
let ie = re === "value" ? Gt : no(Gt);
|
|
2740
|
+
if (R.attrName = Je, R.attrValue = ie, R.keepAttr = !0, R.forceKeepAttr = void 0, $e(P.uponSanitizeAttribute, l, R), ie = R.attrValue, kn && (Je === "id" || Je === "name") && (Be(re, l), ie = Ls + ie), te && ce(/((--!?|])>)|<\/(style|title|textarea)/i, ie)) {
|
|
2741
2741
|
Be(re, l);
|
|
2742
2742
|
continue;
|
|
2743
2743
|
}
|
|
2744
|
-
if (
|
|
2744
|
+
if (Je === "attributename" && Yt(ie, "href")) {
|
|
2745
2745
|
Be(re, l);
|
|
2746
2746
|
continue;
|
|
2747
2747
|
}
|
|
@@ -2751,32 +2751,32 @@ function As() {
|
|
|
2751
2751
|
Be(re, l);
|
|
2752
2752
|
continue;
|
|
2753
2753
|
}
|
|
2754
|
-
if (!
|
|
2754
|
+
if (!K && ce(/\/>/i, ie)) {
|
|
2755
2755
|
Be(re, l);
|
|
2756
2756
|
continue;
|
|
2757
2757
|
}
|
|
2758
|
-
|
|
2759
|
-
ie = ct(ie,
|
|
2758
|
+
G && _t([L, ne, Te], (On) => {
|
|
2759
|
+
ie = ct(ie, On, " ");
|
|
2760
2760
|
});
|
|
2761
|
-
const
|
|
2762
|
-
if (!
|
|
2761
|
+
const _n = oe(l.nodeName);
|
|
2762
|
+
if (!In(_n, Je, ie)) {
|
|
2763
2763
|
Be(re, l);
|
|
2764
2764
|
continue;
|
|
2765
2765
|
}
|
|
2766
|
-
if (
|
|
2767
|
-
switch (y.getAttributeType(
|
|
2766
|
+
if (w && typeof y == "object" && typeof y.getAttributeType == "function" && !fe)
|
|
2767
|
+
switch (y.getAttributeType(_n, Je)) {
|
|
2768
2768
|
case "TrustedHTML": {
|
|
2769
|
-
ie =
|
|
2769
|
+
ie = w.createHTML(ie);
|
|
2770
2770
|
break;
|
|
2771
2771
|
}
|
|
2772
2772
|
case "TrustedScriptURL": {
|
|
2773
|
-
ie =
|
|
2773
|
+
ie = w.createScriptURL(ie);
|
|
2774
2774
|
break;
|
|
2775
2775
|
}
|
|
2776
2776
|
}
|
|
2777
|
-
if (ie !==
|
|
2777
|
+
if (ie !== Gt)
|
|
2778
2778
|
try {
|
|
2779
|
-
fe ? l.setAttributeNS(fe, re, ie) : l.setAttribute(re, ie),
|
|
2779
|
+
fe ? l.setAttributeNS(fe, re, ie) : l.setAttribute(re, ie), Vt(l) ? Ae(l) : Zn(e.removed);
|
|
2780
2780
|
} catch {
|
|
2781
2781
|
Be(re, l);
|
|
2782
2782
|
}
|
|
@@ -2784,14 +2784,14 @@ function As() {
|
|
|
2784
2784
|
$e(P.afterSanitizeAttributes, l, null);
|
|
2785
2785
|
}, Ps = function $(l) {
|
|
2786
2786
|
let x = null;
|
|
2787
|
-
const R =
|
|
2787
|
+
const R = Mn(l);
|
|
2788
2788
|
for ($e(P.beforeSanitizeShadowDOM, l, null); x = R.nextNode(); )
|
|
2789
|
-
$e(P.uponSanitizeShadowNode, x, null),
|
|
2789
|
+
$e(P.uponSanitizeShadowNode, x, null), Ln(x), Dn(x), x.content instanceof o && $(x.content);
|
|
2790
2790
|
$e(P.afterSanitizeShadowDOM, l, null);
|
|
2791
2791
|
};
|
|
2792
2792
|
return e.sanitize = function($) {
|
|
2793
2793
|
let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, x = null, R = null, Q = null, ae = null;
|
|
2794
|
-
if (jt = !$, jt && ($ = "<!-->"), typeof $ != "string" && !
|
|
2794
|
+
if (jt = !$, jt && ($ = "<!-->"), typeof $ != "string" && !Rn($))
|
|
2795
2795
|
if (typeof $.toString == "function") {
|
|
2796
2796
|
if ($ = $.toString(), typeof $ != "string")
|
|
2797
2797
|
throw dt("dirty is not a string, aborting");
|
|
@@ -2799,25 +2799,25 @@ function As() {
|
|
|
2799
2799
|
throw dt("toString is not a function");
|
|
2800
2800
|
if (!e.isSupported)
|
|
2801
2801
|
return $;
|
|
2802
|
-
if (J ||
|
|
2802
|
+
if (J || Kt(l), e.removed = [], typeof $ == "string" && (rt = !1), rt) {
|
|
2803
2803
|
if ($.nodeName) {
|
|
2804
2804
|
const De = oe($.nodeName);
|
|
2805
2805
|
if (!Y[De] || Fe[De])
|
|
2806
2806
|
throw dt("root node is forbidden and cannot be sanitized in-place");
|
|
2807
2807
|
}
|
|
2808
2808
|
} else if ($ instanceof a)
|
|
2809
|
-
x =
|
|
2809
|
+
x = En("<!---->"), R = x.ownerDocument.importNode($, !0), R.nodeType === ht.element && R.nodeName === "BODY" || R.nodeName === "HTML" ? x = R : x.appendChild(R);
|
|
2810
2810
|
else {
|
|
2811
|
-
if (!Se && !
|
|
2811
|
+
if (!Se && !G && !X && // eslint-disable-next-line unicorn/prefer-includes
|
|
2812
2812
|
$.indexOf("<") === -1)
|
|
2813
|
-
return
|
|
2814
|
-
if (x =
|
|
2813
|
+
return w && Ct ? w.createHTML($) : $;
|
|
2814
|
+
if (x = En($), !x)
|
|
2815
2815
|
return Se ? null : Ct ? z : "";
|
|
2816
2816
|
}
|
|
2817
2817
|
x && ue && Ae(x.firstChild);
|
|
2818
|
-
const re =
|
|
2818
|
+
const re = Mn(rt ? $ : x);
|
|
2819
2819
|
for (; Q = re.nextNode(); )
|
|
2820
|
-
|
|
2820
|
+
Ln(Q), Dn(Q), Q.content instanceof o && Ps(Q.content);
|
|
2821
2821
|
if (rt)
|
|
2822
2822
|
return $;
|
|
2823
2823
|
if (Se) {
|
|
@@ -2830,18 +2830,18 @@ function As() {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
let fe = X ? x.outerHTML : x.innerHTML;
|
|
2832
2832
|
return X && Y["!doctype"] && x.ownerDocument && x.ownerDocument.doctype && x.ownerDocument.doctype.name && ce(Ss, x.ownerDocument.doctype.name) && (fe = "<!DOCTYPE " + x.ownerDocument.doctype.name + `>
|
|
2833
|
-
` + fe),
|
|
2833
|
+
` + fe), G && _t([L, ne, Te], (De) => {
|
|
2834
2834
|
fe = ct(fe, De, " ");
|
|
2835
|
-
}),
|
|
2835
|
+
}), w && Ct ? w.createHTML(fe) : fe;
|
|
2836
2836
|
}, e.setConfig = function() {
|
|
2837
2837
|
let $ = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2838
|
-
|
|
2838
|
+
Kt($), J = !0;
|
|
2839
2839
|
}, e.clearConfig = function() {
|
|
2840
|
-
|
|
2840
|
+
Xe = null, J = !1;
|
|
2841
2841
|
}, e.isValidAttribute = function($, l, x) {
|
|
2842
|
-
|
|
2842
|
+
Xe || Kt({});
|
|
2843
2843
|
const R = oe($), Q = oe(l);
|
|
2844
|
-
return
|
|
2844
|
+
return In(R, Q, x);
|
|
2845
2845
|
}, e.addHook = function($, l) {
|
|
2846
2846
|
typeof l == "function" && ut(P[$], l);
|
|
2847
2847
|
}, e.removeHook = function($, l) {
|
|
@@ -2849,11 +2849,11 @@ function As() {
|
|
|
2849
2849
|
const x = Jr(P[$], l);
|
|
2850
2850
|
return x === -1 ? void 0 : eo(P[$], x, 1)[0];
|
|
2851
2851
|
}
|
|
2852
|
-
return
|
|
2852
|
+
return Zn(P[$]);
|
|
2853
2853
|
}, e.removeHooks = function($) {
|
|
2854
2854
|
P[$] = [];
|
|
2855
2855
|
}, e.removeAllHooks = function() {
|
|
2856
|
-
P =
|
|
2856
|
+
P = ns();
|
|
2857
2857
|
}, e;
|
|
2858
2858
|
}
|
|
2859
2859
|
var xo = As();
|
|
@@ -2905,7 +2905,7 @@ function ko() {
|
|
|
2905
2905
|
}
|
|
2906
2906
|
};
|
|
2907
2907
|
}
|
|
2908
|
-
function
|
|
2908
|
+
function ba() {
|
|
2909
2909
|
let n = null;
|
|
2910
2910
|
function e(o) {
|
|
2911
2911
|
const i = o || document.querySelector("[data-rai-chat-container]");
|
|
@@ -2944,8 +2944,8 @@ function wa() {
|
|
|
2944
2944
|
cleanupAutoScroll: r
|
|
2945
2945
|
};
|
|
2946
2946
|
}
|
|
2947
|
-
function
|
|
2948
|
-
const n =
|
|
2947
|
+
function wa() {
|
|
2948
|
+
const n = We(), e = O(() => n.error), t = O(() => {
|
|
2949
2949
|
var o, i;
|
|
2950
2950
|
return ((o = e.value) == null ? void 0 : o.message) !== null && ((i = e.value) == null ? void 0 : i.message) !== void 0;
|
|
2951
2951
|
});
|
|
@@ -2959,7 +2959,7 @@ function ba() {
|
|
|
2959
2959
|
};
|
|
2960
2960
|
}
|
|
2961
2961
|
function Cs() {
|
|
2962
|
-
const n =
|
|
2962
|
+
const n = We(), e = O(() => n.pageContext);
|
|
2963
2963
|
function t(o) {
|
|
2964
2964
|
n.setPageContext(o);
|
|
2965
2965
|
}
|
|
@@ -2993,12 +2993,12 @@ const Ee = [], Es = {
|
|
|
2993
2993
|
return (n == null ? void 0 : n.defaultSuggestions) || [];
|
|
2994
2994
|
}
|
|
2995
2995
|
};
|
|
2996
|
-
function
|
|
2996
|
+
function bo() {
|
|
2997
2997
|
Ee.length = 0;
|
|
2998
2998
|
const n = ee();
|
|
2999
2999
|
n != null && n.suggestionProviders && Ee.push(...n.suggestionProviders), Ee.push(Es);
|
|
3000
3000
|
}
|
|
3001
|
-
function
|
|
3001
|
+
function wo(n, e) {
|
|
3002
3002
|
const t = [...Ee].sort((s, r) => (r.priority || 0) - (s.priority || 0));
|
|
3003
3003
|
for (const s of t)
|
|
3004
3004
|
if (s.matcher && s.matcher(n, e) || s.routes && s.routes.some((o) => o.endsWith("*") ? n.startsWith(o.slice(0, -1)) : n === o || n.startsWith(o + "/")))
|
|
@@ -3006,8 +3006,8 @@ function bo(n, e) {
|
|
|
3006
3006
|
return Es;
|
|
3007
3007
|
}
|
|
3008
3008
|
function vo(n, e) {
|
|
3009
|
-
Ee.length === 0 &&
|
|
3010
|
-
const t =
|
|
3009
|
+
Ee.length === 0 && bo();
|
|
3010
|
+
const t = wo(n, e), s = e || {
|
|
3011
3011
|
pageType: "default",
|
|
3012
3012
|
routePath: n
|
|
3013
3013
|
};
|
|
@@ -3027,7 +3027,7 @@ function To(n) {
|
|
|
3027
3027
|
}
|
|
3028
3028
|
const va = To;
|
|
3029
3029
|
function Ms() {
|
|
3030
|
-
const { context: n } = Cs(), e =
|
|
3030
|
+
const { context: n } = Cs(), e = We(), t = O(() => {
|
|
3031
3031
|
var c;
|
|
3032
3032
|
if (e.quota.remaining === 0) {
|
|
3033
3033
|
const u = ee();
|
|
@@ -3095,26 +3095,33 @@ function So(n) {
|
|
|
3095
3095
|
meta: e.includes("cmd") || e.includes("meta") || e.includes("command"),
|
|
3096
3096
|
ctrl: e.includes("ctrl") || e.includes("control"),
|
|
3097
3097
|
shift: e.includes("shift"),
|
|
3098
|
-
alt: e.includes("alt") || e.includes("option")
|
|
3098
|
+
alt: e.includes("alt") || e.includes("option"),
|
|
3099
|
+
mod: e.includes("mod")
|
|
3100
|
+
// Platform-independent: Cmd on Mac, Ctrl on Windows/Linux
|
|
3099
3101
|
};
|
|
3100
3102
|
}
|
|
3101
3103
|
function Ao(n, e) {
|
|
3102
|
-
const t = n.key.toLowerCase()
|
|
3104
|
+
const t = n.key.toLowerCase();
|
|
3105
|
+
if (e.mod) {
|
|
3106
|
+
const u = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, d = e.shift ? n.shiftKey : !n.shiftKey, g = e.alt ? n.altKey : !n.altKey;
|
|
3107
|
+
return t === e.key && u && d && g;
|
|
3108
|
+
}
|
|
3109
|
+
const s = e.meta ? n.metaKey : !n.metaKey, r = e.ctrl ? n.ctrlKey : !n.ctrlKey, o = e.shift ? n.shiftKey : !n.shiftKey, i = e.alt ? n.altKey : !n.altKey;
|
|
3103
3110
|
let a = s && r && o && i;
|
|
3104
3111
|
return (e.meta && !e.ctrl || !e.meta && e.ctrl) && (a = (n.metaKey || n.ctrlKey) && o && i), t === e.key && a;
|
|
3105
3112
|
}
|
|
3106
3113
|
function Co(n) {
|
|
3107
|
-
const { onToggle: e, enabled: t = !0 } = n, s = q(!1), r = n.shortcut !== void 0 ? n.shortcut :
|
|
3114
|
+
const { onToggle: e, enabled: t = !0 } = n, s = q(!1), r = n.shortcut !== void 0 ? n.shortcut : tt("keyboardShortcut") ?? "mod+g";
|
|
3108
3115
|
if (r === null)
|
|
3109
3116
|
return { isActive: s };
|
|
3110
3117
|
const o = So(r);
|
|
3111
3118
|
function i(a) {
|
|
3112
3119
|
if (!t) return;
|
|
3113
|
-
const c = a.target, u = c.tagName === "INPUT" || c.tagName === "TEXTAREA", d = c.isContentEditable,
|
|
3114
|
-
if (!((u || d) && !
|
|
3120
|
+
const c = a.target, u = c.tagName === "INPUT" || c.tagName === "TEXTAREA", d = c.isContentEditable, g = c.closest("[data-ai-input]");
|
|
3121
|
+
if (!((u || d) && !g) && Ao(a, o)) {
|
|
3115
3122
|
a.preventDefault(), a.stopPropagation();
|
|
3116
|
-
const
|
|
3117
|
-
if (
|
|
3123
|
+
const b = ee();
|
|
3124
|
+
if (b != null && b.canToggle && !b.canToggle())
|
|
3118
3125
|
return;
|
|
3119
3126
|
s.value = !s.value, e();
|
|
3120
3127
|
}
|
|
@@ -3126,9 +3133,10 @@ function Co(n) {
|
|
|
3126
3133
|
}), { isActive: s };
|
|
3127
3134
|
}
|
|
3128
3135
|
function Sa(n) {
|
|
3136
|
+
const e = We();
|
|
3129
3137
|
return Co({
|
|
3130
3138
|
onToggle: () => {
|
|
3131
|
-
n.value = !n.value;
|
|
3139
|
+
n ? n.value = !n.value : e.showChat = !e.showChat;
|
|
3132
3140
|
}
|
|
3133
3141
|
});
|
|
3134
3142
|
}
|
|
@@ -3155,14 +3163,14 @@ function Eo(n, e) {
|
|
|
3155
3163
|
}
|
|
3156
3164
|
function c() {
|
|
3157
3165
|
i();
|
|
3158
|
-
const u = e == null ? void 0 : e(), d = (u == null ? void 0 : u.messages) ?? r(),
|
|
3166
|
+
const u = e == null ? void 0 : e(), d = (u == null ? void 0 : u.messages) ?? r(), g = (u == null ? void 0 : u.intervals) ?? o();
|
|
3159
3167
|
t.value = d[0] || le("loadingText");
|
|
3160
|
-
let
|
|
3168
|
+
let b = 0;
|
|
3161
3169
|
for (let y = 1; y < d.length; y++) {
|
|
3162
|
-
|
|
3170
|
+
b += g[y] || 2e3;
|
|
3163
3171
|
const h = y, A = window.setTimeout(() => {
|
|
3164
3172
|
n() && (t.value = d[h]);
|
|
3165
|
-
},
|
|
3173
|
+
}, b);
|
|
3166
3174
|
s.push(A);
|
|
3167
3175
|
}
|
|
3168
3176
|
}
|
|
@@ -3193,31 +3201,31 @@ function Mo(n) {
|
|
|
3193
3201
|
}), u = O(() => {
|
|
3194
3202
|
var C;
|
|
3195
3203
|
return ((C = s()) == null ? void 0 : C.showWarningAt) ?? c.value - 2;
|
|
3196
|
-
}), d = O(() => Math.max(0, c.value - e())),
|
|
3204
|
+
}), d = O(() => Math.max(0, c.value - e())), g = O(
|
|
3197
3205
|
() => d.value <= c.value - u.value && d.value > 0
|
|
3198
|
-
),
|
|
3199
|
-
var C,
|
|
3200
|
-
return a.value.isReached ? ((C = r()) == null ? void 0 : C.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((
|
|
3206
|
+
), b = O(() => d.value === 0), y = O(() => {
|
|
3207
|
+
var C, w;
|
|
3208
|
+
return a.value.isReached ? ((C = r()) == null ? void 0 : C.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((w = r()) == null ? void 0 : w.historyLimitWarningTitle) ?? "Approaching Chat Limit";
|
|
3201
3209
|
}), h = O(() => {
|
|
3202
|
-
var C,
|
|
3203
|
-
return a.value.isReached ? ((C = s()) == null ? void 0 : C.limitMessage) ?? ((
|
|
3210
|
+
var C, w, z, F;
|
|
3211
|
+
return a.value.isReached ? ((C = s()) == null ? void 0 : C.limitMessage) ?? ((w = r()) == null ? void 0 : w.historyLimitReachedMessage) ?? "You have reached the maximum number of messages in this conversation. Start a new chat to continue." : ((z = s()) == null ? void 0 : z.warningMessage) ?? ((F = r()) == null ? void 0 : F.historyLimitWarningMessage) ?? `You have ${d.value} message${d.value === 1 ? "" : "s"} remaining in this conversation.`;
|
|
3204
3212
|
});
|
|
3205
3213
|
function A() {
|
|
3206
3214
|
a.value.showWarning = !1, a.value.isReached = !1, a.value.pendingMessage = null;
|
|
3207
3215
|
}
|
|
3208
|
-
async function
|
|
3216
|
+
async function m() {
|
|
3209
3217
|
a.value.showWarning = !1;
|
|
3210
3218
|
const C = s();
|
|
3211
3219
|
if (C != null && C.onLimitReached && !await C.onLimitReached())
|
|
3212
3220
|
return a.value.isReached = !1, null;
|
|
3213
3221
|
if (o(), i(), a.value.isReached = !1, a.value.pendingMessage) {
|
|
3214
|
-
const
|
|
3215
|
-
return a.value.pendingMessage = null,
|
|
3222
|
+
const w = a.value.pendingMessage;
|
|
3223
|
+
return a.value.pendingMessage = null, w;
|
|
3216
3224
|
}
|
|
3217
3225
|
return null;
|
|
3218
3226
|
}
|
|
3219
3227
|
function f() {
|
|
3220
|
-
return
|
|
3228
|
+
return b.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (g.value && !a.value.showWarning && (a.value.showWarning = !0), !0);
|
|
3221
3229
|
}
|
|
3222
3230
|
function S(C) {
|
|
3223
3231
|
a.value.pendingMessage = C;
|
|
@@ -3233,22 +3241,22 @@ function Mo(n) {
|
|
|
3233
3241
|
historyLimitDialogMessage: h,
|
|
3234
3242
|
// Actions
|
|
3235
3243
|
dismissHistoryLimitWarning: A,
|
|
3236
|
-
handleHistoryLimitAction:
|
|
3244
|
+
handleHistoryLimitAction: m,
|
|
3237
3245
|
checkHistoryLimit: f,
|
|
3238
3246
|
setPendingMessage: S
|
|
3239
3247
|
};
|
|
3240
3248
|
}
|
|
3241
3249
|
function Ro() {
|
|
3242
|
-
const n =
|
|
3250
|
+
const n = We(), e = q([]), t = q(!1), s = q(0), r = tt("maxAttachments") || 5, o = tt("maxFileSize") || 10 * 1024 * 1024, i = tt("acceptedFileTypes") || "image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx,.csv", a = O(() => e.value.length > 0), c = O(() => e.value.some((E) => E.uploading)), u = O(() => e.value.length < r);
|
|
3243
3251
|
function d(E) {
|
|
3244
3252
|
return (E.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(E.name);
|
|
3245
3253
|
}
|
|
3246
|
-
function
|
|
3254
|
+
function g(E) {
|
|
3247
3255
|
if (E == null) return "";
|
|
3248
3256
|
const M = typeof E == "string" ? parseInt(E, 10) : E;
|
|
3249
3257
|
return Number.isNaN(M) ? "" : M >= 1024 * 1024 ? `${(M / (1024 * 1024)).toFixed(1)} MB` : M >= 1024 ? `${Math.round(M / 1024)} KB` : `${M} B`;
|
|
3250
3258
|
}
|
|
3251
|
-
function
|
|
3259
|
+
function b(E) {
|
|
3252
3260
|
var Te;
|
|
3253
3261
|
const M = crypto.randomUUID(), I = E.type.startsWith("image/") ? URL.createObjectURL(E) : void 0, P = ee(), L = !!((Te = P == null ? void 0 : P.endpoints) != null && Te.uploadFile), ne = {
|
|
3254
3262
|
id: M,
|
|
@@ -3293,7 +3301,7 @@ function Ro() {
|
|
|
3293
3301
|
E.previewUrl && URL.revokeObjectURL(E.previewUrl);
|
|
3294
3302
|
}), e.value = [];
|
|
3295
3303
|
}
|
|
3296
|
-
function
|
|
3304
|
+
function m() {
|
|
3297
3305
|
return e.value.filter((E) => !E.uploading).map((E) => ({
|
|
3298
3306
|
id: E.id,
|
|
3299
3307
|
name: E.name,
|
|
@@ -3307,7 +3315,7 @@ function Ro() {
|
|
|
3307
3315
|
const M = Array.from(E);
|
|
3308
3316
|
for (const I of M) {
|
|
3309
3317
|
if (e.value.length >= r) break;
|
|
3310
|
-
I.size > o ||
|
|
3318
|
+
I.size > o || b(I);
|
|
3311
3319
|
}
|
|
3312
3320
|
}
|
|
3313
3321
|
function S(E) {
|
|
@@ -3317,7 +3325,7 @@ function Ro() {
|
|
|
3317
3325
|
function C(E) {
|
|
3318
3326
|
S(E) && (s.value += 1, t.value = !0);
|
|
3319
3327
|
}
|
|
3320
|
-
function
|
|
3328
|
+
function w(E) {
|
|
3321
3329
|
S(E) || E.preventDefault();
|
|
3322
3330
|
}
|
|
3323
3331
|
function z(E) {
|
|
@@ -3327,7 +3335,7 @@ function Ro() {
|
|
|
3327
3335
|
var M;
|
|
3328
3336
|
S(E) && (s.value = 0, t.value = !1, f(((M = E.dataTransfer) == null ? void 0 : M.files) || null));
|
|
3329
3337
|
}
|
|
3330
|
-
function
|
|
3338
|
+
function V(E) {
|
|
3331
3339
|
const M = E.target, I = M.files;
|
|
3332
3340
|
I && I.length && f(I), M.value = "";
|
|
3333
3341
|
}
|
|
@@ -3344,16 +3352,16 @@ function Ro() {
|
|
|
3344
3352
|
acceptedFileTypes: i,
|
|
3345
3353
|
// Utils
|
|
3346
3354
|
isImage: d,
|
|
3347
|
-
formatFileSize:
|
|
3355
|
+
formatFileSize: g,
|
|
3348
3356
|
// Actions
|
|
3349
3357
|
removeAttachment: h,
|
|
3350
3358
|
clearAttachments: A,
|
|
3351
|
-
buildPayload:
|
|
3359
|
+
buildPayload: m,
|
|
3352
3360
|
processFiles: f,
|
|
3353
|
-
handleFileSelect:
|
|
3361
|
+
handleFileSelect: V,
|
|
3354
3362
|
// Drag & Drop
|
|
3355
3363
|
handleDragEnter: C,
|
|
3356
|
-
handleDragOver:
|
|
3364
|
+
handleDragOver: w,
|
|
3357
3365
|
handleDragLeave: z,
|
|
3358
3366
|
handleDrop: F
|
|
3359
3367
|
};
|
|
@@ -3364,30 +3372,30 @@ function Lo(n, e, t) {
|
|
|
3364
3372
|
return (A == null ? void 0 : A.mentionProviders) || [];
|
|
3365
3373
|
});
|
|
3366
3374
|
function u(A) {
|
|
3367
|
-
const
|
|
3368
|
-
if (!
|
|
3369
|
-
const f =
|
|
3375
|
+
const m = t();
|
|
3376
|
+
if (!m) return;
|
|
3377
|
+
const f = m.selectionStart, S = ls(A, f);
|
|
3370
3378
|
i.value = S, S.inMention && S.query.length >= 0 ? d(S.query) : (s.value = !1, r.value = []);
|
|
3371
3379
|
}
|
|
3372
3380
|
async function d(A) {
|
|
3373
|
-
const
|
|
3374
|
-
if (
|
|
3381
|
+
const m = ds();
|
|
3382
|
+
if (m.length === 0) {
|
|
3375
3383
|
s.value = !1;
|
|
3376
3384
|
return;
|
|
3377
3385
|
}
|
|
3378
3386
|
const f = [];
|
|
3379
|
-
for (const S of
|
|
3387
|
+
for (const S of m)
|
|
3380
3388
|
try {
|
|
3381
3389
|
const C = await S.search(A);
|
|
3382
|
-
f.push(...C.map((
|
|
3390
|
+
f.push(...C.map((w) => ({ ...w, type: S.type })));
|
|
3383
3391
|
} catch (C) {
|
|
3384
3392
|
console.warn(`Mention provider ${S.type} failed:`, C);
|
|
3385
3393
|
}
|
|
3386
3394
|
r.value = f.slice(0, 10), s.value = f.length > 0, o.value = 0;
|
|
3387
3395
|
}
|
|
3388
|
-
function
|
|
3389
|
-
const { startPos:
|
|
3390
|
-
e(`${C}@${z} ${
|
|
3396
|
+
function g(A) {
|
|
3397
|
+
const { startPos: m } = i.value, f = n(), S = t(), C = f.slice(0, m), w = f.slice((S == null ? void 0 : S.selectionStart) || m), z = A.name || A.label || A.title || A.id;
|
|
3398
|
+
e(`${C}@${z} ${w}`), a.value.push({
|
|
3391
3399
|
id: A.id,
|
|
3392
3400
|
name: z,
|
|
3393
3401
|
type: A.type,
|
|
@@ -3395,11 +3403,11 @@ function Lo(n, e, t) {
|
|
|
3395
3403
|
}), s.value = !1, r.value = [], setTimeout(() => {
|
|
3396
3404
|
const F = t();
|
|
3397
3405
|
F == null || F.focus();
|
|
3398
|
-
const
|
|
3399
|
-
F == null || F.setSelectionRange(
|
|
3406
|
+
const V = C.length + z.length + 2;
|
|
3407
|
+
F == null || F.setSelectionRange(V, V);
|
|
3400
3408
|
}, 0);
|
|
3401
3409
|
}
|
|
3402
|
-
function
|
|
3410
|
+
function b(A) {
|
|
3403
3411
|
if (!s.value || r.value.length === 0)
|
|
3404
3412
|
return !1;
|
|
3405
3413
|
if (A.key === "ArrowDown")
|
|
@@ -3408,8 +3416,8 @@ function Lo(n, e, t) {
|
|
|
3408
3416
|
return A.preventDefault(), o.value = Math.max(o.value - 1, 0), !0;
|
|
3409
3417
|
if (A.key === "Enter" || A.key === "Tab") {
|
|
3410
3418
|
A.preventDefault();
|
|
3411
|
-
const
|
|
3412
|
-
return
|
|
3419
|
+
const m = r.value[o.value];
|
|
3420
|
+
return m && g(m), !0;
|
|
3413
3421
|
}
|
|
3414
3422
|
return A.key === "Escape" ? (A.preventDefault(), s.value = !1, !0) : !1;
|
|
3415
3423
|
}
|
|
@@ -3427,8 +3435,8 @@ function Lo(n, e, t) {
|
|
|
3427
3435
|
mentionProviders: c,
|
|
3428
3436
|
// Actions
|
|
3429
3437
|
checkForMentions: u,
|
|
3430
|
-
handleMentionSelect:
|
|
3431
|
-
handleMentionKeyDown:
|
|
3438
|
+
handleMentionSelect: g,
|
|
3439
|
+
handleMentionKeyDown: b,
|
|
3432
3440
|
clearMentions: y,
|
|
3433
3441
|
getMentions: h
|
|
3434
3442
|
};
|
|
@@ -3461,11 +3469,11 @@ function Io(n, e, t, s, r) {
|
|
|
3461
3469
|
function d(y) {
|
|
3462
3470
|
r(y), o.value = !1, i.value = -1;
|
|
3463
3471
|
}
|
|
3464
|
-
function
|
|
3465
|
-
const y = s(), h = e(), A = t(),
|
|
3466
|
-
y && !h && A &&
|
|
3472
|
+
function g() {
|
|
3473
|
+
const y = s(), h = e(), A = t(), m = n();
|
|
3474
|
+
y && !h && A && m.length > 0 ? o.value = !0 : o.value = !1;
|
|
3467
3475
|
}
|
|
3468
|
-
function
|
|
3476
|
+
function b() {
|
|
3469
3477
|
o.value = !1, i.value = -1;
|
|
3470
3478
|
}
|
|
3471
3479
|
return {
|
|
@@ -3474,8 +3482,8 @@ function Io(n, e, t, s, r) {
|
|
|
3474
3482
|
dropdownRef: a,
|
|
3475
3483
|
handleSuggestionKeyDown: u,
|
|
3476
3484
|
handleSuggestionClick: d,
|
|
3477
|
-
updateSuggestionsVisibility:
|
|
3478
|
-
hideSuggestions:
|
|
3485
|
+
updateSuggestionsVisibility: g,
|
|
3486
|
+
hideSuggestions: b
|
|
3479
3487
|
};
|
|
3480
3488
|
}
|
|
3481
3489
|
function $o(n, e = 300) {
|
|
@@ -3567,50 +3575,50 @@ const Do = /* @__PURE__ */ he({
|
|
|
3567
3575
|
emits: ["select", "update:selectedIndex"],
|
|
3568
3576
|
setup(n, { emit: e }) {
|
|
3569
3577
|
const t = n, s = O(() => t.ui || {}), r = e, o = q(t.selectedIndex);
|
|
3570
|
-
Ue(() => t.selectedIndex, (
|
|
3571
|
-
o.value =
|
|
3572
|
-
}), Ue(o, (
|
|
3573
|
-
r("update:selectedIndex",
|
|
3578
|
+
Ue(() => t.selectedIndex, (m) => {
|
|
3579
|
+
o.value = m;
|
|
3580
|
+
}), Ue(o, (m) => {
|
|
3581
|
+
r("update:selectedIndex", m);
|
|
3574
3582
|
});
|
|
3575
3583
|
const i = O(() => {
|
|
3576
|
-
const
|
|
3584
|
+
const m = {};
|
|
3577
3585
|
return t.items.forEach((f) => {
|
|
3578
3586
|
const S = f.type || "default";
|
|
3579
|
-
|
|
3580
|
-
}),
|
|
3587
|
+
m[S] || (m[S] = []), m[S].push(f);
|
|
3588
|
+
}), m;
|
|
3581
3589
|
});
|
|
3582
|
-
function a(
|
|
3583
|
-
return t.providers.find((f) => f.type ===
|
|
3590
|
+
function a(m) {
|
|
3591
|
+
return t.providers.find((f) => f.type === m) || cs(m);
|
|
3584
3592
|
}
|
|
3585
|
-
function c(
|
|
3586
|
-
const f = a(
|
|
3587
|
-
return (f == null ? void 0 : f.label) ||
|
|
3593
|
+
function c(m) {
|
|
3594
|
+
const f = a(m);
|
|
3595
|
+
return (f == null ? void 0 : f.label) || m.charAt(0).toUpperCase() + m.slice(1) + "s";
|
|
3588
3596
|
}
|
|
3589
|
-
function u(
|
|
3597
|
+
function u(m, f) {
|
|
3590
3598
|
let S = 0;
|
|
3591
3599
|
const C = Object.keys(i.value);
|
|
3592
|
-
for (const
|
|
3593
|
-
if (
|
|
3600
|
+
for (const w of C) {
|
|
3601
|
+
if (w === m)
|
|
3594
3602
|
return S + f;
|
|
3595
|
-
S += i.value[
|
|
3603
|
+
S += i.value[w].length;
|
|
3596
3604
|
}
|
|
3597
3605
|
return S;
|
|
3598
3606
|
}
|
|
3599
|
-
function d(
|
|
3600
|
-
r("select",
|
|
3607
|
+
function d(m) {
|
|
3608
|
+
r("select", m);
|
|
3601
3609
|
}
|
|
3602
|
-
function m
|
|
3603
|
-
o.value =
|
|
3610
|
+
function g(m) {
|
|
3611
|
+
o.value = m, r("update:selectedIndex", m);
|
|
3604
3612
|
}
|
|
3605
|
-
function
|
|
3606
|
-
const f = a(
|
|
3607
|
-
return
|
|
3613
|
+
function b(m) {
|
|
3614
|
+
const f = a(m.type);
|
|
3615
|
+
return cn(m, f);
|
|
3608
3616
|
}
|
|
3609
|
-
function y(
|
|
3610
|
-
const f = a(
|
|
3611
|
-
return us(
|
|
3617
|
+
function y(m) {
|
|
3618
|
+
const f = a(m.type);
|
|
3619
|
+
return us(m, f);
|
|
3612
3620
|
}
|
|
3613
|
-
function h(
|
|
3621
|
+
function h(m) {
|
|
3614
3622
|
const f = {
|
|
3615
3623
|
employee: "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",
|
|
3616
3624
|
job: "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400",
|
|
@@ -3618,25 +3626,25 @@ const Do = /* @__PURE__ */ he({
|
|
|
3618
3626
|
project: "bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400",
|
|
3619
3627
|
default: "bg-primary/10 text-primary"
|
|
3620
3628
|
};
|
|
3621
|
-
return f[
|
|
3629
|
+
return f[m] || f.default;
|
|
3622
3630
|
}
|
|
3623
|
-
function A(
|
|
3624
|
-
return
|
|
3631
|
+
function A(m) {
|
|
3632
|
+
return m.split(" ").map((f) => f[0]).join("").slice(0, 2).toUpperCase();
|
|
3625
3633
|
}
|
|
3626
|
-
return (
|
|
3634
|
+
return (m, f) => n.items.length > 0 ? (k(), v("div", {
|
|
3627
3635
|
key: 0,
|
|
3628
3636
|
class: T(["absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg max-h-60 overflow-y-auto z-50", s.value.root])
|
|
3629
3637
|
}, [
|
|
3630
3638
|
p("div", {
|
|
3631
3639
|
class: T(["p-2", s.value.container])
|
|
3632
3640
|
}, [
|
|
3633
|
-
(k(!0), v(
|
|
3641
|
+
(k(!0), v(be, null, Ne(i.value, (S, C) => (k(), v(be, { key: C }, [
|
|
3634
3642
|
Object.keys(i.value).length > 1 ? (k(), v("div", {
|
|
3635
3643
|
key: 0,
|
|
3636
3644
|
class: T(["px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide", s.value.groupHeader])
|
|
3637
3645
|
}, N(c(C)), 3)) : B("", !0),
|
|
3638
|
-
(k(!0), v(
|
|
3639
|
-
key:
|
|
3646
|
+
(k(!0), v(be, null, Ne(S, (w, z) => (k(), v("button", {
|
|
3647
|
+
key: w.id,
|
|
3640
3648
|
type: "button",
|
|
3641
3649
|
class: T(["w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors mb-0.5", [
|
|
3642
3650
|
s.value.item,
|
|
@@ -3645,27 +3653,27 @@ const Do = /* @__PURE__ */ he({
|
|
|
3645
3653
|
"hover:bg-gray-50 dark:hover:bg-gray-700": u(C, z) !== o.value
|
|
3646
3654
|
}
|
|
3647
3655
|
]]),
|
|
3648
|
-
onClick: (F) => d(
|
|
3649
|
-
onMouseenter: (F) =>
|
|
3656
|
+
onClick: (F) => d(w),
|
|
3657
|
+
onMouseenter: (F) => g(u(C, z))
|
|
3650
3658
|
}, [
|
|
3651
|
-
me(
|
|
3652
|
-
item:
|
|
3659
|
+
me(m.$slots, "item-icon", {
|
|
3660
|
+
item: w,
|
|
3653
3661
|
type: C
|
|
3654
3662
|
}, () => [
|
|
3655
3663
|
p("span", {
|
|
3656
|
-
class: T(["w-8 h-8 flex items-center justify-center rounded-full text-xs font-semibold flex-shrink-0", [s.value.itemIcon, h(
|
|
3657
|
-
}, N(A(w
|
|
3664
|
+
class: T(["w-8 h-8 flex items-center justify-center rounded-full text-xs font-semibold flex-shrink-0", [s.value.itemIcon, h(w.type)]])
|
|
3665
|
+
}, N(A(b(w))), 3)
|
|
3658
3666
|
]),
|
|
3659
3667
|
p("div", {
|
|
3660
3668
|
class: T(["flex-1 min-w-0", s.value.itemContent])
|
|
3661
3669
|
}, [
|
|
3662
3670
|
p("p", {
|
|
3663
3671
|
class: T(["text-sm font-medium text-gray-900 dark:text-gray-100 truncate", s.value.itemName])
|
|
3664
|
-
}, N(w
|
|
3665
|
-
y(
|
|
3672
|
+
}, N(b(w)), 3),
|
|
3673
|
+
y(w) ? (k(), v("p", {
|
|
3666
3674
|
key: 0,
|
|
3667
3675
|
class: T(["text-xs text-gray-500 dark:text-gray-400 truncate", s.value.itemSubtitle])
|
|
3668
|
-
}, N(y(
|
|
3676
|
+
}, N(y(w)), 3)) : B("", !0)
|
|
3669
3677
|
], 2)
|
|
3670
3678
|
], 42, _o))), 128))
|
|
3671
3679
|
], 64))), 128))
|
|
@@ -3745,12 +3753,12 @@ const Do = /* @__PURE__ */ he({
|
|
|
3745
3753
|
}, Uo = { class: "flex-1 min-w-0" }, qo = { class: "text-sm font-semibold text-white truncate" }, jo = { class: "text-xs text-white/70" }, Wo = {
|
|
3746
3754
|
key: 0,
|
|
3747
3755
|
class: "text-xs font-medium text-white/90"
|
|
3748
|
-
},
|
|
3756
|
+
}, Ko = ["src"], Vo = {
|
|
3749
3757
|
key: 1,
|
|
3750
3758
|
class: "h-4 w-4 text-white",
|
|
3751
3759
|
viewBox: "0 0 24 24",
|
|
3752
3760
|
fill: "currentColor"
|
|
3753
|
-
},
|
|
3761
|
+
}, Go = { class: "flex-shrink-0 mt-0.5" }, Qo = { class: "text-gray-600 dark:text-gray-400" }, Zo = ["id", "innerHTML"], Yo = { class: "h-12 w-12 flex items-center justify-center rounded-lg bg-white dark:bg-gray-800 overflow-hidden border border-gray-200 dark:border-gray-600" }, Xo = ["src"], Jo = {
|
|
3754
3762
|
key: 1,
|
|
3755
3763
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
3756
3764
|
fill: "none",
|
|
@@ -3785,10 +3793,10 @@ const Do = /* @__PURE__ */ he({
|
|
|
3785
3793
|
`).length;
|
|
3786
3794
|
return f.length > 200 || S > 4;
|
|
3787
3795
|
});
|
|
3788
|
-
function
|
|
3796
|
+
function g() {
|
|
3789
3797
|
a.value = !a.value;
|
|
3790
3798
|
}
|
|
3791
|
-
function
|
|
3799
|
+
function b(f) {
|
|
3792
3800
|
return (f.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(f.name || "");
|
|
3793
3801
|
}
|
|
3794
3802
|
const y = O(() => {
|
|
@@ -3808,7 +3816,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
3808
3816
|
}
|
|
3809
3817
|
return t.message.message;
|
|
3810
3818
|
});
|
|
3811
|
-
function
|
|
3819
|
+
function m(f) {
|
|
3812
3820
|
s("copy", f);
|
|
3813
3821
|
}
|
|
3814
3822
|
return (f, S) => {
|
|
@@ -3827,7 +3835,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
3827
3835
|
class: T(["flex gap-3 justify-end", o.value.userMessage])
|
|
3828
3836
|
}, [
|
|
3829
3837
|
p("div", {
|
|
3830
|
-
class: T(["rounded-2xl px-4 py-3 bg-primary text-white max-w-fit", o.value.userBubble])
|
|
3838
|
+
class: T(["rounded-2xl px-4 py-3 bg-primary-500 text-white max-w-fit", o.value.userBubble])
|
|
3831
3839
|
}, [
|
|
3832
3840
|
n.message.message ? (k(), v("p", {
|
|
3833
3841
|
key: 0,
|
|
@@ -3836,24 +3844,24 @@ const Do = /* @__PURE__ */ he({
|
|
|
3836
3844
|
d.value ? (k(), v("button", {
|
|
3837
3845
|
key: 1,
|
|
3838
3846
|
class: T(["mt-2 text-xs text-white/80 hover:text-white underline", o.value.showMoreButton]),
|
|
3839
|
-
onClick:
|
|
3847
|
+
onClick: g
|
|
3840
3848
|
}, N(a.value ? r("showLess") : r("showMore")), 3)) : B("", !0),
|
|
3841
3849
|
u.value ? (k(), v("div", {
|
|
3842
3850
|
key: 2,
|
|
3843
3851
|
class: T(["mt-3 space-y-2", o.value.attachmentsContainer])
|
|
3844
3852
|
}, [
|
|
3845
|
-
(k(!0), v(
|
|
3846
|
-
key:
|
|
3847
|
-
href:
|
|
3848
|
-
target:
|
|
3853
|
+
(k(!0), v(be, null, Ne(c.value, (w) => (k(), Me(nn(w.url ? "a" : "div"), {
|
|
3854
|
+
key: w.id,
|
|
3855
|
+
href: w.url || void 0,
|
|
3856
|
+
target: w.url ? "_blank" : void 0,
|
|
3849
3857
|
rel: "noopener noreferrer",
|
|
3850
|
-
class: T(["flex items-center gap-3 rounded-xl border border-white/20 bg-white/10 p-2 transition", [o.value.attachmentItem,
|
|
3858
|
+
class: T(["flex items-center gap-3 rounded-xl border border-white/20 bg-white/10 p-2 transition", [o.value.attachmentItem, w.url ? "hover:bg-white/20 cursor-pointer" : ""]])
|
|
3851
3859
|
}, {
|
|
3852
3860
|
default: Ce(() => [
|
|
3853
3861
|
p("div", Ho, [
|
|
3854
|
-
|
|
3862
|
+
w.url && b(w) ? (k(), v("img", {
|
|
3855
3863
|
key: 0,
|
|
3856
|
-
src:
|
|
3864
|
+
src: w.url,
|
|
3857
3865
|
class: "object-cover h-full w-full",
|
|
3858
3866
|
alt: ""
|
|
3859
3867
|
}, null, 8, Fo)) : (k(), v("svg", Bo, [...S[0] || (S[0] = [
|
|
@@ -3866,24 +3874,24 @@ const Do = /* @__PURE__ */ he({
|
|
|
3866
3874
|
])]))
|
|
3867
3875
|
]),
|
|
3868
3876
|
p("div", Uo, [
|
|
3869
|
-
p("p", qo, N(
|
|
3870
|
-
p("p", jo, N(h(
|
|
3877
|
+
p("p", qo, N(w.name || r("attachment")), 1),
|
|
3878
|
+
p("p", jo, N(h(w.size)), 1)
|
|
3871
3879
|
]),
|
|
3872
|
-
|
|
3880
|
+
w.url ? (k(), v("span", Wo, N(r("openAttachment")), 1)) : B("", !0)
|
|
3873
3881
|
]),
|
|
3874
3882
|
_: 2
|
|
3875
3883
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3876
3884
|
], 2)) : B("", !0)
|
|
3877
3885
|
], 2),
|
|
3878
3886
|
p("div", {
|
|
3879
|
-
class: T(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary overflow-hidden", o.value.userAvatar])
|
|
3887
|
+
class: T(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary-500 overflow-hidden", o.value.userAvatar])
|
|
3880
3888
|
}, [
|
|
3881
3889
|
y.value ? (k(), v("img", {
|
|
3882
3890
|
key: 0,
|
|
3883
3891
|
src: y.value,
|
|
3884
3892
|
alt: "User",
|
|
3885
3893
|
class: "h-full w-full object-cover"
|
|
3886
|
-
}, null, 8,
|
|
3894
|
+
}, null, 8, Ko)) : (k(), v("svg", Vo, [...S[1] || (S[1] = [
|
|
3887
3895
|
p("path", {
|
|
3888
3896
|
"fill-rule": "evenodd",
|
|
3889
3897
|
d: "M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",
|
|
@@ -3895,7 +3903,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
3895
3903
|
key: 1,
|
|
3896
3904
|
class: T(["flex items-start gap-3", o.value.assistantMessage])
|
|
3897
3905
|
}, [
|
|
3898
|
-
p("div",
|
|
3906
|
+
p("div", Go, [
|
|
3899
3907
|
ge(Do)
|
|
3900
3908
|
]),
|
|
3901
3909
|
p("div", {
|
|
@@ -3932,18 +3940,18 @@ const Do = /* @__PURE__ */ he({
|
|
|
3932
3940
|
key: 2,
|
|
3933
3941
|
class: T(["mt-4 space-y-2", o.value.attachmentsContainer])
|
|
3934
3942
|
}, [
|
|
3935
|
-
(k(!0), v(
|
|
3936
|
-
key:
|
|
3937
|
-
href:
|
|
3938
|
-
target:
|
|
3943
|
+
(k(!0), v(be, null, Ne(c.value, (w) => (k(), Me(nn(w.url ? "a" : "div"), {
|
|
3944
|
+
key: w.id,
|
|
3945
|
+
href: w.url || void 0,
|
|
3946
|
+
target: w.url ? "_blank" : void 0,
|
|
3939
3947
|
rel: "noopener noreferrer",
|
|
3940
|
-
class: T(["flex items-center gap-3 rounded-xl border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 p-3 transition", [o.value.attachmentItem,
|
|
3948
|
+
class: T(["flex items-center gap-3 rounded-xl border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 p-3 transition", [o.value.attachmentItem, w.url ? "hover:bg-white dark:hover:bg-gray-600 cursor-pointer" : ""]])
|
|
3941
3949
|
}, {
|
|
3942
3950
|
default: Ce(() => [
|
|
3943
3951
|
p("div", Yo, [
|
|
3944
|
-
|
|
3952
|
+
w.url && b(w) ? (k(), v("img", {
|
|
3945
3953
|
key: 0,
|
|
3946
|
-
src:
|
|
3954
|
+
src: w.url,
|
|
3947
3955
|
class: "object-cover h-full w-full",
|
|
3948
3956
|
alt: ""
|
|
3949
3957
|
}, null, 8, Xo)) : (k(), v("svg", Jo, [...S[3] || (S[3] = [
|
|
@@ -3956,10 +3964,10 @@ const Do = /* @__PURE__ */ he({
|
|
|
3956
3964
|
])]))
|
|
3957
3965
|
]),
|
|
3958
3966
|
p("div", ei, [
|
|
3959
|
-
p("p", ti, N(
|
|
3960
|
-
p("p", ni, N(h(
|
|
3967
|
+
p("p", ti, N(w.name || r("attachment")), 1),
|
|
3968
|
+
p("p", ni, N(h(w.size)), 1)
|
|
3961
3969
|
]),
|
|
3962
|
-
|
|
3970
|
+
w.url ? (k(), v("span", si, N(r("openAttachment")), 1)) : B("", !0)
|
|
3963
3971
|
]),
|
|
3964
3972
|
_: 2
|
|
3965
3973
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
@@ -3970,7 +3978,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
3970
3978
|
key: 2,
|
|
3971
3979
|
message: n.message,
|
|
3972
3980
|
class: T(["absolute -bottom-8 left-14", o.value.actionsContainer]),
|
|
3973
|
-
onCopy:
|
|
3981
|
+
onCopy: m
|
|
3974
3982
|
}, null, 8, ["message", "class"])) : B("", !0)
|
|
3975
3983
|
], 2);
|
|
3976
3984
|
};
|
|
@@ -3980,7 +3988,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
3980
3988
|
for (const [s, r] of e)
|
|
3981
3989
|
t[s] = r;
|
|
3982
3990
|
return t;
|
|
3983
|
-
}, oi = /* @__PURE__ */ Rs(ri, [["__scopeId", "data-v-
|
|
3991
|
+
}, oi = /* @__PURE__ */ Rs(ri, [["__scopeId", "data-v-b5ba399c"]]), ii = { class: "text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide" }, ai = { class: "space-y-2" }, li = ["src"], ui = {
|
|
3984
3992
|
key: 1,
|
|
3985
3993
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
3986
3994
|
fill: "none",
|
|
@@ -4010,7 +4018,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4010
4018
|
}, [
|
|
4011
4019
|
p("p", ii, N(((s = n.texts) == null ? void 0 : s.attachedFiles) || "Attached files"), 1),
|
|
4012
4020
|
p("ul", ai, [
|
|
4013
|
-
(k(!0), v(
|
|
4021
|
+
(k(!0), v(be, null, Ne(n.attachments, (r) => (k(), v("li", {
|
|
4014
4022
|
key: r.id,
|
|
4015
4023
|
class: T(["flex items-center gap-3 rounded-xl bg-white dark:bg-gray-700 p-2 shadow-sm border border-gray-100 dark:border-gray-600", n.ui.attachmentItem])
|
|
4016
4024
|
}, [
|
|
@@ -4037,7 +4045,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4037
4045
|
r.uploading ? (k(), v("div", hi, [
|
|
4038
4046
|
p("div", {
|
|
4039
4047
|
class: "h-full bg-primary transition-all",
|
|
4040
|
-
style:
|
|
4048
|
+
style: un({ width: `${r.progress ?? 10}%` })
|
|
4041
4049
|
}, null, 4)
|
|
4042
4050
|
])) : B("", !0)
|
|
4043
4051
|
]),
|
|
@@ -4067,7 +4075,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4067
4075
|
], 2);
|
|
4068
4076
|
};
|
|
4069
4077
|
}
|
|
4070
|
-
}), yi = { class: "py-1" }, xi = ["onClick", "onMouseenter"], ki = { class: "flex items-start gap-3" },
|
|
4078
|
+
}), yi = { class: "py-1" }, xi = ["onClick", "onMouseenter"], ki = { class: "flex items-start gap-3" }, bi = { class: "flex-1 min-w-0" }, wi = { class: "text-sm font-medium text-gray-900 dark:text-gray-100" }, vi = { class: "text-xs text-gray-500 dark:text-gray-400 mt-0.5 line-clamp-2" }, Ti = /* @__PURE__ */ he({
|
|
4071
4079
|
__name: "SuggestionsDropdown",
|
|
4072
4080
|
props: {
|
|
4073
4081
|
suggestions: {},
|
|
@@ -4092,7 +4100,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4092
4100
|
class: T(["absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg max-h-80 overflow-y-auto z-10", n.ui.suggestionsDropdown])
|
|
4093
4101
|
}, [
|
|
4094
4102
|
p("ul", yi, [
|
|
4095
|
-
(k(!0), v(
|
|
4103
|
+
(k(!0), v(be, null, Ne(n.suggestions, (o, i) => (k(), v("li", {
|
|
4096
4104
|
key: o.id,
|
|
4097
4105
|
class: T(["px-4 py-3 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-700 last:border-b-0", [
|
|
4098
4106
|
n.ui.suggestionItem,
|
|
@@ -4105,8 +4113,8 @@ const Do = /* @__PURE__ */ he({
|
|
|
4105
4113
|
onMouseenter: (a) => s.$emit("hover", i)
|
|
4106
4114
|
}, [
|
|
4107
4115
|
p("div", ki, [
|
|
4108
|
-
p("div",
|
|
4109
|
-
p("p",
|
|
4116
|
+
p("div", bi, [
|
|
4117
|
+
p("p", wi, N(o.title), 1),
|
|
4110
4118
|
p("p", vi, N(o.description), 1)
|
|
4111
4119
|
])
|
|
4112
4120
|
])
|
|
@@ -4140,7 +4148,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4140
4148
|
},
|
|
4141
4149
|
emits: ["toggle-support-mode", "click"],
|
|
4142
4150
|
setup(n) {
|
|
4143
|
-
const e = n, t = O(() => e.sending ? [e.ui.stopButton || "bg-red-500 text-white hover:bg-red-600"] : e.canSend ? [e.ui.sendButtonActive || "bg-primary text-white hover:bg-primary
|
|
4151
|
+
const e = n, t = O(() => e.sending ? [e.ui.stopButton || "bg-red-500 text-white hover:bg-red-600"] : e.canSend ? [e.ui.sendButtonActive || "bg-primary-500 text-white hover:bg-primary-600"] : [e.ui.sendButtonDisabled || "bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed opacity-60"]);
|
|
4144
4152
|
return (s, r) => {
|
|
4145
4153
|
var o, i, a;
|
|
4146
4154
|
return k(), v("div", Si, [
|
|
@@ -4204,7 +4212,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4204
4212
|
disabled: !n.canSend && !n.sending,
|
|
4205
4213
|
class: T(["h-9 w-9 rounded-xl flex items-center justify-center transition-all duration-200 flex-shrink-0", t.value]),
|
|
4206
4214
|
type: "button",
|
|
4207
|
-
onClick: r[2] || (r[2] =
|
|
4215
|
+
onClick: r[2] || (r[2] = et((c) => s.$emit("click"), ["prevent"]))
|
|
4208
4216
|
}, [
|
|
4209
4217
|
n.sending ? (k(), v("svg", Ri, [...r[7] || (r[7] = [
|
|
4210
4218
|
p("path", {
|
|
@@ -4252,7 +4260,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4252
4260
|
o.value = M;
|
|
4253
4261
|
},
|
|
4254
4262
|
() => i.value
|
|
4255
|
-
),
|
|
4263
|
+
), g = Io(
|
|
4256
4264
|
() => t.suggestions,
|
|
4257
4265
|
() => t.hasHistory,
|
|
4258
4266
|
() => c.value,
|
|
@@ -4263,85 +4271,85 @@ const Do = /* @__PURE__ */ he({
|
|
|
4263
4271
|
return (I = i.value) == null ? void 0 : I.focus();
|
|
4264
4272
|
});
|
|
4265
4273
|
}
|
|
4266
|
-
), { adjustTextareaHeight:
|
|
4274
|
+
), { adjustTextareaHeight: b } = $o(() => i.value), y = O(() => t.supportRequestMode ? t.supportPlaceholder : t.placeholder), h = O(() => t.showSupportModeToggle ? t.supportRequestMode ? { paddingLeft: "3rem", paddingRight: "8rem" } : { paddingLeft: "3rem", paddingRight: "6rem" } : { paddingLeft: "3rem", paddingRight: "3.5rem" }), A = O(() => {
|
|
4267
4275
|
var I;
|
|
4268
4276
|
return (((I = o.value) == null ? void 0 : I.trim()) ?? "").length >= t.minLength ? !0 : u.hasAttachments.value;
|
|
4269
|
-
}),
|
|
4277
|
+
}), m = O(
|
|
4270
4278
|
() => !t.disabled && !t.sending && A.value && !u.isUploading.value
|
|
4271
4279
|
);
|
|
4272
4280
|
Ue(() => t.modelValue, (M) => {
|
|
4273
|
-
o.value = M, Oe(
|
|
4281
|
+
o.value = M, Oe(b);
|
|
4274
4282
|
}), Ue(o, (M) => {
|
|
4275
|
-
r("update:modelValue", M), Oe(
|
|
4283
|
+
r("update:modelValue", M), Oe(b), d.checkForMentions(M), g.updateSuggestionsVisibility();
|
|
4276
4284
|
}), Ue(() => t.suggestions, () => {
|
|
4277
|
-
|
|
4285
|
+
g.updateSuggestionsVisibility();
|
|
4278
4286
|
});
|
|
4279
4287
|
function f() {
|
|
4280
|
-
|
|
4288
|
+
b();
|
|
4281
4289
|
}
|
|
4282
4290
|
function S(M) {
|
|
4283
|
-
if (!d.handleMentionKeyDown(M) && !
|
|
4291
|
+
if (!d.handleMentionKeyDown(M) && !g.handleSuggestionKeyDown(M) && M.key === "Enter") {
|
|
4284
4292
|
if (M.shiftKey) return;
|
|
4285
|
-
!t.sending &&
|
|
4293
|
+
!t.sending && m.value && (M.preventDefault(), C());
|
|
4286
4294
|
}
|
|
4287
4295
|
}
|
|
4288
4296
|
function C() {
|
|
4289
|
-
if (!
|
|
4297
|
+
if (!m.value) return;
|
|
4290
4298
|
const M = u.buildPayload(), I = o.value.trim(), P = d.getMentions();
|
|
4291
4299
|
r("submit", {
|
|
4292
4300
|
message: I,
|
|
4293
4301
|
attachments: M,
|
|
4294
4302
|
mentions: P,
|
|
4295
4303
|
isSupportRequest: t.supportRequestMode
|
|
4296
|
-
}), o.value = "", u.clearAttachments(), d.clearMentions(), Oe(
|
|
4304
|
+
}), o.value = "", u.clearAttachments(), d.clearMentions(), Oe(b);
|
|
4297
4305
|
}
|
|
4298
|
-
function
|
|
4299
|
-
t.sending ? r("cancel") :
|
|
4306
|
+
function w() {
|
|
4307
|
+
t.sending ? r("cancel") : m.value && C();
|
|
4300
4308
|
}
|
|
4301
4309
|
function z() {
|
|
4302
4310
|
var M;
|
|
4303
4311
|
t.disabled || t.sending || u.canAddMore.value && ((M = a.value) == null || M.click());
|
|
4304
4312
|
}
|
|
4305
4313
|
function F(M) {
|
|
4306
|
-
|
|
4314
|
+
g.handleSuggestionClick(M);
|
|
4307
4315
|
}
|
|
4308
|
-
function
|
|
4309
|
-
c.value = !0,
|
|
4316
|
+
function V() {
|
|
4317
|
+
c.value = !0, g.updateSuggestionsVisibility();
|
|
4310
4318
|
}
|
|
4311
4319
|
function E() {
|
|
4312
4320
|
c.value = !1, setTimeout(() => {
|
|
4313
|
-
|
|
4321
|
+
g.hideSuggestions(), d.showMentions.value = !1;
|
|
4314
4322
|
}, 200);
|
|
4315
4323
|
}
|
|
4316
4324
|
return xt(() => {
|
|
4317
|
-
Oe(
|
|
4325
|
+
Oe(b);
|
|
4318
4326
|
}), (M, I) => {
|
|
4319
4327
|
var P;
|
|
4320
4328
|
return k(), v("div", {
|
|
4321
4329
|
class: T(["px-4 pb-4 bg-white dark:bg-gray-900 sticky bottom-0", s.value.root]),
|
|
4322
|
-
onDragenter: I[6] || (I[6] =
|
|
4330
|
+
onDragenter: I[6] || (I[6] = et(
|
|
4323
4331
|
//@ts-ignore
|
|
4324
4332
|
(...L) => D(u).handleDragEnter && D(u).handleDragEnter(...L),
|
|
4325
4333
|
["prevent"]
|
|
4326
4334
|
)),
|
|
4327
|
-
onDragover: I[7] || (I[7] =
|
|
4335
|
+
onDragover: I[7] || (I[7] = et(
|
|
4328
4336
|
//@ts-ignore
|
|
4329
4337
|
(...L) => D(u).handleDragOver && D(u).handleDragOver(...L),
|
|
4330
4338
|
["prevent"]
|
|
4331
4339
|
)),
|
|
4332
|
-
onDragleave: I[8] || (I[8] =
|
|
4340
|
+
onDragleave: I[8] || (I[8] = et(
|
|
4333
4341
|
//@ts-ignore
|
|
4334
4342
|
(...L) => D(u).handleDragLeave && D(u).handleDragLeave(...L),
|
|
4335
4343
|
["prevent"]
|
|
4336
4344
|
)),
|
|
4337
|
-
onDrop: I[9] || (I[9] =
|
|
4345
|
+
onDrop: I[9] || (I[9] = et(
|
|
4338
4346
|
//@ts-ignore
|
|
4339
4347
|
(...L) => D(u).handleDrop && D(u).handleDrop(...L),
|
|
4340
4348
|
["prevent"]
|
|
4341
4349
|
))
|
|
4342
4350
|
}, [
|
|
4343
4351
|
p("form", {
|
|
4344
|
-
onSubmit:
|
|
4352
|
+
onSubmit: et(C, ["prevent"]),
|
|
4345
4353
|
class: T(s.value.form)
|
|
4346
4354
|
}, [
|
|
4347
4355
|
p("div", Ii, [
|
|
@@ -4367,14 +4375,14 @@ const Do = /* @__PURE__ */ he({
|
|
|
4367
4375
|
p("div", {
|
|
4368
4376
|
class: T(["relative", s.value.inputContainer])
|
|
4369
4377
|
}, [
|
|
4370
|
-
D(
|
|
4378
|
+
D(g).showSuggestions.value && n.suggestions.length > 0 ? (k(), Me(Ti, {
|
|
4371
4379
|
key: 0,
|
|
4372
4380
|
ref: "suggestionsHandler.dropdownRef.value",
|
|
4373
4381
|
suggestions: n.suggestions,
|
|
4374
|
-
"selected-index": D(
|
|
4382
|
+
"selected-index": D(g).selectedSuggestionIndex.value,
|
|
4375
4383
|
ui: s.value,
|
|
4376
4384
|
onSelect: F,
|
|
4377
|
-
onHover: I[1] || (I[1] = (L) => D(
|
|
4385
|
+
onHover: I[1] || (I[1] = (L) => D(g).selectedSuggestionIndex.value = L)
|
|
4378
4386
|
}, null, 8, ["suggestions", "selected-index", "ui"])) : B("", !0),
|
|
4379
4387
|
ge(mt, {
|
|
4380
4388
|
"enter-active-class": "transition ease-out duration-100",
|
|
@@ -4434,24 +4442,25 @@ const Do = /* @__PURE__ */ he({
|
|
|
4434
4442
|
"data-ai-input": "",
|
|
4435
4443
|
placeholder: y.value,
|
|
4436
4444
|
disabled: n.disabled,
|
|
4437
|
-
class: T(["block w-full bg-transparent py-3 text-sm leading-5 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 border-0 focus:outline-none focus-visible:outline-none resize-none
|
|
4445
|
+
class: T(["block w-full bg-transparent py-3 text-sm leading-5 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 border-0 focus:outline-none focus-visible:outline-none resize-none", s.value.textarea]),
|
|
4446
|
+
style: un(h.value),
|
|
4438
4447
|
onInput: f,
|
|
4439
4448
|
onKeydown: S,
|
|
4440
|
-
onFocus:
|
|
4449
|
+
onFocus: V,
|
|
4441
4450
|
onBlur: E
|
|
4442
|
-
}, null,
|
|
4451
|
+
}, null, 46, Oi), [
|
|
4443
4452
|
[qs, o.value]
|
|
4444
4453
|
])
|
|
4445
4454
|
]),
|
|
4446
4455
|
ge(Li, {
|
|
4447
4456
|
sending: n.sending,
|
|
4448
|
-
"can-send":
|
|
4457
|
+
"can-send": m.value,
|
|
4449
4458
|
"support-request-mode": n.supportRequestMode,
|
|
4450
4459
|
"show-support-mode-toggle": n.showSupportModeToggle,
|
|
4451
4460
|
ui: s.value,
|
|
4452
4461
|
texts: n.texts,
|
|
4453
4462
|
onToggleSupportMode: I[4] || (I[4] = (L) => M.$emit("toggle-support-mode")),
|
|
4454
|
-
onClick:
|
|
4463
|
+
onClick: w
|
|
4455
4464
|
}, null, 8, ["sending", "can-send", "support-request-mode", "show-support-mode-toggle", "ui", "texts"])
|
|
4456
4465
|
], 2)
|
|
4457
4466
|
], 2),
|
|
@@ -4477,26 +4486,26 @@ const Do = /* @__PURE__ */ he({
|
|
|
4477
4486
|
},
|
|
4478
4487
|
emits: ["item-click"],
|
|
4479
4488
|
setup(n, { emit: e }) {
|
|
4480
|
-
const t = n, s = e, r = (
|
|
4489
|
+
const t = n, s = e, r = (b) => {
|
|
4481
4490
|
var h;
|
|
4482
|
-
return (h = t.texts) != null && h[
|
|
4491
|
+
return (h = t.texts) != null && h[b] ? t.texts[b] : le({
|
|
4483
4492
|
aiName: "aiName",
|
|
4484
4493
|
title: "emptyStateTitle",
|
|
4485
4494
|
description: "emptyStateDescription"
|
|
4486
|
-
}[
|
|
4495
|
+
}[b]);
|
|
4487
4496
|
}, o = O(() => t.ui || {}), { suggestions: i, resolvePrompt: a } = Ms();
|
|
4488
|
-
function c(
|
|
4497
|
+
function c(b) {
|
|
4489
4498
|
const y = {
|
|
4490
|
-
...
|
|
4491
|
-
prompt: a(
|
|
4499
|
+
...b,
|
|
4500
|
+
prompt: a(b)
|
|
4492
4501
|
};
|
|
4493
4502
|
s("item-click", y);
|
|
4494
4503
|
}
|
|
4495
|
-
function u(
|
|
4496
|
-
return
|
|
4504
|
+
function u(b) {
|
|
4505
|
+
return b.gradientClass ? b.gradientClass : b.className ? b.className : "bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900";
|
|
4497
4506
|
}
|
|
4498
|
-
function d(
|
|
4499
|
-
const y =
|
|
4507
|
+
function d(b) {
|
|
4508
|
+
const y = b.category || "default", h = {
|
|
4500
4509
|
hr: "bg-blue-100 dark:bg-blue-900/30",
|
|
4501
4510
|
finance: "bg-green-100 dark:bg-green-900/30",
|
|
4502
4511
|
analytics: "bg-purple-100 dark:bg-purple-900/30",
|
|
@@ -4505,8 +4514,8 @@ const Do = /* @__PURE__ */ he({
|
|
|
4505
4514
|
};
|
|
4506
4515
|
return h[y] || h.default;
|
|
4507
4516
|
}
|
|
4508
|
-
function
|
|
4509
|
-
const y =
|
|
4517
|
+
function g(b) {
|
|
4518
|
+
const y = b.category || "default", h = {
|
|
4510
4519
|
hr: "text-blue-600 dark:text-blue-400",
|
|
4511
4520
|
finance: "text-green-600 dark:text-green-400",
|
|
4512
4521
|
analytics: "text-purple-600 dark:text-purple-400",
|
|
@@ -4515,7 +4524,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4515
4524
|
};
|
|
4516
4525
|
return h[y] || h.default;
|
|
4517
4526
|
}
|
|
4518
|
-
return (
|
|
4527
|
+
return (b, y) => (k(), v("div", {
|
|
4519
4528
|
class: T(["flex items-center justify-center p-4 h-full", o.value.root])
|
|
4520
4529
|
}, [
|
|
4521
4530
|
p("div", {
|
|
@@ -4552,20 +4561,20 @@ const Do = /* @__PURE__ */ he({
|
|
|
4552
4561
|
p("div", {
|
|
4553
4562
|
class: T(["mb-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-3", o.value.grid])
|
|
4554
4563
|
}, [
|
|
4555
|
-
(k(!0), v(
|
|
4564
|
+
(k(!0), v(be, null, Ne(D(i), (h, A) => (k(), v("button", {
|
|
4556
4565
|
key: h.id || A,
|
|
4557
4566
|
class: T(["group relative overflow-hidden rounded-xl border border-gray-300 dark:border-gray-600 p-4 text-left transition-all hover:shadow-md hover:scale-[1.02]", [o.value.suggestionCard, u(h)]]),
|
|
4558
|
-
onClick: (
|
|
4567
|
+
onClick: (m) => c(h)
|
|
4559
4568
|
}, [
|
|
4560
4569
|
p("div", {
|
|
4561
4570
|
class: T(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, d(h)]])
|
|
4562
4571
|
}, [
|
|
4563
4572
|
h.icon ? (k(), Me(nn(h.icon), {
|
|
4564
4573
|
key: 0,
|
|
4565
|
-
class: T(["h-5 w-5", [o.value.suggestionIcon,
|
|
4574
|
+
class: T(["h-5 w-5", [o.value.suggestionIcon, g(h)]])
|
|
4566
4575
|
}, null, 8, ["class"])) : (k(), v("svg", {
|
|
4567
4576
|
key: 1,
|
|
4568
|
-
class: T(["h-5 w-5", [o.value.suggestionIcon,
|
|
4577
|
+
class: T(["h-5 w-5", [o.value.suggestionIcon, g(h)]]),
|
|
4569
4578
|
fill: "none",
|
|
4570
4579
|
viewBox: "0 0 24 24",
|
|
4571
4580
|
stroke: "currentColor",
|
|
@@ -4598,14 +4607,14 @@ const Do = /* @__PURE__ */ he({
|
|
|
4598
4607
|
}, qi = {
|
|
4599
4608
|
key: 0,
|
|
4600
4609
|
class: "flex items-center gap-2 ml-auto mr-3"
|
|
4601
|
-
}, ji = ["title"], Wi = ["title"],
|
|
4610
|
+
}, ji = ["title"], Wi = ["title"], Ki = ["title"], Vi = {
|
|
4602
4611
|
key: 0,
|
|
4603
4612
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4604
4613
|
fill: "none",
|
|
4605
4614
|
viewBox: "0 0 24 24",
|
|
4606
4615
|
stroke: "currentColor",
|
|
4607
4616
|
"stroke-width": "1.5"
|
|
4608
|
-
},
|
|
4617
|
+
}, Gi = {
|
|
4609
4618
|
key: 1,
|
|
4610
4619
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4611
4620
|
fill: "none",
|
|
@@ -4638,7 +4647,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4638
4647
|
n.isSetupMode ? (k(), v("div", Ui, [...t[5] || (t[5] = [
|
|
4639
4648
|
p("span", { class: "flex h-2 w-2 rounded-full bg-amber-500 animate-pulse" }, null, -1),
|
|
4640
4649
|
p("span", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, "Setup Required", -1)
|
|
4641
|
-
])])) : (k(), v(
|
|
4650
|
+
])])) : (k(), v(be, { key: 0 }, [
|
|
4642
4651
|
n.showNewChatButton && n.hasHistory ? (k(), v("button", {
|
|
4643
4652
|
key: 0,
|
|
4644
4653
|
type: "button",
|
|
@@ -4728,20 +4737,20 @@ const Do = /* @__PURE__ */ he({
|
|
|
4728
4737
|
title: n.isFullscreen ? n.t("exitFullscreen") : n.t("fullscreen"),
|
|
4729
4738
|
onClick: t[3] || (t[3] = (u) => e.$emit("toggle-fullscreen"))
|
|
4730
4739
|
}, [
|
|
4731
|
-
n.isFullscreen ? (k(), v("svg",
|
|
4740
|
+
n.isFullscreen ? (k(), v("svg", Gi, [...t[9] || (t[9] = [
|
|
4732
4741
|
p("path", {
|
|
4733
4742
|
"stroke-linecap": "round",
|
|
4734
4743
|
"stroke-linejoin": "round",
|
|
4735
4744
|
d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"
|
|
4736
4745
|
}, null, -1)
|
|
4737
|
-
])])) : (k(), v("svg",
|
|
4746
|
+
])])) : (k(), v("svg", Vi, [...t[8] || (t[8] = [
|
|
4738
4747
|
p("path", {
|
|
4739
4748
|
"stroke-linecap": "round",
|
|
4740
4749
|
"stroke-linejoin": "round",
|
|
4741
4750
|
d: "M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"
|
|
4742
4751
|
}, null, -1)
|
|
4743
4752
|
])]))
|
|
4744
|
-
], 10,
|
|
4753
|
+
], 10, Ki)) : B("", !0)
|
|
4745
4754
|
], 2)
|
|
4746
4755
|
], 2);
|
|
4747
4756
|
};
|
|
@@ -4782,7 +4791,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4782
4791
|
p("span", null, N(n.t("title") || D(le)("aiName")), 1)
|
|
4783
4792
|
])
|
|
4784
4793
|
]),
|
|
4785
|
-
(k(!0), v(
|
|
4794
|
+
(k(!0), v(be, null, Ne(n.messages, (i, a) => me(e.$slots, "message", {
|
|
4786
4795
|
key: i.id || a,
|
|
4787
4796
|
message: i,
|
|
4788
4797
|
isUser: i.role === "user",
|
|
@@ -4798,7 +4807,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4798
4807
|
n.quota.remaining === 0 ? (k(), v("div", Ji, [
|
|
4799
4808
|
p("button", {
|
|
4800
4809
|
type: "button",
|
|
4801
|
-
class: "inline-flex items-center gap-2 px-6 py-3 bg-primary text-white rounded-lg hover:bg-primary
|
|
4810
|
+
class: "inline-flex items-center gap-2 px-6 py-3 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-all shadow-sm",
|
|
4802
4811
|
onClick: t[1] || (t[1] = (i) => e.$emit("contact-support"))
|
|
4803
4812
|
}, [
|
|
4804
4813
|
t[4] || (t[4] = p("svg", {
|
|
@@ -4855,8 +4864,8 @@ const Do = /* @__PURE__ */ he({
|
|
|
4855
4864
|
},
|
|
4856
4865
|
emits: ["copy"],
|
|
4857
4866
|
setup(n) {
|
|
4858
|
-
return (e, t) => (k(), v(
|
|
4859
|
-
t[4] || (t[4] =
|
|
4867
|
+
return (e, t) => (k(), v(be, null, [
|
|
4868
|
+
t[4] || (t[4] = Nn('<div class="w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mb-5"><svg class="w-7 h-7 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"></path></svg></div><h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-1"> Almost there! </h2><p class="text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-sm text-center"> Configure the plugin in your app entry file to start using AI. </p>', 3)),
|
|
4860
4869
|
p("div", na, [
|
|
4861
4870
|
p("div", sa, [
|
|
4862
4871
|
p("div", ra, [
|
|
@@ -4867,7 +4876,7 @@ const Do = /* @__PURE__ */ he({
|
|
|
4867
4876
|
onClick: t[0] || (t[0] = (s) => e.$emit("copy"))
|
|
4868
4877
|
}, N(n.copied ? "✓ Copied" : "Copy"), 1)
|
|
4869
4878
|
]),
|
|
4870
|
-
t[2] || (t[2] =
|
|
4879
|
+
t[2] || (t[2] = Nn(`<pre class="text-xs text-gray-100 p-4 overflow-x-auto leading-relaxed"><code class="language-typescript"><span class="text-purple-400">import</span> { RestifyAiPlugin } <span class="text-purple-400">from</span> <span class="text-green-400">'@doderasoftware/restify-ai'</span>
|
|
4871
4880
|
|
|
4872
4881
|
app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
4873
4882
|
<span class="text-blue-300">endpoints</span>: {
|
|
@@ -4897,7 +4906,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4897
4906
|
}, la = { class: "text-lg font-semibold text-gray-900 dark:text-white" }, ua = {
|
|
4898
4907
|
key: 1,
|
|
4899
4908
|
class: "text-lg font-semibold text-gray-900 dark:text-white mb-2"
|
|
4900
|
-
}, ca = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, da = { class: "flex justify-end gap-3" },
|
|
4909
|
+
}, ca = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, da = { class: "flex justify-end gap-3" }, ss = /* @__PURE__ */ he({
|
|
4901
4910
|
__name: "ConfirmDialog",
|
|
4902
4911
|
props: {
|
|
4903
4912
|
show: { type: Boolean },
|
|
@@ -4916,7 +4925,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4916
4925
|
return e.icon === "warning" ? (r = e.ui) == null ? void 0 : r.historyLimitModal : (o = e.ui) == null ? void 0 : o.closeConfirmModal;
|
|
4917
4926
|
}), s = O(() => {
|
|
4918
4927
|
var i, a;
|
|
4919
|
-
const r = e.confirmVariant === "danger" ? "bg-red-600 hover:bg-red-700" : "bg-primary hover:bg-primary
|
|
4928
|
+
const r = e.confirmVariant === "danger" ? "bg-red-600 hover:bg-red-700" : "bg-primary-500 hover:bg-primary-600", o = e.confirmVariant === "danger" ? (i = e.ui) == null ? void 0 : i.closeConfirmButton : (a = e.ui) == null ? void 0 : a.historyLimitButton;
|
|
4920
4929
|
return [r, o];
|
|
4921
4930
|
});
|
|
4922
4931
|
return (r, o) => (k(), Me(mt, {
|
|
@@ -5007,28 +5016,28 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5007
5016
|
get: () => t.modelValue,
|
|
5008
5017
|
set: (_) => s("update:modelValue", _)
|
|
5009
5018
|
});
|
|
5010
|
-
function o(_,
|
|
5019
|
+
function o(_, K) {
|
|
5011
5020
|
var te;
|
|
5012
|
-
const
|
|
5013
|
-
if (
|
|
5014
|
-
let X =
|
|
5015
|
-
if (
|
|
5016
|
-
for (const [J, ue] of Object.entries(
|
|
5021
|
+
const G = (te = t.texts) == null ? void 0 : te[_];
|
|
5022
|
+
if (G) {
|
|
5023
|
+
let X = G;
|
|
5024
|
+
if (K)
|
|
5025
|
+
for (const [J, ue] of Object.entries(K))
|
|
5017
5026
|
X = X.replace(`{${J}}`, String(ue));
|
|
5018
5027
|
return X;
|
|
5019
5028
|
}
|
|
5020
|
-
return le(_,
|
|
5029
|
+
return le(_, K);
|
|
5021
5030
|
}
|
|
5022
|
-
const i =
|
|
5031
|
+
const i = We(), a = q(""), c = q(null), u = q(!1), d = q(!1), g = q(!1), { loadingMessage: b, startLoadingText: y, resetLoadingText: h } = Eo(
|
|
5023
5032
|
() => i.sending,
|
|
5024
5033
|
() => t.loadingText
|
|
5025
5034
|
), {
|
|
5026
5035
|
showHistoryLimitWarning: A,
|
|
5027
|
-
historyLimitReached:
|
|
5036
|
+
historyLimitReached: m,
|
|
5028
5037
|
historyLimitDialogTitle: f,
|
|
5029
5038
|
historyLimitDialogMessage: S,
|
|
5030
5039
|
dismissHistoryLimitWarning: C,
|
|
5031
|
-
handleHistoryLimitAction:
|
|
5040
|
+
handleHistoryLimitAction: w,
|
|
5032
5041
|
checkHistoryLimit: z,
|
|
5033
5042
|
setPendingMessage: F
|
|
5034
5043
|
} = Mo({
|
|
@@ -5038,18 +5047,18 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5038
5047
|
getTexts: () => t.texts,
|
|
5039
5048
|
onStartNewChat: () => i.clearChatHistory(),
|
|
5040
5049
|
onNewChatEmit: () => s("new-chat")
|
|
5041
|
-
}),
|
|
5042
|
-
if (
|
|
5043
|
-
const _ = a.value.toLowerCase().trim(),
|
|
5044
|
-
let
|
|
5050
|
+
}), V = O(() => !os()), E = O(() => tt("enableSupportMode") ?? !1), { suggestions: M, resolvePrompt: I } = Ms(), P = O(() => {
|
|
5051
|
+
if (V.value) return [];
|
|
5052
|
+
const _ = a.value.toLowerCase().trim(), K = M.value || [];
|
|
5053
|
+
let G = K;
|
|
5045
5054
|
if (_) {
|
|
5046
5055
|
const te = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), X = _.split(/\s+/).filter((J) => !te.has(J));
|
|
5047
|
-
X.length > 0 && (
|
|
5056
|
+
X.length > 0 && (G = K.filter((J) => {
|
|
5048
5057
|
const ue = `${J.title} ${J.description || ""}`.toLowerCase();
|
|
5049
5058
|
return X.every((Se) => ue.includes(Se));
|
|
5050
5059
|
}));
|
|
5051
5060
|
}
|
|
5052
|
-
return
|
|
5061
|
+
return G.slice(0, 5).map((te) => ({
|
|
5053
5062
|
id: te.id,
|
|
5054
5063
|
title: te.title,
|
|
5055
5064
|
description: te.description || ""
|
|
@@ -5070,8 +5079,8 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5070
5079
|
onCancel: () => i.cancelRequest()
|
|
5071
5080
|
}));
|
|
5072
5081
|
function Te(_) {
|
|
5073
|
-
const
|
|
5074
|
-
|
|
5082
|
+
const K = (M.value || []).find((G) => G.id === _.id);
|
|
5083
|
+
K && (a.value = I(K));
|
|
5075
5084
|
}
|
|
5076
5085
|
function ze() {
|
|
5077
5086
|
u.value = !u.value;
|
|
@@ -5080,10 +5089,10 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5080
5089
|
r.value = !1;
|
|
5081
5090
|
}
|
|
5082
5091
|
function He() {
|
|
5083
|
-
t.confirmClose && !
|
|
5092
|
+
t.confirmClose && !V.value && i.chatHistory.length > 0 ? g.value = !0 : (r.value = !1, s("close"));
|
|
5084
5093
|
}
|
|
5085
|
-
function
|
|
5086
|
-
|
|
5094
|
+
function wt() {
|
|
5095
|
+
g.value = !1, i.clearChatHistory(), r.value = !1, s("close");
|
|
5087
5096
|
}
|
|
5088
5097
|
function Bt() {
|
|
5089
5098
|
s("contact-support");
|
|
@@ -5118,16 +5127,16 @@ app.use(RestifyAiPlugin, {
|
|
|
5118
5127
|
}, 2e3);
|
|
5119
5128
|
}
|
|
5120
5129
|
async function Fe() {
|
|
5121
|
-
const _ = await
|
|
5130
|
+
const _ = await w();
|
|
5122
5131
|
_ && (await Oe(), await Ve(_.message, _.attachments, _.mentions, _.isSupportRequest));
|
|
5123
5132
|
}
|
|
5124
|
-
async function Ve(_,
|
|
5133
|
+
async function Ve(_, K, G, te) {
|
|
5125
5134
|
i.clearError(), y(), await Oe(), Y();
|
|
5126
|
-
const X = await i.askQuestion(_,
|
|
5135
|
+
const X = await i.askQuestion(_, K, G, te);
|
|
5127
5136
|
h(), X && Y();
|
|
5128
5137
|
}
|
|
5129
5138
|
async function Le(_) {
|
|
5130
|
-
const { message:
|
|
5139
|
+
const { message: K, attachments: G, mentions: te, isSupportRequest: X } = _;
|
|
5131
5140
|
if (i.sending) return;
|
|
5132
5141
|
const J = te.map((ue) => ({
|
|
5133
5142
|
id: ue.id,
|
|
@@ -5136,10 +5145,10 @@ app.use(RestifyAiPlugin, {
|
|
|
5136
5145
|
metadata: ue.metadata
|
|
5137
5146
|
}));
|
|
5138
5147
|
if (!z()) {
|
|
5139
|
-
F({ message:
|
|
5148
|
+
F({ message: K, attachments: G, mentions: J, isSupportRequest: X });
|
|
5140
5149
|
return;
|
|
5141
5150
|
}
|
|
5142
|
-
await Ve(
|
|
5151
|
+
await Ve(K, G, J, X);
|
|
5143
5152
|
}
|
|
5144
5153
|
async function St() {
|
|
5145
5154
|
y();
|
|
@@ -5147,7 +5156,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5147
5156
|
h(), _ && Y();
|
|
5148
5157
|
}
|
|
5149
5158
|
function Ge(_) {
|
|
5150
|
-
t.closeOnEscape && _.key === "Escape" && r.value && (
|
|
5159
|
+
t.closeOnEscape && _.key === "Escape" && r.value && (g.value ? g.value = !1 : Re());
|
|
5151
5160
|
}
|
|
5152
5161
|
return Ue(() => t.modelValue, (_) => {
|
|
5153
5162
|
_ && t.autoFetchQuota && i.fetchQuota();
|
|
@@ -5155,15 +5164,15 @@ app.use(RestifyAiPlugin, {
|
|
|
5155
5164
|
window.addEventListener("keydown", Ge);
|
|
5156
5165
|
}), yt(() => {
|
|
5157
5166
|
window.removeEventListener("keydown", Ge);
|
|
5158
|
-
}), (_,
|
|
5167
|
+
}), (_, K) => (k(), Me(Ws, { to: "body" }, [
|
|
5159
5168
|
ge(mt, { name: "rai-fade" }, {
|
|
5160
5169
|
default: Ce(() => {
|
|
5161
|
-
var
|
|
5170
|
+
var G;
|
|
5162
5171
|
return [
|
|
5163
5172
|
r.value && n.showBackdrop ? (k(), v("div", {
|
|
5164
5173
|
key: 0,
|
|
5165
|
-
class: T(["fixed inset-0 bg-black/30 z-40", (
|
|
5166
|
-
onClick:
|
|
5174
|
+
class: T(["fixed inset-0 bg-black/30 z-40", (G = n.ui) == null ? void 0 : G.backdrop]),
|
|
5175
|
+
onClick: K[0] || (K[0] = (te) => n.closeOnBackdropClick && Re())
|
|
5167
5176
|
}, null, 2)) : B("", !0)
|
|
5168
5177
|
];
|
|
5169
5178
|
}),
|
|
@@ -5173,23 +5182,23 @@ app.use(RestifyAiPlugin, {
|
|
|
5173
5182
|
name: n.position === "left" ? "rai-slide-right" : "rai-slide-left"
|
|
5174
5183
|
}, {
|
|
5175
5184
|
default: Ce(() => {
|
|
5176
|
-
var
|
|
5185
|
+
var G, te, X;
|
|
5177
5186
|
return [
|
|
5178
5187
|
r.value ? (k(), v("aside", {
|
|
5179
5188
|
key: 0,
|
|
5180
5189
|
class: T(["fixed bottom-0 z-50 flex-shrink-0 border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-2xl will-change-transform", [
|
|
5181
5190
|
n.position === "left" ? "left-0 border-r" : "right-0 border-l",
|
|
5182
|
-
(
|
|
5191
|
+
(G = n.ui) == null ? void 0 : G.drawer
|
|
5183
5192
|
]]),
|
|
5184
|
-
style:
|
|
5193
|
+
style: un({ width: u.value ? n.fullscreenWidth : n.width, top: n.topOffset, height: `calc(100vh - ${n.topOffset})` })
|
|
5185
5194
|
}, [
|
|
5186
5195
|
p("div", {
|
|
5187
5196
|
class: T(["h-full flex flex-col relative bg-white dark:bg-gray-900", (te = n.ui) == null ? void 0 : te.panel])
|
|
5188
5197
|
}, [
|
|
5189
|
-
me(_.$slots, "header",
|
|
5198
|
+
me(_.$slots, "header", Pn(zn(L.value)), () => [
|
|
5190
5199
|
ge(Qi, {
|
|
5191
5200
|
ui: n.ui,
|
|
5192
|
-
"is-setup-mode":
|
|
5201
|
+
"is-setup-mode": V.value,
|
|
5193
5202
|
"show-new-chat-button": n.showNewChatButton,
|
|
5194
5203
|
"has-history": D(i).chatHistory.length > 0,
|
|
5195
5204
|
"show-quota": n.showQuota,
|
|
@@ -5215,14 +5224,14 @@ app.use(RestifyAiPlugin, {
|
|
|
5215
5224
|
p("div", {
|
|
5216
5225
|
class: T(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl": u.value }, (X = n.ui) == null ? void 0 : X.body]])
|
|
5217
5226
|
}, [
|
|
5218
|
-
|
|
5227
|
+
V.value ? (k(), v("div", pa, [
|
|
5219
5228
|
me(_.$slots, "setup", {}, () => [
|
|
5220
5229
|
ge(oa, {
|
|
5221
5230
|
copied: d.value,
|
|
5222
5231
|
onCopy: Z
|
|
5223
5232
|
}, null, 8, ["copied"])
|
|
5224
5233
|
], !0)
|
|
5225
|
-
])) : (k(), v(
|
|
5234
|
+
])) : (k(), v(be, { key: 1 }, [
|
|
5226
5235
|
D(i).chatHistory.length === 0 ? (k(), v("div", ha, [
|
|
5227
5236
|
me(_.$slots, "empty-state", {
|
|
5228
5237
|
suggestions: P.value,
|
|
@@ -5238,7 +5247,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5238
5247
|
}, [
|
|
5239
5248
|
ge(ta, {
|
|
5240
5249
|
messages: D(i).chatHistory,
|
|
5241
|
-
"loading-message": D(
|
|
5250
|
+
"loading-message": D(b),
|
|
5242
5251
|
quota: D(i).quota,
|
|
5243
5252
|
error: D(i).error,
|
|
5244
5253
|
ui: n.ui,
|
|
@@ -5258,16 +5267,16 @@ app.use(RestifyAiPlugin, {
|
|
|
5258
5267
|
_: 3
|
|
5259
5268
|
}, 8, ["messages", "loading-message", "quota", "error", "ui"])
|
|
5260
5269
|
], 512)),
|
|
5261
|
-
|
|
5270
|
+
K[3] || (K[3] = p("div", {
|
|
5262
5271
|
id: "rai-chat-bottom",
|
|
5263
5272
|
class: "h-8"
|
|
5264
5273
|
}, null, -1)),
|
|
5265
|
-
me(_.$slots, "input",
|
|
5274
|
+
me(_.$slots, "input", Pn(zn(ne.value)), () => {
|
|
5266
5275
|
var J, ue;
|
|
5267
5276
|
return [
|
|
5268
5277
|
ge(Pi, {
|
|
5269
5278
|
modelValue: a.value,
|
|
5270
|
-
"onUpdate:modelValue":
|
|
5279
|
+
"onUpdate:modelValue": K[1] || (K[1] = (Se) => a.value = Se),
|
|
5271
5280
|
sending: D(i).sending,
|
|
5272
5281
|
placeholder: ((J = t.texts) == null ? void 0 : J.placeholder) || D(le)("inputPlaceholder"),
|
|
5273
5282
|
"support-placeholder": ((ue = t.texts) == null ? void 0 : ue.supportPlaceholder) || D(le)("supportPlaceholder"),
|
|
@@ -5290,23 +5299,23 @@ app.use(RestifyAiPlugin, {
|
|
|
5290
5299
|
], 64))
|
|
5291
5300
|
], 2)
|
|
5292
5301
|
], 2),
|
|
5293
|
-
ge(
|
|
5294
|
-
show:
|
|
5302
|
+
ge(ss, {
|
|
5303
|
+
show: g.value,
|
|
5295
5304
|
title: o("closeConfirmTitle"),
|
|
5296
5305
|
message: o("closeConfirmMessage"),
|
|
5297
5306
|
"confirm-text": o("confirmClose"),
|
|
5298
5307
|
"cancel-text": o("cancel"),
|
|
5299
5308
|
ui: n.ui,
|
|
5300
5309
|
"confirm-variant": "danger",
|
|
5301
|
-
onConfirm:
|
|
5302
|
-
onCancel:
|
|
5310
|
+
onConfirm: wt,
|
|
5311
|
+
onCancel: K[2] || (K[2] = (J) => g.value = !1)
|
|
5303
5312
|
}, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui"]),
|
|
5304
|
-
ge(
|
|
5313
|
+
ge(ss, {
|
|
5305
5314
|
show: D(A),
|
|
5306
5315
|
title: D(f),
|
|
5307
5316
|
message: D(S),
|
|
5308
5317
|
"confirm-text": o("startNewChat"),
|
|
5309
|
-
"cancel-text": D(
|
|
5318
|
+
"cancel-text": D(m) ? o("continueChat") : o("cancel"),
|
|
5310
5319
|
ui: n.ui,
|
|
5311
5320
|
icon: "warning",
|
|
5312
5321
|
"confirm-variant": "primary",
|
|
@@ -5386,7 +5395,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5386
5395
|
onFileUploadComplete: e.onFileUploadComplete,
|
|
5387
5396
|
onFileUploadError: e.onFileUploadError
|
|
5388
5397
|
};
|
|
5389
|
-
|
|
5398
|
+
Gs(t), n.provide("restify-ai-config", t);
|
|
5390
5399
|
}
|
|
5391
5400
|
};
|
|
5392
5401
|
export {
|
|
@@ -5396,14 +5405,14 @@ export {
|
|
|
5396
5405
|
Pi as ChatInput,
|
|
5397
5406
|
oi as ChatMessage,
|
|
5398
5407
|
zo as ChatMessageActions,
|
|
5399
|
-
|
|
5408
|
+
nt as ChatRoles,
|
|
5400
5409
|
Oo as MentionList,
|
|
5401
5410
|
Ea as RestifyAiPlugin,
|
|
5402
5411
|
Aa as UserAvatar,
|
|
5403
5412
|
Ea as default,
|
|
5404
5413
|
rs as defaultLabels,
|
|
5405
5414
|
gr as formatMentionsForApi,
|
|
5406
|
-
|
|
5415
|
+
tt as getConfigValue,
|
|
5407
5416
|
le as getLabel,
|
|
5408
5417
|
ee as getRestifyAiConfig,
|
|
5409
5418
|
xa as getRestifyAiConfigOrThrow,
|
|
@@ -5411,15 +5420,15 @@ export {
|
|
|
5411
5420
|
mr as groupMentionsByType,
|
|
5412
5421
|
os as isConfigured,
|
|
5413
5422
|
va as registerSuggestionProvider,
|
|
5414
|
-
|
|
5423
|
+
Gs as setRestifyAiConfig,
|
|
5415
5424
|
Cs as useAiContext,
|
|
5416
5425
|
Sa as useAiDrawerShortcut,
|
|
5417
5426
|
Ms as useAiSuggestions,
|
|
5418
|
-
|
|
5427
|
+
wa as useChatErrorHandling,
|
|
5419
5428
|
ko as useChatMarkdown,
|
|
5420
|
-
|
|
5429
|
+
ba as useChatScroll,
|
|
5421
5430
|
Co as useKeyboardShortcut,
|
|
5422
5431
|
ka as useMentionParsing,
|
|
5423
5432
|
Ta as usePageAiContext,
|
|
5424
|
-
|
|
5433
|
+
We as useRestifyAiStore
|
|
5425
5434
|
};
|