@doderasoftware/restify-ai 0.1.0-beta.8 → 0.1.0-beta.9
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/components/AiChatDrawer.vue.d.ts +4 -0
- package/dist/components/AiChatDrawer.vue.d.ts.map +1 -1
- package/dist/components/drawer/DrawerHeader.vue.d.ts +4 -0
- package/dist/components/drawer/DrawerHeader.vue.d.ts.map +1 -1
- package/dist/restify-ai.js +695 -676
- package/dist/restify-ai.umd.cjs +46 -46
- package/dist/style.css +1 -1
- package/dist/types/texts.d.ts +1 -0
- package/dist/types/texts.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/restify-ai.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var W = (n, e, t) =>
|
|
4
|
-
import { ref as U, nextTick as _e, onUnmounted as yt, computed as N, onMounted as xt, watch as Ue, isRef as Fs, onBeforeUnmount as
|
|
1
|
+
var Hs = Object.defineProperty;
|
|
2
|
+
var Bs = (n, e, t) => e in n ? Hs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var W = (n, e, t) => Bs(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ref as U, nextTick as _e, onUnmounted as yt, computed as N, onMounted as xt, watch as Ue, isRef as Fs, onBeforeUnmount as Us, defineComponent as ce, createElementBlock as v, openBlock as x, normalizeClass as b, renderSlot as le, createElementVNode as h, createCommentVNode as F, Fragment as ke, renderList as Ne, toDisplayString as O, createBlock as Me, resolveDynamicComponent as nn, withCtx as Ce, createVNode as me, normalizeStyle as un, Transition as mt, withModifiers as et, unref as D, withDirectives as qs, vModelText as js, createTextVNode as rs, createStaticVNode as Nn, Teleport as Ws, normalizeProps as Pn, guardReactiveProps as zn, onErrorCaptured as Ks } from "vue";
|
|
5
5
|
import { defineStore as Vs } from "pinia";
|
|
6
6
|
let qe = null;
|
|
7
|
-
const Gs = U(null),
|
|
7
|
+
const Gs = U(null), os = {
|
|
8
8
|
title: "AI Assistant",
|
|
9
9
|
aiName: "AI Assistant",
|
|
10
10
|
you: "You",
|
|
@@ -64,24 +64,24 @@ function Qs(n) {
|
|
|
64
64
|
function ee() {
|
|
65
65
|
return qe;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function ka() {
|
|
68
68
|
if (!qe)
|
|
69
69
|
throw new Error(
|
|
70
70
|
"[@doderasoftware/restify-ai] Plugin not initialized. Make sure to call app.use(RestifyAiPlugin, config) before using the components."
|
|
71
71
|
);
|
|
72
72
|
return qe;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function is() {
|
|
75
75
|
return qe !== null;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ue(n, e) {
|
|
78
78
|
const t = qe, s = (t == null ? void 0 : t.labels) || {}, r = t == null ? void 0 : t.translate;
|
|
79
79
|
if (r) {
|
|
80
80
|
const i = r(n, e);
|
|
81
81
|
if (i !== n)
|
|
82
82
|
return i;
|
|
83
83
|
}
|
|
84
|
-
let o = s[n] ||
|
|
84
|
+
let o = s[n] || os[n];
|
|
85
85
|
return e && Object.entries(e).forEach(([i, a]) => {
|
|
86
86
|
o = o.replace(`{${i}}`, String(a));
|
|
87
87
|
}), o;
|
|
@@ -118,37 +118,37 @@ function Ys(n) {
|
|
|
118
118
|
return function(i) {
|
|
119
119
|
e === void 0 ? (e = i, t = 0, s = -1) : e = Js(e, i);
|
|
120
120
|
const a = e.length;
|
|
121
|
-
let
|
|
121
|
+
let u = 0;
|
|
122
122
|
for (; t < a; ) {
|
|
123
|
-
r && (e[t] === 10 && (
|
|
124
|
-
let
|
|
125
|
-
for (; t < a &&
|
|
123
|
+
r && (e[t] === 10 && (u = ++t), r = !1);
|
|
124
|
+
let c = -1;
|
|
125
|
+
for (; t < a && c === -1; ++t)
|
|
126
126
|
switch (e[t]) {
|
|
127
127
|
case 58:
|
|
128
|
-
s === -1 && (s = t -
|
|
128
|
+
s === -1 && (s = t - u);
|
|
129
129
|
break;
|
|
130
130
|
case 13:
|
|
131
131
|
r = !0;
|
|
132
132
|
case 10:
|
|
133
|
-
|
|
133
|
+
c = t;
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
|
-
if (
|
|
136
|
+
if (c === -1)
|
|
137
137
|
break;
|
|
138
|
-
n(e.subarray(
|
|
138
|
+
n(e.subarray(u, c), s), u = t, s = -1;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
u === a ? e = void 0 : u !== 0 && (e = e.subarray(u), t -= u);
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
function Xs(n, e, t) {
|
|
144
|
-
let s =
|
|
144
|
+
let s = Bn();
|
|
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 = Bn();
|
|
149
149
|
else if (a > 0) {
|
|
150
|
-
const
|
|
151
|
-
switch (
|
|
150
|
+
const u = r.decode(i.subarray(0, a)), c = a + (i[a + 1] === 32 ? 2 : 1), d = r.decode(i.subarray(c));
|
|
151
|
+
switch (u) {
|
|
152
152
|
case "data":
|
|
153
153
|
s.data = s.data ? s.data + `
|
|
154
154
|
` + d : d;
|
|
@@ -160,8 +160,8 @@ function Xs(n, e, t) {
|
|
|
160
160
|
n(s.id = d);
|
|
161
161
|
break;
|
|
162
162
|
case "retry":
|
|
163
|
-
const
|
|
164
|
-
isNaN(
|
|
163
|
+
const p = parseInt(d, 10);
|
|
164
|
+
isNaN(p) || e(s.retry = p);
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -171,7 +171,7 @@ function Js(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 Bn() {
|
|
175
175
|
return {
|
|
176
176
|
data: "",
|
|
177
177
|
event: "",
|
|
@@ -187,39 +187,39 @@ var er = 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", tr = 1e3,
|
|
190
|
+
const sn = "text/event-stream", tr = 1e3, Fn = "last-event-id";
|
|
191
191
|
function nr(n, e) {
|
|
192
|
-
var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden:
|
|
193
|
-
return new Promise((
|
|
192
|
+
var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: c } = e, d = er(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
193
|
+
return new Promise((p, w) => {
|
|
194
194
|
const m = Object.assign({}, s);
|
|
195
195
|
m.accept || (m.accept = sn);
|
|
196
|
-
let
|
|
196
|
+
let f;
|
|
197
197
|
function A() {
|
|
198
|
-
|
|
198
|
+
f.abort(), document.hidden || z();
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
u || document.addEventListener("visibilitychange", A);
|
|
201
201
|
let y = tr, g = 0;
|
|
202
202
|
function S() {
|
|
203
|
-
document.removeEventListener("visibilitychange", A), window.clearTimeout(g),
|
|
203
|
+
document.removeEventListener("visibilitychange", A), window.clearTimeout(g), f.abort();
|
|
204
204
|
}
|
|
205
205
|
t == null || t.addEventListener("abort", () => {
|
|
206
|
-
S(),
|
|
206
|
+
S(), p();
|
|
207
207
|
});
|
|
208
|
-
const C =
|
|
208
|
+
const C = c ?? window.fetch, T = r ?? sr;
|
|
209
209
|
async function z() {
|
|
210
|
-
var
|
|
211
|
-
|
|
210
|
+
var B;
|
|
211
|
+
f = new AbortController();
|
|
212
212
|
try {
|
|
213
|
-
const V = await C(n, Object.assign(Object.assign({}, d), { headers: m, signal:
|
|
213
|
+
const V = await C(n, Object.assign(Object.assign({}, d), { headers: m, signal: f.signal }));
|
|
214
214
|
await T(V), await Zs(V.body, Ys(Xs((E) => {
|
|
215
|
-
E ? m[
|
|
215
|
+
E ? m[Fn] = E : delete m[Fn];
|
|
216
216
|
}, (E) => {
|
|
217
217
|
y = E;
|
|
218
|
-
}, o))), i == null || i(), S(),
|
|
218
|
+
}, o))), i == null || i(), S(), p();
|
|
219
219
|
} catch (V) {
|
|
220
|
-
if (!
|
|
220
|
+
if (!f.signal.aborted)
|
|
221
221
|
try {
|
|
222
|
-
const E = (
|
|
222
|
+
const E = (B = a == null ? void 0 : a(V)) !== null && B !== void 0 ? B : y;
|
|
223
223
|
window.clearTimeout(g), g = window.setTimeout(z, E);
|
|
224
224
|
} catch (E) {
|
|
225
225
|
S(), w(E);
|
|
@@ -403,7 +403,7 @@ const We = Vs("restifyAiStore", {
|
|
|
403
403
|
timestamp: Date.now(),
|
|
404
404
|
quotaExceeded: !1
|
|
405
405
|
}), {
|
|
406
|
-
chatHistoryLimit: tt("chatHistoryLimit") ||
|
|
406
|
+
chatHistoryLimit: tt("chatHistoryLimit") || 20,
|
|
407
407
|
chatHistory: n.history,
|
|
408
408
|
uploadedFiles: ar(n.history),
|
|
409
409
|
loading: !1,
|
|
@@ -414,7 +414,7 @@ const We = Vs("restifyAiStore", {
|
|
|
414
414
|
quota: { limit: 100, used: 0, remaining: 100 },
|
|
415
415
|
error: t,
|
|
416
416
|
supportRequestMode: !1,
|
|
417
|
-
setupState: !
|
|
417
|
+
setupState: !is() && !fr() ? { ...qn(), isActive: !0 } : qn()
|
|
418
418
|
};
|
|
419
419
|
},
|
|
420
420
|
getters: {
|
|
@@ -438,27 +438,27 @@ const We = Vs("restifyAiStore", {
|
|
|
438
438
|
if (!r)
|
|
439
439
|
return console.warn("[RestifyAi] Cannot ask question - plugin not configured"), !1;
|
|
440
440
|
let o = "", i = !1;
|
|
441
|
-
const a = r.retry || {},
|
|
441
|
+
const a = r.retry || {}, u = a.maxRetries ?? 0, c = a.retryDelay ?? 1e3;
|
|
442
442
|
let d = 0;
|
|
443
|
-
const
|
|
444
|
-
id:
|
|
445
|
-
name:
|
|
446
|
-
url:
|
|
447
|
-
type:
|
|
448
|
-
size:
|
|
449
|
-
extractedText:
|
|
443
|
+
const p = e.map((f) => ({
|
|
444
|
+
id: f.id,
|
|
445
|
+
name: f.name,
|
|
446
|
+
url: f.url,
|
|
447
|
+
type: f.type,
|
|
448
|
+
size: f.size,
|
|
449
|
+
extractedText: f.extractedText
|
|
450
450
|
}));
|
|
451
451
|
this.chatHistory.push({
|
|
452
452
|
id: crypto.randomUUID(),
|
|
453
453
|
role: nt.User,
|
|
454
454
|
message: n,
|
|
455
455
|
loading: !1,
|
|
456
|
-
attachments:
|
|
456
|
+
attachments: p,
|
|
457
457
|
mentions: t,
|
|
458
458
|
timestamp: Date.now()
|
|
459
|
-
}),
|
|
459
|
+
}), p.forEach((f) => this.registerUploadedFile(f)), $t(this.chatHistory), this.sending = !0, this.chatHistory.length >= this.chatHistoryLimit && ((m = r.onError) == null || m.call(r, new Error("Chat history limit reached")));
|
|
460
460
|
const w = async () => {
|
|
461
|
-
var
|
|
461
|
+
var f, A, y;
|
|
462
462
|
try {
|
|
463
463
|
const g = this.chatHistory.map((L) => ({
|
|
464
464
|
role: L.role,
|
|
@@ -476,7 +476,7 @@ const We = Vs("restifyAiStore", {
|
|
|
476
476
|
Object.values(this.uploadedFiles).forEach(C), this.chatHistory.forEach((L) => {
|
|
477
477
|
var ne;
|
|
478
478
|
return (ne = L.attachments) == null ? void 0 : ne.forEach(C);
|
|
479
|
-
}),
|
|
479
|
+
}), p.forEach(C);
|
|
480
480
|
const T = Object.values(S), z = this.chatHistory.length;
|
|
481
481
|
this.chatHistory.push({
|
|
482
482
|
id: crypto.randomUUID(),
|
|
@@ -485,12 +485,12 @@ const We = Vs("restifyAiStore", {
|
|
|
485
485
|
loading: !0,
|
|
486
486
|
timestamp: Date.now()
|
|
487
487
|
}), $t(this.chatHistory), it = new AbortController();
|
|
488
|
-
const
|
|
488
|
+
const B = await r.getAuthToken(), E = {
|
|
489
489
|
"Content-Type": "application/json",
|
|
490
490
|
Accept: "application/vnd.api+json",
|
|
491
491
|
...r.getCustomHeaders ? await r.getCustomHeaders() : {}
|
|
492
492
|
};
|
|
493
|
-
this.setupState.isActive && this.setupState.testApiKey ? E["X-Test-Api-Key"] = this.setupState.testApiKey :
|
|
493
|
+
this.setupState.isActive && this.setupState.testApiKey ? E["X-Test-Api-Key"] = this.setupState.testApiKey : B && (E.Authorization = `Bearer ${B}`);
|
|
494
494
|
let M = {
|
|
495
495
|
question: n,
|
|
496
496
|
history: g,
|
|
@@ -499,7 +499,7 @@ const We = Vs("restifyAiStore", {
|
|
|
499
499
|
...t.length > 0 && { mentions: t },
|
|
500
500
|
...this.supportRequestMode && { contact_support: !0 }
|
|
501
501
|
};
|
|
502
|
-
r.beforeSend && (M = await r.beforeSend(M)), r.buildRequest && (M = await r.buildRequest(M)), (
|
|
502
|
+
r.beforeSend && (M = await r.beforeSend(M)), r.buildRequest && (M = await r.buildRequest(M)), (f = r.onMessageSent) == null || f.call(r, this.chatHistory[z - 1]);
|
|
503
503
|
const I = It(r.endpoints.ask);
|
|
504
504
|
let P = {
|
|
505
505
|
method: "POST",
|
|
@@ -517,9 +517,9 @@ const We = Vs("restifyAiStore", {
|
|
|
517
517
|
if (L.status === 429) {
|
|
518
518
|
const ne = We();
|
|
519
519
|
throw ne.error = {
|
|
520
|
-
message:
|
|
520
|
+
message: ue("noQuota"),
|
|
521
521
|
failedQuestion: n,
|
|
522
|
-
failedAttachments:
|
|
522
|
+
failedAttachments: p,
|
|
523
523
|
timestamp: Date.now(),
|
|
524
524
|
quotaExceeded: !0
|
|
525
525
|
}, await ne.fetchQuota(), new Error("Quota exceeded");
|
|
@@ -546,10 +546,10 @@ const We = Vs("restifyAiStore", {
|
|
|
546
546
|
} catch (g) {
|
|
547
547
|
i = !0;
|
|
548
548
|
const S = this.chatHistory.length - 1;
|
|
549
|
-
return this.chatHistory.splice(S, 1), g.name === "AbortError" ? !0 : d <
|
|
549
|
+
return this.chatHistory.splice(S, 1), g.name === "AbortError" ? !0 : d < u && (a.shouldRetry ? a.shouldRetry(g, d) : !0) ? (d++, await ir(c * d), w()) : (this.error = {
|
|
550
550
|
message: rr(g),
|
|
551
551
|
failedQuestion: n,
|
|
552
|
-
failedAttachments:
|
|
552
|
+
failedAttachments: p,
|
|
553
553
|
timestamp: Date.now()
|
|
554
554
|
}, cr({
|
|
555
555
|
message: this.error.message,
|
|
@@ -604,11 +604,11 @@ const We = Vs("restifyAiStore", {
|
|
|
604
604
|
}
|
|
605
605
|
});
|
|
606
606
|
if (i.ok) {
|
|
607
|
-
const a = await i.json(),
|
|
607
|
+
const a = await i.json(), u = a.data ?? a;
|
|
608
608
|
this.quota = {
|
|
609
|
-
limit:
|
|
610
|
-
used:
|
|
611
|
-
remaining:
|
|
609
|
+
limit: u.limit ?? this.quota.limit,
|
|
610
|
+
used: u.used ?? this.quota.used,
|
|
611
|
+
remaining: u.remaining ?? this.quota.remaining
|
|
612
612
|
}, this.quota.remaining === 0 && n.enableSupportMode !== !1 && (this.supportRequestMode = !0), (t = n.onQuotaFetched) == null || t.call(n, this.quota);
|
|
613
613
|
}
|
|
614
614
|
} catch (s) {
|
|
@@ -616,7 +616,7 @@ const We = Vs("restifyAiStore", {
|
|
|
616
616
|
}
|
|
617
617
|
},
|
|
618
618
|
async uploadFile(n) {
|
|
619
|
-
var r, o, i, a,
|
|
619
|
+
var r, o, i, a, u;
|
|
620
620
|
const e = ee();
|
|
621
621
|
if (!((r = e == null ? void 0 : e.endpoints) != null && r.uploadFile))
|
|
622
622
|
return console.warn("[RestifyAi] No uploadFile endpoint configured"), null;
|
|
@@ -630,9 +630,9 @@ const We = Vs("restifyAiStore", {
|
|
|
630
630
|
};
|
|
631
631
|
(o = e.onFileUploadStart) == null || o.call(e, s);
|
|
632
632
|
try {
|
|
633
|
-
const
|
|
633
|
+
const c = await e.getAuthToken(), d = e.getCustomHeaders ? await e.getCustomHeaders() : {}, p = It(e.endpoints.uploadFile), w = new FormData();
|
|
634
634
|
w.append("file", n);
|
|
635
|
-
const m = await new Promise((
|
|
635
|
+
const m = await new Promise((f, A) => {
|
|
636
636
|
const y = new XMLHttpRequest();
|
|
637
637
|
y.upload.addEventListener("progress", (g) => {
|
|
638
638
|
var S;
|
|
@@ -651,18 +651,18 @@ const We = Vs("restifyAiStore", {
|
|
|
651
651
|
uploading: !1,
|
|
652
652
|
progress: 100
|
|
653
653
|
};
|
|
654
|
-
|
|
654
|
+
f(T);
|
|
655
655
|
} catch {
|
|
656
656
|
A(new Error("Failed to parse upload response"));
|
|
657
657
|
}
|
|
658
658
|
else
|
|
659
659
|
A(new Error(`Upload failed: ${y.status}`));
|
|
660
|
-
}), y.addEventListener("error", () => A(new Error("Upload failed"))), y.open("POST",
|
|
660
|
+
}), y.addEventListener("error", () => A(new Error("Upload failed"))), y.open("POST", p), c && y.setRequestHeader("Authorization", `Bearer ${c}`), Object.entries(d).forEach(([g, S]) => y.setRequestHeader(g, S)), y.send(w);
|
|
661
661
|
});
|
|
662
662
|
return (i = e.onFileUploadComplete) == null || i.call(e, m), m;
|
|
663
|
-
} catch (
|
|
663
|
+
} catch (c) {
|
|
664
664
|
const d = { ...s, uploading: !1 };
|
|
665
|
-
return (a = e.onFileUploadError) == null || a.call(e, d,
|
|
665
|
+
return (a = e.onFileUploadError) == null || a.call(e, d, c), (u = e.onError) == null || u.call(e, c), null;
|
|
666
666
|
}
|
|
667
667
|
},
|
|
668
668
|
setPageContext(n) {
|
|
@@ -738,15 +738,15 @@ const We = Vs("restifyAiStore", {
|
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
740
|
});
|
|
741
|
-
function
|
|
741
|
+
function as(n) {
|
|
742
742
|
const e = /@\[([^\]]+)\]\(([^)]+)\)/g, t = [];
|
|
743
743
|
let s = n, r;
|
|
744
744
|
for (; (r = e.exec(n)) !== null; ) {
|
|
745
|
-
const [o, i, a] = r, [
|
|
745
|
+
const [o, i, a] = r, [u, c] = a.includes(":") ? a.split(":") : ["default", a];
|
|
746
746
|
t.push({
|
|
747
|
-
id:
|
|
747
|
+
id: c,
|
|
748
748
|
name: i,
|
|
749
|
-
type:
|
|
749
|
+
type: u
|
|
750
750
|
}), s = s.replace(o, i);
|
|
751
751
|
}
|
|
752
752
|
return {
|
|
@@ -755,16 +755,16 @@ function is(n) {
|
|
|
755
755
|
};
|
|
756
756
|
}
|
|
757
757
|
function gr(n) {
|
|
758
|
-
const { cleanText: e } =
|
|
758
|
+
const { cleanText: e } = as(n);
|
|
759
759
|
return e;
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function ls(n) {
|
|
762
762
|
return n.replace(
|
|
763
763
|
/@([A-Z][a-z]+(?:\s+[A-Z][a-z]+)*)/g,
|
|
764
764
|
'<span class="rai-mention">@$1</span>'
|
|
765
765
|
);
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function us(n, e) {
|
|
768
768
|
const s = n.substring(0, e).match(/@(\w*)$/);
|
|
769
769
|
return s ? {
|
|
770
770
|
inMention: !0,
|
|
@@ -780,19 +780,19 @@ function cn(n, e) {
|
|
|
780
780
|
var t, s;
|
|
781
781
|
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";
|
|
782
782
|
}
|
|
783
|
-
function
|
|
783
|
+
function cs(n, e) {
|
|
784
784
|
var t, s;
|
|
785
785
|
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;
|
|
786
786
|
}
|
|
787
787
|
function mr(n, e) {
|
|
788
788
|
return e != null && e.buildMentionText ? e.buildMentionText(n) : `@[${cn(n, e)}](${n.type}:${n.id})`;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function ds(n) {
|
|
791
791
|
var t;
|
|
792
792
|
const e = ee();
|
|
793
793
|
return (t = e == null ? void 0 : e.mentionProviders) == null ? void 0 : t.find((s) => s.type === n);
|
|
794
794
|
}
|
|
795
|
-
function
|
|
795
|
+
function hs(n) {
|
|
796
796
|
const e = ee(), t = (e == null ? void 0 : e.mentionProviders) || [];
|
|
797
797
|
return n ? t.filter((s) => s.routes ? s.routes.some((r) => r.endsWith("*") ? n.startsWith(r.slice(0, -1)) : n === r || n.startsWith(r + "/")) : !0) : t;
|
|
798
798
|
}
|
|
@@ -811,15 +811,15 @@ function xr(n) {
|
|
|
811
811
|
}
|
|
812
812
|
function ba() {
|
|
813
813
|
return {
|
|
814
|
-
extractMentions:
|
|
814
|
+
extractMentions: as,
|
|
815
815
|
parseAndCleanMessage: gr,
|
|
816
|
-
renderMentionsInHtml:
|
|
817
|
-
detectMentionContext:
|
|
816
|
+
renderMentionsInHtml: ls,
|
|
817
|
+
detectMentionContext: us,
|
|
818
818
|
getMentionDisplayName: cn,
|
|
819
|
-
getMentionSubtitle:
|
|
819
|
+
getMentionSubtitle: cs,
|
|
820
820
|
buildMentionText: mr,
|
|
821
|
-
getMentionProvider:
|
|
822
|
-
getActiveMentionProviders:
|
|
821
|
+
getMentionProvider: ds,
|
|
822
|
+
getActiveMentionProviders: hs,
|
|
823
823
|
formatMentionsForApi: yr,
|
|
824
824
|
groupMentionsByType: xr
|
|
825
825
|
};
|
|
@@ -839,10 +839,10 @@ function dn() {
|
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
841
|
let Ke = dn();
|
|
842
|
-
function
|
|
842
|
+
function ps(n) {
|
|
843
843
|
Ke = n;
|
|
844
844
|
}
|
|
845
|
-
const
|
|
845
|
+
const fs = /[&<>"']/, wr = new RegExp(fs.source, "g"), gs = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, kr = new RegExp(gs.source, "g"), br = {
|
|
846
846
|
"&": "&",
|
|
847
847
|
"<": "<",
|
|
848
848
|
">": ">",
|
|
@@ -851,10 +851,10 @@ const ps = /[&<>"']/, kr = new RegExp(ps.source, "g"), fs = /[<>"']|&(?!(#\d{1,7
|
|
|
851
851
|
}, jn = (n) => br[n];
|
|
852
852
|
function ye(n, e) {
|
|
853
853
|
if (e) {
|
|
854
|
-
if (
|
|
855
|
-
return n.replace(
|
|
856
|
-
} else if (
|
|
857
|
-
return n.replace(
|
|
854
|
+
if (fs.test(n))
|
|
855
|
+
return n.replace(wr, jn);
|
|
856
|
+
} else if (gs.test(n))
|
|
857
|
+
return n.replace(kr, jn);
|
|
858
858
|
return n;
|
|
859
859
|
}
|
|
860
860
|
const vr = /(^|[^\[])\^/g;
|
|
@@ -881,10 +881,10 @@ function Wn(n) {
|
|
|
881
881
|
const ft = { exec: () => null };
|
|
882
882
|
function Kn(n, e) {
|
|
883
883
|
const t = n.replace(/\|/g, (o, i, a) => {
|
|
884
|
-
let
|
|
885
|
-
for (; --
|
|
886
|
-
|
|
887
|
-
return
|
|
884
|
+
let u = !1, c = i;
|
|
885
|
+
for (; --c >= 0 && a[c] === "\\"; )
|
|
886
|
+
u = !u;
|
|
887
|
+
return u ? "|" : " |";
|
|
888
888
|
}), s = t.split(/ \|/);
|
|
889
889
|
let r = 0;
|
|
890
890
|
if (s[0].trim() || s.shift(), s.length > 0 && !s[s.length - 1].trim() && s.pop(), e)
|
|
@@ -1033,39 +1033,39 @@ class Pt {
|
|
|
1033
1033
|
const i = [];
|
|
1034
1034
|
for (; s.length > 0; ) {
|
|
1035
1035
|
let a = !1;
|
|
1036
|
-
const
|
|
1037
|
-
let
|
|
1038
|
-
for (
|
|
1039
|
-
if (/^ {0,3}>/.test(s[
|
|
1040
|
-
|
|
1036
|
+
const u = [];
|
|
1037
|
+
let c;
|
|
1038
|
+
for (c = 0; c < s.length; c++)
|
|
1039
|
+
if (/^ {0,3}>/.test(s[c]))
|
|
1040
|
+
u.push(s[c]), a = !0;
|
|
1041
1041
|
else if (!a)
|
|
1042
|
-
|
|
1042
|
+
u.push(s[c]);
|
|
1043
1043
|
else
|
|
1044
1044
|
break;
|
|
1045
|
-
s = s.slice(
|
|
1046
|
-
const d =
|
|
1047
|
-
`),
|
|
1045
|
+
s = s.slice(c);
|
|
1046
|
+
const d = u.join(`
|
|
1047
|
+
`), p = d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
|
|
1048
1048
|
$1`).replace(/^ {0,3}>[ \t]?/gm, "");
|
|
1049
1049
|
r = r ? `${r}
|
|
1050
1050
|
${d}` : d, o = o ? `${o}
|
|
1051
|
-
${
|
|
1051
|
+
${p}` : p;
|
|
1052
1052
|
const w = this.lexer.state.top;
|
|
1053
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1053
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, i, !0), this.lexer.state.top = w, s.length === 0)
|
|
1054
1054
|
break;
|
|
1055
1055
|
const m = i[i.length - 1];
|
|
1056
1056
|
if ((m == null ? void 0 : m.type) === "code")
|
|
1057
1057
|
break;
|
|
1058
1058
|
if ((m == null ? void 0 : m.type) === "blockquote") {
|
|
1059
|
-
const
|
|
1059
|
+
const f = m, A = f.raw + `
|
|
1060
1060
|
` + s.join(`
|
|
1061
1061
|
`), y = this.blockquote(A);
|
|
1062
|
-
i[i.length - 1] = y, r = r.substring(0, r.length -
|
|
1062
|
+
i[i.length - 1] = y, r = r.substring(0, r.length - f.raw.length) + y.raw, o = o.substring(0, o.length - f.text.length) + y.text;
|
|
1063
1063
|
break;
|
|
1064
1064
|
} else if ((m == null ? void 0 : m.type) === "list") {
|
|
1065
|
-
const
|
|
1065
|
+
const f = m, A = f.raw + `
|
|
1066
1066
|
` + s.join(`
|
|
1067
1067
|
`), y = this.list(A);
|
|
1068
|
-
i[i.length - 1] = y, r = r.substring(0, r.length - m.raw.length) + y.raw, o = o.substring(0, o.length -
|
|
1068
|
+
i[i.length - 1] = y, r = r.substring(0, r.length - m.raw.length) + y.raw, o = o.substring(0, o.length - f.raw.length) + y.raw, s = A.substring(i[i.length - 1].raw.length).split(`
|
|
1069
1069
|
`);
|
|
1070
1070
|
continue;
|
|
1071
1071
|
}
|
|
@@ -1094,56 +1094,56 @@ ${f}` : f;
|
|
|
1094
1094
|
const i = new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`);
|
|
1095
1095
|
let a = !1;
|
|
1096
1096
|
for (; e; ) {
|
|
1097
|
-
let
|
|
1097
|
+
let u = !1, c = "", d = "";
|
|
1098
1098
|
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
1099
1099
|
break;
|
|
1100
|
-
|
|
1101
|
-
let
|
|
1100
|
+
c = t[0], e = e.substring(c.length);
|
|
1101
|
+
let p = t[2].split(`
|
|
1102
1102
|
`, 1)[0].replace(/^\t+/, (g) => " ".repeat(3 * g.length)), w = e.split(`
|
|
1103
|
-
`, 1)[0], m = !
|
|
1104
|
-
if (this.options.pedantic ? (
|
|
1105
|
-
`, e = e.substring(w.length + 1),
|
|
1106
|
-
const g = new RegExp(`^ {0,${Math.min(3,
|
|
1103
|
+
`, 1)[0], m = !p.trim(), f = 0;
|
|
1104
|
+
if (this.options.pedantic ? (f = 2, d = p.trimStart()) : m ? f = t[1].length + 1 : (f = t[2].search(/[^ ]/), f = f > 4 ? 1 : f, d = p.slice(f), f += t[1].length), m && /^[ \t]*$/.test(w) && (c += w + `
|
|
1105
|
+
`, e = e.substring(w.length + 1), u = !0), !u) {
|
|
1106
|
+
const g = new RegExp(`^ {0,${Math.min(3, f - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, f - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, f - 1)}}(?:\`\`\`|~~~)`), T = new RegExp(`^ {0,${Math.min(3, f - 1)}}#`), z = new RegExp(`^ {0,${Math.min(3, f - 1)}}<(?:[a-z].*>|!--)`, "i");
|
|
1107
1107
|
for (; e; ) {
|
|
1108
|
-
const
|
|
1108
|
+
const B = e.split(`
|
|
1109
1109
|
`, 1)[0];
|
|
1110
1110
|
let V;
|
|
1111
|
-
if (w =
|
|
1111
|
+
if (w = B, this.options.pedantic ? (w = w.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "), V = w) : V = w.replace(/\t/g, " "), C.test(w) || T.test(w) || z.test(w) || g.test(w) || S.test(w))
|
|
1112
1112
|
break;
|
|
1113
|
-
if (V.search(/[^ ]/) >=
|
|
1113
|
+
if (V.search(/[^ ]/) >= f || !w.trim())
|
|
1114
1114
|
d += `
|
|
1115
|
-
` + V.slice(
|
|
1115
|
+
` + V.slice(f);
|
|
1116
1116
|
else {
|
|
1117
|
-
if (m ||
|
|
1117
|
+
if (m || p.replace(/\t/g, " ").search(/[^ ]/) >= 4 || C.test(p) || T.test(p) || S.test(p))
|
|
1118
1118
|
break;
|
|
1119
1119
|
d += `
|
|
1120
1120
|
` + w;
|
|
1121
1121
|
}
|
|
1122
|
-
!m && !w.trim() && (m = !0),
|
|
1123
|
-
`, e = e.substring(
|
|
1122
|
+
!m && !w.trim() && (m = !0), c += B + `
|
|
1123
|
+
`, e = e.substring(B.length + 1), p = V.slice(f);
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(
|
|
1126
|
+
o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(c) && (a = !0));
|
|
1127
1127
|
let A = null, y;
|
|
1128
1128
|
this.options.gfm && (A = /^\[[ xX]\] /.exec(d), A && (y = A[0] !== "[ ] ", d = d.replace(/^\[[ xX]\] +/, ""))), o.items.push({
|
|
1129
1129
|
type: "list_item",
|
|
1130
|
-
raw:
|
|
1130
|
+
raw: c,
|
|
1131
1131
|
task: !!A,
|
|
1132
1132
|
checked: y,
|
|
1133
1133
|
loose: !1,
|
|
1134
1134
|
text: d,
|
|
1135
1135
|
tokens: []
|
|
1136
|
-
}), o.raw +=
|
|
1136
|
+
}), o.raw += c;
|
|
1137
1137
|
}
|
|
1138
1138
|
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();
|
|
1139
|
-
for (let
|
|
1140
|
-
if (this.lexer.state.top = !1, o.items[
|
|
1141
|
-
const
|
|
1139
|
+
for (let u = 0; u < o.items.length; u++)
|
|
1140
|
+
if (this.lexer.state.top = !1, o.items[u].tokens = this.lexer.blockTokens(o.items[u].text, []), !o.loose) {
|
|
1141
|
+
const c = o.items[u].tokens.filter((p) => p.type === "space"), d = c.length > 0 && c.some((p) => /\n.*\n/.test(p.raw));
|
|
1142
1142
|
o.loose = d;
|
|
1143
1143
|
}
|
|
1144
1144
|
if (o.loose)
|
|
1145
|
-
for (let
|
|
1146
|
-
o.items[
|
|
1145
|
+
for (let u = 0; u < o.items.length; u++)
|
|
1146
|
+
o.items[u].loose = !0;
|
|
1147
1147
|
return o;
|
|
1148
1148
|
}
|
|
1149
1149
|
}
|
|
@@ -1194,11 +1194,11 @@ ${f}` : f;
|
|
|
1194
1194
|
align: i.align[a]
|
|
1195
1195
|
});
|
|
1196
1196
|
for (const a of o)
|
|
1197
|
-
i.rows.push(Kn(a, i.header.length).map((
|
|
1198
|
-
text:
|
|
1199
|
-
tokens: this.lexer.inline(
|
|
1197
|
+
i.rows.push(Kn(a, i.header.length).map((u, c) => ({
|
|
1198
|
+
text: u,
|
|
1199
|
+
tokens: this.lexer.inline(u),
|
|
1200
1200
|
header: !1,
|
|
1201
|
-
align: i.align[
|
|
1201
|
+
align: i.align[c]
|
|
1202
1202
|
})));
|
|
1203
1203
|
return i;
|
|
1204
1204
|
}
|
|
@@ -1271,8 +1271,8 @@ ${f}` : f;
|
|
|
1271
1271
|
} else {
|
|
1272
1272
|
const i = Tr(t[2], "()");
|
|
1273
1273
|
if (i > -1) {
|
|
1274
|
-
const
|
|
1275
|
-
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0,
|
|
1274
|
+
const u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
1275
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
let r = t[2], o = "";
|
|
@@ -1308,23 +1308,23 @@ ${f}` : f;
|
|
|
1308
1308
|
return;
|
|
1309
1309
|
if (!(r[1] || r[2] || "") || !s || this.rules.inline.punctuation.exec(s)) {
|
|
1310
1310
|
const i = [...r[0]].length - 1;
|
|
1311
|
-
let a,
|
|
1312
|
-
const
|
|
1313
|
-
for (
|
|
1311
|
+
let a, u, c = i, d = 0;
|
|
1312
|
+
const p = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1313
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = p.exec(t)) != null; ) {
|
|
1314
1314
|
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a)
|
|
1315
1315
|
continue;
|
|
1316
|
-
if (
|
|
1317
|
-
|
|
1316
|
+
if (u = [...a].length, r[3] || r[4]) {
|
|
1317
|
+
c += u;
|
|
1318
1318
|
continue;
|
|
1319
|
-
} else if ((r[5] || r[6]) && i % 3 && !((i +
|
|
1320
|
-
d +=
|
|
1319
|
+
} else if ((r[5] || r[6]) && i % 3 && !((i + u) % 3)) {
|
|
1320
|
+
d += u;
|
|
1321
1321
|
continue;
|
|
1322
1322
|
}
|
|
1323
|
-
if (
|
|
1323
|
+
if (c -= u, c > 0)
|
|
1324
1324
|
continue;
|
|
1325
|
-
|
|
1326
|
-
const w = [...r[0]][0].length, m = e.slice(0, i + r.index + w +
|
|
1327
|
-
if (Math.min(i,
|
|
1325
|
+
u = Math.min(u, u + c + d);
|
|
1326
|
+
const w = [...r[0]][0].length, m = e.slice(0, i + r.index + w + u);
|
|
1327
|
+
if (Math.min(i, u) % 2) {
|
|
1328
1328
|
const A = m.slice(1, -1);
|
|
1329
1329
|
return {
|
|
1330
1330
|
type: "em",
|
|
@@ -1333,12 +1333,12 @@ ${f}` : f;
|
|
|
1333
1333
|
tokens: this.lexer.inlineTokens(A)
|
|
1334
1334
|
};
|
|
1335
1335
|
}
|
|
1336
|
-
const
|
|
1336
|
+
const f = m.slice(2, -2);
|
|
1337
1337
|
return {
|
|
1338
1338
|
type: "strong",
|
|
1339
1339
|
raw: m,
|
|
1340
|
-
text:
|
|
1341
|
-
tokens: this.lexer.inlineTokens(
|
|
1340
|
+
text: f,
|
|
1341
|
+
tokens: this.lexer.inlineTokens(f)
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
@@ -1433,24 +1433,24 @@ ${f}` : f;
|
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
|
-
const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1436
|
+
const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, wt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ms = /(?:[*+-]|\d{1,9}[.)])/, ys = j(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, ms).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(), hn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Rr = /^[^\n]+/, pn = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Lr = j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", pn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ir = j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ms).getRegex(), Bt = "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]*?(?:-->|$))/, $r = 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", Bt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), xs = j(hn).replace("hr", wt).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", Bt).getRegex(), Dr = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", xs).getRegex(), gn = {
|
|
1437
1437
|
blockquote: Dr,
|
|
1438
1438
|
code: Cr,
|
|
1439
1439
|
def: Lr,
|
|
1440
1440
|
fences: Er,
|
|
1441
1441
|
heading: Mr,
|
|
1442
|
-
hr:
|
|
1442
|
+
hr: wt,
|
|
1443
1443
|
html: $r,
|
|
1444
|
-
lheading:
|
|
1444
|
+
lheading: ys,
|
|
1445
1445
|
list: Ir,
|
|
1446
1446
|
newline: Ar,
|
|
1447
|
-
paragraph:
|
|
1447
|
+
paragraph: xs,
|
|
1448
1448
|
table: ft,
|
|
1449
1449
|
text: Rr
|
|
1450
|
-
}, Gn = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",
|
|
1450
|
+
}, Gn = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", wt).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", Bt).getRegex(), Or = {
|
|
1451
1451
|
...gn,
|
|
1452
1452
|
table: Gn,
|
|
1453
|
-
paragraph: j(hn).replace("hr",
|
|
1453
|
+
paragraph: j(hn).replace("hr", wt).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", Bt).getRegex()
|
|
1454
1454
|
}, _r = {
|
|
1455
1455
|
...gn,
|
|
1456
1456
|
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(),
|
|
@@ -1459,9 +1459,9 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1459
1459
|
fences: ft,
|
|
1460
1460
|
// fences not supported
|
|
1461
1461
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1462
|
-
paragraph: j(hn).replace("hr",
|
|
1463
|
-
]`).replace("lheading",
|
|
1464
|
-
},
|
|
1462
|
+
paragraph: j(hn).replace("hr", wt).replace("heading", ` *#{1,6} *[^
|
|
1463
|
+
]`).replace("lheading", ys).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1464
|
+
}, ws = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Nr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ks = /^( {2,}|\\)\n(?!\s*$)/, Pr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, kt = "\\p{P}\\p{S}", zr = j(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, kt).getRegex(), Hr = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Br = j(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, kt).getRegex(), Fr = j("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, kt).getRegex(), Ur = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, kt).getRegex(), qr = j(/\\([punct])/, "gu").replace(/punct/g, kt).getRegex(), jr = 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(), Wr = j(fn).replace("(?:-->|$)", "-->").getRegex(), Kr = 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", Wr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), zt = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Vr = 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", pn).getRegex(), vs = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", pn).getRegex(), Gr = j("reflink|nolink(?!\\()", "g").replace("reflink", bs).replace("nolink", vs).getRegex(), mn = {
|
|
1465
1465
|
_backpedal: ft,
|
|
1466
1466
|
// only used for GFM url
|
|
1467
1467
|
anyPunctuation: qr,
|
|
@@ -1470,14 +1470,14 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1470
1470
|
br: ks,
|
|
1471
1471
|
code: Nr,
|
|
1472
1472
|
del: ft,
|
|
1473
|
-
emStrongLDelim:
|
|
1474
|
-
emStrongRDelimAst:
|
|
1473
|
+
emStrongLDelim: Br,
|
|
1474
|
+
emStrongRDelimAst: Fr,
|
|
1475
1475
|
emStrongRDelimUnd: Ur,
|
|
1476
|
-
escape:
|
|
1476
|
+
escape: ws,
|
|
1477
1477
|
link: Vr,
|
|
1478
|
-
nolink:
|
|
1478
|
+
nolink: vs,
|
|
1479
1479
|
punctuation: zr,
|
|
1480
|
-
reflink:
|
|
1480
|
+
reflink: bs,
|
|
1481
1481
|
reflinkSearch: Gr,
|
|
1482
1482
|
tag: Kr,
|
|
1483
1483
|
text: Pr,
|
|
@@ -1488,7 +1488,7 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1488
1488
|
reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", zt).getRegex()
|
|
1489
1489
|
}, rn = {
|
|
1490
1490
|
...mn,
|
|
1491
|
-
escape: j(
|
|
1491
|
+
escape: j(ws).replace("])", "~|])").getRegex(),
|
|
1492
1492
|
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(),
|
|
1493
1493
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1494
1494
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
@@ -1617,10 +1617,10 @@ class xe {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
if (i = e, this.options.extensions && this.options.extensions.startBlock) {
|
|
1619
1619
|
let a = 1 / 0;
|
|
1620
|
-
const
|
|
1621
|
-
let
|
|
1620
|
+
const u = e.slice(1);
|
|
1621
|
+
let c;
|
|
1622
1622
|
this.options.extensions.startBlock.forEach((d) => {
|
|
1623
|
-
|
|
1623
|
+
c = d.call({ lexer: this }, u), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
|
|
1624
1624
|
}), a < 1 / 0 && a >= 0 && (i = e.substring(0, a + 1));
|
|
1625
1625
|
}
|
|
1626
1626
|
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
@@ -1653,7 +1653,7 @@ class xe {
|
|
|
1653
1653
|
* Lexing/Compiling
|
|
1654
1654
|
*/
|
|
1655
1655
|
inlineTokens(e, t = []) {
|
|
1656
|
-
let s, r, o, i = e, a,
|
|
1656
|
+
let s, r, o, i = e, a, u, c;
|
|
1657
1657
|
if (this.tokens.links) {
|
|
1658
1658
|
const d = Object.keys(this.tokens.links);
|
|
1659
1659
|
if (d.length > 0)
|
|
@@ -1665,7 +1665,7 @@ class xe {
|
|
|
1665
1665
|
for (; (a = this.tokenizer.rules.inline.anyPunctuation.exec(i)) != null; )
|
|
1666
1666
|
i = i.slice(0, a.index) + "++" + i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1667
1667
|
for (; e; )
|
|
1668
|
-
if (
|
|
1668
|
+
if (u || (c = ""), u = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((d) => (s = d.call({ lexer: this }, e, t)) ? (e = e.substring(s.raw.length), t.push(s), !0) : !1))) {
|
|
1669
1669
|
if (s = this.tokenizer.escape(e)) {
|
|
1670
1670
|
e = e.substring(s.raw.length), t.push(s);
|
|
1671
1671
|
continue;
|
|
@@ -1682,7 +1682,7 @@ class xe {
|
|
|
1682
1682
|
e = e.substring(s.raw.length), r = t[t.length - 1], r && s.type === "text" && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
|
|
1683
1683
|
continue;
|
|
1684
1684
|
}
|
|
1685
|
-
if (s = this.tokenizer.emStrong(e, i,
|
|
1685
|
+
if (s = this.tokenizer.emStrong(e, i, c)) {
|
|
1686
1686
|
e = e.substring(s.raw.length), t.push(s);
|
|
1687
1687
|
continue;
|
|
1688
1688
|
}
|
|
@@ -1708,14 +1708,14 @@ class xe {
|
|
|
1708
1708
|
}
|
|
1709
1709
|
if (o = e, this.options.extensions && this.options.extensions.startInline) {
|
|
1710
1710
|
let d = 1 / 0;
|
|
1711
|
-
const
|
|
1711
|
+
const p = e.slice(1);
|
|
1712
1712
|
let w;
|
|
1713
1713
|
this.options.extensions.startInline.forEach((m) => {
|
|
1714
|
-
w = m.call({ lexer: this },
|
|
1714
|
+
w = m.call({ lexer: this }, p), typeof w == "number" && w >= 0 && (d = Math.min(d, w));
|
|
1715
1715
|
}), d < 1 / 0 && d >= 0 && (o = e.substring(0, d + 1));
|
|
1716
1716
|
}
|
|
1717
1717
|
if (s = this.tokenizer.inlineText(o)) {
|
|
1718
|
-
e = e.substring(s.raw.length), s.raw.slice(-1) !== "_" && (
|
|
1718
|
+
e = e.substring(s.raw.length), s.raw.slice(-1) !== "_" && (c = s.raw.slice(-1)), u = !0, r = t[t.length - 1], r && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
|
|
1719
1719
|
continue;
|
|
1720
1720
|
}
|
|
1721
1721
|
if (e) {
|
|
@@ -1768,8 +1768,8 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1768
1768
|
const t = e.ordered, s = e.start;
|
|
1769
1769
|
let r = "";
|
|
1770
1770
|
for (let a = 0; a < e.items.length; a++) {
|
|
1771
|
-
const
|
|
1772
|
-
r += this.listitem(
|
|
1771
|
+
const u = e.items[a];
|
|
1772
|
+
r += this.listitem(u);
|
|
1773
1773
|
}
|
|
1774
1774
|
const o = t ? "ol" : "ul", i = t && s !== 1 ? ' start="' + s + '"' : "";
|
|
1775
1775
|
return "<" + o + i + `>
|
|
@@ -1893,7 +1893,7 @@ class yn {
|
|
|
1893
1893
|
return "";
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
|
-
class
|
|
1896
|
+
class we {
|
|
1897
1897
|
constructor(e) {
|
|
1898
1898
|
W(this, "options");
|
|
1899
1899
|
W(this, "renderer");
|
|
@@ -1904,13 +1904,13 @@ class ke {
|
|
|
1904
1904
|
* Static Parse Method
|
|
1905
1905
|
*/
|
|
1906
1906
|
static parse(e, t) {
|
|
1907
|
-
return new
|
|
1907
|
+
return new we(t).parse(e);
|
|
1908
1908
|
}
|
|
1909
1909
|
/**
|
|
1910
1910
|
* Static Parse Inline Method
|
|
1911
1911
|
*/
|
|
1912
1912
|
static parseInline(e, t) {
|
|
1913
|
-
return new
|
|
1913
|
+
return new we(t).parseInline(e);
|
|
1914
1914
|
}
|
|
1915
1915
|
/**
|
|
1916
1916
|
* Parse Loop
|
|
@@ -1920,9 +1920,9 @@ class ke {
|
|
|
1920
1920
|
for (let r = 0; r < e.length; r++) {
|
|
1921
1921
|
const o = e[r];
|
|
1922
1922
|
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[o.type]) {
|
|
1923
|
-
const a = o,
|
|
1924
|
-
if (
|
|
1925
|
-
s +=
|
|
1923
|
+
const a = o, u = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1924
|
+
if (u !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
|
|
1925
|
+
s += u || "";
|
|
1926
1926
|
continue;
|
|
1927
1927
|
}
|
|
1928
1928
|
}
|
|
@@ -1965,16 +1965,16 @@ class ke {
|
|
|
1965
1965
|
continue;
|
|
1966
1966
|
}
|
|
1967
1967
|
case "text": {
|
|
1968
|
-
let a = i,
|
|
1968
|
+
let a = i, u = this.renderer.text(a);
|
|
1969
1969
|
for (; r + 1 < e.length && e[r + 1].type === "text"; )
|
|
1970
|
-
a = e[++r],
|
|
1970
|
+
a = e[++r], u += `
|
|
1971
1971
|
` + this.renderer.text(a);
|
|
1972
1972
|
t ? s += this.renderer.paragraph({
|
|
1973
1973
|
type: "paragraph",
|
|
1974
|
-
raw:
|
|
1975
|
-
text:
|
|
1976
|
-
tokens: [{ type: "text", raw:
|
|
1977
|
-
}) : s +=
|
|
1974
|
+
raw: u,
|
|
1975
|
+
text: u,
|
|
1976
|
+
tokens: [{ type: "text", raw: u, text: u }]
|
|
1977
|
+
}) : s += u;
|
|
1978
1978
|
continue;
|
|
1979
1979
|
}
|
|
1980
1980
|
default: {
|
|
@@ -2089,7 +2089,7 @@ class gt {
|
|
|
2089
2089
|
* Provide function to parse tokens
|
|
2090
2090
|
*/
|
|
2091
2091
|
provideParser() {
|
|
2092
|
-
return this.block ?
|
|
2092
|
+
return this.block ? we.parse : we.parseInline;
|
|
2093
2093
|
}
|
|
2094
2094
|
}
|
|
2095
2095
|
W(gt, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
@@ -2103,7 +2103,7 @@ class Yr {
|
|
|
2103
2103
|
W(this, "options", this.setOptions);
|
|
2104
2104
|
W(this, "parse", this.parseMarkdown(!0));
|
|
2105
2105
|
W(this, "parseInline", this.parseMarkdown(!1));
|
|
2106
|
-
W(this, "Parser",
|
|
2106
|
+
W(this, "Parser", we);
|
|
2107
2107
|
W(this, "Renderer", Ht);
|
|
2108
2108
|
W(this, "TextRenderer", yn);
|
|
2109
2109
|
W(this, "Lexer", xe);
|
|
@@ -2121,11 +2121,11 @@ class Yr {
|
|
|
2121
2121
|
switch (s = s.concat(t.call(this, i)), i.type) {
|
|
2122
2122
|
case "table": {
|
|
2123
2123
|
const a = i;
|
|
2124
|
-
for (const
|
|
2125
|
-
s = s.concat(this.walkTokens(
|
|
2126
|
-
for (const
|
|
2127
|
-
for (const
|
|
2128
|
-
s = s.concat(this.walkTokens(
|
|
2124
|
+
for (const u of a.header)
|
|
2125
|
+
s = s.concat(this.walkTokens(u.tokens, t));
|
|
2126
|
+
for (const u of a.rows)
|
|
2127
|
+
for (const c of u)
|
|
2128
|
+
s = s.concat(this.walkTokens(c.tokens, t));
|
|
2129
2129
|
break;
|
|
2130
2130
|
}
|
|
2131
2131
|
case "list": {
|
|
@@ -2135,9 +2135,9 @@ class Yr {
|
|
|
2135
2135
|
}
|
|
2136
2136
|
default: {
|
|
2137
2137
|
const a = i;
|
|
2138
|
-
(o = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && o[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((
|
|
2139
|
-
const
|
|
2140
|
-
s = s.concat(this.walkTokens(
|
|
2138
|
+
(o = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && o[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((u) => {
|
|
2139
|
+
const c = a[u].flat(1 / 0);
|
|
2140
|
+
s = s.concat(this.walkTokens(c, t));
|
|
2141
2141
|
}) : a.tokens && (s = s.concat(this.walkTokens(a.tokens, t)));
|
|
2142
2142
|
}
|
|
2143
2143
|
}
|
|
@@ -2153,8 +2153,8 @@ class Yr {
|
|
|
2153
2153
|
if ("renderer" in o) {
|
|
2154
2154
|
const i = t.renderers[o.name];
|
|
2155
2155
|
i ? t.renderers[o.name] = function(...a) {
|
|
2156
|
-
let
|
|
2157
|
-
return
|
|
2156
|
+
let u = o.renderer.apply(this, a);
|
|
2157
|
+
return u === !1 && (u = i.apply(this, a)), u;
|
|
2158
2158
|
} : t.renderers[o.name] = o.renderer;
|
|
2159
2159
|
}
|
|
2160
2160
|
if ("tokenizer" in o) {
|
|
@@ -2171,10 +2171,10 @@ class Yr {
|
|
|
2171
2171
|
throw new Error(`renderer '${i}' does not exist`);
|
|
2172
2172
|
if (["options", "parser"].includes(i))
|
|
2173
2173
|
continue;
|
|
2174
|
-
const a = i,
|
|
2174
|
+
const a = i, u = s.renderer[a], c = o[a];
|
|
2175
2175
|
o[a] = (...d) => {
|
|
2176
|
-
let
|
|
2177
|
-
return
|
|
2176
|
+
let p = u.apply(o, d);
|
|
2177
|
+
return p === !1 && (p = c.apply(o, d)), p || "";
|
|
2178
2178
|
};
|
|
2179
2179
|
}
|
|
2180
2180
|
r.renderer = o;
|
|
@@ -2186,10 +2186,10 @@ class Yr {
|
|
|
2186
2186
|
throw new Error(`tokenizer '${i}' does not exist`);
|
|
2187
2187
|
if (["options", "rules", "lexer"].includes(i))
|
|
2188
2188
|
continue;
|
|
2189
|
-
const a = i,
|
|
2189
|
+
const a = i, u = s.tokenizer[a], c = o[a];
|
|
2190
2190
|
o[a] = (...d) => {
|
|
2191
|
-
let
|
|
2192
|
-
return
|
|
2191
|
+
let p = u.apply(o, d);
|
|
2192
|
+
return p === !1 && (p = c.apply(o, d)), p;
|
|
2193
2193
|
};
|
|
2194
2194
|
}
|
|
2195
2195
|
r.tokenizer = o;
|
|
@@ -2201,15 +2201,15 @@ class Yr {
|
|
|
2201
2201
|
throw new Error(`hook '${i}' does not exist`);
|
|
2202
2202
|
if (["options", "block"].includes(i))
|
|
2203
2203
|
continue;
|
|
2204
|
-
const a = i,
|
|
2204
|
+
const a = i, u = s.hooks[a], c = o[a];
|
|
2205
2205
|
gt.passThroughHooks.has(i) ? o[a] = (d) => {
|
|
2206
2206
|
if (this.defaults.async)
|
|
2207
|
-
return Promise.resolve(
|
|
2208
|
-
const
|
|
2209
|
-
return
|
|
2207
|
+
return Promise.resolve(u.call(o, d)).then((w) => c.call(o, w));
|
|
2208
|
+
const p = u.call(o, d);
|
|
2209
|
+
return c.call(o, p);
|
|
2210
2210
|
} : o[a] = (...d) => {
|
|
2211
|
-
let
|
|
2212
|
-
return
|
|
2211
|
+
let p = u.apply(o, d);
|
|
2212
|
+
return p === !1 && (p = c.apply(o, d)), p;
|
|
2213
2213
|
};
|
|
2214
2214
|
}
|
|
2215
2215
|
r.hooks = o;
|
|
@@ -2217,8 +2217,8 @@ class Yr {
|
|
|
2217
2217
|
if (s.walkTokens) {
|
|
2218
2218
|
const o = this.defaults.walkTokens, i = s.walkTokens;
|
|
2219
2219
|
r.walkTokens = function(a) {
|
|
2220
|
-
let
|
|
2221
|
-
return
|
|
2220
|
+
let u = [];
|
|
2221
|
+
return u.push(i.call(this, a)), o && (u = u.concat(o.call(this, a))), u;
|
|
2222
2222
|
};
|
|
2223
2223
|
}
|
|
2224
2224
|
this.defaults = { ...this.defaults, ...r };
|
|
@@ -2231,7 +2231,7 @@ class Yr {
|
|
|
2231
2231
|
return xe.lex(e, t ?? this.defaults);
|
|
2232
2232
|
}
|
|
2233
2233
|
parser(e, t) {
|
|
2234
|
-
return
|
|
2234
|
+
return we.parse(e, t ?? this.defaults);
|
|
2235
2235
|
}
|
|
2236
2236
|
parseMarkdown(e) {
|
|
2237
2237
|
return (s, r) => {
|
|
@@ -2243,15 +2243,15 @@ class Yr {
|
|
|
2243
2243
|
if (typeof s != "string")
|
|
2244
2244
|
return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(s) + ", string expected"));
|
|
2245
2245
|
i.hooks && (i.hooks.options = i, i.hooks.block = e);
|
|
2246
|
-
const
|
|
2246
|
+
const u = i.hooks ? i.hooks.provideLexer() : e ? xe.lex : xe.lexInline, c = i.hooks ? i.hooks.provideParser() : e ? we.parse : we.parseInline;
|
|
2247
2247
|
if (i.async)
|
|
2248
|
-
return Promise.resolve(i.hooks ? i.hooks.preprocess(s) : s).then((d) =>
|
|
2248
|
+
return Promise.resolve(i.hooks ? i.hooks.preprocess(s) : s).then((d) => u(d, i)).then((d) => i.hooks ? i.hooks.processAllTokens(d) : d).then((d) => i.walkTokens ? Promise.all(this.walkTokens(d, i.walkTokens)).then(() => d) : d).then((d) => c(d, i)).then((d) => i.hooks ? i.hooks.postprocess(d) : d).catch(a);
|
|
2249
2249
|
try {
|
|
2250
2250
|
i.hooks && (s = i.hooks.preprocess(s));
|
|
2251
|
-
let d =
|
|
2251
|
+
let d = u(s, i);
|
|
2252
2252
|
i.hooks && (d = i.hooks.processAllTokens(d)), i.walkTokens && this.walkTokens(d, i.walkTokens);
|
|
2253
|
-
let
|
|
2254
|
-
return i.hooks && (
|
|
2253
|
+
let p = c(d, i);
|
|
2254
|
+
return i.hooks && (p = i.hooks.postprocess(p)), p;
|
|
2255
2255
|
} catch (d) {
|
|
2256
2256
|
return a(d);
|
|
2257
2257
|
}
|
|
@@ -2275,19 +2275,19 @@ function q(n, e) {
|
|
|
2275
2275
|
return je.parse(n, e);
|
|
2276
2276
|
}
|
|
2277
2277
|
q.options = q.setOptions = function(n) {
|
|
2278
|
-
return je.setOptions(n), q.defaults = je.defaults,
|
|
2278
|
+
return je.setOptions(n), q.defaults = je.defaults, ps(q.defaults), q;
|
|
2279
2279
|
};
|
|
2280
2280
|
q.getDefaults = dn;
|
|
2281
2281
|
q.defaults = Ke;
|
|
2282
2282
|
q.use = function(...n) {
|
|
2283
|
-
return je.use(...n), q.defaults = je.defaults,
|
|
2283
|
+
return je.use(...n), q.defaults = je.defaults, ps(q.defaults), q;
|
|
2284
2284
|
};
|
|
2285
2285
|
q.walkTokens = function(n, e) {
|
|
2286
2286
|
return je.walkTokens(n, e);
|
|
2287
2287
|
};
|
|
2288
2288
|
q.parseInline = je.parseInline;
|
|
2289
|
-
q.Parser =
|
|
2290
|
-
q.parser =
|
|
2289
|
+
q.Parser = we;
|
|
2290
|
+
q.parser = we.parse;
|
|
2291
2291
|
q.Renderer = Ht;
|
|
2292
2292
|
q.TextRenderer = yn;
|
|
2293
2293
|
q.Lexer = xe;
|
|
@@ -2300,11 +2300,11 @@ q.setOptions;
|
|
|
2300
2300
|
q.use;
|
|
2301
2301
|
q.walkTokens;
|
|
2302
2302
|
q.parseInline;
|
|
2303
|
-
|
|
2303
|
+
we.parse;
|
|
2304
2304
|
xe.lex;
|
|
2305
2305
|
/*! @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 */
|
|
2306
2306
|
const {
|
|
2307
|
-
entries:
|
|
2307
|
+
entries: Ts,
|
|
2308
2308
|
setPrototypeOf: Qn,
|
|
2309
2309
|
isFrozen: Xr,
|
|
2310
2310
|
getPrototypeOf: Jr,
|
|
@@ -2334,7 +2334,7 @@ ln || (ln = function(e) {
|
|
|
2334
2334
|
s[r - 1] = arguments[r];
|
|
2335
2335
|
return new e(...s);
|
|
2336
2336
|
});
|
|
2337
|
-
const Ot = fe(Array.prototype.forEach), to = fe(Array.prototype.lastIndexOf), Zn = fe(Array.prototype.pop), ut = fe(Array.prototype.push), no = fe(Array.prototype.splice), Nt = fe(String.prototype.toLowerCase), Zt = fe(String.prototype.toString), Yt = fe(String.prototype.match), ct = fe(String.prototype.replace), so = fe(String.prototype.indexOf), ro = fe(String.prototype.trim), ve = fe(Object.prototype.hasOwnProperty),
|
|
2337
|
+
const Ot = fe(Array.prototype.forEach), to = fe(Array.prototype.lastIndexOf), Zn = fe(Array.prototype.pop), ut = fe(Array.prototype.push), no = fe(Array.prototype.splice), Nt = fe(String.prototype.toLowerCase), Zt = fe(String.prototype.toString), Yt = fe(String.prototype.match), ct = fe(String.prototype.replace), so = fe(String.prototype.indexOf), ro = fe(String.prototype.trim), ve = fe(Object.prototype.hasOwnProperty), he = fe(RegExp.prototype.test), dt = oo(TypeError);
|
|
2338
2338
|
function fe(n) {
|
|
2339
2339
|
return function(e) {
|
|
2340
2340
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
@@ -2371,7 +2371,7 @@ function io(n) {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
function Oe(n) {
|
|
2373
2373
|
const e = on(null);
|
|
2374
|
-
for (const [t, s] of
|
|
2374
|
+
for (const [t, s] of Ts(n))
|
|
2375
2375
|
ve(n, t) && (Array.isArray(s) ? e[t] = io(s) : s && typeof s == "object" && s.constructor === Object ? e[t] = Oe(s) : e[t] = s);
|
|
2376
2376
|
return e;
|
|
2377
2377
|
}
|
|
@@ -2391,22 +2391,22 @@ function ht(n, e) {
|
|
|
2391
2391
|
}
|
|
2392
2392
|
return t;
|
|
2393
2393
|
}
|
|
2394
|
-
const Yn = pe(["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 = pe(["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 = pe(["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"]), ao = pe(["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 = pe(["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"]), lo = pe(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Xn = pe(["#text"]), Jn = pe(["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 = pe(["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 = pe(["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"]), _t = pe(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), uo = be(/\{\{[\w\W]*|[\w\W]*\}\}/gm), co = be(/<%[\w\W]*|[\w\W]*%>/gm), ho = be(/\$\{[\w\W]*/gm), po = be(/^data-[\-\w.\u00B7-\uFFFF]+$/), fo = be(/^aria-[\-\w]+$/),
|
|
2394
|
+
const Yn = pe(["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 = pe(["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 = pe(["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"]), ao = pe(["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 = pe(["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"]), lo = pe(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Xn = pe(["#text"]), Jn = pe(["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 = pe(["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 = pe(["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"]), _t = pe(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), uo = be(/\{\{[\w\W]*|[\w\W]*\}\}/gm), co = be(/<%[\w\W]*|[\w\W]*%>/gm), ho = be(/\$\{[\w\W]*/gm), po = be(/^data-[\-\w.\u00B7-\uFFFF]+$/), fo = be(/^aria-[\-\w]+$/), Ss = be(
|
|
2395
2395
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
2396
2396
|
// eslint-disable-line no-useless-escape
|
|
2397
2397
|
), go = be(/^(?:\w+script|data):/i), mo = be(
|
|
2398
2398
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
2399
2399
|
// eslint-disable-line no-control-regex
|
|
2400
|
-
),
|
|
2400
|
+
), As = be(/^html$/i), yo = be(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
2401
2401
|
var ts = /* @__PURE__ */ Object.freeze({
|
|
2402
2402
|
__proto__: null,
|
|
2403
2403
|
ARIA_ATTR: fo,
|
|
2404
2404
|
ATTR_WHITESPACE: mo,
|
|
2405
2405
|
CUSTOM_ELEMENT: yo,
|
|
2406
2406
|
DATA_ATTR: po,
|
|
2407
|
-
DOCTYPE_NAME:
|
|
2407
|
+
DOCTYPE_NAME: As,
|
|
2408
2408
|
ERB_EXPR: co,
|
|
2409
|
-
IS_ALLOWED_URI:
|
|
2409
|
+
IS_ALLOWED_URI: Ss,
|
|
2410
2410
|
IS_SCRIPT_OR_DATA: go,
|
|
2411
2411
|
MUSTACHE_EXPR: uo,
|
|
2412
2412
|
TMPLIT_EXPR: ho
|
|
@@ -2420,7 +2420,7 @@ const pt = {
|
|
|
2420
2420
|
document: 9
|
|
2421
2421
|
}, xo = function() {
|
|
2422
2422
|
return typeof window > "u" ? null : window;
|
|
2423
|
-
},
|
|
2423
|
+
}, wo = function(e, t) {
|
|
2424
2424
|
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
2425
2425
|
return null;
|
|
2426
2426
|
let s = null;
|
|
@@ -2452,9 +2452,9 @@ const pt = {
|
|
|
2452
2452
|
uponSanitizeShadowNode: []
|
|
2453
2453
|
};
|
|
2454
2454
|
};
|
|
2455
|
-
function
|
|
2455
|
+
function Cs() {
|
|
2456
2456
|
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : xo();
|
|
2457
|
-
const e = ($) =>
|
|
2457
|
+
const e = ($) => Cs($);
|
|
2458
2458
|
if (e.version = "3.3.0", e.removed = [], !n || !n.document || n.document.nodeType !== pt.document || !n.Element)
|
|
2459
2459
|
return e.isSupported = !1, e;
|
|
2460
2460
|
let {
|
|
@@ -2464,20 +2464,20 @@ function As() {
|
|
|
2464
2464
|
DocumentFragment: o,
|
|
2465
2465
|
HTMLTemplateElement: i,
|
|
2466
2466
|
Node: a,
|
|
2467
|
-
Element:
|
|
2468
|
-
NodeFilter:
|
|
2467
|
+
Element: u,
|
|
2468
|
+
NodeFilter: c,
|
|
2469
2469
|
NamedNodeMap: d = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
2470
|
-
HTMLFormElement:
|
|
2470
|
+
HTMLFormElement: p,
|
|
2471
2471
|
DOMParser: w,
|
|
2472
2472
|
trustedTypes: m
|
|
2473
|
-
} = n,
|
|
2473
|
+
} = n, f = u.prototype, A = ht(f, "cloneNode"), y = ht(f, "remove"), g = ht(f, "nextSibling"), S = ht(f, "childNodes"), C = ht(f, "parentNode");
|
|
2474
2474
|
if (typeof i == "function") {
|
|
2475
2475
|
const $ = t.createElement("template");
|
|
2476
2476
|
$.content && $.content.ownerDocument && (t = $.content.ownerDocument);
|
|
2477
2477
|
}
|
|
2478
2478
|
let T, z = "";
|
|
2479
2479
|
const {
|
|
2480
|
-
implementation:
|
|
2480
|
+
implementation: B,
|
|
2481
2481
|
createNodeIterator: V,
|
|
2482
2482
|
createDocumentFragment: E,
|
|
2483
2483
|
getElementsByTagName: M
|
|
@@ -2485,7 +2485,7 @@ function As() {
|
|
|
2485
2485
|
importNode: I
|
|
2486
2486
|
} = s;
|
|
2487
2487
|
let P = ns();
|
|
2488
|
-
e.isSupported = typeof
|
|
2488
|
+
e.isSupported = typeof Ts == "function" && typeof C == "function" && B && B.createHTMLDocument !== void 0;
|
|
2489
2489
|
const {
|
|
2490
2490
|
MUSTACHE_EXPR: L,
|
|
2491
2491
|
ERB_EXPR: ne,
|
|
@@ -2494,7 +2494,7 @@ function As() {
|
|
|
2494
2494
|
ARIA_ATTR: Re,
|
|
2495
2495
|
IS_SCRIPT_OR_DATA: He,
|
|
2496
2496
|
ATTR_WHITESPACE: bt,
|
|
2497
|
-
CUSTOM_ELEMENT:
|
|
2497
|
+
CUSTOM_ELEMENT: Ft
|
|
2498
2498
|
} = ts;
|
|
2499
2499
|
let {
|
|
2500
2500
|
IS_ALLOWED_URI: vt
|
|
@@ -2521,7 +2521,7 @@ function As() {
|
|
|
2521
2521
|
enumerable: !0,
|
|
2522
2522
|
value: !1
|
|
2523
2523
|
}
|
|
2524
|
-
})),
|
|
2524
|
+
})), Be = null, Ve = null;
|
|
2525
2525
|
const Le = Object.seal(on(null, {
|
|
2526
2526
|
tagCheck: {
|
|
2527
2527
|
writable: !0,
|
|
@@ -2536,45 +2536,45 @@ function As() {
|
|
|
2536
2536
|
value: null
|
|
2537
2537
|
}
|
|
2538
2538
|
}));
|
|
2539
|
-
let St = !0, Ge = !0,
|
|
2540
|
-
const
|
|
2539
|
+
let St = !0, Ge = !0, _ = !1, K = !0, G = !1, te = !0, X = !1, J = !1, de = !1, Se = !1, At = !1, Ct = !1, xn = !0, wn = !1;
|
|
2540
|
+
const Is = "user-content-";
|
|
2541
2541
|
let Ut = !0, rt = !1, Qe = {}, Ze = null;
|
|
2542
|
-
const
|
|
2542
|
+
const kn = 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"]);
|
|
2543
2543
|
let bn = null;
|
|
2544
2544
|
const vn = H({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
2545
2545
|
let qt = null;
|
|
2546
2546
|
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";
|
|
2547
2547
|
let Ye = Ie, jt = !1, Wt = null;
|
|
2548
|
-
const
|
|
2548
|
+
const $s = H({}, [Et, Mt, Ie], Zt);
|
|
2549
2549
|
let Rt = H({}, ["mi", "mo", "mn", "ms", "mtext"]), Lt = H({}, ["annotation-xml"]);
|
|
2550
|
-
const
|
|
2550
|
+
const Ds = H({}, ["title", "style", "font", "a", "script"]);
|
|
2551
2551
|
let ot = null;
|
|
2552
|
-
const
|
|
2552
|
+
const Os = ["application/xhtml+xml", "text/html"], _s = "text/html";
|
|
2553
2553
|
let oe = null, Xe = null;
|
|
2554
|
-
const
|
|
2554
|
+
const Ns = t.createElement("form"), Sn = function(l) {
|
|
2555
2555
|
return l instanceof RegExp || l instanceof Function;
|
|
2556
2556
|
}, Kt = function() {
|
|
2557
2557
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2558
2558
|
if (!(Xe && Xe === l)) {
|
|
2559
2559
|
if ((!l || typeof l != "object") && (l = {}), l = Oe(l), ot = // eslint-disable-next-line unicorn/prefer-includes
|
|
2560
|
-
|
|
2560
|
+
Os.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) : $s, qt = ve(l, "ADD_URI_SAFE_ATTR") ? H(Oe(Tn), l.ADD_URI_SAFE_ATTR, oe) : Tn, bn = ve(l, "ADD_DATA_URI_TAGS") ? H(Oe(vn), l.ADD_DATA_URI_TAGS, oe) : vn, Ze = ve(l, "FORBID_CONTENTS") ? H({}, l.FORBID_CONTENTS, oe) : kn, Be = ve(l, "FORBID_TAGS") ? H({}, l.FORBID_TAGS, oe) : Oe({}), Ve = ve(l, "FORBID_ATTR") ? H({}, l.FORBID_ATTR, oe) : Oe({}), 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, de = l.FORCE_BODY || !1, xn = l.SANITIZE_DOM !== !1, wn = l.SANITIZE_NAMED_PROPS || !1, Ut = l.KEEP_CONTENT !== !1, rt = l.IN_PLACE || !1, vt = l.ALLOWED_URI_REGEXP || Ss, 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, _t)), Qe.svgFilters === !0 && (H(Y, Jt), H(se, tn), H(se, _t)), Qe.mathMl === !0 && (H(Y, en), H(se, es), H(se, _t))), l.ADD_TAGS && (typeof l.ADD_TAGS == "function" ? Le.tagCheck = l.ADD_TAGS : (Y === st && (Y = Oe(Y)), H(Y, l.ADD_TAGS, oe))), l.ADD_ATTR && (typeof l.ADD_ATTR == "function" ? Le.attributeCheck = l.ADD_ATTR : (se === Tt && (se = Oe(se)), H(se, l.ADD_ATTR, oe))), l.ADD_URI_SAFE_ATTR && H(qt, l.ADD_URI_SAFE_ATTR, oe), l.FORBID_CONTENTS && (Ze === kn && (Ze = Oe(Ze)), H(Ze, l.FORBID_CONTENTS, oe)), Ut && (Y["#text"] = !0), X && H(Y, ["html", "head", "body"]), Y.table && (H(Y, ["tbody"]), delete Be.tbody), l.TRUSTED_TYPES_POLICY) {
|
|
2561
2561
|
if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
2562
2562
|
throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
2563
2563
|
if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
2564
2564
|
throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
2565
2565
|
T = l.TRUSTED_TYPES_POLICY, z = T.createHTML("");
|
|
2566
2566
|
} else
|
|
2567
|
-
T === void 0 && (T =
|
|
2567
|
+
T === void 0 && (T = wo(m, r)), T !== null && typeof z == "string" && (z = T.createHTML(""));
|
|
2568
2568
|
pe && pe(l), Xe = l;
|
|
2569
2569
|
}
|
|
2570
|
-
}, An = H({}, [...Xt, ...Jt, ...ao]), Cn = H({}, [...en, ...lo]),
|
|
2570
|
+
}, An = H({}, [...Xt, ...Jt, ...ao]), Cn = H({}, [...en, ...lo]), Ps = function(l) {
|
|
2571
2571
|
let k = C(l);
|
|
2572
2572
|
(!k || !k.tagName) && (k = {
|
|
2573
2573
|
namespaceURI: Ye,
|
|
2574
2574
|
tagName: "template"
|
|
2575
2575
|
});
|
|
2576
2576
|
const R = Nt(l.tagName), Q = Nt(k.tagName);
|
|
2577
|
-
return Wt[l.namespaceURI] ? l.namespaceURI === Mt ? k.namespaceURI === Ie ? R === "svg" : k.namespaceURI === Et ? R === "svg" && (Q === "annotation-xml" || Rt[Q]) : !!An[R] : l.namespaceURI === Et ? k.namespaceURI === Ie ? R === "math" : k.namespaceURI === Mt ? R === "math" && Lt[Q] : !!Cn[R] : l.namespaceURI === Ie ? k.namespaceURI === Mt && !Lt[Q] || k.namespaceURI === Et && !Rt[Q] ? !1 : !Cn[R] && (
|
|
2577
|
+
return Wt[l.namespaceURI] ? l.namespaceURI === Mt ? k.namespaceURI === Ie ? R === "svg" : k.namespaceURI === Et ? R === "svg" && (Q === "annotation-xml" || Rt[Q]) : !!An[R] : l.namespaceURI === Et ? k.namespaceURI === Ie ? R === "math" : k.namespaceURI === Mt ? R === "math" && Lt[Q] : !!Cn[R] : l.namespaceURI === Ie ? k.namespaceURI === Mt && !Lt[Q] || k.namespaceURI === Et && !Rt[Q] ? !1 : !Cn[R] && (Ds[R] || !An[R]) : !!(ot === "application/xhtml+xml" && Wt[l.namespaceURI]) : !1;
|
|
2578
2578
|
}, Ae = function(l) {
|
|
2579
2579
|
ut(e.removed, {
|
|
2580
2580
|
element: l
|
|
@@ -2584,7 +2584,7 @@ function As() {
|
|
|
2584
2584
|
} catch {
|
|
2585
2585
|
y(l);
|
|
2586
2586
|
}
|
|
2587
|
-
},
|
|
2587
|
+
}, Fe = function(l, k) {
|
|
2588
2588
|
try {
|
|
2589
2589
|
ut(e.removed, {
|
|
2590
2590
|
attribute: k.getAttributeNode(l),
|
|
@@ -2609,7 +2609,7 @@ function As() {
|
|
|
2609
2609
|
}
|
|
2610
2610
|
}, En = function(l) {
|
|
2611
2611
|
let k = null, R = null;
|
|
2612
|
-
if (
|
|
2612
|
+
if (de)
|
|
2613
2613
|
l = "<remove></remove>" + l;
|
|
2614
2614
|
else {
|
|
2615
2615
|
const re = Yt(l, /^[\r\n\t ]+/);
|
|
@@ -2623,7 +2623,7 @@ function As() {
|
|
|
2623
2623
|
} catch {
|
|
2624
2624
|
}
|
|
2625
2625
|
if (!k || !k.documentElement) {
|
|
2626
|
-
k =
|
|
2626
|
+
k = B.createDocument(Ye, "template", null);
|
|
2627
2627
|
try {
|
|
2628
2628
|
k.documentElement.innerHTML = jt ? z : Q;
|
|
2629
2629
|
} catch {
|
|
@@ -2636,11 +2636,11 @@ function As() {
|
|
|
2636
2636
|
l.ownerDocument || l,
|
|
2637
2637
|
l,
|
|
2638
2638
|
// eslint-disable-next-line no-bitwise
|
|
2639
|
-
|
|
2639
|
+
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
2640
2640
|
null
|
|
2641
2641
|
);
|
|
2642
2642
|
}, Vt = function(l) {
|
|
2643
|
-
return l instanceof
|
|
2643
|
+
return l instanceof p && (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");
|
|
2644
2644
|
}, Rn = function(l) {
|
|
2645
2645
|
return typeof a == "function" && l instanceof a;
|
|
2646
2646
|
};
|
|
@@ -2657,10 +2657,10 @@ function As() {
|
|
|
2657
2657
|
if ($e(P.uponSanitizeElement, l, {
|
|
2658
2658
|
tagName: R,
|
|
2659
2659
|
allowedTags: Y
|
|
2660
|
-
}), te && l.hasChildNodes() && !Rn(l.firstElementChild) &&
|
|
2660
|
+
}), te && l.hasChildNodes() && !Rn(l.firstElementChild) && he(/<[/\w!]/g, l.innerHTML) && he(/<[/\w!]/g, l.textContent) || l.nodeType === pt.progressingInstruction || te && l.nodeType === pt.comment && he(/<[/\w]/g, l.data))
|
|
2661
2661
|
return Ae(l), !0;
|
|
2662
|
-
if (!(Le.tagCheck instanceof Function && Le.tagCheck(R)) && (!Y[R] ||
|
|
2663
|
-
if (!
|
|
2662
|
+
if (!(Le.tagCheck instanceof Function && Le.tagCheck(R)) && (!Y[R] || Be[R])) {
|
|
2663
|
+
if (!Be[R] && $n(R) && (Z.tagNameCheck instanceof RegExp && he(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
|
|
2664
2664
|
return !1;
|
|
2665
2665
|
if (Ut && !Ze[R]) {
|
|
2666
2666
|
const Q = C(l) || l.parentNode, ae = S(l) || l.childNodes;
|
|
@@ -2674,30 +2674,30 @@ function As() {
|
|
|
2674
2674
|
}
|
|
2675
2675
|
return Ae(l), !0;
|
|
2676
2676
|
}
|
|
2677
|
-
return l instanceof
|
|
2677
|
+
return l instanceof u && !Ps(l) || (R === "noscript" || R === "noembed" || R === "noframes") && he(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Ae(l), !0) : (G && l.nodeType === pt.text && (k = l.textContent, Ot([L, ne, Te], (Q) => {
|
|
2678
2678
|
k = ct(k, Q, " ");
|
|
2679
2679
|
}), l.textContent !== k && (ut(e.removed, {
|
|
2680
2680
|
element: l.cloneNode()
|
|
2681
2681
|
}), l.textContent = k)), $e(P.afterSanitizeElements, l, null), !1);
|
|
2682
2682
|
}, In = function(l, k, R) {
|
|
2683
|
-
if (xn && (k === "id" || k === "name") && (R in t || R in
|
|
2683
|
+
if (xn && (k === "id" || k === "name") && (R in t || R in Ns))
|
|
2684
2684
|
return !1;
|
|
2685
|
-
if (!(Ge && !Ve[k] &&
|
|
2686
|
-
if (!(St &&
|
|
2685
|
+
if (!(Ge && !Ve[k] && he(ze, k))) {
|
|
2686
|
+
if (!(St && he(Re, k))) {
|
|
2687
2687
|
if (!(Le.attributeCheck instanceof Function && Le.attributeCheck(k, l))) {
|
|
2688
2688
|
if (!se[k] || Ve[k]) {
|
|
2689
2689
|
if (
|
|
2690
2690
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
2691
2691
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2692
2692
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
2693
|
-
!($n(l) && (Z.tagNameCheck instanceof RegExp &&
|
|
2693
|
+
!($n(l) && (Z.tagNameCheck instanceof RegExp && he(Z.tagNameCheck, l) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(l)) && (Z.attributeNameCheck instanceof RegExp && he(Z.attributeNameCheck, k) || Z.attributeNameCheck instanceof Function && Z.attributeNameCheck(k, l)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
2694
2694
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2695
|
-
k === "is" && Z.allowCustomizedBuiltInElements && (Z.tagNameCheck instanceof RegExp &&
|
|
2695
|
+
k === "is" && Z.allowCustomizedBuiltInElements && (Z.tagNameCheck instanceof RegExp && he(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
|
|
2696
2696
|
) return !1;
|
|
2697
2697
|
} else if (!qt[k]) {
|
|
2698
|
-
if (!
|
|
2698
|
+
if (!he(vt, ct(R, bt, ""))) {
|
|
2699
2699
|
if (!((k === "src" || k === "xlink:href" || k === "href") && l !== "script" && so(R, "data:") === 0 && bn[l])) {
|
|
2700
|
-
if (!(
|
|
2700
|
+
if (!(_ && !he(He, ct(R, bt, "")))) {
|
|
2701
2701
|
if (R)
|
|
2702
2702
|
return !1;
|
|
2703
2703
|
}
|
|
@@ -2709,7 +2709,7 @@ function As() {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
return !0;
|
|
2711
2711
|
}, $n = function(l) {
|
|
2712
|
-
return l !== "annotation-xml" && Yt(l,
|
|
2712
|
+
return l !== "annotation-xml" && Yt(l, Ft);
|
|
2713
2713
|
}, Dn = function(l) {
|
|
2714
2714
|
$e(P.beforeSanitizeAttributes, l, null);
|
|
2715
2715
|
const {
|
|
@@ -2732,22 +2732,22 @@ function As() {
|
|
|
2732
2732
|
value: De
|
|
2733
2733
|
} = ae, Je = oe(re), Gt = De;
|
|
2734
2734
|
let ie = re === "value" ? Gt : ro(Gt);
|
|
2735
|
-
if (R.attrName = Je, R.attrValue = ie, R.keepAttr = !0, R.forceKeepAttr = void 0, $e(P.uponSanitizeAttribute, l, R), ie = R.attrValue,
|
|
2736
|
-
|
|
2735
|
+
if (R.attrName = Je, R.attrValue = ie, R.keepAttr = !0, R.forceKeepAttr = void 0, $e(P.uponSanitizeAttribute, l, R), ie = R.attrValue, wn && (Je === "id" || Je === "name") && (Fe(re, l), ie = Is + ie), te && he(/((--!?|])>)|<\/(style|title|textarea)/i, ie)) {
|
|
2736
|
+
Fe(re, l);
|
|
2737
2737
|
continue;
|
|
2738
2738
|
}
|
|
2739
2739
|
if (Je === "attributename" && Yt(ie, "href")) {
|
|
2740
|
-
|
|
2740
|
+
Fe(re, l);
|
|
2741
2741
|
continue;
|
|
2742
2742
|
}
|
|
2743
2743
|
if (R.forceKeepAttr)
|
|
2744
2744
|
continue;
|
|
2745
2745
|
if (!R.keepAttr) {
|
|
2746
|
-
|
|
2746
|
+
Fe(re, l);
|
|
2747
2747
|
continue;
|
|
2748
2748
|
}
|
|
2749
|
-
if (!K &&
|
|
2750
|
-
|
|
2749
|
+
if (!K && he(/\/>/i, ie)) {
|
|
2750
|
+
Fe(re, l);
|
|
2751
2751
|
continue;
|
|
2752
2752
|
}
|
|
2753
2753
|
G && Ot([L, ne, Te], (_n) => {
|
|
@@ -2755,7 +2755,7 @@ function As() {
|
|
|
2755
2755
|
});
|
|
2756
2756
|
const On = oe(l.nodeName);
|
|
2757
2757
|
if (!In(On, Je, ie)) {
|
|
2758
|
-
|
|
2758
|
+
Fe(re, l);
|
|
2759
2759
|
continue;
|
|
2760
2760
|
}
|
|
2761
2761
|
if (T && typeof m == "object" && typeof m.getAttributeType == "function" && !ge)
|
|
@@ -2773,11 +2773,11 @@ function As() {
|
|
|
2773
2773
|
try {
|
|
2774
2774
|
ge ? l.setAttributeNS(ge, re, ie) : l.setAttribute(re, ie), Vt(l) ? Ae(l) : Zn(e.removed);
|
|
2775
2775
|
} catch {
|
|
2776
|
-
|
|
2776
|
+
Fe(re, l);
|
|
2777
2777
|
}
|
|
2778
2778
|
}
|
|
2779
2779
|
$e(P.afterSanitizeAttributes, l, null);
|
|
2780
|
-
},
|
|
2780
|
+
}, zs = function $(l) {
|
|
2781
2781
|
let k = null;
|
|
2782
2782
|
const R = Mn(l);
|
|
2783
2783
|
for ($e(P.beforeSanitizeShadowDOM, l, null); k = R.nextNode(); )
|
|
@@ -2797,7 +2797,7 @@ function As() {
|
|
|
2797
2797
|
if (J || Kt(l), e.removed = [], typeof $ == "string" && (rt = !1), rt) {
|
|
2798
2798
|
if ($.nodeName) {
|
|
2799
2799
|
const De = oe($.nodeName);
|
|
2800
|
-
if (!Y[De] ||
|
|
2800
|
+
if (!Y[De] || Be[De])
|
|
2801
2801
|
throw dt("root node is forbidden and cannot be sanitized in-place");
|
|
2802
2802
|
}
|
|
2803
2803
|
} else if ($ instanceof a)
|
|
@@ -2809,10 +2809,10 @@ function As() {
|
|
|
2809
2809
|
if (k = En($), !k)
|
|
2810
2810
|
return Se ? null : Ct ? z : "";
|
|
2811
2811
|
}
|
|
2812
|
-
k &&
|
|
2812
|
+
k && de && Ae(k.firstChild);
|
|
2813
2813
|
const re = Mn(rt ? $ : k);
|
|
2814
2814
|
for (; Q = re.nextNode(); )
|
|
2815
|
-
Ln(Q), Dn(Q), Q.content instanceof o &&
|
|
2815
|
+
Ln(Q), Dn(Q), Q.content instanceof o && zs(Q.content);
|
|
2816
2816
|
if (rt)
|
|
2817
2817
|
return $;
|
|
2818
2818
|
if (Se) {
|
|
@@ -2824,7 +2824,7 @@ function As() {
|
|
|
2824
2824
|
return (se.shadowroot || se.shadowrootmode) && (ae = I.call(s, ae, !0)), ae;
|
|
2825
2825
|
}
|
|
2826
2826
|
let ge = X ? k.outerHTML : k.innerHTML;
|
|
2827
|
-
return X && Y["!doctype"] && k.ownerDocument && k.ownerDocument.doctype && k.ownerDocument.doctype.name &&
|
|
2827
|
+
return X && Y["!doctype"] && k.ownerDocument && k.ownerDocument.doctype && k.ownerDocument.doctype.name && he(As, k.ownerDocument.doctype.name) && (ge = "<!DOCTYPE " + k.ownerDocument.doctype.name + `>
|
|
2828
2828
|
` + ge), G && Ot([L, ne, Te], (De) => {
|
|
2829
2829
|
ge = ct(ge, De, " ");
|
|
2830
2830
|
}), T && Ct ? T.createHTML(ge) : ge;
|
|
@@ -2851,18 +2851,18 @@ function As() {
|
|
|
2851
2851
|
P = ns();
|
|
2852
2852
|
}, e;
|
|
2853
2853
|
}
|
|
2854
|
-
var
|
|
2854
|
+
var ko = Cs();
|
|
2855
2855
|
function bo() {
|
|
2856
2856
|
return {
|
|
2857
2857
|
parseMarkdown: (e) => {
|
|
2858
2858
|
if (!e || typeof e != "string")
|
|
2859
2859
|
return "";
|
|
2860
|
-
const t =
|
|
2860
|
+
const t = ls(e), s = q.parse(t, {
|
|
2861
2861
|
async: !1,
|
|
2862
2862
|
breaks: !0,
|
|
2863
2863
|
gfm: !0
|
|
2864
2864
|
});
|
|
2865
|
-
return
|
|
2865
|
+
return ko.sanitize(s, {
|
|
2866
2866
|
ALLOWED_TAGS: [
|
|
2867
2867
|
"p",
|
|
2868
2868
|
"br",
|
|
@@ -2912,8 +2912,8 @@ function va() {
|
|
|
2912
2912
|
});
|
|
2913
2913
|
}
|
|
2914
2914
|
function t(o, i = 100) {
|
|
2915
|
-
const { scrollTop: a, scrollHeight:
|
|
2916
|
-
return
|
|
2915
|
+
const { scrollTop: a, scrollHeight: u, clientHeight: c } = o;
|
|
2916
|
+
return u - a - c < i;
|
|
2917
2917
|
}
|
|
2918
2918
|
function s(o) {
|
|
2919
2919
|
o && (r(), n = new MutationObserver(() => {
|
|
@@ -2953,7 +2953,7 @@ function Ta() {
|
|
|
2953
2953
|
}
|
|
2954
2954
|
};
|
|
2955
2955
|
}
|
|
2956
|
-
function
|
|
2956
|
+
function Es() {
|
|
2957
2957
|
const n = We(), e = N(() => n.pageContext);
|
|
2958
2958
|
function t(o) {
|
|
2959
2959
|
n.setPageContext(o);
|
|
@@ -2979,7 +2979,7 @@ function Cs() {
|
|
|
2979
2979
|
updateContext: r
|
|
2980
2980
|
};
|
|
2981
2981
|
}
|
|
2982
|
-
const Ee = [],
|
|
2982
|
+
const Ee = [], Ms = {
|
|
2983
2983
|
id: "default",
|
|
2984
2984
|
matcher: () => !0,
|
|
2985
2985
|
priority: 0,
|
|
@@ -2991,14 +2991,14 @@ const Ee = [], Es = {
|
|
|
2991
2991
|
function vo() {
|
|
2992
2992
|
Ee.length = 0;
|
|
2993
2993
|
const n = ee();
|
|
2994
|
-
n != null && n.suggestionProviders && Ee.push(...n.suggestionProviders), Ee.push(
|
|
2994
|
+
n != null && n.suggestionProviders && Ee.push(...n.suggestionProviders), Ee.push(Ms);
|
|
2995
2995
|
}
|
|
2996
2996
|
function To(n, e) {
|
|
2997
2997
|
const t = [...Ee].sort((s, r) => (r.priority || 0) - (s.priority || 0));
|
|
2998
2998
|
for (const s of t)
|
|
2999
2999
|
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 + "/")))
|
|
3000
3000
|
return s;
|
|
3001
|
-
return
|
|
3001
|
+
return Ms;
|
|
3002
3002
|
}
|
|
3003
3003
|
function So(n, e) {
|
|
3004
3004
|
Ee.length === 0 && vo();
|
|
@@ -3021,24 +3021,24 @@ function Ao(n) {
|
|
|
3021
3021
|
}
|
|
3022
3022
|
}
|
|
3023
3023
|
const Sa = Ao;
|
|
3024
|
-
function
|
|
3025
|
-
const { context: n } =
|
|
3026
|
-
var
|
|
3024
|
+
function Rs() {
|
|
3025
|
+
const { context: n } = Es(), e = We(), t = N(() => {
|
|
3026
|
+
var u;
|
|
3027
3027
|
if (e.quota.remaining === 0) {
|
|
3028
|
-
const
|
|
3029
|
-
return (
|
|
3028
|
+
const c = ee();
|
|
3029
|
+
return (c == null ? void 0 : c.enableSupportMode) !== !1 ? [
|
|
3030
3030
|
{
|
|
3031
3031
|
id: "contact-support-quota",
|
|
3032
|
-
title:
|
|
3033
|
-
description:
|
|
3032
|
+
title: ue("contactSupport"),
|
|
3033
|
+
description: ue("noQuota"),
|
|
3034
3034
|
prompt: "I need help with my account",
|
|
3035
3035
|
className: "rai-suggestion--warning",
|
|
3036
3036
|
isSupportRequest: !0
|
|
3037
3037
|
}
|
|
3038
3038
|
] : [];
|
|
3039
3039
|
}
|
|
3040
|
-
const o = ((
|
|
3041
|
-
return a != null && a.can ? i.filter((
|
|
3040
|
+
const o = ((u = n.value) == null ? void 0 : u.routePath) || (typeof window < "u" ? window.location.pathname : "/"), i = So(o, n.value) || [], a = ee();
|
|
3041
|
+
return a != null && a.can ? i.filter((c) => !(c.permission && !a.can(c.permission))) : i;
|
|
3042
3042
|
}), s = N(() => n.value !== null && n.value.pageType !== "default");
|
|
3043
3043
|
function r(o) {
|
|
3044
3044
|
return typeof o.prompt == "function" ? o.prompt(
|
|
@@ -3052,13 +3052,13 @@ function Ms() {
|
|
|
3052
3052
|
};
|
|
3053
3053
|
}
|
|
3054
3054
|
function Aa(n, e) {
|
|
3055
|
-
const { setContext: t, clearContext: s, updateContext: r } =
|
|
3055
|
+
const { setContext: t, clearContext: s, updateContext: r } = Es();
|
|
3056
3056
|
function o() {
|
|
3057
3057
|
if (!e)
|
|
3058
3058
|
return {};
|
|
3059
3059
|
const a = {};
|
|
3060
|
-
for (const [
|
|
3061
|
-
a[
|
|
3060
|
+
for (const [u, c] of Object.entries(e))
|
|
3061
|
+
a[u] = Fs(c) ? c.value : c;
|
|
3062
3062
|
return a;
|
|
3063
3063
|
}
|
|
3064
3064
|
function i() {
|
|
@@ -3098,8 +3098,8 @@ function Co(n) {
|
|
|
3098
3098
|
function Eo(n, e) {
|
|
3099
3099
|
const t = n.key.toLowerCase();
|
|
3100
3100
|
if (e.mod) {
|
|
3101
|
-
const
|
|
3102
|
-
return t === e.key &&
|
|
3101
|
+
const c = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, d = e.shift ? n.shiftKey : !n.shiftKey, p = e.alt ? n.altKey : !n.altKey;
|
|
3102
|
+
return t === e.key && c && d && p;
|
|
3103
3103
|
}
|
|
3104
3104
|
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;
|
|
3105
3105
|
let a = s && r && o && i;
|
|
@@ -3112,8 +3112,8 @@ function Mo(n) {
|
|
|
3112
3112
|
const o = Co(r);
|
|
3113
3113
|
function i(a) {
|
|
3114
3114
|
if (!t) return;
|
|
3115
|
-
const
|
|
3116
|
-
if (!((
|
|
3115
|
+
const u = a.target, c = u.tagName === "INPUT" || u.tagName === "TEXTAREA", d = u.isContentEditable, p = u.closest("[data-ai-input]");
|
|
3116
|
+
if (!((c || d) && !p) && Eo(a, o)) {
|
|
3117
3117
|
a.preventDefault(), a.stopPropagation();
|
|
3118
3118
|
const w = ee();
|
|
3119
3119
|
if (w != null && w.canToggle && !w.canToggle())
|
|
@@ -3136,35 +3136,35 @@ function Ca(n) {
|
|
|
3136
3136
|
});
|
|
3137
3137
|
}
|
|
3138
3138
|
function Ro(n, e) {
|
|
3139
|
-
const t = U(
|
|
3139
|
+
const t = U(ue("loadingText"));
|
|
3140
3140
|
let s = [];
|
|
3141
3141
|
function r() {
|
|
3142
3142
|
return [
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3143
|
+
ue("loadingText"),
|
|
3144
|
+
ue("analyzingText"),
|
|
3145
|
+
ue("craftingText")
|
|
3146
3146
|
];
|
|
3147
3147
|
}
|
|
3148
3148
|
function o() {
|
|
3149
3149
|
return [0, 2e3, 5e3];
|
|
3150
3150
|
}
|
|
3151
3151
|
function i() {
|
|
3152
|
-
s.forEach((
|
|
3152
|
+
s.forEach((c) => clearTimeout(c)), s = [];
|
|
3153
3153
|
}
|
|
3154
3154
|
function a() {
|
|
3155
3155
|
i();
|
|
3156
|
-
const
|
|
3157
|
-
t.value = d[0] ||
|
|
3156
|
+
const c = e == null ? void 0 : e(), d = (c == null ? void 0 : c.messages) ?? r();
|
|
3157
|
+
t.value = d[0] || ue("loadingText");
|
|
3158
3158
|
}
|
|
3159
|
-
function
|
|
3159
|
+
function u() {
|
|
3160
3160
|
i();
|
|
3161
|
-
const
|
|
3162
|
-
t.value = d[0] ||
|
|
3161
|
+
const c = e == null ? void 0 : e(), d = (c == null ? void 0 : c.messages) ?? r(), p = (c == null ? void 0 : c.intervals) ?? o();
|
|
3162
|
+
t.value = d[0] || ue("loadingText");
|
|
3163
3163
|
let w = 0;
|
|
3164
3164
|
for (let m = 1; m < d.length; m++) {
|
|
3165
|
-
w +=
|
|
3166
|
-
const
|
|
3167
|
-
n() && (t.value = d[
|
|
3165
|
+
w += p[m] || 2e3;
|
|
3166
|
+
const f = m, A = window.setTimeout(() => {
|
|
3167
|
+
n() && (t.value = d[f]);
|
|
3168
3168
|
}, w);
|
|
3169
3169
|
s.push(A);
|
|
3170
3170
|
}
|
|
@@ -3173,7 +3173,7 @@ function Ro(n, e) {
|
|
|
3173
3173
|
i();
|
|
3174
3174
|
}), {
|
|
3175
3175
|
loadingMessage: t,
|
|
3176
|
-
startLoadingText:
|
|
3176
|
+
startLoadingText: u,
|
|
3177
3177
|
resetLoadingText: a,
|
|
3178
3178
|
clearLoadingTextTimers: i
|
|
3179
3179
|
};
|
|
@@ -3190,20 +3190,20 @@ function Lo(n) {
|
|
|
3190
3190
|
showWarning: !1,
|
|
3191
3191
|
isReached: !1,
|
|
3192
3192
|
pendingMessage: null
|
|
3193
|
-
}),
|
|
3193
|
+
}), u = N(() => {
|
|
3194
3194
|
var C;
|
|
3195
3195
|
return ((C = s()) == null ? void 0 : C.limit) ?? t();
|
|
3196
|
-
}),
|
|
3196
|
+
}), c = N(() => {
|
|
3197
3197
|
var C;
|
|
3198
|
-
return ((C = s()) == null ? void 0 : C.showWarningAt) ??
|
|
3199
|
-
}), d = N(() => Math.max(0,
|
|
3200
|
-
() => d.value <=
|
|
3198
|
+
return ((C = s()) == null ? void 0 : C.showWarningAt) ?? u.value - 2;
|
|
3199
|
+
}), d = N(() => Math.max(0, u.value - e())), p = N(
|
|
3200
|
+
() => d.value <= u.value - c.value && d.value > 0
|
|
3201
3201
|
), w = N(() => d.value === 0), m = N(() => {
|
|
3202
3202
|
var C, T;
|
|
3203
3203
|
return a.value.isReached ? ((C = r()) == null ? void 0 : C.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((T = r()) == null ? void 0 : T.historyLimitWarningTitle) ?? "Approaching Chat Limit";
|
|
3204
|
-
}),
|
|
3205
|
-
var C, T, z,
|
|
3206
|
-
return a.value.isReached ? ((C = s()) == null ? void 0 : C.limitMessage) ?? ((T = r()) == null ? void 0 : T.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) ?? ((
|
|
3204
|
+
}), f = N(() => {
|
|
3205
|
+
var C, T, z, B;
|
|
3206
|
+
return a.value.isReached ? ((C = s()) == null ? void 0 : C.limitMessage) ?? ((T = r()) == null ? void 0 : T.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) ?? ((B = r()) == null ? void 0 : B.historyLimitWarningMessage) ?? `You have ${d.value} message${d.value === 1 ? "" : "s"} remaining in this conversation.`;
|
|
3207
3207
|
});
|
|
3208
3208
|
function A() {
|
|
3209
3209
|
a.value.showWarning = !1, a.value.isReached = !1, a.value.pendingMessage = null;
|
|
@@ -3220,7 +3220,7 @@ function Lo(n) {
|
|
|
3220
3220
|
return null;
|
|
3221
3221
|
}
|
|
3222
3222
|
function g() {
|
|
3223
|
-
return w.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (
|
|
3223
|
+
return w.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (p.value && !a.value.showWarning && (a.value.showWarning = !0), !0);
|
|
3224
3224
|
}
|
|
3225
3225
|
function S(C) {
|
|
3226
3226
|
a.value.pendingMessage = C;
|
|
@@ -3230,10 +3230,10 @@ function Lo(n) {
|
|
|
3230
3230
|
showHistoryLimitWarning: N(() => a.value.showWarning),
|
|
3231
3231
|
historyLimitReached: N(() => a.value.isReached),
|
|
3232
3232
|
// Computed
|
|
3233
|
-
historyLimit:
|
|
3233
|
+
historyLimit: u,
|
|
3234
3234
|
remainingMessages: d,
|
|
3235
3235
|
historyLimitDialogTitle: m,
|
|
3236
|
-
historyLimitDialogMessage:
|
|
3236
|
+
historyLimitDialogMessage: f,
|
|
3237
3237
|
// Actions
|
|
3238
3238
|
dismissHistoryLimitWarning: A,
|
|
3239
3239
|
handleHistoryLimitAction: y,
|
|
@@ -3242,11 +3242,11 @@ function Lo(n) {
|
|
|
3242
3242
|
};
|
|
3243
3243
|
}
|
|
3244
3244
|
function Io() {
|
|
3245
|
-
const n = We(), e = U([]), t = U(!1), s = U(0), r = tt("maxAttachments") || 5, o = tt("maxFileSize") || 10 * 1024 * 1024, i = tt("acceptedFileTypes") || "image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx,.csv", a = N(() => e.value.length > 0),
|
|
3245
|
+
const n = We(), e = U([]), t = U(!1), s = U(0), r = tt("maxAttachments") || 5, o = tt("maxFileSize") || 10 * 1024 * 1024, i = tt("acceptedFileTypes") || "image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx,.csv", a = N(() => e.value.length > 0), u = N(() => e.value.some((E) => E.uploading)), c = N(() => e.value.length < r);
|
|
3246
3246
|
function d(E) {
|
|
3247
3247
|
return (E.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(E.name);
|
|
3248
3248
|
}
|
|
3249
|
-
function
|
|
3249
|
+
function p(E) {
|
|
3250
3250
|
if (E == null) return "";
|
|
3251
3251
|
const M = typeof E == "string" ? parseInt(E, 10) : E;
|
|
3252
3252
|
return Number.isNaN(M) ? "" : M >= 1024 * 1024 ? `${(M / (1024 * 1024)).toFixed(1)} MB` : M >= 1024 ? `${Math.round(M / 1024)} KB` : `${M} B`;
|
|
@@ -3280,12 +3280,12 @@ function Io() {
|
|
|
3280
3280
|
previewUrl: L || I.previewUrl
|
|
3281
3281
|
};
|
|
3282
3282
|
} else
|
|
3283
|
-
|
|
3283
|
+
f(M);
|
|
3284
3284
|
} catch {
|
|
3285
|
-
|
|
3285
|
+
f(M);
|
|
3286
3286
|
}
|
|
3287
3287
|
}
|
|
3288
|
-
function
|
|
3288
|
+
function f(E) {
|
|
3289
3289
|
const M = e.value.findIndex((P) => P.id === E);
|
|
3290
3290
|
if (M === -1) return;
|
|
3291
3291
|
const [I] = e.value.splice(M, 1);
|
|
@@ -3326,7 +3326,7 @@ function Io() {
|
|
|
3326
3326
|
function z(E) {
|
|
3327
3327
|
S(E) && (s.value = Math.max(0, s.value - 1), s.value === 0 && (t.value = !1));
|
|
3328
3328
|
}
|
|
3329
|
-
function
|
|
3329
|
+
function B(E) {
|
|
3330
3330
|
var M;
|
|
3331
3331
|
S(E) && (s.value = 0, t.value = !1, g(((M = E.dataTransfer) == null ? void 0 : M.files) || null));
|
|
3332
3332
|
}
|
|
@@ -3334,7 +3334,7 @@ function Io() {
|
|
|
3334
3334
|
const M = E.target, I = M.files;
|
|
3335
3335
|
I && I.length && g(I), M.value = "";
|
|
3336
3336
|
}
|
|
3337
|
-
return
|
|
3337
|
+
return Us(() => {
|
|
3338
3338
|
A();
|
|
3339
3339
|
}), {
|
|
3340
3340
|
// State
|
|
@@ -3342,14 +3342,14 @@ function Io() {
|
|
|
3342
3342
|
isDraggingFiles: t,
|
|
3343
3343
|
// Computed
|
|
3344
3344
|
hasAttachments: a,
|
|
3345
|
-
isUploading:
|
|
3346
|
-
canAddMore:
|
|
3345
|
+
isUploading: u,
|
|
3346
|
+
canAddMore: c,
|
|
3347
3347
|
acceptedFileTypes: i,
|
|
3348
3348
|
// Utils
|
|
3349
3349
|
isImage: d,
|
|
3350
|
-
formatFileSize:
|
|
3350
|
+
formatFileSize: p,
|
|
3351
3351
|
// Actions
|
|
3352
|
-
removeAttachment:
|
|
3352
|
+
removeAttachment: f,
|
|
3353
3353
|
clearAttachments: A,
|
|
3354
3354
|
buildPayload: y,
|
|
3355
3355
|
processFiles: g,
|
|
@@ -3358,22 +3358,22 @@ function Io() {
|
|
|
3358
3358
|
handleDragEnter: C,
|
|
3359
3359
|
handleDragOver: T,
|
|
3360
3360
|
handleDragLeave: z,
|
|
3361
|
-
handleDrop:
|
|
3361
|
+
handleDrop: B
|
|
3362
3362
|
};
|
|
3363
3363
|
}
|
|
3364
3364
|
function $o(n, e, t) {
|
|
3365
|
-
const s = U(!1), r = U([]), o = U(0), i = U({ inMention: !1, query: "", startPos: 0 }), a = U([]),
|
|
3365
|
+
const s = U(!1), r = U([]), o = U(0), i = U({ inMention: !1, query: "", startPos: 0 }), a = U([]), u = N(() => {
|
|
3366
3366
|
const A = ee();
|
|
3367
3367
|
return (A == null ? void 0 : A.mentionProviders) || [];
|
|
3368
3368
|
});
|
|
3369
|
-
function
|
|
3369
|
+
function c(A) {
|
|
3370
3370
|
const y = t();
|
|
3371
3371
|
if (!y) return;
|
|
3372
|
-
const g = y.selectionStart, S =
|
|
3372
|
+
const g = y.selectionStart, S = us(A, g);
|
|
3373
3373
|
i.value = S, S.inMention && S.query.length >= 0 ? d(S.query) : (s.value = !1, r.value = []);
|
|
3374
3374
|
}
|
|
3375
3375
|
async function d(A) {
|
|
3376
|
-
const y =
|
|
3376
|
+
const y = hs();
|
|
3377
3377
|
if (y.length === 0) {
|
|
3378
3378
|
s.value = !1;
|
|
3379
3379
|
return;
|
|
@@ -3388,7 +3388,7 @@ function $o(n, e, t) {
|
|
|
3388
3388
|
}
|
|
3389
3389
|
r.value = g.slice(0, 10), s.value = g.length > 0, o.value = 0;
|
|
3390
3390
|
}
|
|
3391
|
-
function
|
|
3391
|
+
function p(A) {
|
|
3392
3392
|
const { startPos: y } = i.value, g = n(), S = t(), C = g.slice(0, y), T = g.slice((S == null ? void 0 : S.selectionStart) || y), z = A.name || A.label || A.title || A.id;
|
|
3393
3393
|
e(`${C}@${z} ${T}`), a.value.push({
|
|
3394
3394
|
id: A.id,
|
|
@@ -3396,10 +3396,10 @@ function $o(n, e, t) {
|
|
|
3396
3396
|
type: A.type,
|
|
3397
3397
|
metadata: A.attributes
|
|
3398
3398
|
}), s.value = !1, r.value = [], setTimeout(() => {
|
|
3399
|
-
const
|
|
3400
|
-
|
|
3399
|
+
const B = t();
|
|
3400
|
+
B == null || B.focus();
|
|
3401
3401
|
const V = C.length + z.length + 2;
|
|
3402
|
-
|
|
3402
|
+
B == null || B.setSelectionRange(V, V);
|
|
3403
3403
|
}, 0);
|
|
3404
3404
|
}
|
|
3405
3405
|
function w(A) {
|
|
@@ -3412,14 +3412,14 @@ function $o(n, e, t) {
|
|
|
3412
3412
|
if (A.key === "Enter" || A.key === "Tab") {
|
|
3413
3413
|
A.preventDefault();
|
|
3414
3414
|
const y = r.value[o.value];
|
|
3415
|
-
return y &&
|
|
3415
|
+
return y && p(y), !0;
|
|
3416
3416
|
}
|
|
3417
3417
|
return A.key === "Escape" ? (A.preventDefault(), s.value = !1, !0) : !1;
|
|
3418
3418
|
}
|
|
3419
3419
|
function m() {
|
|
3420
3420
|
a.value = [];
|
|
3421
3421
|
}
|
|
3422
|
-
function
|
|
3422
|
+
function f() {
|
|
3423
3423
|
return [...a.value];
|
|
3424
3424
|
}
|
|
3425
3425
|
return {
|
|
@@ -3427,36 +3427,36 @@ function $o(n, e, t) {
|
|
|
3427
3427
|
showMentions: s,
|
|
3428
3428
|
mentionItems: r,
|
|
3429
3429
|
selectedMentionIndex: o,
|
|
3430
|
-
mentionProviders:
|
|
3430
|
+
mentionProviders: u,
|
|
3431
3431
|
// Actions
|
|
3432
|
-
checkForMentions:
|
|
3433
|
-
handleMentionSelect:
|
|
3432
|
+
checkForMentions: c,
|
|
3433
|
+
handleMentionSelect: p,
|
|
3434
3434
|
handleMentionKeyDown: w,
|
|
3435
3435
|
clearMentions: m,
|
|
3436
|
-
getMentions:
|
|
3436
|
+
getMentions: f
|
|
3437
3437
|
};
|
|
3438
3438
|
}
|
|
3439
3439
|
function Do(n, e, t, s, r) {
|
|
3440
3440
|
const o = U(!1), i = U(-1), a = U(null);
|
|
3441
|
-
function
|
|
3441
|
+
function u() {
|
|
3442
3442
|
setTimeout(() => {
|
|
3443
3443
|
const m = a.value;
|
|
3444
3444
|
if (!m) return;
|
|
3445
|
-
const
|
|
3446
|
-
|
|
3445
|
+
const f = m.querySelector(`li:nth-child(${i.value + 1})`);
|
|
3446
|
+
f && f.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
3447
3447
|
}, 0);
|
|
3448
3448
|
}
|
|
3449
|
-
function
|
|
3450
|
-
const
|
|
3451
|
-
if (!o.value ||
|
|
3449
|
+
function c(m) {
|
|
3450
|
+
const f = n();
|
|
3451
|
+
if (!o.value || f.length === 0)
|
|
3452
3452
|
return !1;
|
|
3453
3453
|
if (m.key === "ArrowDown")
|
|
3454
|
-
return m.preventDefault(), i.value = Math.min(i.value + 1,
|
|
3454
|
+
return m.preventDefault(), i.value = Math.min(i.value + 1, f.length - 1), u(), !0;
|
|
3455
3455
|
if (m.key === "ArrowUp")
|
|
3456
|
-
return m.preventDefault(), i.value = Math.max(i.value - 1, 0),
|
|
3456
|
+
return m.preventDefault(), i.value = Math.max(i.value - 1, 0), u(), !0;
|
|
3457
3457
|
if (m.key === "Enter" && i.value >= 0) {
|
|
3458
3458
|
m.preventDefault();
|
|
3459
|
-
const A =
|
|
3459
|
+
const A = f[i.value];
|
|
3460
3460
|
return A && d(A), !0;
|
|
3461
3461
|
}
|
|
3462
3462
|
return m.key === "Escape" ? (m.preventDefault(), o.value = !1, i.value = -1, !0) : !1;
|
|
@@ -3464,9 +3464,9 @@ function Do(n, e, t, s, r) {
|
|
|
3464
3464
|
function d(m) {
|
|
3465
3465
|
r(m), o.value = !1, i.value = -1;
|
|
3466
3466
|
}
|
|
3467
|
-
function
|
|
3468
|
-
const m = s(),
|
|
3469
|
-
m && !
|
|
3467
|
+
function p() {
|
|
3468
|
+
const m = s(), f = e(), A = t(), y = n();
|
|
3469
|
+
m && !f && A && y.length > 0 ? o.value = !0 : o.value = !1;
|
|
3470
3470
|
}
|
|
3471
3471
|
function w() {
|
|
3472
3472
|
o.value = !1, i.value = -1;
|
|
@@ -3475,9 +3475,9 @@ function Do(n, e, t, s, r) {
|
|
|
3475
3475
|
showSuggestions: o,
|
|
3476
3476
|
selectedSuggestionIndex: i,
|
|
3477
3477
|
dropdownRef: a,
|
|
3478
|
-
handleSuggestionKeyDown:
|
|
3478
|
+
handleSuggestionKeyDown: c,
|
|
3479
3479
|
handleSuggestionClick: d,
|
|
3480
|
-
updateSuggestionsVisibility:
|
|
3480
|
+
updateSuggestionsVisibility: p,
|
|
3481
3481
|
hideSuggestions: w
|
|
3482
3482
|
};
|
|
3483
3483
|
}
|
|
@@ -3495,7 +3495,7 @@ function Oo(n, e = 300) {
|
|
|
3495
3495
|
adjustTextareaHeight: t
|
|
3496
3496
|
};
|
|
3497
3497
|
}
|
|
3498
|
-
const _o = /* @__PURE__ */
|
|
3498
|
+
const _o = /* @__PURE__ */ ce({
|
|
3499
3499
|
__name: "AiAvatar",
|
|
3500
3500
|
props: {
|
|
3501
3501
|
ui: {}
|
|
@@ -3506,7 +3506,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3506
3506
|
return x(), v("div", {
|
|
3507
3507
|
class: b(["w-6 h-6 min-w-[24px] flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600", (s = n.ui) == null ? void 0 : s.container])
|
|
3508
3508
|
}, [
|
|
3509
|
-
|
|
3509
|
+
le(e.$slots, "default", {}, () => {
|
|
3510
3510
|
var r;
|
|
3511
3511
|
return [
|
|
3512
3512
|
(x(), v("svg", {
|
|
@@ -3527,7 +3527,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3527
3527
|
], 2);
|
|
3528
3528
|
};
|
|
3529
3529
|
}
|
|
3530
|
-
}), Ea = /* @__PURE__ */
|
|
3530
|
+
}), Ea = /* @__PURE__ */ ce({
|
|
3531
3531
|
__name: "UserAvatar",
|
|
3532
3532
|
props: {
|
|
3533
3533
|
ui: {}
|
|
@@ -3538,7 +3538,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3538
3538
|
return x(), v("div", {
|
|
3539
3539
|
class: b(["w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center flex-shrink-0", (s = n.ui) == null ? void 0 : s.container])
|
|
3540
3540
|
}, [
|
|
3541
|
-
|
|
3541
|
+
le(e.$slots, "default", {}, () => {
|
|
3542
3542
|
var r;
|
|
3543
3543
|
return [
|
|
3544
3544
|
(x(), v("svg", {
|
|
@@ -3558,7 +3558,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3558
3558
|
], 2);
|
|
3559
3559
|
};
|
|
3560
3560
|
}
|
|
3561
|
-
}), No = ["onClick", "onMouseenter"], Po = /* @__PURE__ */
|
|
3561
|
+
}), No = ["onClick", "onMouseenter"], Po = /* @__PURE__ */ ce({
|
|
3562
3562
|
__name: "MentionList",
|
|
3563
3563
|
props: {
|
|
3564
3564
|
items: {},
|
|
@@ -3583,13 +3583,13 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3583
3583
|
}), y;
|
|
3584
3584
|
});
|
|
3585
3585
|
function a(y) {
|
|
3586
|
-
return t.providers.find((g) => g.type === y) ||
|
|
3586
|
+
return t.providers.find((g) => g.type === y) || ds(y);
|
|
3587
3587
|
}
|
|
3588
|
-
function
|
|
3588
|
+
function u(y) {
|
|
3589
3589
|
const g = a(y);
|
|
3590
3590
|
return (g == null ? void 0 : g.label) || y.charAt(0).toUpperCase() + y.slice(1) + "s";
|
|
3591
3591
|
}
|
|
3592
|
-
function
|
|
3592
|
+
function c(y, g) {
|
|
3593
3593
|
let S = 0;
|
|
3594
3594
|
const C = Object.keys(i.value);
|
|
3595
3595
|
for (const T of C) {
|
|
@@ -3602,7 +3602,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3602
3602
|
function d(y) {
|
|
3603
3603
|
r("select", y);
|
|
3604
3604
|
}
|
|
3605
|
-
function
|
|
3605
|
+
function p(y) {
|
|
3606
3606
|
o.value = y, r("update:selectedIndex", y);
|
|
3607
3607
|
}
|
|
3608
3608
|
function w(y) {
|
|
@@ -3611,9 +3611,9 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3611
3611
|
}
|
|
3612
3612
|
function m(y) {
|
|
3613
3613
|
const g = a(y.type);
|
|
3614
|
-
return
|
|
3614
|
+
return cs(y, g);
|
|
3615
3615
|
}
|
|
3616
|
-
function
|
|
3616
|
+
function f(y) {
|
|
3617
3617
|
const g = {
|
|
3618
3618
|
employee: "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",
|
|
3619
3619
|
job: "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400",
|
|
@@ -3633,47 +3633,47 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3633
3633
|
h("div", {
|
|
3634
3634
|
class: b(["p-2", s.value.container])
|
|
3635
3635
|
}, [
|
|
3636
|
-
(x(!0), v(
|
|
3636
|
+
(x(!0), v(ke, null, Ne(i.value, (S, C) => (x(), v(ke, { key: C }, [
|
|
3637
3637
|
Object.keys(i.value).length > 1 ? (x(), v("div", {
|
|
3638
3638
|
key: 0,
|
|
3639
3639
|
class: b(["px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide", s.value.groupHeader])
|
|
3640
|
-
},
|
|
3641
|
-
(x(!0), v(
|
|
3640
|
+
}, O(u(C)), 3)) : F("", !0),
|
|
3641
|
+
(x(!0), v(ke, null, Ne(S, (T, z) => (x(), v("button", {
|
|
3642
3642
|
key: T.id,
|
|
3643
3643
|
type: "button",
|
|
3644
3644
|
class: b(["w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors mb-0.5", [
|
|
3645
3645
|
s.value.item,
|
|
3646
3646
|
{
|
|
3647
|
-
[s.value.itemSelected || "bg-primary/10"]:
|
|
3648
|
-
"hover:bg-gray-50 dark:hover:bg-gray-700":
|
|
3647
|
+
[s.value.itemSelected || "bg-primary/10"]: c(C, z) === o.value,
|
|
3648
|
+
"hover:bg-gray-50 dark:hover:bg-gray-700": c(C, z) !== o.value
|
|
3649
3649
|
}
|
|
3650
3650
|
]]),
|
|
3651
|
-
onClick: (
|
|
3652
|
-
onMouseenter: (
|
|
3651
|
+
onClick: (B) => d(T),
|
|
3652
|
+
onMouseenter: (B) => p(c(C, z))
|
|
3653
3653
|
}, [
|
|
3654
|
-
|
|
3654
|
+
le(y.$slots, "item-icon", {
|
|
3655
3655
|
item: T,
|
|
3656
3656
|
type: C
|
|
3657
3657
|
}, () => [
|
|
3658
3658
|
h("span", {
|
|
3659
|
-
class: b(["w-8 h-8 flex items-center justify-center rounded-full text-xs font-semibold flex-shrink-0", [s.value.itemIcon,
|
|
3660
|
-
},
|
|
3659
|
+
class: b(["w-8 h-8 flex items-center justify-center rounded-full text-xs font-semibold flex-shrink-0", [s.value.itemIcon, f(T.type)]])
|
|
3660
|
+
}, O(A(w(T))), 3)
|
|
3661
3661
|
]),
|
|
3662
3662
|
h("div", {
|
|
3663
3663
|
class: b(["flex-1 min-w-0", s.value.itemContent])
|
|
3664
3664
|
}, [
|
|
3665
3665
|
h("p", {
|
|
3666
3666
|
class: b(["text-sm font-medium text-gray-900 dark:text-gray-100 truncate", s.value.itemName])
|
|
3667
|
-
},
|
|
3667
|
+
}, O(w(T)), 3),
|
|
3668
3668
|
m(T) ? (x(), v("p", {
|
|
3669
3669
|
key: 0,
|
|
3670
3670
|
class: b(["text-xs text-gray-500 dark:text-gray-400 truncate", s.value.itemSubtitle])
|
|
3671
|
-
},
|
|
3671
|
+
}, O(m(T)), 3)) : F("", !0)
|
|
3672
3672
|
], 2)
|
|
3673
3673
|
], 42, No))), 128))
|
|
3674
3674
|
], 64))), 128))
|
|
3675
3675
|
], 2)
|
|
3676
|
-
], 2)) :
|
|
3676
|
+
], 2)) : F("", !0);
|
|
3677
3677
|
}
|
|
3678
3678
|
}), zo = ["title"], Ho = {
|
|
3679
3679
|
key: 0,
|
|
@@ -3681,7 +3681,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3681
3681
|
fill: "none",
|
|
3682
3682
|
viewBox: "0 0 24 24",
|
|
3683
3683
|
stroke: "currentColor"
|
|
3684
|
-
},
|
|
3684
|
+
}, Bo = /* @__PURE__ */ ce({
|
|
3685
3685
|
__name: "ChatMessageActions",
|
|
3686
3686
|
props: {
|
|
3687
3687
|
message: {},
|
|
@@ -3690,23 +3690,23 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3690
3690
|
},
|
|
3691
3691
|
emits: ["copy"],
|
|
3692
3692
|
setup(n, { emit: e }) {
|
|
3693
|
-
const t = n, s = e, r = (
|
|
3693
|
+
const t = n, s = e, r = (u) => {
|
|
3694
3694
|
var d;
|
|
3695
|
-
return (d = t.texts) != null && d[
|
|
3695
|
+
return (d = t.texts) != null && d[u] ? t.texts[u] : ue({
|
|
3696
3696
|
copyToClipboard: "copyToClipboard",
|
|
3697
3697
|
copied: "copied"
|
|
3698
|
-
}[
|
|
3698
|
+
}[u]);
|
|
3699
3699
|
}, o = N(() => t.ui || {}), i = U(!1);
|
|
3700
3700
|
async function a() {
|
|
3701
3701
|
try {
|
|
3702
3702
|
await navigator.clipboard.writeText(t.message.message), i.value = !0, s("copy", t.message), setTimeout(() => {
|
|
3703
3703
|
i.value = !1;
|
|
3704
3704
|
}, 2e3);
|
|
3705
|
-
} catch (
|
|
3706
|
-
console.error("Failed to copy:",
|
|
3705
|
+
} catch (u) {
|
|
3706
|
+
console.error("Failed to copy:", u);
|
|
3707
3707
|
}
|
|
3708
3708
|
}
|
|
3709
|
-
return (
|
|
3709
|
+
return (u, c) => (x(), v("div", {
|
|
3710
3710
|
class: b(["flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", o.value.container])
|
|
3711
3711
|
}, [
|
|
3712
3712
|
h("button", {
|
|
@@ -3721,14 +3721,14 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3721
3721
|
fill: "none",
|
|
3722
3722
|
viewBox: "0 0 24 24",
|
|
3723
3723
|
stroke: "currentColor"
|
|
3724
|
-
}, [...
|
|
3724
|
+
}, [...c[1] || (c[1] = [
|
|
3725
3725
|
h("path", {
|
|
3726
3726
|
"stroke-linecap": "round",
|
|
3727
3727
|
"stroke-linejoin": "round",
|
|
3728
3728
|
"stroke-width": "2",
|
|
3729
3729
|
d: "M5 13l4 4L19 7"
|
|
3730
3730
|
}, null, -1)
|
|
3731
|
-
])], 2)) : (x(), v("svg", Ho, [...
|
|
3731
|
+
])], 2)) : (x(), v("svg", Ho, [...c[0] || (c[0] = [
|
|
3732
3732
|
h("path", {
|
|
3733
3733
|
"stroke-linecap": "round",
|
|
3734
3734
|
"stroke-linejoin": "round",
|
|
@@ -3739,7 +3739,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3739
3739
|
], 10, zo)
|
|
3740
3740
|
], 2));
|
|
3741
3741
|
}
|
|
3742
|
-
}),
|
|
3742
|
+
}), Fo = { class: "h-12 w-12 flex items-center justify-center rounded-lg bg-white/20 overflow-hidden" }, Uo = ["src"], qo = {
|
|
3743
3743
|
key: 1,
|
|
3744
3744
|
class: "w-5 h-5 text-white",
|
|
3745
3745
|
fill: "none",
|
|
@@ -3762,7 +3762,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3762
3762
|
}, ni = { class: "flex-1 min-w-0" }, si = { class: "text-sm font-semibold text-gray-800 dark:text-gray-200 truncate" }, ri = { class: "text-xs text-gray-500 dark:text-gray-400" }, oi = {
|
|
3763
3763
|
key: 0,
|
|
3764
3764
|
class: "text-xs font-medium text-primary"
|
|
3765
|
-
}, ii = /* @__PURE__ */
|
|
3765
|
+
}, ii = /* @__PURE__ */ ce({
|
|
3766
3766
|
__name: "ChatMessage",
|
|
3767
3767
|
props: {
|
|
3768
3768
|
message: {},
|
|
@@ -3782,13 +3782,13 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3782
3782
|
openAttachment: "Open",
|
|
3783
3783
|
attachment: "Attachment"
|
|
3784
3784
|
}[g] || g;
|
|
3785
|
-
}, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a = U(!1),
|
|
3785
|
+
}, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a = U(!1), u = N(() => t.message.attachments ?? []), c = N(() => u.value.length > 0), d = N(() => {
|
|
3786
3786
|
if (t.message.role !== "user") return !1;
|
|
3787
3787
|
const g = t.message.message || "", S = g.split(`
|
|
3788
3788
|
`).length;
|
|
3789
3789
|
return g.length > 200 || S > 4;
|
|
3790
3790
|
});
|
|
3791
|
-
function
|
|
3791
|
+
function p() {
|
|
3792
3792
|
a.value = !a.value;
|
|
3793
3793
|
}
|
|
3794
3794
|
function w(g) {
|
|
@@ -3798,7 +3798,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3798
3798
|
const g = ee();
|
|
3799
3799
|
return g != null && g.userAvatar ? typeof g.userAvatar == "string" ? g.userAvatar : typeof g.userAvatar == "function" ? g.userAvatar() : null : null;
|
|
3800
3800
|
});
|
|
3801
|
-
function
|
|
3801
|
+
function f(g) {
|
|
3802
3802
|
if (g == null) return "";
|
|
3803
3803
|
const S = typeof g == "string" ? parseInt(g, 10) : g;
|
|
3804
3804
|
return Number.isNaN(S) ? "" : S >= 1024 * 1024 ? `${(S / (1024 * 1024)).toFixed(1)} MB` : S >= 1024 ? `${Math.round(S / 1024)} KB` : `${S} B`;
|
|
@@ -3835,17 +3835,17 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3835
3835
|
n.message.message ? (x(), v("p", {
|
|
3836
3836
|
key: 0,
|
|
3837
3837
|
class: b(["text-sm whitespace-pre-wrap", [o.value.content, { "line-clamp-4": !a.value && d.value }]])
|
|
3838
|
-
},
|
|
3838
|
+
}, O(n.message.message), 3)) : F("", !0),
|
|
3839
3839
|
d.value ? (x(), v("button", {
|
|
3840
3840
|
key: 1,
|
|
3841
3841
|
class: b(["mt-2 text-xs text-white/80 hover:text-white underline", o.value.showMoreButton]),
|
|
3842
|
-
onClick:
|
|
3843
|
-
},
|
|
3844
|
-
|
|
3842
|
+
onClick: p
|
|
3843
|
+
}, O(a.value ? r("showLess") : r("showMore")), 3)) : F("", !0),
|
|
3844
|
+
c.value ? (x(), v("div", {
|
|
3845
3845
|
key: 2,
|
|
3846
3846
|
class: b(["mt-3 space-y-2", o.value.attachmentsContainer])
|
|
3847
3847
|
}, [
|
|
3848
|
-
(x(!0), v(
|
|
3848
|
+
(x(!0), v(ke, null, Ne(u.value, (T) => (x(), Me(nn(T.url ? "a" : "div"), {
|
|
3849
3849
|
key: T.id,
|
|
3850
3850
|
href: T.url || void 0,
|
|
3851
3851
|
target: T.url ? "_blank" : void 0,
|
|
@@ -3853,7 +3853,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3853
3853
|
class: b(["flex items-center gap-3 rounded-xl border border-white/20 bg-white/10 p-2 transition", [o.value.attachmentItem, T.url ? "hover:bg-white/20 cursor-pointer" : ""]])
|
|
3854
3854
|
}, {
|
|
3855
3855
|
default: Ce(() => [
|
|
3856
|
-
h("div",
|
|
3856
|
+
h("div", Fo, [
|
|
3857
3857
|
T.url && w(T) ? (x(), v("img", {
|
|
3858
3858
|
key: 0,
|
|
3859
3859
|
src: T.url,
|
|
@@ -3869,14 +3869,14 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3869
3869
|
])]))
|
|
3870
3870
|
]),
|
|
3871
3871
|
h("div", jo, [
|
|
3872
|
-
h("p", Wo,
|
|
3873
|
-
h("p", Ko,
|
|
3872
|
+
h("p", Wo, O(T.name || r("attachment")), 1),
|
|
3873
|
+
h("p", Ko, O(f(T.size)), 1)
|
|
3874
3874
|
]),
|
|
3875
|
-
T.url ? (x(), v("span", Vo,
|
|
3875
|
+
T.url ? (x(), v("span", Vo, O(r("openAttachment")), 1)) : F("", !0)
|
|
3876
3876
|
]),
|
|
3877
3877
|
_: 2
|
|
3878
3878
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3879
|
-
], 2)) :
|
|
3879
|
+
], 2)) : F("", !0)
|
|
3880
3880
|
], 2),
|
|
3881
3881
|
h("div", {
|
|
3882
3882
|
class: b(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary-500 overflow-hidden", o.value.userAvatar])
|
|
@@ -3924,18 +3924,18 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3924
3924
|
style: { "animation-delay": "300ms" }
|
|
3925
3925
|
}, null, -1)
|
|
3926
3926
|
])], 2),
|
|
3927
|
-
h("span", Yo,
|
|
3927
|
+
h("span", Yo, O(((C = n.texts) == null ? void 0 : C.loadingText) || n.loadingText), 1)
|
|
3928
3928
|
], 2)) : n.message.message ? (x(), v("div", {
|
|
3929
3929
|
key: 1,
|
|
3930
3930
|
id: n.message.id,
|
|
3931
3931
|
class: b(["prose prose-sm max-w-none prose-gray dark:prose-invert", o.value.content]),
|
|
3932
3932
|
innerHTML: A.value
|
|
3933
|
-
}, null, 10, Xo)) :
|
|
3934
|
-
!n.message.loading &&
|
|
3933
|
+
}, null, 10, Xo)) : F("", !0),
|
|
3934
|
+
!n.message.loading && c.value ? (x(), v("div", {
|
|
3935
3935
|
key: 2,
|
|
3936
3936
|
class: b(["mt-4 space-y-2", o.value.attachmentsContainer])
|
|
3937
3937
|
}, [
|
|
3938
|
-
(x(!0), v(
|
|
3938
|
+
(x(!0), v(ke, null, Ne(u.value, (T) => (x(), Me(nn(T.url ? "a" : "div"), {
|
|
3939
3939
|
key: T.id,
|
|
3940
3940
|
href: T.url || void 0,
|
|
3941
3941
|
target: T.url ? "_blank" : void 0,
|
|
@@ -3959,31 +3959,31 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3959
3959
|
])]))
|
|
3960
3960
|
]),
|
|
3961
3961
|
h("div", ni, [
|
|
3962
|
-
h("p", si,
|
|
3963
|
-
h("p", ri,
|
|
3962
|
+
h("p", si, O(T.name || r("attachment")), 1),
|
|
3963
|
+
h("p", ri, O(f(T.size)), 1)
|
|
3964
3964
|
]),
|
|
3965
|
-
T.url ? (x(), v("span", oi,
|
|
3965
|
+
T.url ? (x(), v("span", oi, O(r("openAttachment")), 1)) : F("", !0)
|
|
3966
3966
|
]),
|
|
3967
3967
|
_: 2
|
|
3968
3968
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3969
|
-
], 2)) :
|
|
3969
|
+
], 2)) : F("", !0)
|
|
3970
3970
|
], 2)
|
|
3971
3971
|
], 2)),
|
|
3972
|
-
n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (x(), Me(
|
|
3972
|
+
n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (x(), Me(Bo, {
|
|
3973
3973
|
key: 2,
|
|
3974
3974
|
message: n.message,
|
|
3975
3975
|
class: b(["absolute -bottom-8 left-14", o.value.actionsContainer]),
|
|
3976
3976
|
onCopy: y
|
|
3977
|
-
}, null, 8, ["message", "class"])) :
|
|
3977
|
+
}, null, 8, ["message", "class"])) : F("", !0)
|
|
3978
3978
|
], 2);
|
|
3979
3979
|
};
|
|
3980
3980
|
}
|
|
3981
|
-
}),
|
|
3981
|
+
}), Ls = (n, e) => {
|
|
3982
3982
|
const t = n.__vccOpts || n;
|
|
3983
3983
|
for (const [s, r] of e)
|
|
3984
3984
|
t[s] = r;
|
|
3985
3985
|
return t;
|
|
3986
|
-
}, ai = /* @__PURE__ */
|
|
3986
|
+
}, ai = /* @__PURE__ */ Ls(ii, [["__scopeId", "data-v-5f7bccb0"]]), li = { class: "text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide" }, ui = { class: "space-y-2" }, ci = ["src"], di = {
|
|
3987
3987
|
key: 1,
|
|
3988
3988
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
3989
3989
|
fill: "none",
|
|
@@ -3995,7 +3995,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
3995
3995
|
}, mi = {
|
|
3996
3996
|
key: 0,
|
|
3997
3997
|
class: "text-xs text-gray-400"
|
|
3998
|
-
}, yi = ["disabled", "onClick"], xi = /* @__PURE__ */
|
|
3998
|
+
}, yi = ["disabled", "onClick"], xi = /* @__PURE__ */ ce({
|
|
3999
3999
|
__name: "AttachmentsPreview",
|
|
4000
4000
|
props: {
|
|
4001
4001
|
attachments: {},
|
|
@@ -4011,9 +4011,9 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4011
4011
|
return x(), v("div", {
|
|
4012
4012
|
class: b(["border border-gray-200 dark:border-gray-700 rounded-2xl p-3 bg-gray-50 dark:bg-gray-800 space-y-3", n.ui.attachmentsContainer])
|
|
4013
4013
|
}, [
|
|
4014
|
-
h("p", li,
|
|
4014
|
+
h("p", li, O(((s = n.texts) == null ? void 0 : s.attachedFiles) || "Attached files"), 1),
|
|
4015
4015
|
h("ul", ui, [
|
|
4016
|
-
(x(!0), v(
|
|
4016
|
+
(x(!0), v(ke, null, Ne(n.attachments, (r) => (x(), v("li", {
|
|
4017
4017
|
key: r.id,
|
|
4018
4018
|
class: b(["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])
|
|
4019
4019
|
}, [
|
|
@@ -4035,16 +4035,16 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4035
4035
|
])]))
|
|
4036
4036
|
], 2),
|
|
4037
4037
|
h("div", hi, [
|
|
4038
|
-
h("p", pi,
|
|
4039
|
-
h("p", fi,
|
|
4038
|
+
h("p", pi, O(r.name), 1),
|
|
4039
|
+
h("p", fi, O(n.formatFileSize(r.size)), 1),
|
|
4040
4040
|
r.uploading ? (x(), v("div", gi, [
|
|
4041
4041
|
h("div", {
|
|
4042
4042
|
class: "h-full bg-primary transition-all",
|
|
4043
4043
|
style: un({ width: `${r.progress ?? 10}%` })
|
|
4044
4044
|
}, null, 4)
|
|
4045
|
-
])) :
|
|
4045
|
+
])) : F("", !0)
|
|
4046
4046
|
]),
|
|
4047
|
-
r.uploading ? (x(), v("span", mi,
|
|
4047
|
+
r.uploading ? (x(), v("span", mi, O(Math.round(r.progress ?? 0)) + "% ", 1)) : F("", !0),
|
|
4048
4048
|
h("button", {
|
|
4049
4049
|
type: "button",
|
|
4050
4050
|
class: b(["p-1 rounded-full hover:bg-gray-100 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed", n.ui.attachmentRemove]),
|
|
@@ -4070,7 +4070,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4070
4070
|
], 2);
|
|
4071
4071
|
};
|
|
4072
4072
|
}
|
|
4073
|
-
}),
|
|
4073
|
+
}), wi = { class: "py-1" }, ki = ["onClick", "onMouseenter"], bi = { class: "flex items-start gap-3" }, vi = { class: "flex-1 min-w-0" }, Ti = { class: "text-sm font-medium text-gray-900 dark:text-gray-100" }, Si = { class: "text-xs text-gray-500 dark:text-gray-400 mt-0.5 line-clamp-2" }, Ai = /* @__PURE__ */ ce({
|
|
4074
4074
|
__name: "SuggestionsDropdown",
|
|
4075
4075
|
props: {
|
|
4076
4076
|
suggestions: {},
|
|
@@ -4094,8 +4094,8 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4094
4094
|
ref: t,
|
|
4095
4095
|
class: b(["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])
|
|
4096
4096
|
}, [
|
|
4097
|
-
h("ul",
|
|
4098
|
-
(x(!0), v(
|
|
4097
|
+
h("ul", wi, [
|
|
4098
|
+
(x(!0), v(ke, null, Ne(n.suggestions, (o, i) => (x(), v("li", {
|
|
4099
4099
|
key: o.id,
|
|
4100
4100
|
class: b(["px-4 py-3 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-700 last:border-b-0", [
|
|
4101
4101
|
n.ui.suggestionItem,
|
|
@@ -4109,11 +4109,11 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4109
4109
|
}, [
|
|
4110
4110
|
h("div", bi, [
|
|
4111
4111
|
h("div", vi, [
|
|
4112
|
-
h("p", Ti,
|
|
4113
|
-
h("p", Si,
|
|
4112
|
+
h("p", Ti, O(o.title), 1),
|
|
4113
|
+
h("p", Si, O(o.description), 1)
|
|
4114
4114
|
])
|
|
4115
4115
|
])
|
|
4116
|
-
], 42,
|
|
4116
|
+
], 42, ki))), 128))
|
|
4117
4117
|
])
|
|
4118
4118
|
], 2)
|
|
4119
4119
|
]),
|
|
@@ -4131,7 +4131,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4131
4131
|
class: "w-4 h-4",
|
|
4132
4132
|
viewBox: "0 0 24 24",
|
|
4133
4133
|
fill: "currentColor"
|
|
4134
|
-
}, $i = /* @__PURE__ */
|
|
4134
|
+
}, $i = /* @__PURE__ */ ce({
|
|
4135
4135
|
__name: "InputActions",
|
|
4136
4136
|
props: {
|
|
4137
4137
|
sending: { type: Boolean },
|
|
@@ -4152,7 +4152,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4152
4152
|
type: "button",
|
|
4153
4153
|
class: b(["h-9 w-9 rounded-xl flex items-center justify-center text-gray-400 hover:text-primary hover:bg-gray-100 dark:hover:bg-gray-700 transition flex-shrink-0", n.ui.supportToggle]),
|
|
4154
4154
|
title: ((o = n.texts) == null ? void 0 : o.toggleSupportMode) || "Toggle support mode",
|
|
4155
|
-
onClick: r[0] || (r[0] = (
|
|
4155
|
+
onClick: r[0] || (r[0] = (u) => s.$emit("toggle-support-mode"))
|
|
4156
4156
|
}, [...r[3] || (r[3] = [
|
|
4157
4157
|
h("svg", {
|
|
4158
4158
|
class: "w-5 h-5",
|
|
@@ -4167,13 +4167,13 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4167
4167
|
d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"
|
|
4168
4168
|
})
|
|
4169
4169
|
], -1)
|
|
4170
|
-
])], 10, Ei)) :
|
|
4170
|
+
])], 10, Ei)) : F("", !0),
|
|
4171
4171
|
n.showSupportModeToggle && n.supportRequestMode ? (x(), v("button", {
|
|
4172
4172
|
key: 1,
|
|
4173
4173
|
type: "button",
|
|
4174
4174
|
class: b(["h-7 px-2 rounded-lg flex items-center gap-1 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 hover:bg-amber-200 dark:hover:bg-amber-900/50 transition flex-shrink-0", n.ui.supportBadge]),
|
|
4175
4175
|
title: ((i = n.texts) == null ? void 0 : i.exitSupportMode) || "Exit support mode",
|
|
4176
|
-
onClick: r[1] || (r[1] = (
|
|
4176
|
+
onClick: r[1] || (r[1] = (u) => s.$emit("toggle-support-mode"))
|
|
4177
4177
|
}, [
|
|
4178
4178
|
r[4] || (r[4] = h("svg", {
|
|
4179
4179
|
class: "w-3.5 h-3.5",
|
|
@@ -4188,7 +4188,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4188
4188
|
d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"
|
|
4189
4189
|
})
|
|
4190
4190
|
], -1)),
|
|
4191
|
-
h("span", null,
|
|
4191
|
+
h("span", null, O(((a = n.texts) == null ? void 0 : a.supportLabel) || "Support"), 1),
|
|
4192
4192
|
r[5] || (r[5] = h("svg", {
|
|
4193
4193
|
class: "w-3 h-3",
|
|
4194
4194
|
fill: "none",
|
|
@@ -4202,12 +4202,12 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4202
4202
|
d: "M6 18L18 6M6 6l12 12"
|
|
4203
4203
|
})
|
|
4204
4204
|
], -1))
|
|
4205
|
-
], 10, Mi)) :
|
|
4205
|
+
], 10, Mi)) : F("", !0),
|
|
4206
4206
|
h("button", {
|
|
4207
4207
|
disabled: !n.canSend && !n.sending,
|
|
4208
4208
|
class: b(["h-9 w-9 rounded-xl flex items-center justify-center transition-all duration-200 flex-shrink-0", t.value]),
|
|
4209
4209
|
type: "button",
|
|
4210
|
-
onClick: r[2] || (r[2] = et((
|
|
4210
|
+
onClick: r[2] || (r[2] = et((u) => s.$emit("click"), ["prevent"]))
|
|
4211
4211
|
}, [
|
|
4212
4212
|
n.sending ? (x(), v("svg", Ii, [...r[7] || (r[7] = [
|
|
4213
4213
|
h("path", {
|
|
@@ -4230,7 +4230,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4230
4230
|
}), Di = { class: "max-w-3xl mx-auto space-y-3" }, Oi = ["accept"], _i = ["title"], Ni = { class: "flex items-center" }, Pi = ["placeholder", "disabled"], zi = {
|
|
4231
4231
|
key: 0,
|
|
4232
4232
|
class: "flex justify-center"
|
|
4233
|
-
}, Hi = /* @__PURE__ */
|
|
4233
|
+
}, Hi = /* @__PURE__ */ ce({
|
|
4234
4234
|
__name: "ChatInput",
|
|
4235
4235
|
props: {
|
|
4236
4236
|
modelValue: {},
|
|
@@ -4249,16 +4249,16 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4249
4249
|
},
|
|
4250
4250
|
emits: ["update:modelValue", "submit", "cancel", "suggestion-select", "toggle-support-mode", "context-link-click"],
|
|
4251
4251
|
setup(n, { emit: e }) {
|
|
4252
|
-
const t = n, s = N(() => t.ui || {}), r = e, o = U(t.modelValue), i = U(null), a = U(null),
|
|
4252
|
+
const t = n, s = N(() => t.ui || {}), r = e, o = U(t.modelValue), i = U(null), a = U(null), u = U(!1), c = Io(), d = $o(
|
|
4253
4253
|
() => o.value,
|
|
4254
4254
|
(M) => {
|
|
4255
4255
|
o.value = M;
|
|
4256
4256
|
},
|
|
4257
4257
|
() => i.value
|
|
4258
|
-
),
|
|
4258
|
+
), p = Do(
|
|
4259
4259
|
() => t.suggestions,
|
|
4260
4260
|
() => t.hasHistory,
|
|
4261
|
-
() =>
|
|
4261
|
+
() => u.value,
|
|
4262
4262
|
() => o.value,
|
|
4263
4263
|
(M) => {
|
|
4264
4264
|
r("suggestion-select", M), _e(() => {
|
|
@@ -4266,54 +4266,54 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4266
4266
|
return (I = i.value) == null ? void 0 : I.focus();
|
|
4267
4267
|
});
|
|
4268
4268
|
}
|
|
4269
|
-
), { adjustTextareaHeight: w } = Oo(() => i.value), m = N(() => t.supportRequestMode ? t.supportPlaceholder : t.placeholder),
|
|
4269
|
+
), { adjustTextareaHeight: w } = Oo(() => i.value), m = N(() => t.supportRequestMode ? t.supportPlaceholder : t.placeholder), f = N(() => t.showSupportModeToggle ? t.supportRequestMode ? { paddingLeft: "3rem", paddingRight: "8rem" } : { paddingLeft: "3rem", paddingRight: "6rem" } : { paddingLeft: "3rem", paddingRight: "3.5rem" }), A = N(() => {
|
|
4270
4270
|
var I;
|
|
4271
|
-
return (((I = o.value) == null ? void 0 : I.trim()) ?? "").length >= t.minLength ? !0 :
|
|
4271
|
+
return (((I = o.value) == null ? void 0 : I.trim()) ?? "").length >= t.minLength ? !0 : c.hasAttachments.value;
|
|
4272
4272
|
}), y = N(
|
|
4273
|
-
() => !t.disabled && !t.sending && A.value && !
|
|
4273
|
+
() => !t.disabled && !t.sending && A.value && !c.isUploading.value
|
|
4274
4274
|
);
|
|
4275
4275
|
Ue(() => t.modelValue, (M) => {
|
|
4276
4276
|
o.value = M, _e(w);
|
|
4277
4277
|
}), Ue(o, (M) => {
|
|
4278
|
-
r("update:modelValue", M), _e(w), d.checkForMentions(M),
|
|
4278
|
+
r("update:modelValue", M), _e(w), d.checkForMentions(M), p.updateSuggestionsVisibility();
|
|
4279
4279
|
}), Ue(() => t.suggestions, () => {
|
|
4280
|
-
|
|
4280
|
+
p.updateSuggestionsVisibility();
|
|
4281
4281
|
});
|
|
4282
4282
|
function g() {
|
|
4283
4283
|
w();
|
|
4284
4284
|
}
|
|
4285
4285
|
function S(M) {
|
|
4286
|
-
if (!d.handleMentionKeyDown(M) && !
|
|
4286
|
+
if (!d.handleMentionKeyDown(M) && !p.handleSuggestionKeyDown(M) && M.key === "Enter") {
|
|
4287
4287
|
if (M.shiftKey) return;
|
|
4288
4288
|
!t.sending && y.value && (M.preventDefault(), C());
|
|
4289
4289
|
}
|
|
4290
4290
|
}
|
|
4291
4291
|
function C() {
|
|
4292
4292
|
if (!y.value) return;
|
|
4293
|
-
const M =
|
|
4293
|
+
const M = c.buildPayload(), I = o.value.trim(), P = d.getMentions();
|
|
4294
4294
|
r("submit", {
|
|
4295
4295
|
message: I,
|
|
4296
4296
|
attachments: M,
|
|
4297
4297
|
mentions: P,
|
|
4298
4298
|
isSupportRequest: t.supportRequestMode
|
|
4299
|
-
}), o.value = "",
|
|
4299
|
+
}), o.value = "", c.clearAttachments(), d.clearMentions(), _e(w);
|
|
4300
4300
|
}
|
|
4301
4301
|
function T() {
|
|
4302
4302
|
t.sending ? r("cancel") : y.value && C();
|
|
4303
4303
|
}
|
|
4304
4304
|
function z() {
|
|
4305
4305
|
var M;
|
|
4306
|
-
t.disabled || t.sending ||
|
|
4306
|
+
t.disabled || t.sending || c.canAddMore.value && ((M = a.value) == null || M.click());
|
|
4307
4307
|
}
|
|
4308
|
-
function
|
|
4309
|
-
|
|
4308
|
+
function B(M) {
|
|
4309
|
+
p.handleSuggestionClick(M);
|
|
4310
4310
|
}
|
|
4311
4311
|
function V() {
|
|
4312
|
-
|
|
4312
|
+
u.value = !0, p.updateSuggestionsVisibility();
|
|
4313
4313
|
}
|
|
4314
4314
|
function E() {
|
|
4315
|
-
|
|
4316
|
-
|
|
4315
|
+
u.value = !1, setTimeout(() => {
|
|
4316
|
+
p.hideSuggestions(), d.showMentions.value = !1;
|
|
4317
4317
|
}, 200);
|
|
4318
4318
|
}
|
|
4319
4319
|
return xt(() => {
|
|
@@ -4324,22 +4324,22 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4324
4324
|
class: b(["px-4 pb-4 bg-white dark:bg-gray-900 sticky bottom-0", s.value.root]),
|
|
4325
4325
|
onDragenter: I[6] || (I[6] = et(
|
|
4326
4326
|
//@ts-ignore
|
|
4327
|
-
(...L) => D(
|
|
4327
|
+
(...L) => D(c).handleDragEnter && D(c).handleDragEnter(...L),
|
|
4328
4328
|
["prevent"]
|
|
4329
4329
|
)),
|
|
4330
4330
|
onDragover: I[7] || (I[7] = et(
|
|
4331
4331
|
//@ts-ignore
|
|
4332
|
-
(...L) => D(
|
|
4332
|
+
(...L) => D(c).handleDragOver && D(c).handleDragOver(...L),
|
|
4333
4333
|
["prevent"]
|
|
4334
4334
|
)),
|
|
4335
4335
|
onDragleave: I[8] || (I[8] = et(
|
|
4336
4336
|
//@ts-ignore
|
|
4337
|
-
(...L) => D(
|
|
4337
|
+
(...L) => D(c).handleDragLeave && D(c).handleDragLeave(...L),
|
|
4338
4338
|
["prevent"]
|
|
4339
4339
|
)),
|
|
4340
4340
|
onDrop: I[9] || (I[9] = et(
|
|
4341
4341
|
//@ts-ignore
|
|
4342
|
-
(...L) => D(
|
|
4342
|
+
(...L) => D(c).handleDrop && D(c).handleDrop(...L),
|
|
4343
4343
|
["prevent"]
|
|
4344
4344
|
))
|
|
4345
4345
|
}, [
|
|
@@ -4354,31 +4354,31 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4354
4354
|
type: "file",
|
|
4355
4355
|
class: "hidden",
|
|
4356
4356
|
multiple: "",
|
|
4357
|
-
accept: D(
|
|
4357
|
+
accept: D(c).acceptedFileTypes,
|
|
4358
4358
|
onChange: I[0] || (I[0] = //@ts-ignore
|
|
4359
|
-
(...L) => D(
|
|
4359
|
+
(...L) => D(c).handleFileSelect && D(c).handleFileSelect(...L))
|
|
4360
4360
|
}, null, 40, Oi),
|
|
4361
|
-
D(
|
|
4361
|
+
D(c).hasAttachments.value ? (x(), Me(xi, {
|
|
4362
4362
|
key: 0,
|
|
4363
|
-
attachments: D(
|
|
4363
|
+
attachments: D(c).attachments.value,
|
|
4364
4364
|
ui: s.value,
|
|
4365
4365
|
texts: n.texts,
|
|
4366
|
-
"is-image": D(
|
|
4367
|
-
"format-file-size": D(
|
|
4368
|
-
onRemove: D(
|
|
4369
|
-
}, null, 8, ["attachments", "ui", "texts", "is-image", "format-file-size", "onRemove"])) :
|
|
4366
|
+
"is-image": D(c).isImage,
|
|
4367
|
+
"format-file-size": D(c).formatFileSize,
|
|
4368
|
+
onRemove: D(c).removeAttachment
|
|
4369
|
+
}, null, 8, ["attachments", "ui", "texts", "is-image", "format-file-size", "onRemove"])) : F("", !0),
|
|
4370
4370
|
h("div", {
|
|
4371
4371
|
class: b(["relative", s.value.inputContainer])
|
|
4372
4372
|
}, [
|
|
4373
|
-
D(
|
|
4373
|
+
D(p).showSuggestions.value && n.suggestions.length > 0 ? (x(), Me(Ai, {
|
|
4374
4374
|
key: 0,
|
|
4375
4375
|
ref: "suggestionsHandler.dropdownRef.value",
|
|
4376
4376
|
suggestions: n.suggestions,
|
|
4377
|
-
"selected-index": D(
|
|
4377
|
+
"selected-index": D(p).selectedSuggestionIndex.value,
|
|
4378
4378
|
ui: s.value,
|
|
4379
|
-
onSelect:
|
|
4380
|
-
onHover: I[1] || (I[1] = (L) => D(
|
|
4381
|
-
}, null, 8, ["suggestions", "selected-index", "ui"])) :
|
|
4379
|
+
onSelect: B,
|
|
4380
|
+
onHover: I[1] || (I[1] = (L) => D(p).selectedSuggestionIndex.value = L)
|
|
4381
|
+
}, null, 8, ["suggestions", "selected-index", "ui"])) : F("", !0),
|
|
4382
4382
|
me(mt, {
|
|
4383
4383
|
"enter-active-class": "transition ease-out duration-100",
|
|
4384
4384
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
@@ -4395,7 +4395,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4395
4395
|
providers: D(d).mentionProviders.value,
|
|
4396
4396
|
onSelect: D(d).handleMentionSelect,
|
|
4397
4397
|
"onUpdate:selectedIndex": I[2] || (I[2] = (L) => D(d).selectedMentionIndex.value = L)
|
|
4398
|
-
}, null, 8, ["items", "selected-index", "providers", "onSelect"])) :
|
|
4398
|
+
}, null, 8, ["items", "selected-index", "providers", "onSelect"])) : F("", !0)
|
|
4399
4399
|
]),
|
|
4400
4400
|
_: 1
|
|
4401
4401
|
}),
|
|
@@ -4403,8 +4403,8 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4403
4403
|
class: b(["rounded-2xl border shadow-lg transition-all duration-200 bg-white dark:bg-gray-800", [
|
|
4404
4404
|
s.value.inputWrapper,
|
|
4405
4405
|
{
|
|
4406
|
-
"border-primary shadow-primary/30":
|
|
4407
|
-
"border-gray-200 dark:border-gray-700 shadow-gray-100 dark:shadow-gray-900": !
|
|
4406
|
+
"border-primary shadow-primary/30": u.value || D(c).isDraggingFiles.value,
|
|
4407
|
+
"border-gray-200 dark:border-gray-700 shadow-gray-100 dark:shadow-gray-900": !u.value && !D(c).isDraggingFiles.value
|
|
4408
4408
|
}
|
|
4409
4409
|
]])
|
|
4410
4410
|
}, [
|
|
@@ -4429,7 +4429,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4429
4429
|
], -1)
|
|
4430
4430
|
])], 10, _i),
|
|
4431
4431
|
h("div", Ni, [
|
|
4432
|
-
|
|
4432
|
+
qs(h("textarea", {
|
|
4433
4433
|
ref_key: "textareaRef",
|
|
4434
4434
|
ref: i,
|
|
4435
4435
|
"onUpdate:modelValue": I[3] || (I[3] = (L) => o.value = L),
|
|
@@ -4438,13 +4438,13 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4438
4438
|
placeholder: m.value,
|
|
4439
4439
|
disabled: n.disabled,
|
|
4440
4440
|
class: b(["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]),
|
|
4441
|
-
style: un(
|
|
4441
|
+
style: un(f.value),
|
|
4442
4442
|
onInput: g,
|
|
4443
4443
|
onKeydown: S,
|
|
4444
4444
|
onFocus: V,
|
|
4445
4445
|
onBlur: E
|
|
4446
4446
|
}, null, 46, Pi), [
|
|
4447
|
-
[
|
|
4447
|
+
[js, o.value]
|
|
4448
4448
|
])
|
|
4449
4449
|
]),
|
|
4450
4450
|
me($i, {
|
|
@@ -4459,21 +4459,21 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4459
4459
|
}, null, 8, ["sending", "can-send", "support-request-mode", "show-support-mode-toggle", "ui", "texts"])
|
|
4460
4460
|
], 2)
|
|
4461
4461
|
], 2),
|
|
4462
|
-
|
|
4462
|
+
le(M.$slots, "context-link", {}, () => [
|
|
4463
4463
|
n.contextLinkText ? (x(), v("div", zi, [
|
|
4464
4464
|
h("button", {
|
|
4465
4465
|
type: "button",
|
|
4466
4466
|
class: b(["text-xs text-gray-400 hover:text-primary transition-colors", s.value.contextLink]),
|
|
4467
4467
|
onClick: I[5] || (I[5] = (L) => M.$emit("context-link-click"))
|
|
4468
|
-
},
|
|
4469
|
-
])) :
|
|
4468
|
+
}, O(n.contextLinkText), 3)
|
|
4469
|
+
])) : F("", !0)
|
|
4470
4470
|
])
|
|
4471
4471
|
])
|
|
4472
4472
|
], 34)
|
|
4473
4473
|
], 34);
|
|
4474
4474
|
};
|
|
4475
4475
|
}
|
|
4476
|
-
}),
|
|
4476
|
+
}), Bi = ["onClick"], Fi = /* @__PURE__ */ ce({
|
|
4477
4477
|
__name: "AiEmptyState",
|
|
4478
4478
|
props: {
|
|
4479
4479
|
ui: {},
|
|
@@ -4482,42 +4482,42 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4482
4482
|
emits: ["item-click"],
|
|
4483
4483
|
setup(n, { emit: e }) {
|
|
4484
4484
|
const t = n, s = e, r = (w) => {
|
|
4485
|
-
var
|
|
4486
|
-
return (
|
|
4485
|
+
var f;
|
|
4486
|
+
return (f = t.texts) != null && f[w] ? t.texts[w] : ue({
|
|
4487
4487
|
aiName: "aiName",
|
|
4488
4488
|
title: "emptyStateTitle",
|
|
4489
4489
|
description: "emptyStateDescription"
|
|
4490
4490
|
}[w]);
|
|
4491
|
-
}, o = N(() => t.ui || {}), { suggestions: i, resolvePrompt: a } =
|
|
4492
|
-
function
|
|
4491
|
+
}, o = N(() => t.ui || {}), { suggestions: i, resolvePrompt: a } = Rs();
|
|
4492
|
+
function u(w) {
|
|
4493
4493
|
const m = {
|
|
4494
4494
|
...w,
|
|
4495
4495
|
prompt: a(w)
|
|
4496
4496
|
};
|
|
4497
4497
|
s("item-click", m);
|
|
4498
4498
|
}
|
|
4499
|
-
function
|
|
4499
|
+
function c(w) {
|
|
4500
4500
|
return w.gradientClass ? w.gradientClass : w.className ? w.className : "bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900";
|
|
4501
4501
|
}
|
|
4502
4502
|
function d(w) {
|
|
4503
|
-
const m = w.category || "default",
|
|
4503
|
+
const m = w.category || "default", f = {
|
|
4504
4504
|
hr: "bg-blue-100 dark:bg-blue-900/30",
|
|
4505
4505
|
finance: "bg-green-100 dark:bg-green-900/30",
|
|
4506
4506
|
analytics: "bg-purple-100 dark:bg-purple-900/30",
|
|
4507
4507
|
support: "bg-amber-100 dark:bg-amber-900/30",
|
|
4508
4508
|
default: "bg-primary/10"
|
|
4509
4509
|
};
|
|
4510
|
-
return
|
|
4510
|
+
return f[m] || f.default;
|
|
4511
4511
|
}
|
|
4512
|
-
function
|
|
4513
|
-
const m = w.category || "default",
|
|
4512
|
+
function p(w) {
|
|
4513
|
+
const m = w.category || "default", f = {
|
|
4514
4514
|
hr: "text-blue-600 dark:text-blue-400",
|
|
4515
4515
|
finance: "text-green-600 dark:text-green-400",
|
|
4516
4516
|
analytics: "text-purple-600 dark:text-purple-400",
|
|
4517
4517
|
support: "text-amber-600 dark:text-amber-400",
|
|
4518
4518
|
default: "text-primary"
|
|
4519
4519
|
};
|
|
4520
|
-
return
|
|
4520
|
+
return f[m] || f.default;
|
|
4521
4521
|
}
|
|
4522
4522
|
return (w, m) => (x(), v("div", {
|
|
4523
4523
|
class: b(["flex items-center justify-center p-4 h-full", o.value.root])
|
|
@@ -4544,32 +4544,32 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4544
4544
|
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"
|
|
4545
4545
|
})
|
|
4546
4546
|
], -1)),
|
|
4547
|
-
h("span", null,
|
|
4547
|
+
h("span", null, O(r("aiName")), 1)
|
|
4548
4548
|
], 2),
|
|
4549
4549
|
h("h1", {
|
|
4550
4550
|
class: b(["mb-3 text-4xl font-bold tracking-tight text-gray-900 dark:text-white", o.value.title])
|
|
4551
|
-
},
|
|
4551
|
+
}, O(r("title")), 3),
|
|
4552
4552
|
h("p", {
|
|
4553
4553
|
class: b(["text-gray-600 dark:text-gray-400", o.value.description])
|
|
4554
|
-
},
|
|
4554
|
+
}, O(r("description")), 3)
|
|
4555
4555
|
], 2),
|
|
4556
4556
|
h("div", {
|
|
4557
4557
|
class: b(["mb-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-3", o.value.grid])
|
|
4558
4558
|
}, [
|
|
4559
|
-
(x(!0), v(
|
|
4560
|
-
key:
|
|
4561
|
-
class: b(["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,
|
|
4562
|
-
onClick: (y) =>
|
|
4559
|
+
(x(!0), v(ke, null, Ne(D(i), (f, A) => (x(), v("button", {
|
|
4560
|
+
key: f.id || A,
|
|
4561
|
+
class: b(["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, c(f)]]),
|
|
4562
|
+
onClick: (y) => u(f)
|
|
4563
4563
|
}, [
|
|
4564
4564
|
h("div", {
|
|
4565
|
-
class: b(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, d(
|
|
4565
|
+
class: b(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, d(f)]])
|
|
4566
4566
|
}, [
|
|
4567
|
-
|
|
4567
|
+
f.icon ? (x(), Me(nn(f.icon), {
|
|
4568
4568
|
key: 0,
|
|
4569
|
-
class: b(["h-5 w-5", [o.value.suggestionIcon, f
|
|
4569
|
+
class: b(["h-5 w-5", [o.value.suggestionIcon, p(f)]])
|
|
4570
4570
|
}, null, 8, ["class"])) : (x(), v("svg", {
|
|
4571
4571
|
key: 1,
|
|
4572
|
-
class: b(["h-5 w-5", [o.value.suggestionIcon, f
|
|
4572
|
+
class: b(["h-5 w-5", [o.value.suggestionIcon, p(f)]]),
|
|
4573
4573
|
fill: "none",
|
|
4574
4574
|
viewBox: "0 0 24 24",
|
|
4575
4575
|
stroke: "currentColor",
|
|
@@ -4584,11 +4584,11 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4584
4584
|
], 2),
|
|
4585
4585
|
h("h3", {
|
|
4586
4586
|
class: b(["mb-1 text-sm font-semibold text-gray-900 dark:text-white", o.value.suggestionTitle])
|
|
4587
|
-
},
|
|
4587
|
+
}, O(f.title), 3),
|
|
4588
4588
|
h("p", {
|
|
4589
4589
|
class: b(["text-xs text-gray-600 dark:text-gray-400", o.value.suggestionDescription])
|
|
4590
|
-
},
|
|
4591
|
-
], 10,
|
|
4590
|
+
}, O(f.description), 3)
|
|
4591
|
+
], 10, Bi))), 128))
|
|
4592
4592
|
], 2)
|
|
4593
4593
|
], 2)
|
|
4594
4594
|
], 2));
|
|
@@ -4601,7 +4601,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4601
4601
|
class: "flex items-center gap-2"
|
|
4602
4602
|
}, Wi = {
|
|
4603
4603
|
key: 0,
|
|
4604
|
-
class: "flex items-center gap-
|
|
4604
|
+
class: "flex items-center gap-3 ml-auto mr-3"
|
|
4605
4605
|
}, Ki = ["title"], Vi = ["title"], Gi = ["title"], Qi = {
|
|
4606
4606
|
key: 0,
|
|
4607
4607
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
@@ -4616,7 +4616,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4616
4616
|
viewBox: "0 0 24 24",
|
|
4617
4617
|
stroke: "currentColor",
|
|
4618
4618
|
"stroke-width": "1.5"
|
|
4619
|
-
}, Yi = /* @__PURE__ */
|
|
4619
|
+
}, Yi = /* @__PURE__ */ ce({
|
|
4620
4620
|
__name: "DrawerHeader",
|
|
4621
4621
|
props: {
|
|
4622
4622
|
ui: {},
|
|
@@ -4629,27 +4629,34 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4629
4629
|
showMinimizeButton: { type: Boolean },
|
|
4630
4630
|
showFullscreenToggle: { type: Boolean },
|
|
4631
4631
|
isFullscreen: { type: Boolean },
|
|
4632
|
+
showMessageCount: { type: Boolean },
|
|
4633
|
+
messageCount: {},
|
|
4634
|
+
messageLimit: {},
|
|
4632
4635
|
t: { type: Function }
|
|
4633
4636
|
},
|
|
4634
4637
|
emits: ["new-chat", "close", "minimize", "toggle-fullscreen"],
|
|
4635
4638
|
setup(n) {
|
|
4636
|
-
|
|
4637
|
-
|
|
4639
|
+
const e = n, t = N(() => {
|
|
4640
|
+
const s = e.messageCount / e.messageLimit;
|
|
4641
|
+
return s >= 1 ? "text-red-600 dark:text-red-400 font-medium" : s >= 0.8 ? "text-amber-600 dark:text-amber-400" : "text-gray-500 dark:text-gray-400";
|
|
4642
|
+
});
|
|
4643
|
+
return (s, r) => {
|
|
4644
|
+
var o, i, a, u, c, d;
|
|
4638
4645
|
return x(), v("div", {
|
|
4639
|
-
class: b(["flex items-center justify-between px-4 sm:px-6 pt-4 border-b border-gray-200 dark:border-gray-700 pb-4", (
|
|
4646
|
+
class: b(["flex items-center justify-between px-4 sm:px-6 pt-4 border-b border-gray-200 dark:border-gray-700 pb-4", (o = n.ui) == null ? void 0 : o.header])
|
|
4640
4647
|
}, [
|
|
4641
4648
|
h("div", Ui, [
|
|
4642
|
-
n.isSetupMode ? (x(), v("div", ji, [...
|
|
4649
|
+
n.isSetupMode ? (x(), v("div", ji, [...r[5] || (r[5] = [
|
|
4643
4650
|
h("span", { class: "flex h-2 w-2 rounded-full bg-amber-500 animate-pulse" }, null, -1),
|
|
4644
4651
|
h("span", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, "Setup Required", -1)
|
|
4645
|
-
])])) : (x(), v(
|
|
4652
|
+
])])) : (x(), v(ke, { key: 0 }, [
|
|
4646
4653
|
n.showNewChatButton && n.hasHistory ? (x(), v("button", {
|
|
4647
4654
|
key: 0,
|
|
4648
4655
|
type: "button",
|
|
4649
|
-
class: b(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-400 transition-all duration-200 shadow-sm", (
|
|
4650
|
-
onClick:
|
|
4656
|
+
class: b(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-400 transition-all duration-200 shadow-sm", (i = n.ui) == null ? void 0 : i.newChatButton]),
|
|
4657
|
+
onClick: r[0] || (r[0] = (p) => s.$emit("new-chat"))
|
|
4651
4658
|
}, [
|
|
4652
|
-
|
|
4659
|
+
r[4] || (r[4] = h("svg", {
|
|
4653
4660
|
class: "w-4 h-4",
|
|
4654
4661
|
fill: "none",
|
|
4655
4662
|
viewBox: "0 0 24 24",
|
|
@@ -4662,34 +4669,42 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4662
4669
|
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"
|
|
4663
4670
|
})
|
|
4664
4671
|
], -1)),
|
|
4665
|
-
h("span", null,
|
|
4666
|
-
], 2)) : (x(), v("span", qi,
|
|
4672
|
+
h("span", null, O(n.t("newChat")), 1)
|
|
4673
|
+
], 2)) : (x(), v("span", qi, O(n.t("keyboardShortcutHint")), 1))
|
|
4667
4674
|
], 64))
|
|
4668
4675
|
]),
|
|
4669
|
-
n.
|
|
4670
|
-
|
|
4671
|
-
|
|
4676
|
+
n.isSetupMode ? F("", !0) : (x(), v("div", Wi, [
|
|
4677
|
+
n.showMessageCount && n.hasHistory ? (x(), v("span", {
|
|
4678
|
+
key: 0,
|
|
4679
|
+
class: b(["text-xs", t.value])
|
|
4680
|
+
}, [
|
|
4681
|
+
le(s.$slots, "message-count", {}, () => [
|
|
4682
|
+
rs(O(n.messageCount) + " / " + O(n.messageLimit), 1)
|
|
4683
|
+
])
|
|
4684
|
+
], 2)) : F("", !0),
|
|
4685
|
+
n.showQuota ? le(s.$slots, "quota", { key: 1 }, () => {
|
|
4686
|
+
var p, w;
|
|
4672
4687
|
return [
|
|
4673
4688
|
n.quota.remaining > 0 ? (x(), v("span", {
|
|
4674
4689
|
key: 0,
|
|
4675
|
-
class: b(["text-xs text-green-600 dark:text-green-400", (
|
|
4676
|
-
},
|
|
4690
|
+
class: b(["text-xs text-green-600 dark:text-green-400", (p = n.ui) == null ? void 0 : p.quotaDisplay])
|
|
4691
|
+
}, O(n.quota.remaining) + " " + O(n.t("quotaRemaining")), 3)) : n.quota.remaining === 0 ? (x(), v("span", {
|
|
4677
4692
|
key: 1,
|
|
4678
|
-
class: b(["text-xs text-red-600 dark:text-red-400", (
|
|
4679
|
-
},
|
|
4693
|
+
class: b(["text-xs text-red-600 dark:text-red-400", (w = n.ui) == null ? void 0 : w.quotaDisplay])
|
|
4694
|
+
}, O(n.t("noQuota")), 3)) : F("", !0)
|
|
4680
4695
|
];
|
|
4681
|
-
})
|
|
4682
|
-
]))
|
|
4696
|
+
}) : F("", !0)
|
|
4697
|
+
])),
|
|
4683
4698
|
h("div", {
|
|
4684
|
-
class: b(["flex items-center gap-1", (
|
|
4699
|
+
class: b(["flex items-center gap-1", (a = n.ui) == null ? void 0 : a.headerActions])
|
|
4685
4700
|
}, [
|
|
4686
4701
|
n.showCloseButton ? (x(), v("button", {
|
|
4687
4702
|
key: 0,
|
|
4688
4703
|
type: "button",
|
|
4689
|
-
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (
|
|
4704
|
+
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (u = n.ui) == null ? void 0 : u.headerActionButton]),
|
|
4690
4705
|
title: n.t("close"),
|
|
4691
|
-
onClick:
|
|
4692
|
-
}, [...
|
|
4706
|
+
onClick: r[1] || (r[1] = (p) => s.$emit("close"))
|
|
4707
|
+
}, [...r[6] || (r[6] = [
|
|
4693
4708
|
h("svg", {
|
|
4694
4709
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4695
4710
|
fill: "none",
|
|
@@ -4703,14 +4718,14 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4703
4718
|
d: "M6 18L18 6M6 6l12 12"
|
|
4704
4719
|
})
|
|
4705
4720
|
], -1)
|
|
4706
|
-
])], 10, Ki)) :
|
|
4721
|
+
])], 10, Ki)) : F("", !0),
|
|
4707
4722
|
n.showMinimizeButton ? (x(), v("button", {
|
|
4708
4723
|
key: 1,
|
|
4709
4724
|
type: "button",
|
|
4710
|
-
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (
|
|
4725
|
+
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (c = n.ui) == null ? void 0 : c.headerActionButton]),
|
|
4711
4726
|
title: n.t("minimize"),
|
|
4712
|
-
onClick:
|
|
4713
|
-
}, [...
|
|
4727
|
+
onClick: r[2] || (r[2] = (p) => s.$emit("minimize"))
|
|
4728
|
+
}, [...r[7] || (r[7] = [
|
|
4714
4729
|
h("svg", {
|
|
4715
4730
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4716
4731
|
fill: "none",
|
|
@@ -4724,28 +4739,28 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4724
4739
|
d: "M5 12h14"
|
|
4725
4740
|
})
|
|
4726
4741
|
], -1)
|
|
4727
|
-
])], 10, Vi)) :
|
|
4742
|
+
])], 10, Vi)) : F("", !0),
|
|
4728
4743
|
n.showFullscreenToggle ? (x(), v("button", {
|
|
4729
4744
|
key: 2,
|
|
4730
4745
|
type: "button",
|
|
4731
|
-
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (
|
|
4746
|
+
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (d = n.ui) == null ? void 0 : d.headerActionButton]),
|
|
4732
4747
|
title: n.isFullscreen ? n.t("exitFullscreen") : n.t("fullscreen"),
|
|
4733
|
-
onClick:
|
|
4748
|
+
onClick: r[3] || (r[3] = (p) => s.$emit("toggle-fullscreen"))
|
|
4734
4749
|
}, [
|
|
4735
|
-
n.isFullscreen ? (x(), v("svg", Zi, [...
|
|
4750
|
+
n.isFullscreen ? (x(), v("svg", Zi, [...r[9] || (r[9] = [
|
|
4736
4751
|
h("path", {
|
|
4737
4752
|
"stroke-linecap": "round",
|
|
4738
4753
|
"stroke-linejoin": "round",
|
|
4739
4754
|
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"
|
|
4740
4755
|
}, null, -1)
|
|
4741
|
-
])])) : (x(), v("svg", Qi, [...
|
|
4756
|
+
])])) : (x(), v("svg", Qi, [...r[8] || (r[8] = [
|
|
4742
4757
|
h("path", {
|
|
4743
4758
|
"stroke-linecap": "round",
|
|
4744
4759
|
"stroke-linejoin": "round",
|
|
4745
4760
|
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"
|
|
4746
4761
|
}, null, -1)
|
|
4747
4762
|
])]))
|
|
4748
|
-
], 10, Gi)) :
|
|
4763
|
+
], 10, Gi)) : F("", !0)
|
|
4749
4764
|
], 2)
|
|
4750
4765
|
], 2);
|
|
4751
4766
|
};
|
|
@@ -4753,7 +4768,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4753
4768
|
}), Xi = { class: "max-w-3xl mx-auto px-4 space-y-6" }, Ji = { class: "flex justify-center" }, ea = { class: "inline-flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2 text-sm font-medium text-primary" }, ta = {
|
|
4754
4769
|
key: 0,
|
|
4755
4770
|
class: "flex justify-center"
|
|
4756
|
-
}, na = ["title"], sa = /* @__PURE__ */
|
|
4771
|
+
}, na = ["title"], sa = /* @__PURE__ */ ce({
|
|
4757
4772
|
__name: "DrawerMessageList",
|
|
4758
4773
|
props: {
|
|
4759
4774
|
messages: {},
|
|
@@ -4783,10 +4798,10 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4783
4798
|
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"
|
|
4784
4799
|
})
|
|
4785
4800
|
], -1)),
|
|
4786
|
-
h("span", null,
|
|
4801
|
+
h("span", null, O(n.t("title") || D(ue)("aiName")), 1)
|
|
4787
4802
|
])
|
|
4788
4803
|
]),
|
|
4789
|
-
(x(!0), v(
|
|
4804
|
+
(x(!0), v(ke, null, Ne(n.messages, (i, a) => le(e.$slots, "message", {
|
|
4790
4805
|
key: i.id || a,
|
|
4791
4806
|
message: i,
|
|
4792
4807
|
isUser: i.role === "user",
|
|
@@ -4796,7 +4811,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4796
4811
|
me(ai, {
|
|
4797
4812
|
message: i,
|
|
4798
4813
|
"loading-text": n.loadingMessage,
|
|
4799
|
-
onCopy: t[0] || (t[0] = (
|
|
4814
|
+
onCopy: t[0] || (t[0] = (u) => e.$emit("copy", u))
|
|
4800
4815
|
}, null, 8, ["message", "loading-text"])
|
|
4801
4816
|
])), 128)),
|
|
4802
4817
|
n.quota.remaining === 0 ? (x(), v("div", ta, [
|
|
@@ -4818,16 +4833,16 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4818
4833
|
d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"
|
|
4819
4834
|
})
|
|
4820
4835
|
], -1)),
|
|
4821
|
-
h("span", null,
|
|
4836
|
+
h("span", null, O(D(ue)("contactSupport")), 1)
|
|
4822
4837
|
])
|
|
4823
|
-
])) :
|
|
4838
|
+
])) : F("", !0),
|
|
4824
4839
|
n.error.message ? (x(), v("div", {
|
|
4825
4840
|
key: 1,
|
|
4826
4841
|
class: b(["flex items-center gap-2 text-sm text-red-600 dark:text-red-400 px-2 py-1 pb-6", (s = n.ui) == null ? void 0 : s.errorContainer])
|
|
4827
4842
|
}, [
|
|
4828
4843
|
h("span", {
|
|
4829
4844
|
class: b((r = n.ui) == null ? void 0 : r.errorMessage)
|
|
4830
|
-
},
|
|
4845
|
+
}, O(n.error.message), 3),
|
|
4831
4846
|
h("button", {
|
|
4832
4847
|
type: "button",
|
|
4833
4848
|
class: b(["inline-flex items-center gap-1 text-red-700 dark:text-red-300 hover:text-red-800 dark:hover:text-red-200 font-medium", (o = n.ui) == null ? void 0 : o.retryButton]),
|
|
@@ -4848,18 +4863,18 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4848
4863
|
})
|
|
4849
4864
|
], -1)
|
|
4850
4865
|
])], 10, na)
|
|
4851
|
-
], 2)) :
|
|
4866
|
+
], 2)) : F("", !0)
|
|
4852
4867
|
]);
|
|
4853
4868
|
};
|
|
4854
4869
|
}
|
|
4855
|
-
}), ra = { class: "w-full max-w-md" }, oa = { class: "bg-gray-900 rounded-xl overflow-hidden" }, ia = { class: "flex items-center justify-between px-4 py-2 bg-gray-800/50 border-b border-gray-700" }, aa = /* @__PURE__ */
|
|
4870
|
+
}), ra = { class: "w-full max-w-md" }, oa = { class: "bg-gray-900 rounded-xl overflow-hidden" }, ia = { class: "flex items-center justify-between px-4 py-2 bg-gray-800/50 border-b border-gray-700" }, aa = /* @__PURE__ */ ce({
|
|
4856
4871
|
__name: "SetupGuide",
|
|
4857
4872
|
props: {
|
|
4858
4873
|
copied: { type: Boolean }
|
|
4859
4874
|
},
|
|
4860
4875
|
emits: ["copy"],
|
|
4861
4876
|
setup(n) {
|
|
4862
|
-
return (e, t) => (x(), v(
|
|
4877
|
+
return (e, t) => (x(), v(ke, null, [
|
|
4863
4878
|
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)),
|
|
4864
4879
|
h("div", ra, [
|
|
4865
4880
|
h("div", oa, [
|
|
@@ -4869,7 +4884,7 @@ const _o = /* @__PURE__ */ ue({
|
|
|
4869
4884
|
type: "button",
|
|
4870
4885
|
class: "text-xs text-gray-400 hover:text-white transition-colors",
|
|
4871
4886
|
onClick: t[0] || (t[0] = (s) => e.$emit("copy"))
|
|
4872
|
-
},
|
|
4887
|
+
}, O(n.copied ? "✓ Copied" : "Copy"), 1)
|
|
4873
4888
|
]),
|
|
4874
4889
|
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>
|
|
4875
4890
|
|
|
@@ -4882,7 +4897,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4882
4897
|
})</code></pre>`, 1))
|
|
4883
4898
|
]),
|
|
4884
4899
|
t[3] || (t[3] = h("p", { class: "text-xs text-gray-400 dark:text-gray-500 mt-4 text-center" }, [
|
|
4885
|
-
|
|
4900
|
+
rs(" Need help? Check the "),
|
|
4886
4901
|
h("a", {
|
|
4887
4902
|
href: "https://github.com/doderasoftware/restify-ai",
|
|
4888
4903
|
target: "_blank",
|
|
@@ -4901,7 +4916,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4901
4916
|
}, ca = { class: "text-lg font-semibold text-gray-900 dark:text-white" }, da = {
|
|
4902
4917
|
key: 1,
|
|
4903
4918
|
class: "text-lg font-semibold text-gray-900 dark:text-white mb-2"
|
|
4904
|
-
}, ha = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, pa = { class: "flex justify-end gap-3" }, ss = /* @__PURE__ */
|
|
4919
|
+
}, ha = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, pa = { class: "flex justify-end gap-3" }, ss = /* @__PURE__ */ ce({
|
|
4905
4920
|
__name: "ConfirmDialog",
|
|
4906
4921
|
props: {
|
|
4907
4922
|
show: { type: Boolean },
|
|
@@ -4954,23 +4969,23 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4954
4969
|
})
|
|
4955
4970
|
])
|
|
4956
4971
|
], -1)),
|
|
4957
|
-
h("h3", ca,
|
|
4958
|
-
])) : (x(), v("h3", da,
|
|
4959
|
-
h("p", ha,
|
|
4972
|
+
h("h3", ca, O(n.title), 1)
|
|
4973
|
+
])) : (x(), v("h3", da, O(n.title), 1)),
|
|
4974
|
+
h("p", ha, O(n.message), 1),
|
|
4960
4975
|
h("div", pa, [
|
|
4961
4976
|
h("button", {
|
|
4962
4977
|
type: "button",
|
|
4963
4978
|
class: b(["px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors", (i = n.ui) == null ? void 0 : i.cancelButton]),
|
|
4964
4979
|
onClick: o[0] || (o[0] = (a) => r.$emit("cancel"))
|
|
4965
|
-
},
|
|
4980
|
+
}, O(n.cancelText), 3),
|
|
4966
4981
|
h("button", {
|
|
4967
4982
|
type: "button",
|
|
4968
4983
|
class: b(["px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors", s.value]),
|
|
4969
4984
|
onClick: o[1] || (o[1] = (a) => r.$emit("confirm"))
|
|
4970
|
-
},
|
|
4985
|
+
}, O(n.confirmText), 3)
|
|
4971
4986
|
])
|
|
4972
4987
|
], 2)
|
|
4973
|
-
])) :
|
|
4988
|
+
])) : F("", !0)
|
|
4974
4989
|
];
|
|
4975
4990
|
}),
|
|
4976
4991
|
_: 1
|
|
@@ -4982,7 +4997,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4982
4997
|
}, ga = {
|
|
4983
4998
|
key: 0,
|
|
4984
4999
|
class: "flex-1 flex flex-col overflow-y-auto"
|
|
4985
|
-
}, ma = /* @__PURE__ */
|
|
5000
|
+
}, ma = /* @__PURE__ */ ce({
|
|
4986
5001
|
__name: "AiChatDrawer",
|
|
4987
5002
|
props: {
|
|
4988
5003
|
modelValue: { type: Boolean },
|
|
@@ -4996,6 +5011,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4996
5011
|
closeOnBackdropClick: { type: Boolean, default: !1 },
|
|
4997
5012
|
closeOnEscape: { type: Boolean, default: !0 },
|
|
4998
5013
|
showQuota: { type: Boolean, default: !0 },
|
|
5014
|
+
showMessageCount: { type: Boolean, default: !0 },
|
|
4999
5015
|
showFullscreenToggle: { type: Boolean, default: !0 },
|
|
5000
5016
|
showMinimizeButton: { type: Boolean, default: !0 },
|
|
5001
5017
|
showCloseButton: { type: Boolean, default: !0 },
|
|
@@ -5009,21 +5025,21 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5009
5025
|
setup(n, { emit: e }) {
|
|
5010
5026
|
const t = n, s = e, r = N({
|
|
5011
5027
|
get: () => t.modelValue,
|
|
5012
|
-
set: (
|
|
5028
|
+
set: (_) => s("update:modelValue", _)
|
|
5013
5029
|
});
|
|
5014
|
-
function o(
|
|
5030
|
+
function o(_, K) {
|
|
5015
5031
|
var te;
|
|
5016
|
-
const G = (te = t.texts) == null ? void 0 : te[
|
|
5032
|
+
const G = (te = t.texts) == null ? void 0 : te[_];
|
|
5017
5033
|
if (G) {
|
|
5018
5034
|
let X = G;
|
|
5019
5035
|
if (K)
|
|
5020
|
-
for (const [J,
|
|
5021
|
-
X = X.replace(`{${J}}`, String(
|
|
5036
|
+
for (const [J, de] of Object.entries(K))
|
|
5037
|
+
X = X.replace(`{${J}}`, String(de));
|
|
5022
5038
|
return X;
|
|
5023
5039
|
}
|
|
5024
|
-
return
|
|
5040
|
+
return ue(_, K);
|
|
5025
5041
|
}
|
|
5026
|
-
const i = We(), a = U(""),
|
|
5042
|
+
const i = We(), a = U(""), u = U(null), c = U(!1), d = U(!1), p = U(!1), { loadingMessage: w, startLoadingText: m, resetLoadingText: f } = Ro(
|
|
5027
5043
|
() => i.sending,
|
|
5028
5044
|
() => t.loadingText
|
|
5029
5045
|
), {
|
|
@@ -5034,7 +5050,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5034
5050
|
dismissHistoryLimitWarning: C,
|
|
5035
5051
|
handleHistoryLimitAction: T,
|
|
5036
5052
|
checkHistoryLimit: z,
|
|
5037
|
-
setPendingMessage:
|
|
5053
|
+
setPendingMessage: B
|
|
5038
5054
|
} = Lo({
|
|
5039
5055
|
getHistoryLength: () => i.chatHistory.length,
|
|
5040
5056
|
getStoreLimit: () => i.chatHistoryLimit,
|
|
@@ -5042,15 +5058,15 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5042
5058
|
getTexts: () => t.texts,
|
|
5043
5059
|
onStartNewChat: () => i.clearChatHistory(),
|
|
5044
5060
|
onNewChatEmit: () => s("new-chat")
|
|
5045
|
-
}), V = N(() => !
|
|
5061
|
+
}), V = N(() => !is()), E = N(() => tt("enableSupportMode") ?? !1), { suggestions: M, resolvePrompt: I } = Rs(), P = N(() => {
|
|
5046
5062
|
if (V.value) return [];
|
|
5047
|
-
const
|
|
5063
|
+
const _ = a.value.toLowerCase().trim(), K = M.value || [];
|
|
5048
5064
|
let G = K;
|
|
5049
|
-
if (
|
|
5050
|
-
const te = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), X =
|
|
5065
|
+
if (_) {
|
|
5066
|
+
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));
|
|
5051
5067
|
X.length > 0 && (G = K.filter((J) => {
|
|
5052
|
-
const
|
|
5053
|
-
return X.every((Se) =>
|
|
5068
|
+
const de = `${J.title} ${J.description || ""}`.toLowerCase();
|
|
5069
|
+
return X.every((Se) => de.includes(Se));
|
|
5054
5070
|
}));
|
|
5055
5071
|
}
|
|
5056
5072
|
return G.slice(0, 5).map((te) => ({
|
|
@@ -5060,7 +5076,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5060
5076
|
}));
|
|
5061
5077
|
}), L = N(() => ({
|
|
5062
5078
|
quota: i.quota,
|
|
5063
|
-
isFullscreen:
|
|
5079
|
+
isFullscreen: c.value,
|
|
5064
5080
|
hasHistory: i.chatHistory.length > 0,
|
|
5065
5081
|
onNewChat: se,
|
|
5066
5082
|
onClose: He,
|
|
@@ -5073,23 +5089,23 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5073
5089
|
onSubmit: Le,
|
|
5074
5090
|
onCancel: () => i.cancelRequest()
|
|
5075
5091
|
}));
|
|
5076
|
-
function Te(
|
|
5077
|
-
const K = (M.value || []).find((G) => G.id ===
|
|
5092
|
+
function Te(_) {
|
|
5093
|
+
const K = (M.value || []).find((G) => G.id === _.id);
|
|
5078
5094
|
K && (a.value = I(K));
|
|
5079
5095
|
}
|
|
5080
5096
|
function ze() {
|
|
5081
|
-
|
|
5097
|
+
c.value = !c.value;
|
|
5082
5098
|
}
|
|
5083
5099
|
function Re() {
|
|
5084
5100
|
r.value = !1;
|
|
5085
5101
|
}
|
|
5086
5102
|
function He() {
|
|
5087
|
-
t.confirmClose && !V.value && i.chatHistory.length > 0 ?
|
|
5103
|
+
t.confirmClose && !V.value && i.chatHistory.length > 0 ? p.value = !0 : (r.value = !1, s("close"));
|
|
5088
5104
|
}
|
|
5089
5105
|
function bt() {
|
|
5090
|
-
|
|
5106
|
+
p.value = !1, i.clearChatHistory(), r.value = !1, s("close");
|
|
5091
5107
|
}
|
|
5092
|
-
function
|
|
5108
|
+
function Ft() {
|
|
5093
5109
|
s("contact-support");
|
|
5094
5110
|
}
|
|
5095
5111
|
function vt() {
|
|
@@ -5097,16 +5113,16 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5097
5113
|
}
|
|
5098
5114
|
async function Y() {
|
|
5099
5115
|
await _e();
|
|
5100
|
-
const
|
|
5101
|
-
|
|
5116
|
+
const _ = document.getElementById("rai-chat-bottom");
|
|
5117
|
+
_ && _.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
5102
5118
|
}
|
|
5103
|
-
function st(
|
|
5104
|
-
a.value =
|
|
5119
|
+
function st(_) {
|
|
5120
|
+
a.value = _.prompt, i.clearError();
|
|
5105
5121
|
}
|
|
5106
5122
|
function se() {
|
|
5107
5123
|
i.clearChatHistory(), s("new-chat");
|
|
5108
5124
|
}
|
|
5109
|
-
function Tt(
|
|
5125
|
+
function Tt(_) {
|
|
5110
5126
|
}
|
|
5111
5127
|
function Z() {
|
|
5112
5128
|
navigator.clipboard.writeText(`import { RestifyAiPlugin } from '@doderasoftware/restify-ai'
|
|
@@ -5121,45 +5137,45 @@ app.use(RestifyAiPlugin, {
|
|
|
5121
5137
|
d.value = !1;
|
|
5122
5138
|
}, 2e3);
|
|
5123
5139
|
}
|
|
5124
|
-
async function
|
|
5125
|
-
const
|
|
5126
|
-
|
|
5140
|
+
async function Be() {
|
|
5141
|
+
const _ = await T();
|
|
5142
|
+
_ && (await _e(), await Ve(_.message, _.attachments, _.mentions, _.isSupportRequest));
|
|
5127
5143
|
}
|
|
5128
|
-
async function Ve(
|
|
5144
|
+
async function Ve(_, K, G, te) {
|
|
5129
5145
|
i.clearError(), m(), await _e(), Y();
|
|
5130
|
-
const X = await i.askQuestion(
|
|
5131
|
-
|
|
5146
|
+
const X = await i.askQuestion(_, K, G, te);
|
|
5147
|
+
f(), X && Y();
|
|
5132
5148
|
}
|
|
5133
|
-
async function Le(
|
|
5134
|
-
const { message: K, attachments: G, mentions: te, isSupportRequest: X } =
|
|
5149
|
+
async function Le(_) {
|
|
5150
|
+
const { message: K, attachments: G, mentions: te, isSupportRequest: X } = _;
|
|
5135
5151
|
if (i.sending) return;
|
|
5136
|
-
const J = te.map((
|
|
5137
|
-
id:
|
|
5138
|
-
name:
|
|
5139
|
-
type:
|
|
5140
|
-
metadata:
|
|
5152
|
+
const J = te.map((de) => ({
|
|
5153
|
+
id: de.id,
|
|
5154
|
+
name: de.name,
|
|
5155
|
+
type: de.type || "unknown",
|
|
5156
|
+
metadata: de.metadata
|
|
5141
5157
|
}));
|
|
5142
5158
|
if (!z()) {
|
|
5143
|
-
|
|
5159
|
+
B({ message: K, attachments: G, mentions: J, isSupportRequest: X });
|
|
5144
5160
|
return;
|
|
5145
5161
|
}
|
|
5146
5162
|
await Ve(K, G, J, X);
|
|
5147
5163
|
}
|
|
5148
5164
|
async function St() {
|
|
5149
5165
|
m();
|
|
5150
|
-
const
|
|
5151
|
-
|
|
5166
|
+
const _ = await i.retry();
|
|
5167
|
+
f(), _ && Y();
|
|
5152
5168
|
}
|
|
5153
|
-
function Ge(
|
|
5154
|
-
t.closeOnEscape &&
|
|
5169
|
+
function Ge(_) {
|
|
5170
|
+
t.closeOnEscape && _.key === "Escape" && r.value && (p.value ? p.value = !1 : Re());
|
|
5155
5171
|
}
|
|
5156
|
-
return Ue(() => t.modelValue, (
|
|
5157
|
-
|
|
5172
|
+
return Ue(() => t.modelValue, (_) => {
|
|
5173
|
+
_ && t.autoFetchQuota && i.fetchQuota();
|
|
5158
5174
|
}, { immediate: !0 }), xt(() => {
|
|
5159
5175
|
window.addEventListener("keydown", Ge);
|
|
5160
5176
|
}), yt(() => {
|
|
5161
5177
|
window.removeEventListener("keydown", Ge);
|
|
5162
|
-
}), (
|
|
5178
|
+
}), (_, K) => (x(), Me(Ws, { to: "body" }, [
|
|
5163
5179
|
me(mt, { name: "rai-fade" }, {
|
|
5164
5180
|
default: Ce(() => {
|
|
5165
5181
|
var G;
|
|
@@ -5168,7 +5184,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5168
5184
|
key: 0,
|
|
5169
5185
|
class: b(["fixed inset-0 bg-black/30 z-40", (G = n.ui) == null ? void 0 : G.backdrop]),
|
|
5170
5186
|
onClick: K[0] || (K[0] = (te) => n.closeOnBackdropClick && Re())
|
|
5171
|
-
}, null, 2)) :
|
|
5187
|
+
}, null, 2)) : F("", !0)
|
|
5172
5188
|
];
|
|
5173
5189
|
}),
|
|
5174
5190
|
_: 1
|
|
@@ -5185,12 +5201,12 @@ app.use(RestifyAiPlugin, {
|
|
|
5185
5201
|
n.position === "left" ? "left-0 border-r" : "right-0 border-l",
|
|
5186
5202
|
(G = n.ui) == null ? void 0 : G.drawer
|
|
5187
5203
|
]]),
|
|
5188
|
-
style: un({ width:
|
|
5204
|
+
style: un({ width: c.value ? n.fullscreenWidth : n.width, top: n.topOffset, height: `calc(100vh - ${n.topOffset})` })
|
|
5189
5205
|
}, [
|
|
5190
5206
|
h("div", {
|
|
5191
5207
|
class: b(["h-full flex flex-col relative bg-white dark:bg-gray-900", (te = n.ui) == null ? void 0 : te.panel])
|
|
5192
5208
|
}, [
|
|
5193
|
-
|
|
5209
|
+
le(_.$slots, "header", Pn(zn(L.value)), () => [
|
|
5194
5210
|
me(Yi, {
|
|
5195
5211
|
ui: n.ui,
|
|
5196
5212
|
"is-setup-mode": V.value,
|
|
@@ -5201,7 +5217,10 @@ app.use(RestifyAiPlugin, {
|
|
|
5201
5217
|
"show-close-button": n.showCloseButton,
|
|
5202
5218
|
"show-minimize-button": n.showMinimizeButton,
|
|
5203
5219
|
"show-fullscreen-toggle": n.showFullscreenToggle,
|
|
5204
|
-
"is-fullscreen":
|
|
5220
|
+
"is-fullscreen": c.value,
|
|
5221
|
+
"show-message-count": n.showMessageCount,
|
|
5222
|
+
"message-count": D(i).chatHistory.length,
|
|
5223
|
+
"message-limit": D(i).chatHistoryLimit,
|
|
5205
5224
|
t: o,
|
|
5206
5225
|
onNewChat: se,
|
|
5207
5226
|
onClose: He,
|
|
@@ -5209,35 +5228,35 @@ app.use(RestifyAiPlugin, {
|
|
|
5209
5228
|
onToggleFullscreen: ze
|
|
5210
5229
|
}, {
|
|
5211
5230
|
quota: Ce(() => [
|
|
5212
|
-
|
|
5231
|
+
le(_.$slots, "quota", {
|
|
5213
5232
|
quota: D(i).quota
|
|
5214
5233
|
}, void 0, !0)
|
|
5215
5234
|
]),
|
|
5216
5235
|
_: 3
|
|
5217
|
-
}, 8, ["ui", "is-setup-mode", "show-new-chat-button", "has-history", "show-quota", "quota", "show-close-button", "show-minimize-button", "show-fullscreen-toggle", "is-fullscreen"])
|
|
5236
|
+
}, 8, ["ui", "is-setup-mode", "show-new-chat-button", "has-history", "show-quota", "quota", "show-close-button", "show-minimize-button", "show-fullscreen-toggle", "is-fullscreen", "show-message-count", "message-count", "message-limit"])
|
|
5218
5237
|
], !0),
|
|
5219
5238
|
h("div", {
|
|
5220
|
-
class: b(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl":
|
|
5239
|
+
class: b(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl": c.value }, (X = n.ui) == null ? void 0 : X.body]])
|
|
5221
5240
|
}, [
|
|
5222
5241
|
V.value ? (x(), v("div", fa, [
|
|
5223
|
-
|
|
5242
|
+
le(_.$slots, "setup", {}, () => [
|
|
5224
5243
|
me(aa, {
|
|
5225
5244
|
copied: d.value,
|
|
5226
5245
|
onCopy: Z
|
|
5227
5246
|
}, null, 8, ["copied"])
|
|
5228
5247
|
], !0)
|
|
5229
|
-
])) : (x(), v(
|
|
5248
|
+
])) : (x(), v(ke, { key: 1 }, [
|
|
5230
5249
|
D(i).chatHistory.length === 0 ? (x(), v("div", ga, [
|
|
5231
|
-
|
|
5250
|
+
le(_.$slots, "empty-state", {
|
|
5232
5251
|
suggestions: P.value,
|
|
5233
5252
|
onClick: st
|
|
5234
5253
|
}, () => [
|
|
5235
|
-
me(
|
|
5254
|
+
me(Fi, { onItemClick: st })
|
|
5236
5255
|
], !0)
|
|
5237
5256
|
])) : (x(), v("div", {
|
|
5238
5257
|
key: 1,
|
|
5239
5258
|
ref_key: "chatContainer",
|
|
5240
|
-
ref:
|
|
5259
|
+
ref: u,
|
|
5241
5260
|
class: "flex-1 overflow-y-auto py-6 pb-24"
|
|
5242
5261
|
}, [
|
|
5243
5262
|
me(sa, {
|
|
@@ -5248,11 +5267,11 @@ app.use(RestifyAiPlugin, {
|
|
|
5248
5267
|
ui: n.ui,
|
|
5249
5268
|
t: o,
|
|
5250
5269
|
onCopy: Tt,
|
|
5251
|
-
onContactSupport:
|
|
5270
|
+
onContactSupport: Ft,
|
|
5252
5271
|
onRetry: St
|
|
5253
5272
|
}, {
|
|
5254
5273
|
message: Ce((J) => [
|
|
5255
|
-
|
|
5274
|
+
le(_.$slots, "message", {
|
|
5256
5275
|
message: J.message,
|
|
5257
5276
|
isUser: J.isUser,
|
|
5258
5277
|
isLoading: J.isLoading,
|
|
@@ -5266,15 +5285,15 @@ app.use(RestifyAiPlugin, {
|
|
|
5266
5285
|
id: "rai-chat-bottom",
|
|
5267
5286
|
class: "h-8"
|
|
5268
5287
|
}, null, -1)),
|
|
5269
|
-
|
|
5270
|
-
var J,
|
|
5288
|
+
le(_.$slots, "input", Pn(zn(ne.value)), () => {
|
|
5289
|
+
var J, de;
|
|
5271
5290
|
return [
|
|
5272
5291
|
me(Hi, {
|
|
5273
5292
|
modelValue: a.value,
|
|
5274
5293
|
"onUpdate:modelValue": K[1] || (K[1] = (Se) => a.value = Se),
|
|
5275
5294
|
sending: D(i).sending,
|
|
5276
|
-
placeholder: ((J = t.texts) == null ? void 0 : J.placeholder) || D(
|
|
5277
|
-
"support-placeholder": ((
|
|
5295
|
+
placeholder: ((J = t.texts) == null ? void 0 : J.placeholder) || D(ue)("inputPlaceholder"),
|
|
5296
|
+
"support-placeholder": ((de = t.texts) == null ? void 0 : de.supportPlaceholder) || D(ue)("supportPlaceholder"),
|
|
5278
5297
|
suggestions: P.value,
|
|
5279
5298
|
"has-history": D(i).chatHistory.length > 0,
|
|
5280
5299
|
"support-request-mode": D(i).supportRequestMode,
|
|
@@ -5285,7 +5304,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5285
5304
|
onToggleSupportMode: vt
|
|
5286
5305
|
}, {
|
|
5287
5306
|
"context-link": Ce(() => [
|
|
5288
|
-
|
|
5307
|
+
le(_.$slots, "context-link", {}, void 0, !0)
|
|
5289
5308
|
]),
|
|
5290
5309
|
_: 3
|
|
5291
5310
|
}, 8, ["modelValue", "sending", "placeholder", "support-placeholder", "suggestions", "has-history", "support-request-mode", "show-support-mode-toggle", "onCancel"])
|
|
@@ -5295,7 +5314,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5295
5314
|
], 2)
|
|
5296
5315
|
], 2),
|
|
5297
5316
|
me(ss, {
|
|
5298
|
-
show:
|
|
5317
|
+
show: p.value,
|
|
5299
5318
|
title: o("closeConfirmTitle"),
|
|
5300
5319
|
message: o("closeConfirmMessage"),
|
|
5301
5320
|
"confirm-text": o("confirmClose"),
|
|
@@ -5303,7 +5322,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5303
5322
|
ui: n.ui,
|
|
5304
5323
|
"confirm-variant": "danger",
|
|
5305
5324
|
onConfirm: bt,
|
|
5306
|
-
onCancel: K[2] || (K[2] = (J) =>
|
|
5325
|
+
onCancel: K[2] || (K[2] = (J) => p.value = !1)
|
|
5307
5326
|
}, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui"]),
|
|
5308
5327
|
me(ss, {
|
|
5309
5328
|
show: D(A),
|
|
@@ -5314,17 +5333,17 @@ app.use(RestifyAiPlugin, {
|
|
|
5314
5333
|
ui: n.ui,
|
|
5315
5334
|
icon: "warning",
|
|
5316
5335
|
"confirm-variant": "primary",
|
|
5317
|
-
onConfirm:
|
|
5336
|
+
onConfirm: Be,
|
|
5318
5337
|
onCancel: D(C)
|
|
5319
5338
|
}, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui", "onCancel"])
|
|
5320
|
-
], 6)) :
|
|
5339
|
+
], 6)) : F("", !0)
|
|
5321
5340
|
];
|
|
5322
5341
|
}),
|
|
5323
5342
|
_: 3
|
|
5324
5343
|
}, 8, ["name"])
|
|
5325
5344
|
]));
|
|
5326
5345
|
}
|
|
5327
|
-
}), Ma = /* @__PURE__ */
|
|
5346
|
+
}), Ma = /* @__PURE__ */ Ls(ma, [["__scopeId", "data-v-02153e6b"]]), Ra = /* @__PURE__ */ ce({
|
|
5328
5347
|
__name: "ErrorBoundary",
|
|
5329
5348
|
props: {
|
|
5330
5349
|
title: { default: "Something went wrong" },
|
|
@@ -5337,9 +5356,9 @@ app.use(RestifyAiPlugin, {
|
|
|
5337
5356
|
emits: ["error", "reset"],
|
|
5338
5357
|
setup(n, { expose: e, emit: t }) {
|
|
5339
5358
|
const s = n, r = t, o = U(!1), i = U(null);
|
|
5340
|
-
Ks((
|
|
5341
|
-
var
|
|
5342
|
-
return o.value = !0, i.value =
|
|
5359
|
+
Ks((u, c, d) => {
|
|
5360
|
+
var p;
|
|
5361
|
+
return o.value = !0, i.value = u, (p = s.onError) == null || p.call(s, u, d), r("error", u, d), !1;
|
|
5343
5362
|
});
|
|
5344
5363
|
function a() {
|
|
5345
5364
|
o.value = !1, i.value = null, r("reset");
|
|
@@ -5348,19 +5367,19 @@ app.use(RestifyAiPlugin, {
|
|
|
5348
5367
|
hasError: o,
|
|
5349
5368
|
error: i,
|
|
5350
5369
|
reset: a
|
|
5351
|
-
}), (
|
|
5370
|
+
}), (u, c) => o.value ? le(u.$slots, "error", {
|
|
5352
5371
|
key: 1,
|
|
5353
5372
|
error: i.value,
|
|
5354
5373
|
reset: a
|
|
5355
5374
|
}, () => {
|
|
5356
|
-
var d,
|
|
5375
|
+
var d, p, w, m, f;
|
|
5357
5376
|
return [
|
|
5358
5377
|
h("div", {
|
|
5359
5378
|
class: b(["flex flex-col items-center justify-center p-6 text-center", (d = n.ui) == null ? void 0 : d.container])
|
|
5360
5379
|
}, [
|
|
5361
5380
|
h("div", {
|
|
5362
|
-
class: b(["w-12 h-12 mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center", (
|
|
5363
|
-
}, [...
|
|
5381
|
+
class: b(["w-12 h-12 mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center", (p = n.ui) == null ? void 0 : p.iconContainer])
|
|
5382
|
+
}, [...c[0] || (c[0] = [
|
|
5364
5383
|
h("svg", {
|
|
5365
5384
|
class: "w-6 h-6 text-red-600 dark:text-red-400",
|
|
5366
5385
|
fill: "none",
|
|
@@ -5377,18 +5396,18 @@ app.use(RestifyAiPlugin, {
|
|
|
5377
5396
|
])], 2),
|
|
5378
5397
|
h("h3", {
|
|
5379
5398
|
class: b(["text-lg font-semibold text-gray-900 dark:text-white mb-2", (w = n.ui) == null ? void 0 : w.title])
|
|
5380
|
-
},
|
|
5399
|
+
}, O(n.title), 3),
|
|
5381
5400
|
h("p", {
|
|
5382
5401
|
class: b(["text-sm text-gray-600 dark:text-gray-400 mb-4", (m = n.ui) == null ? void 0 : m.message])
|
|
5383
|
-
},
|
|
5402
|
+
}, O(n.message), 3),
|
|
5384
5403
|
n.showRetry ? (x(), v("button", {
|
|
5385
5404
|
key: 0,
|
|
5386
|
-
class: b(["px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary/90 transition-colors", (
|
|
5405
|
+
class: b(["px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary/90 transition-colors", (f = n.ui) == null ? void 0 : f.retryButton]),
|
|
5387
5406
|
onClick: a
|
|
5388
|
-
},
|
|
5407
|
+
}, O(n.retryText), 3)) : F("", !0)
|
|
5389
5408
|
], 2)
|
|
5390
5409
|
];
|
|
5391
|
-
}) :
|
|
5410
|
+
}) : le(u.$slots, "default", { key: 0 });
|
|
5392
5411
|
}
|
|
5393
5412
|
}), La = {
|
|
5394
5413
|
install(n, e) {
|
|
@@ -5413,7 +5432,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5413
5432
|
translate: e.translate,
|
|
5414
5433
|
can: e.can,
|
|
5415
5434
|
labels: {
|
|
5416
|
-
...
|
|
5435
|
+
...os,
|
|
5417
5436
|
...e.labels
|
|
5418
5437
|
},
|
|
5419
5438
|
// Providers
|
|
@@ -5462,30 +5481,30 @@ app.use(RestifyAiPlugin, {
|
|
|
5462
5481
|
export {
|
|
5463
5482
|
_o as AiAvatar,
|
|
5464
5483
|
Ma as AiChatDrawer,
|
|
5465
|
-
|
|
5484
|
+
Fi as AiEmptyState,
|
|
5466
5485
|
Hi as ChatInput,
|
|
5467
5486
|
ai as ChatMessage,
|
|
5468
|
-
|
|
5487
|
+
Bo as ChatMessageActions,
|
|
5469
5488
|
nt as ChatRoles,
|
|
5470
5489
|
Ra as ErrorBoundary,
|
|
5471
5490
|
Po as MentionList,
|
|
5472
5491
|
La as RestifyAiPlugin,
|
|
5473
5492
|
Ea as UserAvatar,
|
|
5474
5493
|
La as default,
|
|
5475
|
-
|
|
5494
|
+
os as defaultLabels,
|
|
5476
5495
|
yr as formatMentionsForApi,
|
|
5477
5496
|
tt as getConfigValue,
|
|
5478
|
-
|
|
5497
|
+
ue as getLabel,
|
|
5479
5498
|
ee as getRestifyAiConfig,
|
|
5480
|
-
|
|
5499
|
+
ka as getRestifyAiConfigOrThrow,
|
|
5481
5500
|
So as getSuggestionsForPath,
|
|
5482
5501
|
xr as groupMentionsByType,
|
|
5483
|
-
|
|
5502
|
+
is as isConfigured,
|
|
5484
5503
|
Sa as registerSuggestionProvider,
|
|
5485
5504
|
Qs as setRestifyAiConfig,
|
|
5486
|
-
|
|
5505
|
+
Es as useAiContext,
|
|
5487
5506
|
Ca as useAiDrawerShortcut,
|
|
5488
|
-
|
|
5507
|
+
Rs as useAiSuggestions,
|
|
5489
5508
|
Ta as useChatErrorHandling,
|
|
5490
5509
|
bo as useChatMarkdown,
|
|
5491
5510
|
va as useChatScroll,
|