@doderasoftware/restify-ai 0.1.0-beta.6 → 0.1.0-beta.8
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/README.md +855 -262
- package/dist/components/AiAvatar.vue.d.ts.map +1 -1
- package/dist/components/AiChatDrawer.vue.d.ts +3 -3
- package/dist/components/AiChatDrawer.vue.d.ts.map +1 -1
- package/dist/components/AiEmptyState.vue.d.ts.map +1 -1
- package/dist/components/ChatInput.vue.d.ts.map +1 -1
- package/dist/components/ChatMessage.vue.d.ts.map +1 -1
- package/dist/components/ChatMessageActions.vue.d.ts.map +1 -1
- package/dist/components/ErrorBoundary.vue.d.ts +74 -0
- package/dist/components/ErrorBoundary.vue.d.ts.map +1 -0
- package/dist/components/MentionList.vue.d.ts.map +1 -1
- package/dist/components/UserAvatar.vue.d.ts.map +1 -1
- package/dist/components/drawer/ConfirmDialog.vue.d.ts.map +1 -1
- package/dist/components/drawer/DrawerHeader.vue.d.ts.map +1 -1
- package/dist/components/drawer/DrawerMessageList.vue.d.ts.map +1 -1
- package/dist/components/drawer/SetupGuide.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/AttachmentsPreview.vue.d.ts.map +1 -1
- package/dist/components/input/InputActions.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/restify-ai.js +1191 -1135
- package/dist/restify-ai.umd.cjs +42 -42
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/storage.d.ts +30 -0
- package/dist/store/storage.d.ts.map +1 -0
- package/dist/store/store.d.ts +247 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/utils.d.ts +23 -0
- package/dist/store/utils.d.ts.map +1 -0
- package/dist/store.d.ts +1 -246
- package/dist/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/api.d.ts +43 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/chat.d.ts +56 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/config.d.ts +167 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/index.d.ts +15 -599
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mentions.d.ts +34 -0
- package/dist/types/mentions.d.ts.map +1 -0
- package/dist/types/setup.d.ts +13 -0
- package/dist/types/setup.d.ts.map +1 -0
- package/dist/types/slots.d.ts +33 -0
- package/dist/types/slots.d.ts.map +1 -0
- package/dist/types/suggestions.d.ts +32 -0
- package/dist/types/suggestions.d.ts.map +1 -0
- package/dist/types/texts.d.ts +56 -0
- package/dist/types/texts.d.ts.map +1 -0
- package/dist/types/ui.d.ts +101 -0
- package/dist/types/ui.d.ts.map +1 -0
- package/package.json +11 -3
package/dist/restify-ai.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var zs = Object.defineProperty;
|
|
2
2
|
var Hs = (n, e, t) => e in n ? zs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var W = (n, e, t) => Hs(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { ref as
|
|
5
|
-
import { defineStore as
|
|
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 Bs, defineComponent as ue, createElementBlock as v, openBlock as x, normalizeClass as b, renderSlot as he, createElementVNode as h, createCommentVNode as B, Fragment as we, renderList as Ne, toDisplayString as _, 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 Us, vModelText as qs, createStaticVNode as Nn, createTextVNode as js, Teleport as Ws, normalizeProps as Pn, guardReactiveProps as zn, onErrorCaptured as Ks } from "vue";
|
|
5
|
+
import { defineStore as Vs } from "pinia";
|
|
6
6
|
let qe = null;
|
|
7
|
-
const
|
|
7
|
+
const Gs = U(null), rs = {
|
|
8
8
|
title: "AI Assistant",
|
|
9
9
|
aiName: "AI Assistant",
|
|
10
10
|
you: "You",
|
|
@@ -58,8 +58,8 @@ const Vs = q(null), rs = {
|
|
|
58
58
|
setupBackendDescription: "Configure your backend endpoint",
|
|
59
59
|
setupCompleteTitle: "Setup Complete!"
|
|
60
60
|
};
|
|
61
|
-
function
|
|
62
|
-
qe = n,
|
|
61
|
+
function Qs(n) {
|
|
62
|
+
qe = n, Gs.value = n;
|
|
63
63
|
}
|
|
64
64
|
function ee() {
|
|
65
65
|
return qe;
|
|
@@ -107,16 +107,16 @@ const nt = {
|
|
|
107
107
|
User: "user",
|
|
108
108
|
System: "system"
|
|
109
109
|
};
|
|
110
|
-
async function
|
|
110
|
+
async function Zs(n, e) {
|
|
111
111
|
const t = n.getReader();
|
|
112
112
|
let s;
|
|
113
113
|
for (; !(s = await t.read()).done; )
|
|
114
114
|
e(s.value);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Ys(n) {
|
|
117
117
|
let e, t, s, r = !1;
|
|
118
118
|
return function(i) {
|
|
119
|
-
e === void 0 ? (e = i, t = 0, s = -1) : e =
|
|
119
|
+
e === void 0 ? (e = i, t = 0, s = -1) : e = Js(e, i);
|
|
120
120
|
const a = e.length;
|
|
121
121
|
let c = 0;
|
|
122
122
|
for (; t < a; ) {
|
|
@@ -140,7 +140,7 @@ function Zs(n) {
|
|
|
140
140
|
c === a ? e = void 0 : c !== 0 && (e = e.subarray(c), t -= c);
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Xs(n, e, t) {
|
|
144
144
|
let s = Fn();
|
|
145
145
|
const r = new TextDecoder();
|
|
146
146
|
return function(i, a) {
|
|
@@ -160,14 +160,14 @@ function Ys(n, e, t) {
|
|
|
160
160
|
n(s.id = d);
|
|
161
161
|
break;
|
|
162
162
|
case "retry":
|
|
163
|
-
const
|
|
164
|
-
isNaN(
|
|
163
|
+
const f = parseInt(d, 10);
|
|
164
|
+
isNaN(f) || e(s.retry = f);
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
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
|
}
|
|
@@ -179,7 +179,7 @@ function Fn() {
|
|
|
179
179
|
retry: void 0
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
var
|
|
182
|
+
var er = function(n, e) {
|
|
183
183
|
var t = {};
|
|
184
184
|
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
|
|
185
185
|
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -187,54 +187,53 @@ var Js = function(n, e) {
|
|
|
187
187
|
e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (t[s[r]] = n[s[r]]);
|
|
188
188
|
return t;
|
|
189
189
|
};
|
|
190
|
-
const sn = "text/event-stream",
|
|
191
|
-
function
|
|
192
|
-
var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = e, d =
|
|
193
|
-
return new Promise((
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
let
|
|
190
|
+
const sn = "text/event-stream", tr = 1e3, Bn = "last-event-id";
|
|
191
|
+
function nr(n, e) {
|
|
192
|
+
var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = e, d = er(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
193
|
+
return new Promise((f, w) => {
|
|
194
|
+
const m = Object.assign({}, s);
|
|
195
|
+
m.accept || (m.accept = sn);
|
|
196
|
+
let p;
|
|
197
197
|
function A() {
|
|
198
|
-
|
|
198
|
+
p.abort(), document.hidden || z();
|
|
199
199
|
}
|
|
200
200
|
c || document.addEventListener("visibilitychange", A);
|
|
201
|
-
let
|
|
201
|
+
let y = tr, g = 0;
|
|
202
202
|
function S() {
|
|
203
|
-
document.removeEventListener("visibilitychange", A), window.clearTimeout(
|
|
203
|
+
document.removeEventListener("visibilitychange", A), window.clearTimeout(g), p.abort();
|
|
204
204
|
}
|
|
205
205
|
t == null || t.addEventListener("abort", () => {
|
|
206
|
-
S(),
|
|
206
|
+
S(), f();
|
|
207
207
|
});
|
|
208
|
-
const C = u ?? window.fetch,
|
|
208
|
+
const C = u ?? window.fetch, T = r ?? sr;
|
|
209
209
|
async function z() {
|
|
210
210
|
var F;
|
|
211
|
-
|
|
211
|
+
p = new AbortController();
|
|
212
212
|
try {
|
|
213
|
-
const V = await C(n, Object.assign(Object.assign({}, d), { headers:
|
|
214
|
-
await
|
|
215
|
-
E ?
|
|
213
|
+
const V = await C(n, Object.assign(Object.assign({}, d), { headers: m, signal: p.signal }));
|
|
214
|
+
await T(V), await Zs(V.body, Ys(Xs((E) => {
|
|
215
|
+
E ? m[Bn] = E : delete m[Bn];
|
|
216
216
|
}, (E) => {
|
|
217
|
-
|
|
218
|
-
}, o))), i == null || i(), S(),
|
|
217
|
+
y = E;
|
|
218
|
+
}, o))), i == null || i(), S(), f();
|
|
219
219
|
} catch (V) {
|
|
220
|
-
if (!
|
|
220
|
+
if (!p.signal.aborted)
|
|
221
221
|
try {
|
|
222
|
-
const E = (F = a == null ? void 0 : a(V)) !== null && F !== void 0 ? F :
|
|
223
|
-
window.clearTimeout(
|
|
222
|
+
const E = (F = a == null ? void 0 : a(V)) !== null && F !== void 0 ? F : y;
|
|
223
|
+
window.clearTimeout(g), g = window.setTimeout(z, E);
|
|
224
224
|
} catch (E) {
|
|
225
|
-
S(),
|
|
225
|
+
S(), w(E);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
z();
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function sr(n) {
|
|
233
233
|
const e = n.headers.get("content-type");
|
|
234
234
|
if (!(e != null && e.startsWith(sn)))
|
|
235
235
|
throw new Error(`Expected content-type to be ${sn}, Actual: ${e}`);
|
|
236
236
|
}
|
|
237
|
-
let it = new AbortController();
|
|
238
237
|
function It(n) {
|
|
239
238
|
if (!n)
|
|
240
239
|
throw console.error("[RestifyAi] Endpoint is undefined. Check your endpoints configuration."), new Error("AI service endpoint is not configured. Please contact support.");
|
|
@@ -243,11 +242,11 @@ function It(n) {
|
|
|
243
242
|
const s = t.endsWith("/") ? t.slice(0, -1) : t, r = n.startsWith("/") ? n : `/${n}`;
|
|
244
243
|
return `${s}${r}`;
|
|
245
244
|
}
|
|
246
|
-
function
|
|
245
|
+
function rr(n) {
|
|
247
246
|
const t = (n instanceof Error ? n.message : String(n)).toLowerCase();
|
|
248
247
|
return t.includes("failed to fetch") || t.includes("network") || t.includes("fetch") ? "Unable to connect to the AI service. Please check your internet connection and try again." : t.includes("500") || t.includes("internal server error") ? "The AI service is temporarily unavailable. Please try again in a few moments." : t.includes("timeout") || t.includes("timed out") ? "The request took too long. Please try again." : t.includes("401") || t.includes("unauthorized") || t.includes("authentication") ? "Your session has expired. Please refresh the page and try again." : t.includes("429") || t.includes("rate limit") || t.includes("too many requests") ? "Too many requests. Please wait a moment before trying again." : t.includes("cors") || t.includes("cross-origin") ? "Unable to connect to the AI service. Please contact support." : t.includes("endpoint is not configured") ? "AI service endpoint is not configured. Please contact support." : "Something went wrong. Please try again later.";
|
|
249
248
|
}
|
|
250
|
-
function
|
|
249
|
+
function or(n) {
|
|
251
250
|
var e, t, s;
|
|
252
251
|
try {
|
|
253
252
|
if (n === "[DONE]") return "[DONE]";
|
|
@@ -257,9 +256,18 @@ function rr(n) {
|
|
|
257
256
|
return null;
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
|
-
function
|
|
259
|
+
function ir(n) {
|
|
261
260
|
return new Promise((e) => setTimeout(e, n));
|
|
262
261
|
}
|
|
262
|
+
function ar(n) {
|
|
263
|
+
const e = {};
|
|
264
|
+
return n.forEach((t) => {
|
|
265
|
+
var s;
|
|
266
|
+
(s = t.attachments) == null || s.forEach((r) => {
|
|
267
|
+
r != null && r.id && (e[r.id] = r);
|
|
268
|
+
});
|
|
269
|
+
}), e;
|
|
270
|
+
}
|
|
263
271
|
function Pe(n) {
|
|
264
272
|
const e = ee();
|
|
265
273
|
return n === "chatHistory" ? (e == null ? void 0 : e.chatHistoryKey) || "restify_ai_chat_history" : n === "setupComplete" ? "restify_ai_setup_complete" : (e == null ? void 0 : e.drawerStateKey) || "restify_ai_drawer_open";
|
|
@@ -271,31 +279,7 @@ function $t(n) {
|
|
|
271
279
|
console.warn("[RestifyAi] Failed to save chat history:", e);
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
|
-
function ir(n) {
|
|
275
|
-
try {
|
|
276
|
-
n.message || n.failedQuestion ? sessionStorage.setItem("restify_ai_error_state", JSON.stringify(n)) : sessionStorage.removeItem("restify_ai_error_state");
|
|
277
|
-
} catch (e) {
|
|
278
|
-
console.warn("[RestifyAi] Failed to save error state:", e);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
function ar() {
|
|
282
|
-
try {
|
|
283
|
-
const n = sessionStorage.getItem("restify_ai_error_state");
|
|
284
|
-
if (n)
|
|
285
|
-
return JSON.parse(n);
|
|
286
|
-
} catch (n) {
|
|
287
|
-
console.warn("[RestifyAi] Failed to load error state:", n);
|
|
288
|
-
}
|
|
289
|
-
return null;
|
|
290
|
-
}
|
|
291
282
|
function lr() {
|
|
292
|
-
try {
|
|
293
|
-
sessionStorage.removeItem("restify_ai_error_state");
|
|
294
|
-
} catch (n) {
|
|
295
|
-
console.warn("[RestifyAi] Failed to clear error state:", n);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
function ur() {
|
|
299
283
|
try {
|
|
300
284
|
const n = sessionStorage.getItem(Pe("chatHistory"));
|
|
301
285
|
if (n) {
|
|
@@ -304,7 +288,6 @@ function ur() {
|
|
|
304
288
|
return !(o.role === nt.Assistant && o.loading || o.role === nt.Assistant && !((i = o.message) != null && i.trim()));
|
|
305
289
|
}).map((o) => ({
|
|
306
290
|
...o,
|
|
307
|
-
// Reset streaming flag in case page was refreshed mid-stream
|
|
308
291
|
streaming: !1,
|
|
309
292
|
loading: !1
|
|
310
293
|
}));
|
|
@@ -324,13 +307,37 @@ function ur() {
|
|
|
324
307
|
}
|
|
325
308
|
return { history: [], hasOrphanedUserMessage: !1 };
|
|
326
309
|
}
|
|
327
|
-
function
|
|
310
|
+
function ur() {
|
|
328
311
|
try {
|
|
329
312
|
sessionStorage.removeItem(Pe("chatHistory"));
|
|
330
313
|
} catch (n) {
|
|
331
314
|
console.warn("[RestifyAi] Failed to clear chat history:", n);
|
|
332
315
|
}
|
|
333
316
|
}
|
|
317
|
+
function cr(n) {
|
|
318
|
+
try {
|
|
319
|
+
n.message || n.failedQuestion ? sessionStorage.setItem("restify_ai_error_state", JSON.stringify(n)) : sessionStorage.removeItem("restify_ai_error_state");
|
|
320
|
+
} catch (e) {
|
|
321
|
+
console.warn("[RestifyAi] Failed to save error state:", e);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function dr() {
|
|
325
|
+
try {
|
|
326
|
+
const n = sessionStorage.getItem("restify_ai_error_state");
|
|
327
|
+
if (n)
|
|
328
|
+
return JSON.parse(n);
|
|
329
|
+
} catch (n) {
|
|
330
|
+
console.warn("[RestifyAi] Failed to load error state:", n);
|
|
331
|
+
}
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
function hr() {
|
|
335
|
+
try {
|
|
336
|
+
sessionStorage.removeItem("restify_ai_error_state");
|
|
337
|
+
} catch (n) {
|
|
338
|
+
console.warn("[RestifyAi] Failed to clear error state:", n);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
334
341
|
function Qt(n) {
|
|
335
342
|
try {
|
|
336
343
|
localStorage.setItem(Pe("drawerState"), JSON.stringify(n));
|
|
@@ -338,7 +345,7 @@ function Qt(n) {
|
|
|
338
345
|
console.warn("[RestifyAi] Failed to save drawer state:", e);
|
|
339
346
|
}
|
|
340
347
|
}
|
|
341
|
-
function
|
|
348
|
+
function pr() {
|
|
342
349
|
try {
|
|
343
350
|
const n = localStorage.getItem(Pe("drawerState"));
|
|
344
351
|
if (n !== null)
|
|
@@ -348,7 +355,7 @@ function dr() {
|
|
|
348
355
|
}
|
|
349
356
|
return !1;
|
|
350
357
|
}
|
|
351
|
-
function
|
|
358
|
+
function fr() {
|
|
352
359
|
try {
|
|
353
360
|
return localStorage.getItem(Pe("setupComplete")) === "true";
|
|
354
361
|
} catch {
|
|
@@ -362,15 +369,6 @@ function Un() {
|
|
|
362
369
|
console.warn("[RestifyAi] Failed to mark setup complete:", n);
|
|
363
370
|
}
|
|
364
371
|
}
|
|
365
|
-
function hr(n) {
|
|
366
|
-
const e = {};
|
|
367
|
-
return n.forEach((t) => {
|
|
368
|
-
var s;
|
|
369
|
-
(s = t.attachments) == null || s.forEach((r) => {
|
|
370
|
-
r != null && r.id && (e[r.id] = r);
|
|
371
|
-
});
|
|
372
|
-
}), e;
|
|
373
|
-
}
|
|
374
372
|
function qn() {
|
|
375
373
|
return {
|
|
376
374
|
isActive: !1,
|
|
@@ -381,9 +379,10 @@ function qn() {
|
|
|
381
379
|
lastError: null
|
|
382
380
|
};
|
|
383
381
|
}
|
|
384
|
-
|
|
382
|
+
let it = new AbortController();
|
|
383
|
+
const We = Vs("restifyAiStore", {
|
|
385
384
|
state: () => {
|
|
386
|
-
const n =
|
|
385
|
+
const n = lr(), e = dr();
|
|
387
386
|
let t = {
|
|
388
387
|
message: null,
|
|
389
388
|
failedQuestion: null,
|
|
@@ -406,20 +405,16 @@ const We = Ks("restifyAiStore", {
|
|
|
406
405
|
}), {
|
|
407
406
|
chatHistoryLimit: tt("chatHistoryLimit") || 15,
|
|
408
407
|
chatHistory: n.history,
|
|
409
|
-
uploadedFiles:
|
|
408
|
+
uploadedFiles: ar(n.history),
|
|
410
409
|
loading: !1,
|
|
411
|
-
showChat:
|
|
410
|
+
showChat: pr(),
|
|
412
411
|
isFullscreen: !1,
|
|
413
412
|
sending: !1,
|
|
414
413
|
pageContext: null,
|
|
415
|
-
quota: {
|
|
416
|
-
limit: 100,
|
|
417
|
-
used: 0,
|
|
418
|
-
remaining: 100
|
|
419
|
-
},
|
|
414
|
+
quota: { limit: 100, used: 0, remaining: 100 },
|
|
420
415
|
error: t,
|
|
421
416
|
supportRequestMode: !1,
|
|
422
|
-
setupState: !os() && !
|
|
417
|
+
setupState: !os() && !fr() ? { ...qn(), isActive: !0 } : qn()
|
|
423
418
|
};
|
|
424
419
|
},
|
|
425
420
|
getters: {
|
|
@@ -429,43 +424,43 @@ const We = Ks("restifyAiStore", {
|
|
|
429
424
|
},
|
|
430
425
|
actions: {
|
|
431
426
|
async scrollToBottom() {
|
|
432
|
-
await
|
|
427
|
+
await _e();
|
|
433
428
|
const n = document.getElementById("rai-chat-bottom");
|
|
434
429
|
n && n.scrollIntoView({ behavior: "smooth" });
|
|
435
430
|
},
|
|
436
431
|
parseStreamContent(n) {
|
|
437
432
|
const e = ee(), t = e == null ? void 0 : e.parseStreamContent;
|
|
438
|
-
return t ? t(n.data) :
|
|
433
|
+
return t ? t(n.data) : or(n.data);
|
|
439
434
|
},
|
|
440
435
|
async askQuestion(n, e = [], t = [], s = !1) {
|
|
441
|
-
var
|
|
436
|
+
var m;
|
|
442
437
|
const r = ee();
|
|
443
438
|
if (!r)
|
|
444
439
|
return console.warn("[RestifyAi] Cannot ask question - plugin not configured"), !1;
|
|
445
440
|
let o = "", i = !1;
|
|
446
441
|
const a = r.retry || {}, c = a.maxRetries ?? 0, u = a.retryDelay ?? 1e3;
|
|
447
442
|
let d = 0;
|
|
448
|
-
const
|
|
449
|
-
id:
|
|
450
|
-
name:
|
|
451
|
-
url:
|
|
452
|
-
type:
|
|
453
|
-
size:
|
|
454
|
-
extractedText:
|
|
443
|
+
const f = e.map((p) => ({
|
|
444
|
+
id: p.id,
|
|
445
|
+
name: p.name,
|
|
446
|
+
url: p.url,
|
|
447
|
+
type: p.type,
|
|
448
|
+
size: p.size,
|
|
449
|
+
extractedText: p.extractedText
|
|
455
450
|
}));
|
|
456
451
|
this.chatHistory.push({
|
|
457
452
|
id: crypto.randomUUID(),
|
|
458
453
|
role: nt.User,
|
|
459
454
|
message: n,
|
|
460
455
|
loading: !1,
|
|
461
|
-
attachments:
|
|
456
|
+
attachments: f,
|
|
462
457
|
mentions: t,
|
|
463
458
|
timestamp: Date.now()
|
|
464
|
-
}),
|
|
465
|
-
const
|
|
466
|
-
var
|
|
459
|
+
}), f.forEach((p) => this.registerUploadedFile(p)), $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
|
+
const w = async () => {
|
|
461
|
+
var p, A, y;
|
|
467
462
|
try {
|
|
468
|
-
const
|
|
463
|
+
const g = this.chatHistory.map((L) => ({
|
|
469
464
|
role: L.role,
|
|
470
465
|
message: L.message,
|
|
471
466
|
attachments: L.attachments ?? []
|
|
@@ -480,9 +475,9 @@ const We = Ks("restifyAiStore", {
|
|
|
480
475
|
};
|
|
481
476
|
Object.values(this.uploadedFiles).forEach(C), this.chatHistory.forEach((L) => {
|
|
482
477
|
var ne;
|
|
483
|
-
(ne = L.attachments) == null
|
|
484
|
-
}),
|
|
485
|
-
const
|
|
478
|
+
return (ne = L.attachments) == null ? void 0 : ne.forEach(C);
|
|
479
|
+
}), f.forEach(C);
|
|
480
|
+
const T = Object.values(S), z = this.chatHistory.length;
|
|
486
481
|
this.chatHistory.push({
|
|
487
482
|
id: crypto.randomUUID(),
|
|
488
483
|
role: nt.Assistant,
|
|
@@ -490,8 +485,7 @@ const We = Ks("restifyAiStore", {
|
|
|
490
485
|
loading: !0,
|
|
491
486
|
timestamp: Date.now()
|
|
492
487
|
}), $t(this.chatHistory), it = new AbortController();
|
|
493
|
-
const F = await r.getAuthToken()
|
|
494
|
-
let E = {
|
|
488
|
+
const F = await r.getAuthToken(), E = {
|
|
495
489
|
"Content-Type": "application/json",
|
|
496
490
|
Accept: "application/vnd.api+json",
|
|
497
491
|
...r.getCustomHeaders ? await r.getCustomHeaders() : {}
|
|
@@ -499,20 +493,20 @@ const We = Ks("restifyAiStore", {
|
|
|
499
493
|
this.setupState.isActive && this.setupState.testApiKey ? E["X-Test-Api-Key"] = this.setupState.testApiKey : F && (E.Authorization = `Bearer ${F}`);
|
|
500
494
|
let M = {
|
|
501
495
|
question: n,
|
|
502
|
-
history:
|
|
496
|
+
history: g,
|
|
503
497
|
stream: !0,
|
|
504
|
-
...
|
|
498
|
+
...T.length > 0 && { files: T },
|
|
505
499
|
...t.length > 0 && { mentions: t },
|
|
506
500
|
...this.supportRequestMode && { contact_support: !0 }
|
|
507
501
|
};
|
|
508
|
-
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)), (p = r.onMessageSent) == null || p.call(r, this.chatHistory[z - 1]);
|
|
509
503
|
const I = It(r.endpoints.ask);
|
|
510
504
|
let P = {
|
|
511
505
|
method: "POST",
|
|
512
506
|
body: JSON.stringify(M),
|
|
513
507
|
headers: E
|
|
514
508
|
};
|
|
515
|
-
return r.requestInterceptor && (P = await r.requestInterceptor(I, P)), (A = r.onStreamStart) == null || A.call(r), await
|
|
509
|
+
return r.requestInterceptor && (P = await r.requestInterceptor(I, P)), (A = r.onStreamStart) == null || A.call(r), await nr(I, {
|
|
516
510
|
method: "POST",
|
|
517
511
|
body: JSON.stringify(M),
|
|
518
512
|
signal: it.signal,
|
|
@@ -525,7 +519,7 @@ const We = Ks("restifyAiStore", {
|
|
|
525
519
|
throw ne.error = {
|
|
526
520
|
message: le("noQuota"),
|
|
527
521
|
failedQuestion: n,
|
|
528
|
-
failedAttachments:
|
|
522
|
+
failedAttachments: f,
|
|
529
523
|
timestamp: Date.now(),
|
|
530
524
|
quotaExceeded: !0
|
|
531
525
|
}, await ne.fetchQuota(), new Error("Quota exceeded");
|
|
@@ -549,24 +543,24 @@ const We = Ks("restifyAiStore", {
|
|
|
549
543
|
throw i = !0, L;
|
|
550
544
|
}
|
|
551
545
|
}), !0;
|
|
552
|
-
} catch (
|
|
546
|
+
} catch (g) {
|
|
553
547
|
i = !0;
|
|
554
548
|
const S = this.chatHistory.length - 1;
|
|
555
|
-
return this.chatHistory.splice(S, 1),
|
|
556
|
-
message:
|
|
549
|
+
return this.chatHistory.splice(S, 1), g.name === "AbortError" ? !0 : d < c && (a.shouldRetry ? a.shouldRetry(g, d) : !0) ? (d++, await ir(u * d), w()) : (this.error = {
|
|
550
|
+
message: rr(g),
|
|
557
551
|
failedQuestion: n,
|
|
558
|
-
failedAttachments:
|
|
552
|
+
failedAttachments: f,
|
|
559
553
|
timestamp: Date.now()
|
|
560
|
-
},
|
|
554
|
+
}, cr({
|
|
561
555
|
message: this.error.message,
|
|
562
556
|
failedQuestion: this.error.failedQuestion,
|
|
563
557
|
failedAttachments: this.error.failedAttachments || null
|
|
564
|
-
}), (
|
|
558
|
+
}), (y = r.onError) == null || y.call(r, g), !1);
|
|
565
559
|
} finally {
|
|
566
560
|
this.sending = !1;
|
|
567
561
|
}
|
|
568
562
|
};
|
|
569
|
-
return
|
|
563
|
+
return w();
|
|
570
564
|
},
|
|
571
565
|
cancelRequest() {
|
|
572
566
|
it == null || it.abort(), this.chatHistory = this.chatHistory.map((n) => ({
|
|
@@ -578,11 +572,10 @@ const We = Ks("restifyAiStore", {
|
|
|
578
572
|
clearChatHistory() {
|
|
579
573
|
var e;
|
|
580
574
|
const n = ee();
|
|
581
|
-
this.chatHistory = [], this.sending = !1, this.uploadedFiles = {}, this.clearError(), this.quota.remaining > 0 && (this.supportRequestMode = !1),
|
|
575
|
+
this.chatHistory = [], this.sending = !1, this.uploadedFiles = {}, this.clearError(), this.quota.remaining > 0 && (this.supportRequestMode = !1), ur(), (e = n == null ? void 0 : n.onNewChat) == null || e.call(n);
|
|
582
576
|
},
|
|
583
577
|
async retry() {
|
|
584
|
-
if (!this.error.failedQuestion)
|
|
585
|
-
return !1;
|
|
578
|
+
if (!this.error.failedQuestion) return !1;
|
|
586
579
|
const n = this.error.failedQuestion, e = this.error.failedAttachments || [], t = this.chatHistory[this.chatHistory.length - 1];
|
|
587
580
|
return (t == null ? void 0 : t.role) === nt.User && t.message === n && (this.chatHistory.pop(), $t(this.chatHistory)), this.clearError(), await this.askQuestion(n, e);
|
|
588
581
|
},
|
|
@@ -593,7 +586,7 @@ const We = Ks("restifyAiStore", {
|
|
|
593
586
|
failedAttachments: null,
|
|
594
587
|
timestamp: null,
|
|
595
588
|
quotaExceeded: !1
|
|
596
|
-
},
|
|
589
|
+
}, hr();
|
|
597
590
|
},
|
|
598
591
|
toggleSupportMode() {
|
|
599
592
|
this.supportRequestMode = !this.supportRequestMode;
|
|
@@ -637,40 +630,36 @@ const We = Ks("restifyAiStore", {
|
|
|
637
630
|
};
|
|
638
631
|
(o = e.onFileUploadStart) == null || o.call(e, s);
|
|
639
632
|
try {
|
|
640
|
-
const u = await e.getAuthToken(), d = e.getCustomHeaders ? await e.getCustomHeaders() : {},
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
|
|
633
|
+
const u = await e.getAuthToken(), d = e.getCustomHeaders ? await e.getCustomHeaders() : {}, f = It(e.endpoints.uploadFile), w = new FormData();
|
|
634
|
+
w.append("file", n);
|
|
635
|
+
const m = await new Promise((p, A) => {
|
|
636
|
+
const y = new XMLHttpRequest();
|
|
637
|
+
y.upload.addEventListener("progress", (g) => {
|
|
645
638
|
var S;
|
|
646
|
-
if (
|
|
647
|
-
const C = Math.round(
|
|
639
|
+
if (g.lengthComputable) {
|
|
640
|
+
const C = Math.round(g.loaded / g.total * 100);
|
|
648
641
|
s.progress = C, (S = e.onFileUploadProgress) == null || S.call(e, s, C);
|
|
649
642
|
}
|
|
650
|
-
}),
|
|
651
|
-
var
|
|
652
|
-
if (
|
|
643
|
+
}), y.addEventListener("load", () => {
|
|
644
|
+
var g, S;
|
|
645
|
+
if (y.status >= 200 && y.status < 300)
|
|
653
646
|
try {
|
|
654
|
-
const C = JSON.parse(
|
|
647
|
+
const C = JSON.parse(y.responseText), T = {
|
|
655
648
|
...s,
|
|
656
|
-
url: C.url || ((
|
|
649
|
+
url: C.url || ((g = C.data) == null ? void 0 : g.url),
|
|
657
650
|
extractedText: C.extracted_text || ((S = C.data) == null ? void 0 : S.extracted_text),
|
|
658
651
|
uploading: !1,
|
|
659
652
|
progress: 100
|
|
660
653
|
};
|
|
661
|
-
|
|
654
|
+
p(T);
|
|
662
655
|
} catch {
|
|
663
656
|
A(new Error("Failed to parse upload response"));
|
|
664
657
|
}
|
|
665
658
|
else
|
|
666
|
-
A(new Error(`Upload failed: ${
|
|
667
|
-
}),
|
|
668
|
-
A(new Error("Upload failed"));
|
|
669
|
-
}), m.open("POST", g), u && m.setRequestHeader("Authorization", `Bearer ${u}`), Object.entries(d).forEach(([f, S]) => {
|
|
670
|
-
m.setRequestHeader(f, S);
|
|
671
|
-
}), m.send(k);
|
|
659
|
+
A(new Error(`Upload failed: ${y.status}`));
|
|
660
|
+
}), y.addEventListener("error", () => A(new Error("Upload failed"))), y.open("POST", f), u && y.setRequestHeader("Authorization", `Bearer ${u}`), Object.entries(d).forEach(([g, S]) => y.setRequestHeader(g, S)), y.send(w);
|
|
672
661
|
});
|
|
673
|
-
return (i = e.onFileUploadComplete) == null || i.call(e,
|
|
662
|
+
return (i = e.onFileUploadComplete) == null || i.call(e, m), m;
|
|
674
663
|
} catch (u) {
|
|
675
664
|
const d = { ...s, uploading: !1 };
|
|
676
665
|
return (a = e.onFileUploadError) == null || a.call(e, d, u), (c = e.onError) == null || c.call(e, u), null;
|
|
@@ -765,7 +754,7 @@ function is(n) {
|
|
|
765
754
|
mentions: t
|
|
766
755
|
};
|
|
767
756
|
}
|
|
768
|
-
function
|
|
757
|
+
function gr(n) {
|
|
769
758
|
const { cleanText: e } = is(n);
|
|
770
759
|
return e;
|
|
771
760
|
}
|
|
@@ -795,7 +784,7 @@ function us(n, e) {
|
|
|
795
784
|
var t, s;
|
|
796
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;
|
|
797
786
|
}
|
|
798
|
-
function
|
|
787
|
+
function mr(n, e) {
|
|
799
788
|
return e != null && e.buildMentionText ? e.buildMentionText(n) : `@[${cn(n, e)}](${n.type}:${n.id})`;
|
|
800
789
|
}
|
|
801
790
|
function cs(n) {
|
|
@@ -807,32 +796,32 @@ function ds(n) {
|
|
|
807
796
|
const e = ee(), t = (e == null ? void 0 : e.mentionProviders) || [];
|
|
808
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;
|
|
809
798
|
}
|
|
810
|
-
function
|
|
799
|
+
function yr(n) {
|
|
811
800
|
return n.map((e) => ({
|
|
812
801
|
type: e.type,
|
|
813
802
|
id: e.id,
|
|
814
803
|
name: e.name
|
|
815
804
|
}));
|
|
816
805
|
}
|
|
817
|
-
function
|
|
806
|
+
function xr(n) {
|
|
818
807
|
return n.reduce((e, t) => {
|
|
819
808
|
const s = t.type || "default";
|
|
820
809
|
return e[s] || (e[s] = []), e[s].push(t), e;
|
|
821
810
|
}, {});
|
|
822
811
|
}
|
|
823
|
-
function
|
|
812
|
+
function ba() {
|
|
824
813
|
return {
|
|
825
814
|
extractMentions: is,
|
|
826
|
-
parseAndCleanMessage:
|
|
815
|
+
parseAndCleanMessage: gr,
|
|
827
816
|
renderMentionsInHtml: as,
|
|
828
817
|
detectMentionContext: ls,
|
|
829
818
|
getMentionDisplayName: cn,
|
|
830
819
|
getMentionSubtitle: us,
|
|
831
|
-
buildMentionText:
|
|
820
|
+
buildMentionText: mr,
|
|
832
821
|
getMentionProvider: cs,
|
|
833
822
|
getActiveMentionProviders: ds,
|
|
834
|
-
formatMentionsForApi:
|
|
835
|
-
groupMentionsByType:
|
|
823
|
+
formatMentionsForApi: yr,
|
|
824
|
+
groupMentionsByType: xr
|
|
836
825
|
};
|
|
837
826
|
}
|
|
838
827
|
function dn() {
|
|
@@ -850,32 +839,32 @@ function dn() {
|
|
|
850
839
|
};
|
|
851
840
|
}
|
|
852
841
|
let Ke = dn();
|
|
853
|
-
function
|
|
842
|
+
function hs(n) {
|
|
854
843
|
Ke = n;
|
|
855
844
|
}
|
|
856
|
-
const
|
|
845
|
+
const ps = /[&<>"']/, kr = new RegExp(ps.source, "g"), fs = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, wr = new RegExp(fs.source, "g"), br = {
|
|
857
846
|
"&": "&",
|
|
858
847
|
"<": "<",
|
|
859
848
|
">": ">",
|
|
860
849
|
'"': """,
|
|
861
850
|
"'": "'"
|
|
862
|
-
}, jn = (n) =>
|
|
851
|
+
}, jn = (n) => br[n];
|
|
863
852
|
function ye(n, e) {
|
|
864
853
|
if (e) {
|
|
865
|
-
if (
|
|
866
|
-
return n.replace(
|
|
854
|
+
if (ps.test(n))
|
|
855
|
+
return n.replace(kr, jn);
|
|
867
856
|
} else if (fs.test(n))
|
|
868
857
|
return n.replace(wr, jn);
|
|
869
858
|
return n;
|
|
870
859
|
}
|
|
871
|
-
const
|
|
860
|
+
const vr = /(^|[^\[])\^/g;
|
|
872
861
|
function j(n, e) {
|
|
873
862
|
let t = typeof n == "string" ? n : n.source;
|
|
874
863
|
e = e || "";
|
|
875
864
|
const s = {
|
|
876
865
|
replace: (r, o) => {
|
|
877
866
|
let i = typeof o == "string" ? o : o.source;
|
|
878
|
-
return i = i.replace(
|
|
867
|
+
return i = i.replace(vr, "$1"), t = t.replace(r, i), s;
|
|
879
868
|
},
|
|
880
869
|
getRegex: () => new RegExp(t, e)
|
|
881
870
|
};
|
|
@@ -917,7 +906,7 @@ function at(n, e, t) {
|
|
|
917
906
|
r++;
|
|
918
907
|
return n.slice(0, s - r);
|
|
919
908
|
}
|
|
920
|
-
function
|
|
909
|
+
function Tr(n, e) {
|
|
921
910
|
if (n.indexOf(e[1]) === -1)
|
|
922
911
|
return -1;
|
|
923
912
|
let t = 0;
|
|
@@ -952,7 +941,7 @@ function Vn(n, e, t, s) {
|
|
|
952
941
|
text: ye(i)
|
|
953
942
|
};
|
|
954
943
|
}
|
|
955
|
-
function
|
|
944
|
+
function Sr(n, e) {
|
|
956
945
|
const t = n.match(/^(\s+)(?:```)/);
|
|
957
946
|
if (t === null)
|
|
958
947
|
return e;
|
|
@@ -1000,7 +989,7 @@ class Pt {
|
|
|
1000
989
|
fences(e) {
|
|
1001
990
|
const t = this.rules.block.fences.exec(e);
|
|
1002
991
|
if (t) {
|
|
1003
|
-
const s = t[0], r =
|
|
992
|
+
const s = t[0], r = Sr(s, t[3] || "");
|
|
1004
993
|
return {
|
|
1005
994
|
type: "code",
|
|
1006
995
|
raw: s,
|
|
@@ -1055,28 +1044,28 @@ class Pt {
|
|
|
1055
1044
|
break;
|
|
1056
1045
|
s = s.slice(u);
|
|
1057
1046
|
const d = c.join(`
|
|
1058
|
-
`),
|
|
1047
|
+
`), f = d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
|
|
1059
1048
|
$1`).replace(/^ {0,3}>[ \t]?/gm, "");
|
|
1060
1049
|
r = r ? `${r}
|
|
1061
1050
|
${d}` : d, o = o ? `${o}
|
|
1062
|
-
${
|
|
1063
|
-
const
|
|
1064
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1051
|
+
${f}` : f;
|
|
1052
|
+
const w = this.lexer.state.top;
|
|
1053
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(f, i, !0), this.lexer.state.top = w, s.length === 0)
|
|
1065
1054
|
break;
|
|
1066
|
-
const
|
|
1067
|
-
if ((
|
|
1055
|
+
const m = i[i.length - 1];
|
|
1056
|
+
if ((m == null ? void 0 : m.type) === "code")
|
|
1068
1057
|
break;
|
|
1069
|
-
if ((
|
|
1070
|
-
const
|
|
1058
|
+
if ((m == null ? void 0 : m.type) === "blockquote") {
|
|
1059
|
+
const p = m, A = p.raw + `
|
|
1071
1060
|
` + s.join(`
|
|
1072
|
-
`),
|
|
1073
|
-
i[i.length - 1] =
|
|
1061
|
+
`), y = this.blockquote(A);
|
|
1062
|
+
i[i.length - 1] = y, r = r.substring(0, r.length - p.raw.length) + y.raw, o = o.substring(0, o.length - p.text.length) + y.text;
|
|
1074
1063
|
break;
|
|
1075
|
-
} else if ((
|
|
1076
|
-
const
|
|
1064
|
+
} else if ((m == null ? void 0 : m.type) === "list") {
|
|
1065
|
+
const p = m, A = p.raw + `
|
|
1077
1066
|
` + s.join(`
|
|
1078
|
-
`),
|
|
1079
|
-
i[i.length - 1] =
|
|
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 - p.raw.length) + y.raw, s = A.substring(i[i.length - 1].raw.length).split(`
|
|
1080
1069
|
`);
|
|
1081
1070
|
continue;
|
|
1082
1071
|
}
|
|
@@ -1109,38 +1098,38 @@ ${g}` : g;
|
|
|
1109
1098
|
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
1110
1099
|
break;
|
|
1111
1100
|
u = t[0], e = e.substring(u.length);
|
|
1112
|
-
let
|
|
1113
|
-
`, 1)[0].replace(/^\t+/, (
|
|
1114
|
-
`, 1)[0],
|
|
1115
|
-
if (this.options.pedantic ? (
|
|
1116
|
-
`, e = e.substring(
|
|
1117
|
-
const
|
|
1101
|
+
let f = t[2].split(`
|
|
1102
|
+
`, 1)[0].replace(/^\t+/, (g) => " ".repeat(3 * g.length)), w = e.split(`
|
|
1103
|
+
`, 1)[0], m = !f.trim(), p = 0;
|
|
1104
|
+
if (this.options.pedantic ? (p = 2, d = f.trimStart()) : m ? p = t[1].length + 1 : (p = t[2].search(/[^ ]/), p = p > 4 ? 1 : p, d = f.slice(p), p += t[1].length), m && /^[ \t]*$/.test(w) && (u += w + `
|
|
1105
|
+
`, e = e.substring(w.length + 1), c = !0), !c) {
|
|
1106
|
+
const g = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, p - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:\`\`\`|~~~)`), T = new RegExp(`^ {0,${Math.min(3, p - 1)}}#`), z = new RegExp(`^ {0,${Math.min(3, p - 1)}}<(?:[a-z].*>|!--)`, "i");
|
|
1118
1107
|
for (; e; ) {
|
|
1119
1108
|
const F = e.split(`
|
|
1120
1109
|
`, 1)[0];
|
|
1121
1110
|
let V;
|
|
1122
|
-
if (
|
|
1111
|
+
if (w = F, 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))
|
|
1123
1112
|
break;
|
|
1124
|
-
if (V.search(/[^ ]/) >=
|
|
1113
|
+
if (V.search(/[^ ]/) >= p || !w.trim())
|
|
1125
1114
|
d += `
|
|
1126
|
-
` + V.slice(
|
|
1115
|
+
` + V.slice(p);
|
|
1127
1116
|
else {
|
|
1128
|
-
if (
|
|
1117
|
+
if (m || f.replace(/\t/g, " ").search(/[^ ]/) >= 4 || C.test(f) || T.test(f) || S.test(f))
|
|
1129
1118
|
break;
|
|
1130
1119
|
d += `
|
|
1131
|
-
` +
|
|
1120
|
+
` + w;
|
|
1132
1121
|
}
|
|
1133
|
-
!
|
|
1134
|
-
`, e = e.substring(F.length + 1),
|
|
1122
|
+
!m && !w.trim() && (m = !0), u += F + `
|
|
1123
|
+
`, e = e.substring(F.length + 1), f = V.slice(p);
|
|
1135
1124
|
}
|
|
1136
1125
|
}
|
|
1137
1126
|
o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(u) && (a = !0));
|
|
1138
|
-
let A = null,
|
|
1139
|
-
this.options.gfm && (A = /^\[[ xX]\] /.exec(d), A && (
|
|
1127
|
+
let A = null, y;
|
|
1128
|
+
this.options.gfm && (A = /^\[[ xX]\] /.exec(d), A && (y = A[0] !== "[ ] ", d = d.replace(/^\[[ xX]\] +/, ""))), o.items.push({
|
|
1140
1129
|
type: "list_item",
|
|
1141
1130
|
raw: u,
|
|
1142
1131
|
task: !!A,
|
|
1143
|
-
checked:
|
|
1132
|
+
checked: y,
|
|
1144
1133
|
loose: !1,
|
|
1145
1134
|
text: d,
|
|
1146
1135
|
tokens: []
|
|
@@ -1149,7 +1138,7 @@ ${g}` : g;
|
|
|
1149
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();
|
|
1150
1139
|
for (let c = 0; c < o.items.length; c++)
|
|
1151
1140
|
if (this.lexer.state.top = !1, o.items[c].tokens = this.lexer.blockTokens(o.items[c].text, []), !o.loose) {
|
|
1152
|
-
const u = o.items[c].tokens.filter((
|
|
1141
|
+
const u = o.items[c].tokens.filter((f) => f.type === "space"), d = u.length > 0 && u.some((f) => /\n.*\n/.test(f.raw));
|
|
1153
1142
|
o.loose = d;
|
|
1154
1143
|
}
|
|
1155
1144
|
if (o.loose)
|
|
@@ -1280,7 +1269,7 @@ ${g}` : g;
|
|
|
1280
1269
|
if ((s.length - i.length) % 2 === 0)
|
|
1281
1270
|
return;
|
|
1282
1271
|
} else {
|
|
1283
|
-
const i =
|
|
1272
|
+
const i = Tr(t[2], "()");
|
|
1284
1273
|
if (i > -1) {
|
|
1285
1274
|
const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
1286
1275
|
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, c).trim(), t[3] = "";
|
|
@@ -1320,8 +1309,8 @@ ${g}` : g;
|
|
|
1320
1309
|
if (!(r[1] || r[2] || "") || !s || this.rules.inline.punctuation.exec(s)) {
|
|
1321
1310
|
const i = [...r[0]].length - 1;
|
|
1322
1311
|
let a, c, u = i, d = 0;
|
|
1323
|
-
const
|
|
1324
|
-
for (
|
|
1312
|
+
const f = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1313
|
+
for (f.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = f.exec(t)) != null; ) {
|
|
1325
1314
|
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a)
|
|
1326
1315
|
continue;
|
|
1327
1316
|
if (c = [...a].length, r[3] || r[4]) {
|
|
@@ -1334,22 +1323,22 @@ ${g}` : g;
|
|
|
1334
1323
|
if (u -= c, u > 0)
|
|
1335
1324
|
continue;
|
|
1336
1325
|
c = Math.min(c, c + u + d);
|
|
1337
|
-
const
|
|
1326
|
+
const w = [...r[0]][0].length, m = e.slice(0, i + r.index + w + c);
|
|
1338
1327
|
if (Math.min(i, c) % 2) {
|
|
1339
|
-
const A =
|
|
1328
|
+
const A = m.slice(1, -1);
|
|
1340
1329
|
return {
|
|
1341
1330
|
type: "em",
|
|
1342
|
-
raw:
|
|
1331
|
+
raw: m,
|
|
1343
1332
|
text: A,
|
|
1344
1333
|
tokens: this.lexer.inlineTokens(A)
|
|
1345
1334
|
};
|
|
1346
1335
|
}
|
|
1347
|
-
const
|
|
1336
|
+
const p = m.slice(2, -2);
|
|
1348
1337
|
return {
|
|
1349
1338
|
type: "strong",
|
|
1350
|
-
raw:
|
|
1351
|
-
text:
|
|
1352
|
-
tokens: this.lexer.inlineTokens(
|
|
1339
|
+
raw: m,
|
|
1340
|
+
text: p,
|
|
1341
|
+
tokens: this.lexer.inlineTokens(p)
|
|
1353
1342
|
};
|
|
1354
1343
|
}
|
|
1355
1344
|
}
|
|
@@ -1444,24 +1433,24 @@ ${g}` : g;
|
|
|
1444
1433
|
}
|
|
1445
1434
|
}
|
|
1446
1435
|
}
|
|
1447
|
-
const
|
|
1448
|
-
blockquote:
|
|
1449
|
-
code:
|
|
1450
|
-
def:
|
|
1451
|
-
fences:
|
|
1452
|
-
heading:
|
|
1453
|
-
hr:
|
|
1454
|
-
html:
|
|
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|$)|$)/, kt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, gs = /(?:[*+-]|\d{1,9}[.)])/, ms = j(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, gs).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), 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, gs).getRegex(), Ft = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", fn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $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", Ft).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ys = j(hn).replace("hr", kt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ft).getRegex(), Dr = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ys).getRegex(), gn = {
|
|
1437
|
+
blockquote: Dr,
|
|
1438
|
+
code: Cr,
|
|
1439
|
+
def: Lr,
|
|
1440
|
+
fences: Er,
|
|
1441
|
+
heading: Mr,
|
|
1442
|
+
hr: kt,
|
|
1443
|
+
html: $r,
|
|
1455
1444
|
lheading: ms,
|
|
1456
|
-
list:
|
|
1457
|
-
newline:
|
|
1445
|
+
list: Ir,
|
|
1446
|
+
newline: Ar,
|
|
1458
1447
|
paragraph: ys,
|
|
1459
1448
|
table: ft,
|
|
1460
|
-
text:
|
|
1461
|
-
}, Gn = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",
|
|
1449
|
+
text: Rr
|
|
1450
|
+
}, Gn = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", kt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ft).getRegex(), Or = {
|
|
1462
1451
|
...gn,
|
|
1463
1452
|
table: Gn,
|
|
1464
|
-
paragraph: j(
|
|
1453
|
+
paragraph: j(hn).replace("hr", kt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Gn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ft).getRegex()
|
|
1465
1454
|
}, _r = {
|
|
1466
1455
|
...gn,
|
|
1467
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(),
|
|
@@ -1470,30 +1459,30 @@ const Sr = /^(?:[ \t]*(?:\n|$))+/, Ar = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1470
1459
|
fences: ft,
|
|
1471
1460
|
// fences not supported
|
|
1472
1461
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1473
|
-
paragraph: j(
|
|
1462
|
+
paragraph: j(hn).replace("hr", kt).replace("heading", ` *#{1,6} *[^
|
|
1474
1463
|
]`).replace("lheading", ms).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1475
|
-
}, xs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1464
|
+
}, xs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Nr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ks = /^( {2,}|\\)\n(?!\s*$)/, Pr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, wt = "\\p{P}\\p{S}", zr = j(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, wt).getRegex(), Hr = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Fr = j(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, wt).getRegex(), Br = j("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, wt).getRegex(), Ur = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, wt).getRegex(), qr = j(/\\([punct])/, "gu").replace(/punct/g, wt).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(), ws = j(/^!?\[(label)\]\[(ref)\]/).replace("label", zt).replace("ref", pn).getRegex(), bs = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", pn).getRegex(), Gr = j("reflink|nolink(?!\\()", "g").replace("reflink", ws).replace("nolink", bs).getRegex(), mn = {
|
|
1476
1465
|
_backpedal: ft,
|
|
1477
1466
|
// only used for GFM url
|
|
1478
|
-
anyPunctuation:
|
|
1479
|
-
autolink:
|
|
1480
|
-
blockSkip:
|
|
1481
|
-
br:
|
|
1482
|
-
code:
|
|
1467
|
+
anyPunctuation: qr,
|
|
1468
|
+
autolink: jr,
|
|
1469
|
+
blockSkip: Hr,
|
|
1470
|
+
br: ks,
|
|
1471
|
+
code: Nr,
|
|
1483
1472
|
del: ft,
|
|
1484
|
-
emStrongLDelim:
|
|
1485
|
-
emStrongRDelimAst:
|
|
1486
|
-
emStrongRDelimUnd:
|
|
1473
|
+
emStrongLDelim: Fr,
|
|
1474
|
+
emStrongRDelimAst: Br,
|
|
1475
|
+
emStrongRDelimUnd: Ur,
|
|
1487
1476
|
escape: xs,
|
|
1488
|
-
link:
|
|
1477
|
+
link: Vr,
|
|
1489
1478
|
nolink: bs,
|
|
1490
|
-
punctuation:
|
|
1491
|
-
reflink:
|
|
1492
|
-
reflinkSearch:
|
|
1493
|
-
tag:
|
|
1494
|
-
text:
|
|
1479
|
+
punctuation: zr,
|
|
1480
|
+
reflink: ws,
|
|
1481
|
+
reflinkSearch: Gr,
|
|
1482
|
+
tag: Kr,
|
|
1483
|
+
text: Pr,
|
|
1495
1484
|
url: ft
|
|
1496
|
-
},
|
|
1485
|
+
}, Qr = {
|
|
1497
1486
|
...mn,
|
|
1498
1487
|
link: j(/^!?\[(label)\]\((.*?)\)/).replace("label", zt).getRegex(),
|
|
1499
1488
|
reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", zt).getRegex()
|
|
@@ -1504,19 +1493,19 @@ const Sr = /^(?:[ \t]*(?:\n|$))+/, Ar = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1504
1493
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1505
1494
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1506
1495
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1507
|
-
},
|
|
1496
|
+
}, Zr = {
|
|
1508
1497
|
...rn,
|
|
1509
|
-
br: j(
|
|
1498
|
+
br: j(ks).replace("{2,}", "*").getRegex(),
|
|
1510
1499
|
text: j(rn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1511
1500
|
}, Dt = {
|
|
1512
1501
|
normal: gn,
|
|
1513
|
-
gfm:
|
|
1502
|
+
gfm: Or,
|
|
1514
1503
|
pedantic: _r
|
|
1515
1504
|
}, lt = {
|
|
1516
1505
|
normal: mn,
|
|
1517
1506
|
gfm: rn,
|
|
1518
|
-
breaks:
|
|
1519
|
-
pedantic:
|
|
1507
|
+
breaks: Zr,
|
|
1508
|
+
pedantic: Qr
|
|
1520
1509
|
};
|
|
1521
1510
|
class xe {
|
|
1522
1511
|
constructor(e) {
|
|
@@ -1719,10 +1708,10 @@ class xe {
|
|
|
1719
1708
|
}
|
|
1720
1709
|
if (o = e, this.options.extensions && this.options.extensions.startInline) {
|
|
1721
1710
|
let d = 1 / 0;
|
|
1722
|
-
const
|
|
1723
|
-
let
|
|
1724
|
-
this.options.extensions.startInline.forEach((
|
|
1725
|
-
|
|
1711
|
+
const f = e.slice(1);
|
|
1712
|
+
let w;
|
|
1713
|
+
this.options.extensions.startInline.forEach((m) => {
|
|
1714
|
+
w = m.call({ lexer: this }, f), typeof w == "number" && w >= 0 && (d = Math.min(d, w));
|
|
1726
1715
|
}), d < 1 / 0 && d >= 0 && (o = e.substring(0, d + 1));
|
|
1727
1716
|
}
|
|
1728
1717
|
if (s = this.tokenizer.inlineText(o)) {
|
|
@@ -1904,7 +1893,7 @@ class yn {
|
|
|
1904
1893
|
return "";
|
|
1905
1894
|
}
|
|
1906
1895
|
}
|
|
1907
|
-
class
|
|
1896
|
+
class ke {
|
|
1908
1897
|
constructor(e) {
|
|
1909
1898
|
W(this, "options");
|
|
1910
1899
|
W(this, "renderer");
|
|
@@ -1915,13 +1904,13 @@ class we {
|
|
|
1915
1904
|
* Static Parse Method
|
|
1916
1905
|
*/
|
|
1917
1906
|
static parse(e, t) {
|
|
1918
|
-
return new
|
|
1907
|
+
return new ke(t).parse(e);
|
|
1919
1908
|
}
|
|
1920
1909
|
/**
|
|
1921
1910
|
* Static Parse Inline Method
|
|
1922
1911
|
*/
|
|
1923
1912
|
static parseInline(e, t) {
|
|
1924
|
-
return new
|
|
1913
|
+
return new ke(t).parseInline(e);
|
|
1925
1914
|
}
|
|
1926
1915
|
/**
|
|
1927
1916
|
* Parse Loop
|
|
@@ -2100,7 +2089,7 @@ class gt {
|
|
|
2100
2089
|
* Provide function to parse tokens
|
|
2101
2090
|
*/
|
|
2102
2091
|
provideParser() {
|
|
2103
|
-
return this.block ?
|
|
2092
|
+
return this.block ? ke.parse : ke.parseInline;
|
|
2104
2093
|
}
|
|
2105
2094
|
}
|
|
2106
2095
|
W(gt, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
@@ -2108,13 +2097,13 @@ W(gt, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
|
2108
2097
|
"postprocess",
|
|
2109
2098
|
"processAllTokens"
|
|
2110
2099
|
]));
|
|
2111
|
-
class
|
|
2100
|
+
class Yr {
|
|
2112
2101
|
constructor(...e) {
|
|
2113
2102
|
W(this, "defaults", dn());
|
|
2114
2103
|
W(this, "options", this.setOptions);
|
|
2115
2104
|
W(this, "parse", this.parseMarkdown(!0));
|
|
2116
2105
|
W(this, "parseInline", this.parseMarkdown(!1));
|
|
2117
|
-
W(this, "Parser",
|
|
2106
|
+
W(this, "Parser", ke);
|
|
2118
2107
|
W(this, "Renderer", Ht);
|
|
2119
2108
|
W(this, "TextRenderer", yn);
|
|
2120
2109
|
W(this, "Lexer", xe);
|
|
@@ -2184,8 +2173,8 @@ class Zr {
|
|
|
2184
2173
|
continue;
|
|
2185
2174
|
const a = i, c = s.renderer[a], u = o[a];
|
|
2186
2175
|
o[a] = (...d) => {
|
|
2187
|
-
let
|
|
2188
|
-
return
|
|
2176
|
+
let f = c.apply(o, d);
|
|
2177
|
+
return f === !1 && (f = u.apply(o, d)), f || "";
|
|
2189
2178
|
};
|
|
2190
2179
|
}
|
|
2191
2180
|
r.renderer = o;
|
|
@@ -2199,8 +2188,8 @@ class Zr {
|
|
|
2199
2188
|
continue;
|
|
2200
2189
|
const a = i, c = s.tokenizer[a], u = o[a];
|
|
2201
2190
|
o[a] = (...d) => {
|
|
2202
|
-
let
|
|
2203
|
-
return
|
|
2191
|
+
let f = c.apply(o, d);
|
|
2192
|
+
return f === !1 && (f = u.apply(o, d)), f;
|
|
2204
2193
|
};
|
|
2205
2194
|
}
|
|
2206
2195
|
r.tokenizer = o;
|
|
@@ -2215,12 +2204,12 @@ class Zr {
|
|
|
2215
2204
|
const a = i, c = s.hooks[a], u = o[a];
|
|
2216
2205
|
gt.passThroughHooks.has(i) ? o[a] = (d) => {
|
|
2217
2206
|
if (this.defaults.async)
|
|
2218
|
-
return Promise.resolve(c.call(o, d)).then((
|
|
2219
|
-
const
|
|
2220
|
-
return u.call(o,
|
|
2207
|
+
return Promise.resolve(c.call(o, d)).then((w) => u.call(o, w));
|
|
2208
|
+
const f = c.call(o, d);
|
|
2209
|
+
return u.call(o, f);
|
|
2221
2210
|
} : o[a] = (...d) => {
|
|
2222
|
-
let
|
|
2223
|
-
return
|
|
2211
|
+
let f = c.apply(o, d);
|
|
2212
|
+
return f === !1 && (f = u.apply(o, d)), f;
|
|
2224
2213
|
};
|
|
2225
2214
|
}
|
|
2226
2215
|
r.hooks = o;
|
|
@@ -2242,7 +2231,7 @@ class Zr {
|
|
|
2242
2231
|
return xe.lex(e, t ?? this.defaults);
|
|
2243
2232
|
}
|
|
2244
2233
|
parser(e, t) {
|
|
2245
|
-
return
|
|
2234
|
+
return ke.parse(e, t ?? this.defaults);
|
|
2246
2235
|
}
|
|
2247
2236
|
parseMarkdown(e) {
|
|
2248
2237
|
return (s, r) => {
|
|
@@ -2254,15 +2243,15 @@ class Zr {
|
|
|
2254
2243
|
if (typeof s != "string")
|
|
2255
2244
|
return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(s) + ", string expected"));
|
|
2256
2245
|
i.hooks && (i.hooks.options = i, i.hooks.block = e);
|
|
2257
|
-
const c = i.hooks ? i.hooks.provideLexer() : e ? xe.lex : xe.lexInline, u = i.hooks ? i.hooks.provideParser() : e ?
|
|
2246
|
+
const c = i.hooks ? i.hooks.provideLexer() : e ? xe.lex : xe.lexInline, u = i.hooks ? i.hooks.provideParser() : e ? ke.parse : ke.parseInline;
|
|
2258
2247
|
if (i.async)
|
|
2259
2248
|
return Promise.resolve(i.hooks ? i.hooks.preprocess(s) : s).then((d) => c(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) => u(d, i)).then((d) => i.hooks ? i.hooks.postprocess(d) : d).catch(a);
|
|
2260
2249
|
try {
|
|
2261
2250
|
i.hooks && (s = i.hooks.preprocess(s));
|
|
2262
2251
|
let d = c(s, i);
|
|
2263
2252
|
i.hooks && (d = i.hooks.processAllTokens(d)), i.walkTokens && this.walkTokens(d, i.walkTokens);
|
|
2264
|
-
let
|
|
2265
|
-
return i.hooks && (
|
|
2253
|
+
let f = u(d, i);
|
|
2254
|
+
return i.hooks && (f = i.hooks.postprocess(f)), f;
|
|
2266
2255
|
} catch (d) {
|
|
2267
2256
|
return a(d);
|
|
2268
2257
|
}
|
|
@@ -2281,55 +2270,55 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
2281
2270
|
};
|
|
2282
2271
|
}
|
|
2283
2272
|
}
|
|
2284
|
-
const je = new
|
|
2285
|
-
function
|
|
2273
|
+
const je = new Yr();
|
|
2274
|
+
function q(n, e) {
|
|
2286
2275
|
return je.parse(n, e);
|
|
2287
2276
|
}
|
|
2288
|
-
|
|
2289
|
-
return je.setOptions(n),
|
|
2277
|
+
q.options = q.setOptions = function(n) {
|
|
2278
|
+
return je.setOptions(n), q.defaults = je.defaults, hs(q.defaults), q;
|
|
2290
2279
|
};
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
return je.use(...n),
|
|
2280
|
+
q.getDefaults = dn;
|
|
2281
|
+
q.defaults = Ke;
|
|
2282
|
+
q.use = function(...n) {
|
|
2283
|
+
return je.use(...n), q.defaults = je.defaults, hs(q.defaults), q;
|
|
2295
2284
|
};
|
|
2296
|
-
|
|
2285
|
+
q.walkTokens = function(n, e) {
|
|
2297
2286
|
return je.walkTokens(n, e);
|
|
2298
2287
|
};
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2288
|
+
q.parseInline = je.parseInline;
|
|
2289
|
+
q.Parser = ke;
|
|
2290
|
+
q.parser = ke.parse;
|
|
2291
|
+
q.Renderer = Ht;
|
|
2292
|
+
q.TextRenderer = yn;
|
|
2293
|
+
q.Lexer = xe;
|
|
2294
|
+
q.lexer = xe.lex;
|
|
2295
|
+
q.Tokenizer = Pt;
|
|
2296
|
+
q.Hooks = gt;
|
|
2297
|
+
q.parse = q;
|
|
2298
|
+
q.options;
|
|
2299
|
+
q.setOptions;
|
|
2300
|
+
q.use;
|
|
2301
|
+
q.walkTokens;
|
|
2302
|
+
q.parseInline;
|
|
2303
|
+
ke.parse;
|
|
2315
2304
|
xe.lex;
|
|
2316
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 */
|
|
2317
2306
|
const {
|
|
2318
2307
|
entries: vs,
|
|
2319
2308
|
setPrototypeOf: Qn,
|
|
2320
|
-
isFrozen:
|
|
2321
|
-
getPrototypeOf:
|
|
2322
|
-
getOwnPropertyDescriptor:
|
|
2309
|
+
isFrozen: Xr,
|
|
2310
|
+
getPrototypeOf: Jr,
|
|
2311
|
+
getOwnPropertyDescriptor: eo
|
|
2323
2312
|
} = Object;
|
|
2324
2313
|
let {
|
|
2325
|
-
freeze:
|
|
2314
|
+
freeze: pe,
|
|
2326
2315
|
seal: be,
|
|
2327
2316
|
create: on
|
|
2328
2317
|
} = Object, {
|
|
2329
2318
|
apply: an,
|
|
2330
2319
|
construct: ln
|
|
2331
2320
|
} = typeof Reflect < "u" && Reflect;
|
|
2332
|
-
|
|
2321
|
+
pe || (pe = function(e) {
|
|
2333
2322
|
return e;
|
|
2334
2323
|
});
|
|
2335
2324
|
be || (be = function(e) {
|
|
@@ -2345,8 +2334,8 @@ ln || (ln = function(e) {
|
|
|
2345
2334
|
s[r - 1] = arguments[r];
|
|
2346
2335
|
return new e(...s);
|
|
2347
2336
|
});
|
|
2348
|
-
const
|
|
2349
|
-
function
|
|
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), de = fe(RegExp.prototype.test), dt = oo(TypeError);
|
|
2338
|
+
function fe(n) {
|
|
2350
2339
|
return function(e) {
|
|
2351
2340
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
2352
2341
|
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)
|
|
@@ -2354,7 +2343,7 @@ function pe(n) {
|
|
|
2354
2343
|
return an(n, e, s);
|
|
2355
2344
|
};
|
|
2356
2345
|
}
|
|
2357
|
-
function
|
|
2346
|
+
function oo(n) {
|
|
2358
2347
|
return function() {
|
|
2359
2348
|
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
2360
2349
|
t[s] = arguments[s];
|
|
@@ -2369,69 +2358,69 @@ function H(n, e) {
|
|
|
2369
2358
|
let r = e[s];
|
|
2370
2359
|
if (typeof r == "string") {
|
|
2371
2360
|
const o = t(r);
|
|
2372
|
-
o !== r && (
|
|
2361
|
+
o !== r && (Xr(e) || (e[s] = o), r = o);
|
|
2373
2362
|
}
|
|
2374
2363
|
n[r] = !0;
|
|
2375
2364
|
}
|
|
2376
2365
|
return n;
|
|
2377
2366
|
}
|
|
2378
|
-
function
|
|
2367
|
+
function io(n) {
|
|
2379
2368
|
for (let e = 0; e < n.length; e++)
|
|
2380
2369
|
ve(n, e) || (n[e] = null);
|
|
2381
2370
|
return n;
|
|
2382
2371
|
}
|
|
2383
|
-
function
|
|
2372
|
+
function Oe(n) {
|
|
2384
2373
|
const e = on(null);
|
|
2385
2374
|
for (const [t, s] of vs(n))
|
|
2386
|
-
ve(n, t) && (Array.isArray(s) ? e[t] =
|
|
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);
|
|
2387
2376
|
return e;
|
|
2388
2377
|
}
|
|
2389
|
-
function
|
|
2378
|
+
function ht(n, e) {
|
|
2390
2379
|
for (; n !== null; ) {
|
|
2391
|
-
const s =
|
|
2380
|
+
const s = eo(n, e);
|
|
2392
2381
|
if (s) {
|
|
2393
2382
|
if (s.get)
|
|
2394
|
-
return
|
|
2383
|
+
return fe(s.get);
|
|
2395
2384
|
if (typeof s.value == "function")
|
|
2396
|
-
return
|
|
2385
|
+
return fe(s.value);
|
|
2397
2386
|
}
|
|
2398
|
-
n =
|
|
2387
|
+
n = Jr(n);
|
|
2399
2388
|
}
|
|
2400
2389
|
function t() {
|
|
2401
2390
|
return null;
|
|
2402
2391
|
}
|
|
2403
2392
|
return t;
|
|
2404
2393
|
}
|
|
2405
|
-
const Yn =
|
|
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]+$/), Ts = be(
|
|
2406
2395
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
2407
2396
|
// eslint-disable-line no-useless-escape
|
|
2408
|
-
),
|
|
2397
|
+
), go = be(/^(?:\w+script|data):/i), mo = be(
|
|
2409
2398
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
2410
2399
|
// eslint-disable-line no-control-regex
|
|
2411
|
-
), Ss = be(/^html$/i),
|
|
2400
|
+
), Ss = be(/^html$/i), yo = be(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
2412
2401
|
var ts = /* @__PURE__ */ Object.freeze({
|
|
2413
2402
|
__proto__: null,
|
|
2414
|
-
ARIA_ATTR:
|
|
2415
|
-
ATTR_WHITESPACE:
|
|
2416
|
-
CUSTOM_ELEMENT:
|
|
2403
|
+
ARIA_ATTR: fo,
|
|
2404
|
+
ATTR_WHITESPACE: mo,
|
|
2405
|
+
CUSTOM_ELEMENT: yo,
|
|
2417
2406
|
DATA_ATTR: po,
|
|
2418
2407
|
DOCTYPE_NAME: Ss,
|
|
2419
|
-
ERB_EXPR:
|
|
2408
|
+
ERB_EXPR: co,
|
|
2420
2409
|
IS_ALLOWED_URI: Ts,
|
|
2421
|
-
IS_SCRIPT_OR_DATA:
|
|
2422
|
-
MUSTACHE_EXPR:
|
|
2423
|
-
TMPLIT_EXPR:
|
|
2410
|
+
IS_SCRIPT_OR_DATA: go,
|
|
2411
|
+
MUSTACHE_EXPR: uo,
|
|
2412
|
+
TMPLIT_EXPR: ho
|
|
2424
2413
|
});
|
|
2425
|
-
const
|
|
2414
|
+
const pt = {
|
|
2426
2415
|
element: 1,
|
|
2427
2416
|
text: 3,
|
|
2428
2417
|
// Deprecated
|
|
2429
2418
|
progressingInstruction: 7,
|
|
2430
2419
|
comment: 8,
|
|
2431
2420
|
document: 9
|
|
2432
|
-
},
|
|
2421
|
+
}, xo = function() {
|
|
2433
2422
|
return typeof window > "u" ? null : window;
|
|
2434
|
-
},
|
|
2423
|
+
}, ko = function(e, t) {
|
|
2435
2424
|
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
2436
2425
|
return null;
|
|
2437
2426
|
let s = null;
|
|
@@ -2464,9 +2453,9 @@ const ht = {
|
|
|
2464
2453
|
};
|
|
2465
2454
|
};
|
|
2466
2455
|
function As() {
|
|
2467
|
-
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
2456
|
+
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : xo();
|
|
2468
2457
|
const e = ($) => As($);
|
|
2469
|
-
if (e.version = "3.3.0", e.removed = [], !n || !n.document || n.document.nodeType !==
|
|
2458
|
+
if (e.version = "3.3.0", e.removed = [], !n || !n.document || n.document.nodeType !== pt.document || !n.Element)
|
|
2470
2459
|
return e.isSupported = !1, e;
|
|
2471
2460
|
let {
|
|
2472
2461
|
document: t
|
|
@@ -2478,15 +2467,15 @@ function As() {
|
|
|
2478
2467
|
Element: c,
|
|
2479
2468
|
NodeFilter: u,
|
|
2480
2469
|
NamedNodeMap: d = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
2481
|
-
HTMLFormElement:
|
|
2482
|
-
DOMParser:
|
|
2483
|
-
trustedTypes:
|
|
2484
|
-
} = n,
|
|
2470
|
+
HTMLFormElement: f,
|
|
2471
|
+
DOMParser: w,
|
|
2472
|
+
trustedTypes: m
|
|
2473
|
+
} = n, p = c.prototype, A = ht(p, "cloneNode"), y = ht(p, "remove"), g = ht(p, "nextSibling"), S = ht(p, "childNodes"), C = ht(p, "parentNode");
|
|
2485
2474
|
if (typeof i == "function") {
|
|
2486
2475
|
const $ = t.createElement("template");
|
|
2487
2476
|
$.content && $.content.ownerDocument && (t = $.content.ownerDocument);
|
|
2488
2477
|
}
|
|
2489
|
-
let
|
|
2478
|
+
let T, z = "";
|
|
2490
2479
|
const {
|
|
2491
2480
|
implementation: F,
|
|
2492
2481
|
createNodeIterator: V,
|
|
@@ -2512,7 +2501,7 @@ function As() {
|
|
|
2512
2501
|
} = ts, Y = null;
|
|
2513
2502
|
const st = H({}, [...Yn, ...Xt, ...Jt, ...en, ...Xn]);
|
|
2514
2503
|
let se = null;
|
|
2515
|
-
const Tt = H({}, [...Jn, ...tn, ...es, ...
|
|
2504
|
+
const Tt = H({}, [...Jn, ...tn, ...es, ..._t]);
|
|
2516
2505
|
let Z = Object.seal(on(null, {
|
|
2517
2506
|
tagNameCheck: {
|
|
2518
2507
|
writable: !0,
|
|
@@ -2547,10 +2536,10 @@ function As() {
|
|
|
2547
2536
|
value: null
|
|
2548
2537
|
}
|
|
2549
2538
|
}));
|
|
2550
|
-
let St = !0, Ge = !0,
|
|
2539
|
+
let St = !0, Ge = !0, O = !1, K = !0, G = !1, te = !0, X = !1, J = !1, ce = !1, Se = !1, At = !1, Ct = !1, xn = !0, kn = !1;
|
|
2551
2540
|
const Ls = "user-content-";
|
|
2552
2541
|
let Ut = !0, rt = !1, Qe = {}, Ze = null;
|
|
2553
|
-
const
|
|
2542
|
+
const wn = 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"]);
|
|
2554
2543
|
let bn = null;
|
|
2555
2544
|
const vn = H({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
2556
2545
|
let qt = null;
|
|
@@ -2560,32 +2549,32 @@ function As() {
|
|
|
2560
2549
|
let Rt = H({}, ["mi", "mo", "mn", "ms", "mtext"]), Lt = H({}, ["annotation-xml"]);
|
|
2561
2550
|
const $s = H({}, ["title", "style", "font", "a", "script"]);
|
|
2562
2551
|
let ot = null;
|
|
2563
|
-
const Ds = ["application/xhtml+xml", "text/html"],
|
|
2552
|
+
const Ds = ["application/xhtml+xml", "text/html"], Os = "text/html";
|
|
2564
2553
|
let oe = null, Xe = null;
|
|
2565
|
-
const
|
|
2554
|
+
const _s = t.createElement("form"), Sn = function(l) {
|
|
2566
2555
|
return l instanceof RegExp || l instanceof Function;
|
|
2567
2556
|
}, Kt = function() {
|
|
2568
2557
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2569
2558
|
if (!(Xe && Xe === l)) {
|
|
2570
|
-
if ((!l || typeof l != "object") && (l = {}), l =
|
|
2571
|
-
Ds.indexOf(l.PARSER_MEDIA_TYPE) === -1 ?
|
|
2559
|
+
if ((!l || typeof l != "object") && (l = {}), l = Oe(l), ot = // eslint-disable-next-line unicorn/prefer-includes
|
|
2560
|
+
Ds.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Os : l.PARSER_MEDIA_TYPE, oe = ot === "application/xhtml+xml" ? Zt : Nt, Y = ve(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, oe) : st, se = ve(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, oe) : Tt, Wt = ve(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : Is, qt = ve(l, "ADD_URI_SAFE_ATTR") ? H(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) : wn, Fe = 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, O = 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, ce = l.FORCE_BODY || !1, xn = l.SANITIZE_DOM !== !1, kn = l.SANITIZE_NAMED_PROPS || !1, Ut = l.KEEP_CONTENT !== !1, rt = l.IN_PLACE || !1, vt = l.ALLOWED_URI_REGEXP || Ts, Ye = l.NAMESPACE || Ie, Rt = l.MATHML_TEXT_INTEGRATION_POINTS || Rt, Lt = l.HTML_INTEGRATION_POINTS || Lt, Z = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && Sn(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Z.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && Sn(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Z.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Z.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), G && (Ge = !1), At && (Se = !0), Qe && (Y = H({}, Xn), se = [], Qe.html === !0 && (H(Y, Yn), H(se, Jn)), Qe.svg === !0 && (H(Y, Xt), H(se, tn), H(se, _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 === wn && (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 Fe.tbody), l.TRUSTED_TYPES_POLICY) {
|
|
2572
2561
|
if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
2573
2562
|
throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
2574
2563
|
if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
2575
2564
|
throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
2576
|
-
|
|
2565
|
+
T = l.TRUSTED_TYPES_POLICY, z = T.createHTML("");
|
|
2577
2566
|
} else
|
|
2578
|
-
|
|
2579
|
-
|
|
2567
|
+
T === void 0 && (T = ko(m, r)), T !== null && typeof z == "string" && (z = T.createHTML(""));
|
|
2568
|
+
pe && pe(l), Xe = l;
|
|
2580
2569
|
}
|
|
2581
|
-
}, An = H({}, [...Xt, ...Jt, ...
|
|
2582
|
-
let
|
|
2583
|
-
(!
|
|
2570
|
+
}, An = H({}, [...Xt, ...Jt, ...ao]), Cn = H({}, [...en, ...lo]), Ns = function(l) {
|
|
2571
|
+
let k = C(l);
|
|
2572
|
+
(!k || !k.tagName) && (k = {
|
|
2584
2573
|
namespaceURI: Ye,
|
|
2585
2574
|
tagName: "template"
|
|
2586
2575
|
});
|
|
2587
|
-
const R = Nt(l.tagName), Q = Nt(
|
|
2588
|
-
return Wt[l.namespaceURI] ? l.namespaceURI === Mt ?
|
|
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] && ($s[R] || !An[R]) : !!(ot === "application/xhtml+xml" && Wt[l.namespaceURI]) : !1;
|
|
2589
2578
|
}, Ae = function(l) {
|
|
2590
2579
|
ut(e.removed, {
|
|
2591
2580
|
element: l
|
|
@@ -2593,55 +2582,55 @@ function As() {
|
|
|
2593
2582
|
try {
|
|
2594
2583
|
C(l).removeChild(l);
|
|
2595
2584
|
} catch {
|
|
2596
|
-
|
|
2585
|
+
y(l);
|
|
2597
2586
|
}
|
|
2598
|
-
}, Be = function(l,
|
|
2587
|
+
}, Be = function(l, k) {
|
|
2599
2588
|
try {
|
|
2600
2589
|
ut(e.removed, {
|
|
2601
|
-
attribute:
|
|
2602
|
-
from:
|
|
2590
|
+
attribute: k.getAttributeNode(l),
|
|
2591
|
+
from: k
|
|
2603
2592
|
});
|
|
2604
2593
|
} catch {
|
|
2605
2594
|
ut(e.removed, {
|
|
2606
2595
|
attribute: null,
|
|
2607
|
-
from:
|
|
2596
|
+
from: k
|
|
2608
2597
|
});
|
|
2609
2598
|
}
|
|
2610
|
-
if (
|
|
2599
|
+
if (k.removeAttribute(l), l === "is")
|
|
2611
2600
|
if (Se || At)
|
|
2612
2601
|
try {
|
|
2613
|
-
Ae(
|
|
2602
|
+
Ae(k);
|
|
2614
2603
|
} catch {
|
|
2615
2604
|
}
|
|
2616
2605
|
else
|
|
2617
2606
|
try {
|
|
2618
|
-
|
|
2607
|
+
k.setAttribute(l, "");
|
|
2619
2608
|
} catch {
|
|
2620
2609
|
}
|
|
2621
2610
|
}, En = function(l) {
|
|
2622
|
-
let
|
|
2623
|
-
if (
|
|
2611
|
+
let k = null, R = null;
|
|
2612
|
+
if (ce)
|
|
2624
2613
|
l = "<remove></remove>" + l;
|
|
2625
2614
|
else {
|
|
2626
2615
|
const re = Yt(l, /^[\r\n\t ]+/);
|
|
2627
2616
|
R = re && re[0];
|
|
2628
2617
|
}
|
|
2629
2618
|
ot === "application/xhtml+xml" && Ye === Ie && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
|
|
2630
|
-
const Q =
|
|
2619
|
+
const Q = T ? T.createHTML(l) : l;
|
|
2631
2620
|
if (Ye === Ie)
|
|
2632
2621
|
try {
|
|
2633
|
-
|
|
2622
|
+
k = new w().parseFromString(Q, ot);
|
|
2634
2623
|
} catch {
|
|
2635
2624
|
}
|
|
2636
|
-
if (!
|
|
2637
|
-
|
|
2625
|
+
if (!k || !k.documentElement) {
|
|
2626
|
+
k = F.createDocument(Ye, "template", null);
|
|
2638
2627
|
try {
|
|
2639
|
-
|
|
2628
|
+
k.documentElement.innerHTML = jt ? z : Q;
|
|
2640
2629
|
} catch {
|
|
2641
2630
|
}
|
|
2642
2631
|
}
|
|
2643
|
-
const ae =
|
|
2644
|
-
return l && R && ae.insertBefore(t.createTextNode(R), ae.childNodes[0] || null), Ye === Ie ? M.call(
|
|
2632
|
+
const ae = k.body || k.documentElement;
|
|
2633
|
+
return l && R && ae.insertBefore(t.createTextNode(R), ae.childNodes[0] || null), Ye === Ie ? M.call(k, X ? "html" : "body")[0] : X ? k.documentElement : ae;
|
|
2645
2634
|
}, Mn = function(l) {
|
|
2646
2635
|
return V.call(
|
|
2647
2636
|
l.ownerDocument || l,
|
|
@@ -2651,64 +2640,64 @@ function As() {
|
|
|
2651
2640
|
null
|
|
2652
2641
|
);
|
|
2653
2642
|
}, Vt = function(l) {
|
|
2654
|
-
return l instanceof
|
|
2643
|
+
return l instanceof f && (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");
|
|
2655
2644
|
}, Rn = function(l) {
|
|
2656
2645
|
return typeof a == "function" && l instanceof a;
|
|
2657
2646
|
};
|
|
2658
|
-
function $e($, l,
|
|
2659
|
-
|
|
2660
|
-
R.call(e, l,
|
|
2647
|
+
function $e($, l, k) {
|
|
2648
|
+
Ot($, (R) => {
|
|
2649
|
+
R.call(e, l, k, Xe);
|
|
2661
2650
|
});
|
|
2662
2651
|
}
|
|
2663
2652
|
const Ln = function(l) {
|
|
2664
|
-
let
|
|
2653
|
+
let k = null;
|
|
2665
2654
|
if ($e(P.beforeSanitizeElements, l, null), Vt(l))
|
|
2666
2655
|
return Ae(l), !0;
|
|
2667
2656
|
const R = oe(l.nodeName);
|
|
2668
2657
|
if ($e(P.uponSanitizeElement, l, {
|
|
2669
2658
|
tagName: R,
|
|
2670
2659
|
allowedTags: Y
|
|
2671
|
-
}), te && l.hasChildNodes() && !Rn(l.firstElementChild) &&
|
|
2660
|
+
}), te && l.hasChildNodes() && !Rn(l.firstElementChild) && de(/<[/\w!]/g, l.innerHTML) && de(/<[/\w!]/g, l.textContent) || l.nodeType === pt.progressingInstruction || te && l.nodeType === pt.comment && de(/<[/\w]/g, l.data))
|
|
2672
2661
|
return Ae(l), !0;
|
|
2673
2662
|
if (!(Le.tagCheck instanceof Function && Le.tagCheck(R)) && (!Y[R] || Fe[R])) {
|
|
2674
|
-
if (!Fe[R] && $n(R) && (Z.tagNameCheck instanceof RegExp &&
|
|
2663
|
+
if (!Fe[R] && $n(R) && (Z.tagNameCheck instanceof RegExp && de(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
|
|
2675
2664
|
return !1;
|
|
2676
2665
|
if (Ut && !Ze[R]) {
|
|
2677
2666
|
const Q = C(l) || l.parentNode, ae = S(l) || l.childNodes;
|
|
2678
2667
|
if (ae && Q) {
|
|
2679
2668
|
const re = ae.length;
|
|
2680
|
-
for (let
|
|
2681
|
-
const De = A(ae[
|
|
2682
|
-
De.__removalCount = (l.__removalCount || 0) + 1, Q.insertBefore(De,
|
|
2669
|
+
for (let ge = re - 1; ge >= 0; --ge) {
|
|
2670
|
+
const De = A(ae[ge], !0);
|
|
2671
|
+
De.__removalCount = (l.__removalCount || 0) + 1, Q.insertBefore(De, g(l));
|
|
2683
2672
|
}
|
|
2684
2673
|
}
|
|
2685
2674
|
}
|
|
2686
2675
|
return Ae(l), !0;
|
|
2687
2676
|
}
|
|
2688
|
-
return l instanceof c && !Ns(l) || (R === "noscript" || R === "noembed" || R === "noframes") &&
|
|
2689
|
-
|
|
2690
|
-
}), l.textContent !==
|
|
2677
|
+
return l instanceof c && !Ns(l) || (R === "noscript" || R === "noembed" || R === "noframes") && de(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Ae(l), !0) : (G && l.nodeType === pt.text && (k = l.textContent, Ot([L, ne, Te], (Q) => {
|
|
2678
|
+
k = ct(k, Q, " ");
|
|
2679
|
+
}), l.textContent !== k && (ut(e.removed, {
|
|
2691
2680
|
element: l.cloneNode()
|
|
2692
|
-
}), l.textContent =
|
|
2693
|
-
}, In = function(l,
|
|
2694
|
-
if (xn && (
|
|
2681
|
+
}), l.textContent = k)), $e(P.afterSanitizeElements, l, null), !1);
|
|
2682
|
+
}, In = function(l, k, R) {
|
|
2683
|
+
if (xn && (k === "id" || k === "name") && (R in t || R in _s))
|
|
2695
2684
|
return !1;
|
|
2696
|
-
if (!(Ge && !Ve[
|
|
2697
|
-
if (!(St &&
|
|
2698
|
-
if (!(Le.attributeCheck instanceof Function && Le.attributeCheck(
|
|
2699
|
-
if (!se[
|
|
2685
|
+
if (!(Ge && !Ve[k] && de(ze, k))) {
|
|
2686
|
+
if (!(St && de(Re, k))) {
|
|
2687
|
+
if (!(Le.attributeCheck instanceof Function && Le.attributeCheck(k, l))) {
|
|
2688
|
+
if (!se[k] || Ve[k]) {
|
|
2700
2689
|
if (
|
|
2701
2690
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
2702
2691
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2703
2692
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
2704
|
-
!($n(l) && (Z.tagNameCheck instanceof RegExp &&
|
|
2693
|
+
!($n(l) && (Z.tagNameCheck instanceof RegExp && de(Z.tagNameCheck, l) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(l)) && (Z.attributeNameCheck instanceof RegExp && de(Z.attributeNameCheck, k) || Z.attributeNameCheck instanceof Function && Z.attributeNameCheck(k, l)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
2705
2694
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2706
|
-
|
|
2695
|
+
k === "is" && Z.allowCustomizedBuiltInElements && (Z.tagNameCheck instanceof RegExp && de(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
|
|
2707
2696
|
) return !1;
|
|
2708
|
-
} else if (!qt[
|
|
2709
|
-
if (!
|
|
2710
|
-
if (!((
|
|
2711
|
-
if (!(
|
|
2697
|
+
} else if (!qt[k]) {
|
|
2698
|
+
if (!de(vt, ct(R, bt, ""))) {
|
|
2699
|
+
if (!((k === "src" || k === "xlink:href" || k === "href") && l !== "script" && so(R, "data:") === 0 && bn[l])) {
|
|
2700
|
+
if (!(O && !de(He, ct(R, bt, "")))) {
|
|
2712
2701
|
if (R)
|
|
2713
2702
|
return !1;
|
|
2714
2703
|
}
|
|
@@ -2724,9 +2713,9 @@ function As() {
|
|
|
2724
2713
|
}, Dn = function(l) {
|
|
2725
2714
|
$e(P.beforeSanitizeAttributes, l, null);
|
|
2726
2715
|
const {
|
|
2727
|
-
attributes:
|
|
2716
|
+
attributes: k
|
|
2728
2717
|
} = l;
|
|
2729
|
-
if (!
|
|
2718
|
+
if (!k || Vt(l))
|
|
2730
2719
|
return;
|
|
2731
2720
|
const R = {
|
|
2732
2721
|
attrName: "",
|
|
@@ -2735,15 +2724,15 @@ function As() {
|
|
|
2735
2724
|
allowedAttributes: se,
|
|
2736
2725
|
forceKeepAttr: void 0
|
|
2737
2726
|
};
|
|
2738
|
-
let Q =
|
|
2727
|
+
let Q = k.length;
|
|
2739
2728
|
for (; Q--; ) {
|
|
2740
|
-
const ae =
|
|
2729
|
+
const ae = k[Q], {
|
|
2741
2730
|
name: re,
|
|
2742
|
-
namespaceURI:
|
|
2731
|
+
namespaceURI: ge,
|
|
2743
2732
|
value: De
|
|
2744
2733
|
} = ae, Je = oe(re), Gt = De;
|
|
2745
|
-
let ie = re === "value" ? Gt :
|
|
2746
|
-
if (R.attrName = Je, R.attrValue = ie, R.keepAttr = !0, R.forceKeepAttr = void 0, $e(P.uponSanitizeAttribute, l, R), ie = R.attrValue,
|
|
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, kn && (Je === "id" || Je === "name") && (Be(re, l), ie = Ls + ie), te && de(/((--!?|])>)|<\/(style|title|textarea)/i, ie)) {
|
|
2747
2736
|
Be(re, l);
|
|
2748
2737
|
continue;
|
|
2749
2738
|
}
|
|
@@ -2757,46 +2746,46 @@ function As() {
|
|
|
2757
2746
|
Be(re, l);
|
|
2758
2747
|
continue;
|
|
2759
2748
|
}
|
|
2760
|
-
if (!K &&
|
|
2749
|
+
if (!K && de(/\/>/i, ie)) {
|
|
2761
2750
|
Be(re, l);
|
|
2762
2751
|
continue;
|
|
2763
2752
|
}
|
|
2764
|
-
G &&
|
|
2765
|
-
ie = ct(ie,
|
|
2753
|
+
G && Ot([L, ne, Te], (_n) => {
|
|
2754
|
+
ie = ct(ie, _n, " ");
|
|
2766
2755
|
});
|
|
2767
|
-
const
|
|
2768
|
-
if (!In(
|
|
2756
|
+
const On = oe(l.nodeName);
|
|
2757
|
+
if (!In(On, Je, ie)) {
|
|
2769
2758
|
Be(re, l);
|
|
2770
2759
|
continue;
|
|
2771
2760
|
}
|
|
2772
|
-
if (
|
|
2773
|
-
switch (
|
|
2761
|
+
if (T && typeof m == "object" && typeof m.getAttributeType == "function" && !ge)
|
|
2762
|
+
switch (m.getAttributeType(On, Je)) {
|
|
2774
2763
|
case "TrustedHTML": {
|
|
2775
|
-
ie =
|
|
2764
|
+
ie = T.createHTML(ie);
|
|
2776
2765
|
break;
|
|
2777
2766
|
}
|
|
2778
2767
|
case "TrustedScriptURL": {
|
|
2779
|
-
ie =
|
|
2768
|
+
ie = T.createScriptURL(ie);
|
|
2780
2769
|
break;
|
|
2781
2770
|
}
|
|
2782
2771
|
}
|
|
2783
2772
|
if (ie !== Gt)
|
|
2784
2773
|
try {
|
|
2785
|
-
|
|
2774
|
+
ge ? l.setAttributeNS(ge, re, ie) : l.setAttribute(re, ie), Vt(l) ? Ae(l) : Zn(e.removed);
|
|
2786
2775
|
} catch {
|
|
2787
2776
|
Be(re, l);
|
|
2788
2777
|
}
|
|
2789
2778
|
}
|
|
2790
2779
|
$e(P.afterSanitizeAttributes, l, null);
|
|
2791
2780
|
}, Ps = function $(l) {
|
|
2792
|
-
let
|
|
2781
|
+
let k = null;
|
|
2793
2782
|
const R = Mn(l);
|
|
2794
|
-
for ($e(P.beforeSanitizeShadowDOM, l, null);
|
|
2795
|
-
$e(P.uponSanitizeShadowNode,
|
|
2783
|
+
for ($e(P.beforeSanitizeShadowDOM, l, null); k = R.nextNode(); )
|
|
2784
|
+
$e(P.uponSanitizeShadowNode, k, null), Ln(k), Dn(k), k.content instanceof o && $(k.content);
|
|
2796
2785
|
$e(P.afterSanitizeShadowDOM, l, null);
|
|
2797
2786
|
};
|
|
2798
2787
|
return e.sanitize = function($) {
|
|
2799
|
-
let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
2788
|
+
let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, k = null, R = null, Q = null, ae = null;
|
|
2800
2789
|
if (jt = !$, jt && ($ = "<!-->"), typeof $ != "string" && !Rn($))
|
|
2801
2790
|
if (typeof $.toString == "function") {
|
|
2802
2791
|
if ($ = $.toString(), typeof $ != "string")
|
|
@@ -2812,48 +2801,48 @@ function As() {
|
|
|
2812
2801
|
throw dt("root node is forbidden and cannot be sanitized in-place");
|
|
2813
2802
|
}
|
|
2814
2803
|
} else if ($ instanceof a)
|
|
2815
|
-
|
|
2804
|
+
k = En("<!---->"), R = k.ownerDocument.importNode($, !0), R.nodeType === pt.element && R.nodeName === "BODY" || R.nodeName === "HTML" ? k = R : k.appendChild(R);
|
|
2816
2805
|
else {
|
|
2817
2806
|
if (!Se && !G && !X && // eslint-disable-next-line unicorn/prefer-includes
|
|
2818
2807
|
$.indexOf("<") === -1)
|
|
2819
|
-
return
|
|
2820
|
-
if (
|
|
2808
|
+
return T && Ct ? T.createHTML($) : $;
|
|
2809
|
+
if (k = En($), !k)
|
|
2821
2810
|
return Se ? null : Ct ? z : "";
|
|
2822
2811
|
}
|
|
2823
|
-
|
|
2824
|
-
const re = Mn(rt ? $ :
|
|
2812
|
+
k && ce && Ae(k.firstChild);
|
|
2813
|
+
const re = Mn(rt ? $ : k);
|
|
2825
2814
|
for (; Q = re.nextNode(); )
|
|
2826
2815
|
Ln(Q), Dn(Q), Q.content instanceof o && Ps(Q.content);
|
|
2827
2816
|
if (rt)
|
|
2828
2817
|
return $;
|
|
2829
2818
|
if (Se) {
|
|
2830
2819
|
if (At)
|
|
2831
|
-
for (ae = E.call(
|
|
2832
|
-
ae.appendChild(
|
|
2820
|
+
for (ae = E.call(k.ownerDocument); k.firstChild; )
|
|
2821
|
+
ae.appendChild(k.firstChild);
|
|
2833
2822
|
else
|
|
2834
|
-
ae =
|
|
2823
|
+
ae = k;
|
|
2835
2824
|
return (se.shadowroot || se.shadowrootmode) && (ae = I.call(s, ae, !0)), ae;
|
|
2836
2825
|
}
|
|
2837
|
-
let
|
|
2838
|
-
return X && Y["!doctype"] &&
|
|
2839
|
-
` +
|
|
2840
|
-
|
|
2841
|
-
}),
|
|
2826
|
+
let ge = X ? k.outerHTML : k.innerHTML;
|
|
2827
|
+
return X && Y["!doctype"] && k.ownerDocument && k.ownerDocument.doctype && k.ownerDocument.doctype.name && de(Ss, k.ownerDocument.doctype.name) && (ge = "<!DOCTYPE " + k.ownerDocument.doctype.name + `>
|
|
2828
|
+
` + ge), G && Ot([L, ne, Te], (De) => {
|
|
2829
|
+
ge = ct(ge, De, " ");
|
|
2830
|
+
}), T && Ct ? T.createHTML(ge) : ge;
|
|
2842
2831
|
}, e.setConfig = function() {
|
|
2843
2832
|
let $ = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2844
2833
|
Kt($), J = !0;
|
|
2845
2834
|
}, e.clearConfig = function() {
|
|
2846
2835
|
Xe = null, J = !1;
|
|
2847
|
-
}, e.isValidAttribute = function($, l,
|
|
2836
|
+
}, e.isValidAttribute = function($, l, k) {
|
|
2848
2837
|
Xe || Kt({});
|
|
2849
2838
|
const R = oe($), Q = oe(l);
|
|
2850
|
-
return In(R, Q,
|
|
2839
|
+
return In(R, Q, k);
|
|
2851
2840
|
}, e.addHook = function($, l) {
|
|
2852
2841
|
typeof l == "function" && ut(P[$], l);
|
|
2853
2842
|
}, e.removeHook = function($, l) {
|
|
2854
2843
|
if (l !== void 0) {
|
|
2855
|
-
const
|
|
2856
|
-
return
|
|
2844
|
+
const k = to(P[$], l);
|
|
2845
|
+
return k === -1 ? void 0 : no(P[$], k, 1)[0];
|
|
2857
2846
|
}
|
|
2858
2847
|
return Zn(P[$]);
|
|
2859
2848
|
}, e.removeHooks = function($) {
|
|
@@ -2863,12 +2852,12 @@ function As() {
|
|
|
2863
2852
|
}, e;
|
|
2864
2853
|
}
|
|
2865
2854
|
var wo = As();
|
|
2866
|
-
function
|
|
2855
|
+
function bo() {
|
|
2867
2856
|
return {
|
|
2868
2857
|
parseMarkdown: (e) => {
|
|
2869
2858
|
if (!e || typeof e != "string")
|
|
2870
2859
|
return "";
|
|
2871
|
-
const t = as(e), s =
|
|
2860
|
+
const t = as(e), s = q.parse(t, {
|
|
2872
2861
|
async: !1,
|
|
2873
2862
|
breaks: !0,
|
|
2874
2863
|
gfm: !0
|
|
@@ -2911,7 +2900,7 @@ function ko() {
|
|
|
2911
2900
|
}
|
|
2912
2901
|
};
|
|
2913
2902
|
}
|
|
2914
|
-
function
|
|
2903
|
+
function va() {
|
|
2915
2904
|
let n = null;
|
|
2916
2905
|
function e(o) {
|
|
2917
2906
|
const i = o || document.querySelector("[data-rai-chat-container]");
|
|
@@ -2950,8 +2939,8 @@ function ba() {
|
|
|
2950
2939
|
cleanupAutoScroll: r
|
|
2951
2940
|
};
|
|
2952
2941
|
}
|
|
2953
|
-
function
|
|
2954
|
-
const n = We(), e =
|
|
2942
|
+
function Ta() {
|
|
2943
|
+
const n = We(), e = N(() => n.error), t = N(() => {
|
|
2955
2944
|
var o, i;
|
|
2956
2945
|
return ((o = e.value) == null ? void 0 : o.message) !== null && ((i = e.value) == null ? void 0 : i.message) !== void 0;
|
|
2957
2946
|
});
|
|
@@ -2965,7 +2954,7 @@ function va() {
|
|
|
2965
2954
|
};
|
|
2966
2955
|
}
|
|
2967
2956
|
function Cs() {
|
|
2968
|
-
const n = We(), e =
|
|
2957
|
+
const n = We(), e = N(() => n.pageContext);
|
|
2969
2958
|
function t(o) {
|
|
2970
2959
|
n.setPageContext(o);
|
|
2971
2960
|
}
|
|
@@ -2999,21 +2988,21 @@ const Ee = [], Es = {
|
|
|
2999
2988
|
return (n == null ? void 0 : n.defaultSuggestions) || [];
|
|
3000
2989
|
}
|
|
3001
2990
|
};
|
|
3002
|
-
function
|
|
2991
|
+
function vo() {
|
|
3003
2992
|
Ee.length = 0;
|
|
3004
2993
|
const n = ee();
|
|
3005
2994
|
n != null && n.suggestionProviders && Ee.push(...n.suggestionProviders), Ee.push(Es);
|
|
3006
2995
|
}
|
|
3007
|
-
function
|
|
2996
|
+
function To(n, e) {
|
|
3008
2997
|
const t = [...Ee].sort((s, r) => (r.priority || 0) - (s.priority || 0));
|
|
3009
2998
|
for (const s of t)
|
|
3010
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 + "/")))
|
|
3011
3000
|
return s;
|
|
3012
3001
|
return Es;
|
|
3013
3002
|
}
|
|
3014
|
-
function
|
|
3015
|
-
Ee.length === 0 &&
|
|
3016
|
-
const t =
|
|
3003
|
+
function So(n, e) {
|
|
3004
|
+
Ee.length === 0 && vo();
|
|
3005
|
+
const t = To(n, e), s = e || {
|
|
3017
3006
|
pageType: "default",
|
|
3018
3007
|
routePath: n
|
|
3019
3008
|
};
|
|
@@ -3022,7 +3011,7 @@ function To(n, e) {
|
|
|
3022
3011
|
...t.extractContext(n)
|
|
3023
3012
|
}), t.getSuggestions(s) || [];
|
|
3024
3013
|
}
|
|
3025
|
-
function
|
|
3014
|
+
function Ao(n) {
|
|
3026
3015
|
const e = Ee.findIndex((t) => t.id === n.id);
|
|
3027
3016
|
if (e >= 0)
|
|
3028
3017
|
Ee[e] = n;
|
|
@@ -3031,9 +3020,9 @@ function So(n) {
|
|
|
3031
3020
|
t >= 0 ? Ee.splice(t, 0, n) : Ee.push(n);
|
|
3032
3021
|
}
|
|
3033
3022
|
}
|
|
3034
|
-
const
|
|
3023
|
+
const Sa = Ao;
|
|
3035
3024
|
function Ms() {
|
|
3036
|
-
const { context: n } = Cs(), e = We(), t =
|
|
3025
|
+
const { context: n } = Cs(), e = We(), t = N(() => {
|
|
3037
3026
|
var c;
|
|
3038
3027
|
if (e.quota.remaining === 0) {
|
|
3039
3028
|
const u = ee();
|
|
@@ -3048,9 +3037,9 @@ function Ms() {
|
|
|
3048
3037
|
}
|
|
3049
3038
|
] : [];
|
|
3050
3039
|
}
|
|
3051
|
-
const o = ((c = n.value) == null ? void 0 : c.routePath) || (typeof window < "u" ? window.location.pathname : "/"), i =
|
|
3040
|
+
const o = ((c = n.value) == null ? void 0 : c.routePath) || (typeof window < "u" ? window.location.pathname : "/"), i = So(o, n.value) || [], a = ee();
|
|
3052
3041
|
return a != null && a.can ? i.filter((u) => !(u.permission && !a.can(u.permission))) : i;
|
|
3053
|
-
}), s =
|
|
3042
|
+
}), s = N(() => n.value !== null && n.value.pageType !== "default");
|
|
3054
3043
|
function r(o) {
|
|
3055
3044
|
return typeof o.prompt == "function" ? o.prompt(
|
|
3056
3045
|
n.value || { pageType: "default" }
|
|
@@ -3062,7 +3051,7 @@ function Ms() {
|
|
|
3062
3051
|
resolvePrompt: r
|
|
3063
3052
|
};
|
|
3064
3053
|
}
|
|
3065
|
-
function
|
|
3054
|
+
function Aa(n, e) {
|
|
3066
3055
|
const { setContext: t, clearContext: s, updateContext: r } = Cs();
|
|
3067
3056
|
function o() {
|
|
3068
3057
|
if (!e)
|
|
@@ -3094,7 +3083,7 @@ function Sa(n, e) {
|
|
|
3094
3083
|
setupContext: i
|
|
3095
3084
|
};
|
|
3096
3085
|
}
|
|
3097
|
-
function
|
|
3086
|
+
function Co(n) {
|
|
3098
3087
|
const e = n.toLowerCase().split("+");
|
|
3099
3088
|
return {
|
|
3100
3089
|
key: e.pop() || "",
|
|
@@ -3106,28 +3095,28 @@ function Ao(n) {
|
|
|
3106
3095
|
// Platform-independent: Cmd on Mac, Ctrl on Windows/Linux
|
|
3107
3096
|
};
|
|
3108
3097
|
}
|
|
3109
|
-
function
|
|
3098
|
+
function Eo(n, e) {
|
|
3110
3099
|
const t = n.key.toLowerCase();
|
|
3111
3100
|
if (e.mod) {
|
|
3112
|
-
const u = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, d = e.shift ? n.shiftKey : !n.shiftKey,
|
|
3113
|
-
return t === e.key && u && d &&
|
|
3101
|
+
const u = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, d = e.shift ? n.shiftKey : !n.shiftKey, f = e.alt ? n.altKey : !n.altKey;
|
|
3102
|
+
return t === e.key && u && d && f;
|
|
3114
3103
|
}
|
|
3115
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;
|
|
3116
3105
|
let a = s && r && o && i;
|
|
3117
3106
|
return (e.meta && !e.ctrl || !e.meta && e.ctrl) && (a = (n.metaKey || n.ctrlKey) && o && i), t === e.key && a;
|
|
3118
3107
|
}
|
|
3119
|
-
function
|
|
3120
|
-
const { onToggle: e, enabled: t = !0 } = n, s =
|
|
3108
|
+
function Mo(n) {
|
|
3109
|
+
const { onToggle: e, enabled: t = !0 } = n, s = U(!1), r = n.shortcut !== void 0 ? n.shortcut : tt("keyboardShortcut") ?? "mod+g";
|
|
3121
3110
|
if (r === null)
|
|
3122
3111
|
return { isActive: s };
|
|
3123
|
-
const o =
|
|
3112
|
+
const o = Co(r);
|
|
3124
3113
|
function i(a) {
|
|
3125
3114
|
if (!t) return;
|
|
3126
|
-
const c = a.target, u = c.tagName === "INPUT" || c.tagName === "TEXTAREA", d = c.isContentEditable,
|
|
3127
|
-
if (!((u || d) && !
|
|
3115
|
+
const c = a.target, u = c.tagName === "INPUT" || c.tagName === "TEXTAREA", d = c.isContentEditable, f = c.closest("[data-ai-input]");
|
|
3116
|
+
if (!((u || d) && !f) && Eo(a, o)) {
|
|
3128
3117
|
a.preventDefault(), a.stopPropagation();
|
|
3129
|
-
const
|
|
3130
|
-
if (
|
|
3118
|
+
const w = ee();
|
|
3119
|
+
if (w != null && w.canToggle && !w.canToggle())
|
|
3131
3120
|
return;
|
|
3132
3121
|
s.value = !s.value, e();
|
|
3133
3122
|
}
|
|
@@ -3138,16 +3127,16 @@ function Eo(n) {
|
|
|
3138
3127
|
window.removeEventListener("keydown", i, !0);
|
|
3139
3128
|
}), { isActive: s };
|
|
3140
3129
|
}
|
|
3141
|
-
function
|
|
3130
|
+
function Ca(n) {
|
|
3142
3131
|
const e = We();
|
|
3143
|
-
return
|
|
3132
|
+
return Mo({
|
|
3144
3133
|
onToggle: () => {
|
|
3145
3134
|
n ? n.value = !n.value : e.showChat = !e.showChat;
|
|
3146
3135
|
}
|
|
3147
3136
|
});
|
|
3148
3137
|
}
|
|
3149
|
-
function
|
|
3150
|
-
const t =
|
|
3138
|
+
function Ro(n, e) {
|
|
3139
|
+
const t = U(le("loadingText"));
|
|
3151
3140
|
let s = [];
|
|
3152
3141
|
function r() {
|
|
3153
3142
|
return [
|
|
@@ -3169,14 +3158,14 @@ function Mo(n, e) {
|
|
|
3169
3158
|
}
|
|
3170
3159
|
function c() {
|
|
3171
3160
|
i();
|
|
3172
|
-
const u = e == null ? void 0 : e(), d = (u == null ? void 0 : u.messages) ?? r(),
|
|
3161
|
+
const u = e == null ? void 0 : e(), d = (u == null ? void 0 : u.messages) ?? r(), f = (u == null ? void 0 : u.intervals) ?? o();
|
|
3173
3162
|
t.value = d[0] || le("loadingText");
|
|
3174
|
-
let
|
|
3175
|
-
for (let
|
|
3176
|
-
|
|
3177
|
-
const
|
|
3178
|
-
n() && (t.value = d[
|
|
3179
|
-
},
|
|
3163
|
+
let w = 0;
|
|
3164
|
+
for (let m = 1; m < d.length; m++) {
|
|
3165
|
+
w += f[m] || 2e3;
|
|
3166
|
+
const p = m, A = window.setTimeout(() => {
|
|
3167
|
+
n() && (t.value = d[p]);
|
|
3168
|
+
}, w);
|
|
3180
3169
|
s.push(A);
|
|
3181
3170
|
}
|
|
3182
3171
|
}
|
|
@@ -3189,7 +3178,7 @@ function Mo(n, e) {
|
|
|
3189
3178
|
clearLoadingTextTimers: i
|
|
3190
3179
|
};
|
|
3191
3180
|
}
|
|
3192
|
-
function
|
|
3181
|
+
function Lo(n) {
|
|
3193
3182
|
const {
|
|
3194
3183
|
getHistoryLength: e,
|
|
3195
3184
|
getStoreLimit: t,
|
|
@@ -3197,72 +3186,72 @@ function Ro(n) {
|
|
|
3197
3186
|
getTexts: r,
|
|
3198
3187
|
onStartNewChat: o,
|
|
3199
3188
|
onNewChatEmit: i
|
|
3200
|
-
} = n, a =
|
|
3189
|
+
} = n, a = U({
|
|
3201
3190
|
showWarning: !1,
|
|
3202
3191
|
isReached: !1,
|
|
3203
3192
|
pendingMessage: null
|
|
3204
|
-
}), c =
|
|
3193
|
+
}), c = N(() => {
|
|
3205
3194
|
var C;
|
|
3206
3195
|
return ((C = s()) == null ? void 0 : C.limit) ?? t();
|
|
3207
|
-
}), u =
|
|
3196
|
+
}), u = N(() => {
|
|
3208
3197
|
var C;
|
|
3209
3198
|
return ((C = s()) == null ? void 0 : C.showWarningAt) ?? c.value - 2;
|
|
3210
|
-
}), d =
|
|
3199
|
+
}), d = N(() => Math.max(0, c.value - e())), f = N(
|
|
3211
3200
|
() => d.value <= c.value - u.value && d.value > 0
|
|
3212
|
-
),
|
|
3213
|
-
var C,
|
|
3214
|
-
return a.value.isReached ? ((C = r()) == null ? void 0 : C.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((
|
|
3215
|
-
}),
|
|
3216
|
-
var C,
|
|
3217
|
-
return a.value.isReached ? ((C = s()) == null ? void 0 : C.limitMessage) ?? ((
|
|
3201
|
+
), w = N(() => d.value === 0), m = N(() => {
|
|
3202
|
+
var C, T;
|
|
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
|
+
}), p = N(() => {
|
|
3205
|
+
var C, T, z, F;
|
|
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) ?? ((F = r()) == null ? void 0 : F.historyLimitWarningMessage) ?? `You have ${d.value} message${d.value === 1 ? "" : "s"} remaining in this conversation.`;
|
|
3218
3207
|
});
|
|
3219
3208
|
function A() {
|
|
3220
3209
|
a.value.showWarning = !1, a.value.isReached = !1, a.value.pendingMessage = null;
|
|
3221
3210
|
}
|
|
3222
|
-
async function
|
|
3211
|
+
async function y() {
|
|
3223
3212
|
a.value.showWarning = !1;
|
|
3224
3213
|
const C = s();
|
|
3225
3214
|
if (C != null && C.onLimitReached && !await C.onLimitReached())
|
|
3226
3215
|
return a.value.isReached = !1, null;
|
|
3227
3216
|
if (o(), i(), a.value.isReached = !1, a.value.pendingMessage) {
|
|
3228
|
-
const
|
|
3229
|
-
return a.value.pendingMessage = null,
|
|
3217
|
+
const T = a.value.pendingMessage;
|
|
3218
|
+
return a.value.pendingMessage = null, T;
|
|
3230
3219
|
}
|
|
3231
3220
|
return null;
|
|
3232
3221
|
}
|
|
3233
|
-
function
|
|
3234
|
-
return
|
|
3222
|
+
function g() {
|
|
3223
|
+
return w.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (f.value && !a.value.showWarning && (a.value.showWarning = !0), !0);
|
|
3235
3224
|
}
|
|
3236
3225
|
function S(C) {
|
|
3237
3226
|
a.value.pendingMessage = C;
|
|
3238
3227
|
}
|
|
3239
3228
|
return {
|
|
3240
3229
|
// State
|
|
3241
|
-
showHistoryLimitWarning:
|
|
3242
|
-
historyLimitReached:
|
|
3230
|
+
showHistoryLimitWarning: N(() => a.value.showWarning),
|
|
3231
|
+
historyLimitReached: N(() => a.value.isReached),
|
|
3243
3232
|
// Computed
|
|
3244
3233
|
historyLimit: c,
|
|
3245
3234
|
remainingMessages: d,
|
|
3246
|
-
historyLimitDialogTitle:
|
|
3247
|
-
historyLimitDialogMessage:
|
|
3235
|
+
historyLimitDialogTitle: m,
|
|
3236
|
+
historyLimitDialogMessage: p,
|
|
3248
3237
|
// Actions
|
|
3249
3238
|
dismissHistoryLimitWarning: A,
|
|
3250
|
-
handleHistoryLimitAction:
|
|
3251
|
-
checkHistoryLimit:
|
|
3239
|
+
handleHistoryLimitAction: y,
|
|
3240
|
+
checkHistoryLimit: g,
|
|
3252
3241
|
setPendingMessage: S
|
|
3253
3242
|
};
|
|
3254
3243
|
}
|
|
3255
|
-
function
|
|
3256
|
-
const n = We(), e =
|
|
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), c = N(() => e.value.some((E) => E.uploading)), u = N(() => e.value.length < r);
|
|
3257
3246
|
function d(E) {
|
|
3258
3247
|
return (E.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(E.name);
|
|
3259
3248
|
}
|
|
3260
|
-
function
|
|
3249
|
+
function f(E) {
|
|
3261
3250
|
if (E == null) return "";
|
|
3262
3251
|
const M = typeof E == "string" ? parseInt(E, 10) : E;
|
|
3263
3252
|
return Number.isNaN(M) ? "" : M >= 1024 * 1024 ? `${(M / (1024 * 1024)).toFixed(1)} MB` : M >= 1024 ? `${Math.round(M / 1024)} KB` : `${M} B`;
|
|
3264
3253
|
}
|
|
3265
|
-
function
|
|
3254
|
+
function w(E) {
|
|
3266
3255
|
var Te;
|
|
3267
3256
|
const M = crypto.randomUUID(), I = E.type.startsWith("image/") ? URL.createObjectURL(E) : void 0, P = ee(), L = !!((Te = P == null ? void 0 : P.endpoints) != null && Te.uploadFile), ne = {
|
|
3268
3257
|
id: M,
|
|
@@ -3273,9 +3262,9 @@ function Lo() {
|
|
|
3273
3262
|
progress: L ? 0 : 100,
|
|
3274
3263
|
previewUrl: I
|
|
3275
3264
|
};
|
|
3276
|
-
e.value.push(ne), L &&
|
|
3265
|
+
e.value.push(ne), L && m(E, M);
|
|
3277
3266
|
}
|
|
3278
|
-
async function
|
|
3267
|
+
async function m(E, M) {
|
|
3279
3268
|
try {
|
|
3280
3269
|
const I = await n.uploadFile(E), P = e.value.findIndex((L) => L.id === M);
|
|
3281
3270
|
if (P === -1) return;
|
|
@@ -3291,12 +3280,12 @@ function Lo() {
|
|
|
3291
3280
|
previewUrl: L || I.previewUrl
|
|
3292
3281
|
};
|
|
3293
3282
|
} else
|
|
3294
|
-
|
|
3283
|
+
p(M);
|
|
3295
3284
|
} catch {
|
|
3296
|
-
|
|
3285
|
+
p(M);
|
|
3297
3286
|
}
|
|
3298
3287
|
}
|
|
3299
|
-
function
|
|
3288
|
+
function p(E) {
|
|
3300
3289
|
const M = e.value.findIndex((P) => P.id === E);
|
|
3301
3290
|
if (M === -1) return;
|
|
3302
3291
|
const [I] = e.value.splice(M, 1);
|
|
@@ -3307,7 +3296,7 @@ function Lo() {
|
|
|
3307
3296
|
E.previewUrl && URL.revokeObjectURL(E.previewUrl);
|
|
3308
3297
|
}), e.value = [];
|
|
3309
3298
|
}
|
|
3310
|
-
function
|
|
3299
|
+
function y() {
|
|
3311
3300
|
return e.value.filter((E) => !E.uploading).map((E) => ({
|
|
3312
3301
|
id: E.id,
|
|
3313
3302
|
name: E.name,
|
|
@@ -3316,12 +3305,12 @@ function Lo() {
|
|
|
3316
3305
|
size: E.size
|
|
3317
3306
|
}));
|
|
3318
3307
|
}
|
|
3319
|
-
function
|
|
3308
|
+
function g(E) {
|
|
3320
3309
|
if (!E) return;
|
|
3321
3310
|
const M = Array.from(E);
|
|
3322
3311
|
for (const I of M) {
|
|
3323
3312
|
if (e.value.length >= r) break;
|
|
3324
|
-
I.size > o ||
|
|
3313
|
+
I.size > o || w(I);
|
|
3325
3314
|
}
|
|
3326
3315
|
}
|
|
3327
3316
|
function S(E) {
|
|
@@ -3331,7 +3320,7 @@ function Lo() {
|
|
|
3331
3320
|
function C(E) {
|
|
3332
3321
|
S(E) && (s.value += 1, t.value = !0);
|
|
3333
3322
|
}
|
|
3334
|
-
function
|
|
3323
|
+
function T(E) {
|
|
3335
3324
|
S(E) || E.preventDefault();
|
|
3336
3325
|
}
|
|
3337
3326
|
function z(E) {
|
|
@@ -3339,11 +3328,11 @@ function Lo() {
|
|
|
3339
3328
|
}
|
|
3340
3329
|
function F(E) {
|
|
3341
3330
|
var M;
|
|
3342
|
-
S(E) && (s.value = 0, t.value = !1,
|
|
3331
|
+
S(E) && (s.value = 0, t.value = !1, g(((M = E.dataTransfer) == null ? void 0 : M.files) || null));
|
|
3343
3332
|
}
|
|
3344
3333
|
function V(E) {
|
|
3345
3334
|
const M = E.target, I = M.files;
|
|
3346
|
-
I && I.length &&
|
|
3335
|
+
I && I.length && g(I), M.value = "";
|
|
3347
3336
|
}
|
|
3348
3337
|
return Bs(() => {
|
|
3349
3338
|
A();
|
|
@@ -3358,50 +3347,50 @@ function Lo() {
|
|
|
3358
3347
|
acceptedFileTypes: i,
|
|
3359
3348
|
// Utils
|
|
3360
3349
|
isImage: d,
|
|
3361
|
-
formatFileSize:
|
|
3350
|
+
formatFileSize: f,
|
|
3362
3351
|
// Actions
|
|
3363
|
-
removeAttachment:
|
|
3352
|
+
removeAttachment: p,
|
|
3364
3353
|
clearAttachments: A,
|
|
3365
|
-
buildPayload:
|
|
3366
|
-
processFiles:
|
|
3354
|
+
buildPayload: y,
|
|
3355
|
+
processFiles: g,
|
|
3367
3356
|
handleFileSelect: V,
|
|
3368
3357
|
// Drag & Drop
|
|
3369
3358
|
handleDragEnter: C,
|
|
3370
|
-
handleDragOver:
|
|
3359
|
+
handleDragOver: T,
|
|
3371
3360
|
handleDragLeave: z,
|
|
3372
3361
|
handleDrop: F
|
|
3373
3362
|
};
|
|
3374
3363
|
}
|
|
3375
|
-
function
|
|
3376
|
-
const s =
|
|
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([]), c = N(() => {
|
|
3377
3366
|
const A = ee();
|
|
3378
3367
|
return (A == null ? void 0 : A.mentionProviders) || [];
|
|
3379
3368
|
});
|
|
3380
3369
|
function u(A) {
|
|
3381
|
-
const
|
|
3382
|
-
if (!
|
|
3383
|
-
const
|
|
3370
|
+
const y = t();
|
|
3371
|
+
if (!y) return;
|
|
3372
|
+
const g = y.selectionStart, S = ls(A, g);
|
|
3384
3373
|
i.value = S, S.inMention && S.query.length >= 0 ? d(S.query) : (s.value = !1, r.value = []);
|
|
3385
3374
|
}
|
|
3386
3375
|
async function d(A) {
|
|
3387
|
-
const
|
|
3388
|
-
if (
|
|
3376
|
+
const y = ds();
|
|
3377
|
+
if (y.length === 0) {
|
|
3389
3378
|
s.value = !1;
|
|
3390
3379
|
return;
|
|
3391
3380
|
}
|
|
3392
|
-
const
|
|
3393
|
-
for (const S of
|
|
3381
|
+
const g = [];
|
|
3382
|
+
for (const S of y)
|
|
3394
3383
|
try {
|
|
3395
3384
|
const C = await S.search(A);
|
|
3396
|
-
|
|
3385
|
+
g.push(...C.map((T) => ({ ...T, type: S.type })));
|
|
3397
3386
|
} catch (C) {
|
|
3398
3387
|
console.warn(`Mention provider ${S.type} failed:`, C);
|
|
3399
3388
|
}
|
|
3400
|
-
r.value =
|
|
3389
|
+
r.value = g.slice(0, 10), s.value = g.length > 0, o.value = 0;
|
|
3401
3390
|
}
|
|
3402
|
-
function
|
|
3403
|
-
const { startPos:
|
|
3404
|
-
e(`${C}@${z} ${
|
|
3391
|
+
function f(A) {
|
|
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
|
+
e(`${C}@${z} ${T}`), a.value.push({
|
|
3405
3394
|
id: A.id,
|
|
3406
3395
|
name: z,
|
|
3407
3396
|
type: A.type,
|
|
@@ -3413,7 +3402,7 @@ function Io(n, e, t) {
|
|
|
3413
3402
|
F == null || F.setSelectionRange(V, V);
|
|
3414
3403
|
}, 0);
|
|
3415
3404
|
}
|
|
3416
|
-
function
|
|
3405
|
+
function w(A) {
|
|
3417
3406
|
if (!s.value || r.value.length === 0)
|
|
3418
3407
|
return !1;
|
|
3419
3408
|
if (A.key === "ArrowDown")
|
|
@@ -3422,15 +3411,15 @@ function Io(n, e, t) {
|
|
|
3422
3411
|
return A.preventDefault(), o.value = Math.max(o.value - 1, 0), !0;
|
|
3423
3412
|
if (A.key === "Enter" || A.key === "Tab") {
|
|
3424
3413
|
A.preventDefault();
|
|
3425
|
-
const
|
|
3426
|
-
return
|
|
3414
|
+
const y = r.value[o.value];
|
|
3415
|
+
return y && f(y), !0;
|
|
3427
3416
|
}
|
|
3428
3417
|
return A.key === "Escape" ? (A.preventDefault(), s.value = !1, !0) : !1;
|
|
3429
3418
|
}
|
|
3430
|
-
function
|
|
3419
|
+
function m() {
|
|
3431
3420
|
a.value = [];
|
|
3432
3421
|
}
|
|
3433
|
-
function
|
|
3422
|
+
function p() {
|
|
3434
3423
|
return [...a.value];
|
|
3435
3424
|
}
|
|
3436
3425
|
return {
|
|
@@ -3441,45 +3430,45 @@ function Io(n, e, t) {
|
|
|
3441
3430
|
mentionProviders: c,
|
|
3442
3431
|
// Actions
|
|
3443
3432
|
checkForMentions: u,
|
|
3444
|
-
handleMentionSelect:
|
|
3445
|
-
handleMentionKeyDown:
|
|
3446
|
-
clearMentions:
|
|
3447
|
-
getMentions:
|
|
3433
|
+
handleMentionSelect: f,
|
|
3434
|
+
handleMentionKeyDown: w,
|
|
3435
|
+
clearMentions: m,
|
|
3436
|
+
getMentions: p
|
|
3448
3437
|
};
|
|
3449
3438
|
}
|
|
3450
|
-
function
|
|
3451
|
-
const o =
|
|
3439
|
+
function Do(n, e, t, s, r) {
|
|
3440
|
+
const o = U(!1), i = U(-1), a = U(null);
|
|
3452
3441
|
function c() {
|
|
3453
3442
|
setTimeout(() => {
|
|
3454
|
-
const
|
|
3455
|
-
if (!
|
|
3456
|
-
const
|
|
3457
|
-
|
|
3443
|
+
const m = a.value;
|
|
3444
|
+
if (!m) return;
|
|
3445
|
+
const p = m.querySelector(`li:nth-child(${i.value + 1})`);
|
|
3446
|
+
p && p.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
3458
3447
|
}, 0);
|
|
3459
3448
|
}
|
|
3460
|
-
function u(
|
|
3461
|
-
const
|
|
3462
|
-
if (!o.value ||
|
|
3449
|
+
function u(m) {
|
|
3450
|
+
const p = n();
|
|
3451
|
+
if (!o.value || p.length === 0)
|
|
3463
3452
|
return !1;
|
|
3464
|
-
if (
|
|
3465
|
-
return
|
|
3466
|
-
if (
|
|
3467
|
-
return
|
|
3468
|
-
if (
|
|
3469
|
-
|
|
3470
|
-
const A =
|
|
3453
|
+
if (m.key === "ArrowDown")
|
|
3454
|
+
return m.preventDefault(), i.value = Math.min(i.value + 1, p.length - 1), c(), !0;
|
|
3455
|
+
if (m.key === "ArrowUp")
|
|
3456
|
+
return m.preventDefault(), i.value = Math.max(i.value - 1, 0), c(), !0;
|
|
3457
|
+
if (m.key === "Enter" && i.value >= 0) {
|
|
3458
|
+
m.preventDefault();
|
|
3459
|
+
const A = p[i.value];
|
|
3471
3460
|
return A && d(A), !0;
|
|
3472
3461
|
}
|
|
3473
|
-
return
|
|
3462
|
+
return m.key === "Escape" ? (m.preventDefault(), o.value = !1, i.value = -1, !0) : !1;
|
|
3474
3463
|
}
|
|
3475
|
-
function d(
|
|
3476
|
-
r(
|
|
3464
|
+
function d(m) {
|
|
3465
|
+
r(m), o.value = !1, i.value = -1;
|
|
3477
3466
|
}
|
|
3478
|
-
function
|
|
3479
|
-
const
|
|
3480
|
-
|
|
3467
|
+
function f() {
|
|
3468
|
+
const m = s(), p = e(), A = t(), y = n();
|
|
3469
|
+
m && !p && A && y.length > 0 ? o.value = !0 : o.value = !1;
|
|
3481
3470
|
}
|
|
3482
|
-
function
|
|
3471
|
+
function w() {
|
|
3483
3472
|
o.value = !1, i.value = -1;
|
|
3484
3473
|
}
|
|
3485
3474
|
return {
|
|
@@ -3488,11 +3477,11 @@ function $o(n, e, t, s, r) {
|
|
|
3488
3477
|
dropdownRef: a,
|
|
3489
3478
|
handleSuggestionKeyDown: u,
|
|
3490
3479
|
handleSuggestionClick: d,
|
|
3491
|
-
updateSuggestionsVisibility:
|
|
3492
|
-
hideSuggestions:
|
|
3480
|
+
updateSuggestionsVisibility: f,
|
|
3481
|
+
hideSuggestions: w
|
|
3493
3482
|
};
|
|
3494
3483
|
}
|
|
3495
|
-
function
|
|
3484
|
+
function Oo(n, e = 300) {
|
|
3496
3485
|
function t() {
|
|
3497
3486
|
const s = n();
|
|
3498
3487
|
if (!s) return;
|
|
@@ -3506,7 +3495,7 @@ function Do(n, e = 300) {
|
|
|
3506
3495
|
adjustTextareaHeight: t
|
|
3507
3496
|
};
|
|
3508
3497
|
}
|
|
3509
|
-
const _o = /* @__PURE__ */
|
|
3498
|
+
const _o = /* @__PURE__ */ ue({
|
|
3510
3499
|
__name: "AiAvatar",
|
|
3511
3500
|
props: {
|
|
3512
3501
|
ui: {}
|
|
@@ -3514,20 +3503,20 @@ const _o = /* @__PURE__ */ he({
|
|
|
3514
3503
|
setup(n) {
|
|
3515
3504
|
return (e, t) => {
|
|
3516
3505
|
var s;
|
|
3517
|
-
return
|
|
3518
|
-
class:
|
|
3506
|
+
return x(), v("div", {
|
|
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])
|
|
3519
3508
|
}, [
|
|
3520
|
-
|
|
3509
|
+
he(e.$slots, "default", {}, () => {
|
|
3521
3510
|
var r;
|
|
3522
3511
|
return [
|
|
3523
|
-
(
|
|
3524
|
-
class:
|
|
3512
|
+
(x(), v("svg", {
|
|
3513
|
+
class: b(["w-4 h-4 text-gray-400 dark:text-gray-500", (r = n.ui) == null ? void 0 : r.icon]),
|
|
3525
3514
|
fill: "none",
|
|
3526
3515
|
viewBox: "0 0 24 24",
|
|
3527
3516
|
stroke: "currentColor",
|
|
3528
3517
|
"stroke-width": "1.5"
|
|
3529
3518
|
}, [...t[0] || (t[0] = [
|
|
3530
|
-
|
|
3519
|
+
h("path", {
|
|
3531
3520
|
"stroke-linecap": "round",
|
|
3532
3521
|
"stroke-linejoin": "round",
|
|
3533
3522
|
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"
|
|
@@ -3538,7 +3527,7 @@ const _o = /* @__PURE__ */ he({
|
|
|
3538
3527
|
], 2);
|
|
3539
3528
|
};
|
|
3540
3529
|
}
|
|
3541
|
-
}),
|
|
3530
|
+
}), Ea = /* @__PURE__ */ ue({
|
|
3542
3531
|
__name: "UserAvatar",
|
|
3543
3532
|
props: {
|
|
3544
3533
|
ui: {}
|
|
@@ -3546,19 +3535,19 @@ const _o = /* @__PURE__ */ he({
|
|
|
3546
3535
|
setup(n) {
|
|
3547
3536
|
return (e, t) => {
|
|
3548
3537
|
var s;
|
|
3549
|
-
return
|
|
3550
|
-
class:
|
|
3538
|
+
return x(), v("div", {
|
|
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])
|
|
3551
3540
|
}, [
|
|
3552
|
-
|
|
3541
|
+
he(e.$slots, "default", {}, () => {
|
|
3553
3542
|
var r;
|
|
3554
3543
|
return [
|
|
3555
|
-
(
|
|
3544
|
+
(x(), v("svg", {
|
|
3556
3545
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3557
3546
|
viewBox: "0 0 24 24",
|
|
3558
3547
|
fill: "currentColor",
|
|
3559
|
-
class:
|
|
3548
|
+
class: b(["w-5 h-5 text-gray-500 dark:text-gray-400", (r = n.ui) == null ? void 0 : r.icon])
|
|
3560
3549
|
}, [...t[0] || (t[0] = [
|
|
3561
|
-
|
|
3550
|
+
h("path", {
|
|
3562
3551
|
"fill-rule": "evenodd",
|
|
3563
3552
|
d: "M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",
|
|
3564
3553
|
"clip-rule": "evenodd"
|
|
@@ -3569,7 +3558,7 @@ const _o = /* @__PURE__ */ he({
|
|
|
3569
3558
|
], 2);
|
|
3570
3559
|
};
|
|
3571
3560
|
}
|
|
3572
|
-
}),
|
|
3561
|
+
}), No = ["onClick", "onMouseenter"], Po = /* @__PURE__ */ ue({
|
|
3573
3562
|
__name: "MentionList",
|
|
3574
3563
|
props: {
|
|
3575
3564
|
items: {},
|
|
@@ -3580,119 +3569,119 @@ const _o = /* @__PURE__ */ he({
|
|
|
3580
3569
|
},
|
|
3581
3570
|
emits: ["select", "update:selectedIndex"],
|
|
3582
3571
|
setup(n, { emit: e }) {
|
|
3583
|
-
const t = n, s =
|
|
3584
|
-
Ue(() => t.selectedIndex, (
|
|
3585
|
-
o.value =
|
|
3586
|
-
}), Ue(o, (
|
|
3587
|
-
r("update:selectedIndex",
|
|
3572
|
+
const t = n, s = N(() => t.ui || {}), r = e, o = U(t.selectedIndex);
|
|
3573
|
+
Ue(() => t.selectedIndex, (y) => {
|
|
3574
|
+
o.value = y;
|
|
3575
|
+
}), Ue(o, (y) => {
|
|
3576
|
+
r("update:selectedIndex", y);
|
|
3588
3577
|
});
|
|
3589
|
-
const i =
|
|
3590
|
-
const
|
|
3591
|
-
return t.items.forEach((
|
|
3592
|
-
const S =
|
|
3593
|
-
|
|
3594
|
-
}),
|
|
3578
|
+
const i = N(() => {
|
|
3579
|
+
const y = {};
|
|
3580
|
+
return t.items.forEach((g) => {
|
|
3581
|
+
const S = g.type || "default";
|
|
3582
|
+
y[S] || (y[S] = []), y[S].push(g);
|
|
3583
|
+
}), y;
|
|
3595
3584
|
});
|
|
3596
|
-
function a(
|
|
3597
|
-
return t.providers.find((
|
|
3585
|
+
function a(y) {
|
|
3586
|
+
return t.providers.find((g) => g.type === y) || cs(y);
|
|
3598
3587
|
}
|
|
3599
|
-
function c(
|
|
3600
|
-
const
|
|
3601
|
-
return (
|
|
3588
|
+
function c(y) {
|
|
3589
|
+
const g = a(y);
|
|
3590
|
+
return (g == null ? void 0 : g.label) || y.charAt(0).toUpperCase() + y.slice(1) + "s";
|
|
3602
3591
|
}
|
|
3603
|
-
function u(
|
|
3592
|
+
function u(y, g) {
|
|
3604
3593
|
let S = 0;
|
|
3605
3594
|
const C = Object.keys(i.value);
|
|
3606
|
-
for (const
|
|
3607
|
-
if (
|
|
3608
|
-
return S +
|
|
3609
|
-
S += i.value[
|
|
3595
|
+
for (const T of C) {
|
|
3596
|
+
if (T === y)
|
|
3597
|
+
return S + g;
|
|
3598
|
+
S += i.value[T].length;
|
|
3610
3599
|
}
|
|
3611
3600
|
return S;
|
|
3612
3601
|
}
|
|
3613
|
-
function d(
|
|
3614
|
-
r("select",
|
|
3602
|
+
function d(y) {
|
|
3603
|
+
r("select", y);
|
|
3615
3604
|
}
|
|
3616
|
-
function
|
|
3617
|
-
o.value =
|
|
3605
|
+
function f(y) {
|
|
3606
|
+
o.value = y, r("update:selectedIndex", y);
|
|
3618
3607
|
}
|
|
3619
|
-
function
|
|
3620
|
-
const
|
|
3621
|
-
return cn(
|
|
3608
|
+
function w(y) {
|
|
3609
|
+
const g = a(y.type);
|
|
3610
|
+
return cn(y, g);
|
|
3622
3611
|
}
|
|
3623
|
-
function y
|
|
3624
|
-
const
|
|
3625
|
-
return us(
|
|
3612
|
+
function m(y) {
|
|
3613
|
+
const g = a(y.type);
|
|
3614
|
+
return us(y, g);
|
|
3626
3615
|
}
|
|
3627
|
-
function
|
|
3628
|
-
const
|
|
3616
|
+
function p(y) {
|
|
3617
|
+
const g = {
|
|
3629
3618
|
employee: "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",
|
|
3630
3619
|
job: "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400",
|
|
3631
3620
|
candidate: "bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400",
|
|
3632
3621
|
project: "bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400",
|
|
3633
3622
|
default: "bg-primary/10 text-primary"
|
|
3634
3623
|
};
|
|
3635
|
-
return
|
|
3624
|
+
return g[y] || g.default;
|
|
3636
3625
|
}
|
|
3637
|
-
function A(
|
|
3638
|
-
return
|
|
3626
|
+
function A(y) {
|
|
3627
|
+
return y.split(" ").map((g) => g[0]).join("").slice(0, 2).toUpperCase();
|
|
3639
3628
|
}
|
|
3640
|
-
return (
|
|
3629
|
+
return (y, g) => n.items.length > 0 ? (x(), v("div", {
|
|
3641
3630
|
key: 0,
|
|
3642
|
-
class:
|
|
3631
|
+
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-60 overflow-y-auto z-50", s.value.root])
|
|
3643
3632
|
}, [
|
|
3644
|
-
|
|
3645
|
-
class:
|
|
3633
|
+
h("div", {
|
|
3634
|
+
class: b(["p-2", s.value.container])
|
|
3646
3635
|
}, [
|
|
3647
|
-
(
|
|
3648
|
-
Object.keys(i.value).length > 1 ? (
|
|
3636
|
+
(x(!0), v(we, null, Ne(i.value, (S, C) => (x(), v(we, { key: C }, [
|
|
3637
|
+
Object.keys(i.value).length > 1 ? (x(), v("div", {
|
|
3649
3638
|
key: 0,
|
|
3650
|
-
class:
|
|
3651
|
-
},
|
|
3652
|
-
(
|
|
3653
|
-
key:
|
|
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
|
+
}, _(c(C)), 3)) : B("", !0),
|
|
3641
|
+
(x(!0), v(we, null, Ne(S, (T, z) => (x(), v("button", {
|
|
3642
|
+
key: T.id,
|
|
3654
3643
|
type: "button",
|
|
3655
|
-
class:
|
|
3644
|
+
class: b(["w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors mb-0.5", [
|
|
3656
3645
|
s.value.item,
|
|
3657
3646
|
{
|
|
3658
3647
|
[s.value.itemSelected || "bg-primary/10"]: u(C, z) === o.value,
|
|
3659
3648
|
"hover:bg-gray-50 dark:hover:bg-gray-700": u(C, z) !== o.value
|
|
3660
3649
|
}
|
|
3661
3650
|
]]),
|
|
3662
|
-
onClick: (F) => d(
|
|
3663
|
-
onMouseenter: (F) =>
|
|
3651
|
+
onClick: (F) => d(T),
|
|
3652
|
+
onMouseenter: (F) => f(u(C, z))
|
|
3664
3653
|
}, [
|
|
3665
|
-
|
|
3666
|
-
item:
|
|
3654
|
+
he(y.$slots, "item-icon", {
|
|
3655
|
+
item: T,
|
|
3667
3656
|
type: C
|
|
3668
3657
|
}, () => [
|
|
3669
|
-
|
|
3670
|
-
class:
|
|
3671
|
-
},
|
|
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, p(T.type)]])
|
|
3660
|
+
}, _(A(w(T))), 3)
|
|
3672
3661
|
]),
|
|
3673
|
-
|
|
3674
|
-
class:
|
|
3662
|
+
h("div", {
|
|
3663
|
+
class: b(["flex-1 min-w-0", s.value.itemContent])
|
|
3675
3664
|
}, [
|
|
3676
|
-
|
|
3677
|
-
class:
|
|
3678
|
-
},
|
|
3679
|
-
|
|
3665
|
+
h("p", {
|
|
3666
|
+
class: b(["text-sm font-medium text-gray-900 dark:text-gray-100 truncate", s.value.itemName])
|
|
3667
|
+
}, _(w(T)), 3),
|
|
3668
|
+
m(T) ? (x(), v("p", {
|
|
3680
3669
|
key: 0,
|
|
3681
|
-
class:
|
|
3682
|
-
},
|
|
3670
|
+
class: b(["text-xs text-gray-500 dark:text-gray-400 truncate", s.value.itemSubtitle])
|
|
3671
|
+
}, _(m(T)), 3)) : B("", !0)
|
|
3683
3672
|
], 2)
|
|
3684
|
-
], 42,
|
|
3673
|
+
], 42, No))), 128))
|
|
3685
3674
|
], 64))), 128))
|
|
3686
3675
|
], 2)
|
|
3687
3676
|
], 2)) : B("", !0);
|
|
3688
3677
|
}
|
|
3689
|
-
}),
|
|
3678
|
+
}), zo = ["title"], Ho = {
|
|
3690
3679
|
key: 0,
|
|
3691
3680
|
class: "w-4 h-4 text-gray-500 dark:text-gray-400",
|
|
3692
3681
|
fill: "none",
|
|
3693
3682
|
viewBox: "0 0 24 24",
|
|
3694
3683
|
stroke: "currentColor"
|
|
3695
|
-
},
|
|
3684
|
+
}, Fo = /* @__PURE__ */ ue({
|
|
3696
3685
|
__name: "ChatMessageActions",
|
|
3697
3686
|
props: {
|
|
3698
3687
|
message: {},
|
|
@@ -3707,7 +3696,7 @@ const _o = /* @__PURE__ */ he({
|
|
|
3707
3696
|
copyToClipboard: "copyToClipboard",
|
|
3708
3697
|
copied: "copied"
|
|
3709
3698
|
}[c]);
|
|
3710
|
-
}, o =
|
|
3699
|
+
}, o = N(() => t.ui || {}), i = U(!1);
|
|
3711
3700
|
async function a() {
|
|
3712
3701
|
try {
|
|
3713
3702
|
await navigator.clipboard.writeText(t.message.message), i.value = !0, s("copy", t.message), setTimeout(() => {
|
|
@@ -3717,63 +3706,63 @@ const _o = /* @__PURE__ */ he({
|
|
|
3717
3706
|
console.error("Failed to copy:", c);
|
|
3718
3707
|
}
|
|
3719
3708
|
}
|
|
3720
|
-
return (c, u) => (
|
|
3721
|
-
class:
|
|
3709
|
+
return (c, u) => (x(), v("div", {
|
|
3710
|
+
class: b(["flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", o.value.container])
|
|
3722
3711
|
}, [
|
|
3723
|
-
|
|
3712
|
+
h("button", {
|
|
3724
3713
|
type: "button",
|
|
3725
|
-
class:
|
|
3714
|
+
class: b(["p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors", [o.value.button, o.value.copyButton]]),
|
|
3726
3715
|
title: i.value ? r("copied") : r("copyToClipboard"),
|
|
3727
3716
|
onClick: a
|
|
3728
3717
|
}, [
|
|
3729
|
-
i.value ? (
|
|
3718
|
+
i.value ? (x(), v("svg", {
|
|
3730
3719
|
key: 1,
|
|
3731
|
-
class:
|
|
3720
|
+
class: b(["w-4 h-4 text-green-500", o.value.successState]),
|
|
3732
3721
|
fill: "none",
|
|
3733
3722
|
viewBox: "0 0 24 24",
|
|
3734
3723
|
stroke: "currentColor"
|
|
3735
3724
|
}, [...u[1] || (u[1] = [
|
|
3736
|
-
|
|
3725
|
+
h("path", {
|
|
3737
3726
|
"stroke-linecap": "round",
|
|
3738
3727
|
"stroke-linejoin": "round",
|
|
3739
3728
|
"stroke-width": "2",
|
|
3740
3729
|
d: "M5 13l4 4L19 7"
|
|
3741
3730
|
}, null, -1)
|
|
3742
|
-
])], 2)) : (
|
|
3743
|
-
|
|
3731
|
+
])], 2)) : (x(), v("svg", Ho, [...u[0] || (u[0] = [
|
|
3732
|
+
h("path", {
|
|
3744
3733
|
"stroke-linecap": "round",
|
|
3745
3734
|
"stroke-linejoin": "round",
|
|
3746
3735
|
"stroke-width": "1.5",
|
|
3747
3736
|
d: "M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"
|
|
3748
3737
|
}, null, -1)
|
|
3749
3738
|
])]))
|
|
3750
|
-
], 10,
|
|
3739
|
+
], 10, zo)
|
|
3751
3740
|
], 2));
|
|
3752
3741
|
}
|
|
3753
|
-
}),
|
|
3742
|
+
}), Bo = { class: "h-12 w-12 flex items-center justify-center rounded-lg bg-white/20 overflow-hidden" }, Uo = ["src"], qo = {
|
|
3754
3743
|
key: 1,
|
|
3755
3744
|
class: "w-5 h-5 text-white",
|
|
3756
3745
|
fill: "none",
|
|
3757
3746
|
viewBox: "0 0 24 24",
|
|
3758
3747
|
stroke: "currentColor"
|
|
3759
|
-
},
|
|
3748
|
+
}, jo = { class: "flex-1 min-w-0" }, Wo = { class: "text-sm font-semibold text-white truncate" }, Ko = { class: "text-xs text-white/70" }, Vo = {
|
|
3760
3749
|
key: 0,
|
|
3761
3750
|
class: "text-xs font-medium text-white/90"
|
|
3762
|
-
},
|
|
3751
|
+
}, Go = ["src"], Qo = {
|
|
3763
3752
|
key: 1,
|
|
3764
3753
|
class: "h-4 w-4 text-white",
|
|
3765
3754
|
viewBox: "0 0 24 24",
|
|
3766
3755
|
fill: "currentColor"
|
|
3767
|
-
},
|
|
3756
|
+
}, Zo = { class: "flex-shrink-0 mt-0.5" }, Yo = { class: "text-gray-600 dark:text-gray-400" }, Xo = ["id", "innerHTML"], Jo = { class: "h-12 w-12 flex items-center justify-center rounded-lg bg-white dark:bg-gray-800 overflow-hidden border border-gray-200 dark:border-gray-600" }, ei = ["src"], ti = {
|
|
3768
3757
|
key: 1,
|
|
3769
3758
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
3770
3759
|
fill: "none",
|
|
3771
3760
|
viewBox: "0 0 24 24",
|
|
3772
3761
|
stroke: "currentColor"
|
|
3773
|
-
},
|
|
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 = {
|
|
3774
3763
|
key: 0,
|
|
3775
3764
|
class: "text-xs font-medium text-primary"
|
|
3776
|
-
},
|
|
3765
|
+
}, ii = /* @__PURE__ */ ue({
|
|
3777
3766
|
__name: "ChatMessage",
|
|
3778
3767
|
props: {
|
|
3779
3768
|
message: {},
|
|
@@ -3784,51 +3773,51 @@ const _o = /* @__PURE__ */ he({
|
|
|
3784
3773
|
},
|
|
3785
3774
|
emits: ["copy"],
|
|
3786
3775
|
setup(n, { emit: e }) {
|
|
3787
|
-
const t = n, s = e, r = (
|
|
3776
|
+
const t = n, s = e, r = (g) => {
|
|
3788
3777
|
var C;
|
|
3789
|
-
return (C = t.texts) != null && C[
|
|
3778
|
+
return (C = t.texts) != null && C[g] ? t.texts[g] : {
|
|
3790
3779
|
loadingText: "Gathering data...",
|
|
3791
3780
|
showMore: "Show more",
|
|
3792
3781
|
showLess: "Show less",
|
|
3793
3782
|
openAttachment: "Open",
|
|
3794
3783
|
attachment: "Attachment"
|
|
3795
|
-
}[
|
|
3796
|
-
}, o =
|
|
3784
|
+
}[g] || g;
|
|
3785
|
+
}, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a = U(!1), c = N(() => t.message.attachments ?? []), u = N(() => c.value.length > 0), d = N(() => {
|
|
3797
3786
|
if (t.message.role !== "user") return !1;
|
|
3798
|
-
const
|
|
3787
|
+
const g = t.message.message || "", S = g.split(`
|
|
3799
3788
|
`).length;
|
|
3800
|
-
return
|
|
3789
|
+
return g.length > 200 || S > 4;
|
|
3801
3790
|
});
|
|
3802
|
-
function
|
|
3791
|
+
function f() {
|
|
3803
3792
|
a.value = !a.value;
|
|
3804
3793
|
}
|
|
3805
|
-
function
|
|
3806
|
-
return (
|
|
3794
|
+
function w(g) {
|
|
3795
|
+
return (g.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(g.name || "");
|
|
3807
3796
|
}
|
|
3808
|
-
const
|
|
3809
|
-
const
|
|
3810
|
-
return
|
|
3797
|
+
const m = N(() => {
|
|
3798
|
+
const g = ee();
|
|
3799
|
+
return g != null && g.userAvatar ? typeof g.userAvatar == "string" ? g.userAvatar : typeof g.userAvatar == "function" ? g.userAvatar() : null : null;
|
|
3811
3800
|
});
|
|
3812
|
-
function
|
|
3813
|
-
if (
|
|
3814
|
-
const S = typeof
|
|
3801
|
+
function p(g) {
|
|
3802
|
+
if (g == null) return "";
|
|
3803
|
+
const S = typeof g == "string" ? parseInt(g, 10) : g;
|
|
3815
3804
|
return Number.isNaN(S) ? "" : S >= 1024 * 1024 ? `${(S / (1024 * 1024)).toFixed(1)} MB` : S >= 1024 ? `${Math.round(S / 1024)} KB` : `${S} B`;
|
|
3816
3805
|
}
|
|
3817
|
-
const A =
|
|
3806
|
+
const A = N(() => {
|
|
3818
3807
|
if (t.message.role === "assistant") {
|
|
3819
|
-
let
|
|
3820
|
-
return
|
|
3821
|
-
`), i(
|
|
3808
|
+
let g = t.message.message;
|
|
3809
|
+
return g = g.replace(/\\n/g, `
|
|
3810
|
+
`), i(g);
|
|
3822
3811
|
}
|
|
3823
3812
|
return t.message.message;
|
|
3824
3813
|
});
|
|
3825
|
-
function
|
|
3826
|
-
s("copy",
|
|
3814
|
+
function y(g) {
|
|
3815
|
+
s("copy", g);
|
|
3827
3816
|
}
|
|
3828
|
-
return (
|
|
3817
|
+
return (g, S) => {
|
|
3829
3818
|
var C;
|
|
3830
|
-
return
|
|
3831
|
-
class:
|
|
3819
|
+
return x(), v("div", {
|
|
3820
|
+
class: b(["group relative animate-in fade-in slide-in-from-bottom-2 duration-300", [
|
|
3832
3821
|
o.value.root,
|
|
3833
3822
|
{
|
|
3834
3823
|
"flex justify-end": n.message.role === "user",
|
|
@@ -3836,42 +3825,42 @@ const _o = /* @__PURE__ */ he({
|
|
|
3836
3825
|
}
|
|
3837
3826
|
]])
|
|
3838
3827
|
}, [
|
|
3839
|
-
n.message.role === "user" ? (
|
|
3828
|
+
n.message.role === "user" ? (x(), v("div", {
|
|
3840
3829
|
key: 0,
|
|
3841
|
-
class:
|
|
3830
|
+
class: b(["flex gap-3 justify-end", o.value.userMessage])
|
|
3842
3831
|
}, [
|
|
3843
|
-
|
|
3844
|
-
class:
|
|
3832
|
+
h("div", {
|
|
3833
|
+
class: b(["rounded-2xl px-4 py-3 bg-primary-500 text-white max-w-fit", o.value.userBubble])
|
|
3845
3834
|
}, [
|
|
3846
|
-
n.message.message ? (
|
|
3835
|
+
n.message.message ? (x(), v("p", {
|
|
3847
3836
|
key: 0,
|
|
3848
|
-
class:
|
|
3849
|
-
},
|
|
3850
|
-
d.value ? (
|
|
3837
|
+
class: b(["text-sm whitespace-pre-wrap", [o.value.content, { "line-clamp-4": !a.value && d.value }]])
|
|
3838
|
+
}, _(n.message.message), 3)) : B("", !0),
|
|
3839
|
+
d.value ? (x(), v("button", {
|
|
3851
3840
|
key: 1,
|
|
3852
|
-
class:
|
|
3853
|
-
onClick:
|
|
3854
|
-
},
|
|
3855
|
-
u.value ? (
|
|
3841
|
+
class: b(["mt-2 text-xs text-white/80 hover:text-white underline", o.value.showMoreButton]),
|
|
3842
|
+
onClick: f
|
|
3843
|
+
}, _(a.value ? r("showLess") : r("showMore")), 3)) : B("", !0),
|
|
3844
|
+
u.value ? (x(), v("div", {
|
|
3856
3845
|
key: 2,
|
|
3857
|
-
class:
|
|
3846
|
+
class: b(["mt-3 space-y-2", o.value.attachmentsContainer])
|
|
3858
3847
|
}, [
|
|
3859
|
-
(
|
|
3860
|
-
key:
|
|
3861
|
-
href:
|
|
3862
|
-
target:
|
|
3848
|
+
(x(!0), v(we, null, Ne(c.value, (T) => (x(), Me(nn(T.url ? "a" : "div"), {
|
|
3849
|
+
key: T.id,
|
|
3850
|
+
href: T.url || void 0,
|
|
3851
|
+
target: T.url ? "_blank" : void 0,
|
|
3863
3852
|
rel: "noopener noreferrer",
|
|
3864
|
-
class:
|
|
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" : ""]])
|
|
3865
3854
|
}, {
|
|
3866
3855
|
default: Ce(() => [
|
|
3867
|
-
|
|
3868
|
-
|
|
3856
|
+
h("div", Bo, [
|
|
3857
|
+
T.url && w(T) ? (x(), v("img", {
|
|
3869
3858
|
key: 0,
|
|
3870
|
-
src:
|
|
3859
|
+
src: T.url,
|
|
3871
3860
|
class: "object-cover h-full w-full",
|
|
3872
3861
|
alt: ""
|
|
3873
|
-
}, null, 8,
|
|
3874
|
-
|
|
3862
|
+
}, null, 8, Uo)) : (x(), v("svg", qo, [...S[0] || (S[0] = [
|
|
3863
|
+
h("path", {
|
|
3875
3864
|
"stroke-linecap": "round",
|
|
3876
3865
|
"stroke-linejoin": "round",
|
|
3877
3866
|
"stroke-width": "1.5",
|
|
@@ -3879,89 +3868,89 @@ const _o = /* @__PURE__ */ he({
|
|
|
3879
3868
|
}, null, -1)
|
|
3880
3869
|
])]))
|
|
3881
3870
|
]),
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3871
|
+
h("div", jo, [
|
|
3872
|
+
h("p", Wo, _(T.name || r("attachment")), 1),
|
|
3873
|
+
h("p", Ko, _(p(T.size)), 1)
|
|
3885
3874
|
]),
|
|
3886
|
-
|
|
3875
|
+
T.url ? (x(), v("span", Vo, _(r("openAttachment")), 1)) : B("", !0)
|
|
3887
3876
|
]),
|
|
3888
3877
|
_: 2
|
|
3889
3878
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3890
3879
|
], 2)) : B("", !0)
|
|
3891
3880
|
], 2),
|
|
3892
|
-
|
|
3893
|
-
class:
|
|
3881
|
+
h("div", {
|
|
3882
|
+
class: b(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary-500 overflow-hidden", o.value.userAvatar])
|
|
3894
3883
|
}, [
|
|
3895
|
-
|
|
3884
|
+
m.value ? (x(), v("img", {
|
|
3896
3885
|
key: 0,
|
|
3897
|
-
src:
|
|
3886
|
+
src: m.value,
|
|
3898
3887
|
alt: "User",
|
|
3899
3888
|
class: "h-full w-full object-cover"
|
|
3900
|
-
}, null, 8,
|
|
3901
|
-
|
|
3889
|
+
}, null, 8, Go)) : (x(), v("svg", Qo, [...S[1] || (S[1] = [
|
|
3890
|
+
h("path", {
|
|
3902
3891
|
"fill-rule": "evenodd",
|
|
3903
3892
|
d: "M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",
|
|
3904
3893
|
"clip-rule": "evenodd"
|
|
3905
3894
|
}, null, -1)
|
|
3906
3895
|
])]))
|
|
3907
3896
|
], 2)
|
|
3908
|
-
], 2)) : (
|
|
3897
|
+
], 2)) : (x(), v("div", {
|
|
3909
3898
|
key: 1,
|
|
3910
|
-
class:
|
|
3899
|
+
class: b(["flex items-start gap-3", o.value.assistantMessage])
|
|
3911
3900
|
}, [
|
|
3912
|
-
|
|
3913
|
-
|
|
3901
|
+
h("div", Zo, [
|
|
3902
|
+
me(_o)
|
|
3914
3903
|
]),
|
|
3915
|
-
|
|
3916
|
-
class:
|
|
3904
|
+
h("div", {
|
|
3905
|
+
class: b(["bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 px-5 py-4 shadow-sm rounded-2xl transition-all duration-200 flex-1", o.value.assistantBubble])
|
|
3917
3906
|
}, [
|
|
3918
|
-
n.message.loading ? (
|
|
3907
|
+
n.message.loading ? (x(), v("div", {
|
|
3919
3908
|
key: 0,
|
|
3920
|
-
class:
|
|
3909
|
+
class: b(["flex items-center gap-2 text-sm min-w-[150px]", o.value.loadingIndicator])
|
|
3921
3910
|
}, [
|
|
3922
|
-
|
|
3923
|
-
class:
|
|
3911
|
+
h("div", {
|
|
3912
|
+
class: b(["flex space-x-1", o.value.loadingDots])
|
|
3924
3913
|
}, [...S[2] || (S[2] = [
|
|
3925
|
-
|
|
3914
|
+
h("div", {
|
|
3926
3915
|
class: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
|
|
3927
3916
|
style: { "animation-delay": "0ms" }
|
|
3928
3917
|
}, null, -1),
|
|
3929
|
-
|
|
3918
|
+
h("div", {
|
|
3930
3919
|
class: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
|
|
3931
3920
|
style: { "animation-delay": "150ms" }
|
|
3932
3921
|
}, null, -1),
|
|
3933
|
-
|
|
3922
|
+
h("div", {
|
|
3934
3923
|
class: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
|
|
3935
3924
|
style: { "animation-delay": "300ms" }
|
|
3936
3925
|
}, null, -1)
|
|
3937
3926
|
])], 2),
|
|
3938
|
-
|
|
3939
|
-
], 2)) : n.message.message ? (
|
|
3927
|
+
h("span", Yo, _(((C = n.texts) == null ? void 0 : C.loadingText) || n.loadingText), 1)
|
|
3928
|
+
], 2)) : n.message.message ? (x(), v("div", {
|
|
3940
3929
|
key: 1,
|
|
3941
3930
|
id: n.message.id,
|
|
3942
|
-
class:
|
|
3931
|
+
class: b(["prose prose-sm max-w-none prose-gray dark:prose-invert", o.value.content]),
|
|
3943
3932
|
innerHTML: A.value
|
|
3944
|
-
}, null, 10,
|
|
3945
|
-
!n.message.loading && u.value ? (
|
|
3933
|
+
}, null, 10, Xo)) : B("", !0),
|
|
3934
|
+
!n.message.loading && u.value ? (x(), v("div", {
|
|
3946
3935
|
key: 2,
|
|
3947
|
-
class:
|
|
3936
|
+
class: b(["mt-4 space-y-2", o.value.attachmentsContainer])
|
|
3948
3937
|
}, [
|
|
3949
|
-
(
|
|
3950
|
-
key:
|
|
3951
|
-
href:
|
|
3952
|
-
target:
|
|
3938
|
+
(x(!0), v(we, null, Ne(c.value, (T) => (x(), Me(nn(T.url ? "a" : "div"), {
|
|
3939
|
+
key: T.id,
|
|
3940
|
+
href: T.url || void 0,
|
|
3941
|
+
target: T.url ? "_blank" : void 0,
|
|
3953
3942
|
rel: "noopener noreferrer",
|
|
3954
|
-
class:
|
|
3943
|
+
class: b(["flex items-center gap-3 rounded-xl border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 p-3 transition", [o.value.attachmentItem, T.url ? "hover:bg-white dark:hover:bg-gray-600 cursor-pointer" : ""]])
|
|
3955
3944
|
}, {
|
|
3956
3945
|
default: Ce(() => [
|
|
3957
|
-
|
|
3958
|
-
|
|
3946
|
+
h("div", Jo, [
|
|
3947
|
+
T.url && w(T) ? (x(), v("img", {
|
|
3959
3948
|
key: 0,
|
|
3960
|
-
src:
|
|
3949
|
+
src: T.url,
|
|
3961
3950
|
class: "object-cover h-full w-full",
|
|
3962
3951
|
alt: ""
|
|
3963
|
-
}, null, 8,
|
|
3964
|
-
|
|
3952
|
+
}, null, 8, ei)) : (x(), v("svg", ti, [...S[3] || (S[3] = [
|
|
3953
|
+
h("path", {
|
|
3965
3954
|
"stroke-linecap": "round",
|
|
3966
3955
|
"stroke-linejoin": "round",
|
|
3967
3956
|
"stroke-width": "1.5",
|
|
@@ -3969,22 +3958,22 @@ const _o = /* @__PURE__ */ he({
|
|
|
3969
3958
|
}, null, -1)
|
|
3970
3959
|
])]))
|
|
3971
3960
|
]),
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3961
|
+
h("div", ni, [
|
|
3962
|
+
h("p", si, _(T.name || r("attachment")), 1),
|
|
3963
|
+
h("p", ri, _(p(T.size)), 1)
|
|
3975
3964
|
]),
|
|
3976
|
-
|
|
3965
|
+
T.url ? (x(), v("span", oi, _(r("openAttachment")), 1)) : B("", !0)
|
|
3977
3966
|
]),
|
|
3978
3967
|
_: 2
|
|
3979
3968
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3980
3969
|
], 2)) : B("", !0)
|
|
3981
3970
|
], 2)
|
|
3982
3971
|
], 2)),
|
|
3983
|
-
n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (
|
|
3972
|
+
n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (x(), Me(Fo, {
|
|
3984
3973
|
key: 2,
|
|
3985
3974
|
message: n.message,
|
|
3986
|
-
class:
|
|
3987
|
-
onCopy:
|
|
3975
|
+
class: b(["absolute -bottom-8 left-14", o.value.actionsContainer]),
|
|
3976
|
+
onCopy: y
|
|
3988
3977
|
}, null, 8, ["message", "class"])) : B("", !0)
|
|
3989
3978
|
], 2);
|
|
3990
3979
|
};
|
|
@@ -3994,19 +3983,19 @@ const _o = /* @__PURE__ */ he({
|
|
|
3994
3983
|
for (const [s, r] of e)
|
|
3995
3984
|
t[s] = r;
|
|
3996
3985
|
return t;
|
|
3997
|
-
},
|
|
3986
|
+
}, ai = /* @__PURE__ */ Rs(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 = {
|
|
3998
3987
|
key: 1,
|
|
3999
3988
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
4000
3989
|
fill: "none",
|
|
4001
3990
|
viewBox: "0 0 24 24",
|
|
4002
3991
|
stroke: "currentColor"
|
|
4003
|
-
},
|
|
3992
|
+
}, hi = { class: "flex-1 min-w-0" }, pi = { class: "text-sm font-medium text-gray-800 dark:text-gray-200 truncate" }, fi = { class: "text-xs text-gray-500 dark:text-gray-400" }, gi = {
|
|
4004
3993
|
key: 0,
|
|
4005
3994
|
class: "mt-1 h-1 bg-gray-200 dark:bg-gray-600 rounded-full overflow-hidden"
|
|
4006
|
-
},
|
|
3995
|
+
}, mi = {
|
|
4007
3996
|
key: 0,
|
|
4008
3997
|
class: "text-xs text-gray-400"
|
|
4009
|
-
},
|
|
3998
|
+
}, yi = ["disabled", "onClick"], xi = /* @__PURE__ */ ue({
|
|
4010
3999
|
__name: "AttachmentsPreview",
|
|
4011
4000
|
props: {
|
|
4012
4001
|
attachments: {},
|
|
@@ -4019,25 +4008,25 @@ const _o = /* @__PURE__ */ he({
|
|
|
4019
4008
|
setup(n) {
|
|
4020
4009
|
return (e, t) => {
|
|
4021
4010
|
var s;
|
|
4022
|
-
return
|
|
4023
|
-
class:
|
|
4011
|
+
return x(), v("div", {
|
|
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])
|
|
4024
4013
|
}, [
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
(
|
|
4014
|
+
h("p", li, _(((s = n.texts) == null ? void 0 : s.attachedFiles) || "Attached files"), 1),
|
|
4015
|
+
h("ul", ui, [
|
|
4016
|
+
(x(!0), v(we, null, Ne(n.attachments, (r) => (x(), v("li", {
|
|
4028
4017
|
key: r.id,
|
|
4029
|
-
class:
|
|
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])
|
|
4030
4019
|
}, [
|
|
4031
|
-
|
|
4032
|
-
class:
|
|
4020
|
+
h("div", {
|
|
4021
|
+
class: b(["h-10 w-10 flex items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-600 overflow-hidden", n.ui.attachmentThumbnail])
|
|
4033
4022
|
}, [
|
|
4034
|
-
n.isImage(r) ? (
|
|
4023
|
+
n.isImage(r) ? (x(), v("img", {
|
|
4035
4024
|
key: 0,
|
|
4036
4025
|
src: r.previewUrl || r.url,
|
|
4037
4026
|
class: "object-cover h-full w-full",
|
|
4038
4027
|
alt: ""
|
|
4039
|
-
}, null, 8,
|
|
4040
|
-
|
|
4028
|
+
}, null, 8, ci)) : (x(), v("svg", di, [...t[0] || (t[0] = [
|
|
4029
|
+
h("path", {
|
|
4041
4030
|
"stroke-linecap": "round",
|
|
4042
4031
|
"stroke-linejoin": "round",
|
|
4043
4032
|
"stroke-width": "1.5",
|
|
@@ -4045,43 +4034,43 @@ const _o = /* @__PURE__ */ he({
|
|
|
4045
4034
|
}, null, -1)
|
|
4046
4035
|
])]))
|
|
4047
4036
|
], 2),
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
r.uploading ? (
|
|
4052
|
-
|
|
4037
|
+
h("div", hi, [
|
|
4038
|
+
h("p", pi, _(r.name), 1),
|
|
4039
|
+
h("p", fi, _(n.formatFileSize(r.size)), 1),
|
|
4040
|
+
r.uploading ? (x(), v("div", gi, [
|
|
4041
|
+
h("div", {
|
|
4053
4042
|
class: "h-full bg-primary transition-all",
|
|
4054
4043
|
style: un({ width: `${r.progress ?? 10}%` })
|
|
4055
4044
|
}, null, 4)
|
|
4056
4045
|
])) : B("", !0)
|
|
4057
4046
|
]),
|
|
4058
|
-
r.uploading ? (
|
|
4059
|
-
|
|
4047
|
+
r.uploading ? (x(), v("span", mi, _(Math.round(r.progress ?? 0)) + "% ", 1)) : B("", !0),
|
|
4048
|
+
h("button", {
|
|
4060
4049
|
type: "button",
|
|
4061
|
-
class:
|
|
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]),
|
|
4062
4051
|
disabled: r.uploading,
|
|
4063
4052
|
onClick: (o) => e.$emit("remove", r.id)
|
|
4064
4053
|
}, [...t[1] || (t[1] = [
|
|
4065
|
-
|
|
4054
|
+
h("svg", {
|
|
4066
4055
|
class: "w-4 h-4 text-gray-500 dark:text-gray-400",
|
|
4067
4056
|
fill: "none",
|
|
4068
4057
|
viewBox: "0 0 24 24",
|
|
4069
4058
|
stroke: "currentColor"
|
|
4070
4059
|
}, [
|
|
4071
|
-
|
|
4060
|
+
h("path", {
|
|
4072
4061
|
"stroke-linecap": "round",
|
|
4073
4062
|
"stroke-linejoin": "round",
|
|
4074
4063
|
"stroke-width": "1.5",
|
|
4075
4064
|
d: "M6 18L18 6M6 6l12 12"
|
|
4076
4065
|
})
|
|
4077
4066
|
], -1)
|
|
4078
|
-
])], 10,
|
|
4067
|
+
])], 10, yi)
|
|
4079
4068
|
], 2))), 128))
|
|
4080
4069
|
])
|
|
4081
4070
|
], 2);
|
|
4082
4071
|
};
|
|
4083
4072
|
}
|
|
4084
|
-
}),
|
|
4073
|
+
}), ki = { class: "py-1" }, wi = ["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__ */ ue({
|
|
4085
4074
|
__name: "SuggestionsDropdown",
|
|
4086
4075
|
props: {
|
|
4087
4076
|
suggestions: {},
|
|
@@ -4090,8 +4079,8 @@ const _o = /* @__PURE__ */ he({
|
|
|
4090
4079
|
},
|
|
4091
4080
|
emits: ["select", "hover"],
|
|
4092
4081
|
setup(n, { expose: e }) {
|
|
4093
|
-
const t =
|
|
4094
|
-
return e({ dropdownRef: t }), (s, r) => (
|
|
4082
|
+
const t = U(null);
|
|
4083
|
+
return e({ dropdownRef: t }), (s, r) => (x(), Me(mt, {
|
|
4095
4084
|
"enter-active-class": "transition ease-out duration-100",
|
|
4096
4085
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
4097
4086
|
"enter-to-class": "transform opacity-100 scale-100",
|
|
@@ -4100,15 +4089,15 @@ const _o = /* @__PURE__ */ he({
|
|
|
4100
4089
|
"leave-to-class": "transform opacity-0 scale-95"
|
|
4101
4090
|
}, {
|
|
4102
4091
|
default: Ce(() => [
|
|
4103
|
-
|
|
4092
|
+
h("div", {
|
|
4104
4093
|
ref_key: "dropdownRef",
|
|
4105
4094
|
ref: t,
|
|
4106
|
-
class:
|
|
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])
|
|
4107
4096
|
}, [
|
|
4108
|
-
|
|
4109
|
-
(
|
|
4097
|
+
h("ul", ki, [
|
|
4098
|
+
(x(!0), v(we, null, Ne(n.suggestions, (o, i) => (x(), v("li", {
|
|
4110
4099
|
key: o.id,
|
|
4111
|
-
class:
|
|
4100
|
+
class: b(["px-4 py-3 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-700 last:border-b-0", [
|
|
4112
4101
|
n.ui.suggestionItem,
|
|
4113
4102
|
{
|
|
4114
4103
|
[n.ui.suggestionItemSelected || "bg-primary/10"]: i === n.selectedIndex,
|
|
@@ -4118,10 +4107,10 @@ const _o = /* @__PURE__ */ he({
|
|
|
4118
4107
|
onClick: (a) => s.$emit("select", o),
|
|
4119
4108
|
onMouseenter: (a) => s.$emit("hover", i)
|
|
4120
4109
|
}, [
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4110
|
+
h("div", bi, [
|
|
4111
|
+
h("div", vi, [
|
|
4112
|
+
h("p", Ti, _(o.title), 1),
|
|
4113
|
+
h("p", Si, _(o.description), 1)
|
|
4125
4114
|
])
|
|
4126
4115
|
])
|
|
4127
4116
|
], 42, wi))), 128))
|
|
@@ -4131,18 +4120,18 @@ const _o = /* @__PURE__ */ he({
|
|
|
4131
4120
|
_: 1
|
|
4132
4121
|
}));
|
|
4133
4122
|
}
|
|
4134
|
-
}),
|
|
4123
|
+
}), Ci = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1 z-10" }, Ei = ["title"], Mi = ["title"], Ri = ["disabled"], Li = {
|
|
4135
4124
|
key: 0,
|
|
4136
4125
|
class: "w-4 h-4",
|
|
4137
4126
|
fill: "none",
|
|
4138
4127
|
viewBox: "0 0 24 24",
|
|
4139
4128
|
stroke: "currentColor"
|
|
4140
|
-
},
|
|
4129
|
+
}, Ii = {
|
|
4141
4130
|
key: 1,
|
|
4142
4131
|
class: "w-4 h-4",
|
|
4143
4132
|
viewBox: "0 0 24 24",
|
|
4144
4133
|
fill: "currentColor"
|
|
4145
|
-
},
|
|
4134
|
+
}, $i = /* @__PURE__ */ ue({
|
|
4146
4135
|
__name: "InputActions",
|
|
4147
4136
|
props: {
|
|
4148
4137
|
sending: { type: Boolean },
|
|
@@ -4154,94 +4143,94 @@ const _o = /* @__PURE__ */ he({
|
|
|
4154
4143
|
},
|
|
4155
4144
|
emits: ["toggle-support-mode", "click"],
|
|
4156
4145
|
setup(n) {
|
|
4157
|
-
const e = n, t =
|
|
4146
|
+
const e = n, t = N(() => e.sending ? [e.ui.stopButton || "bg-red-500 text-white hover:bg-red-600"] : e.canSend ? [e.ui.sendButtonActive || "bg-primary-500 text-white hover:bg-primary-600"] : [e.ui.sendButtonDisabled || "bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed opacity-60"]);
|
|
4158
4147
|
return (s, r) => {
|
|
4159
4148
|
var o, i, a;
|
|
4160
|
-
return
|
|
4161
|
-
n.showSupportModeToggle && !n.supportRequestMode ? (
|
|
4149
|
+
return x(), v("div", Ci, [
|
|
4150
|
+
n.showSupportModeToggle && !n.supportRequestMode ? (x(), v("button", {
|
|
4162
4151
|
key: 0,
|
|
4163
4152
|
type: "button",
|
|
4164
|
-
class:
|
|
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]),
|
|
4165
4154
|
title: ((o = n.texts) == null ? void 0 : o.toggleSupportMode) || "Toggle support mode",
|
|
4166
4155
|
onClick: r[0] || (r[0] = (c) => s.$emit("toggle-support-mode"))
|
|
4167
4156
|
}, [...r[3] || (r[3] = [
|
|
4168
|
-
|
|
4157
|
+
h("svg", {
|
|
4169
4158
|
class: "w-5 h-5",
|
|
4170
4159
|
fill: "none",
|
|
4171
4160
|
viewBox: "0 0 24 24",
|
|
4172
4161
|
stroke: "currentColor",
|
|
4173
4162
|
"stroke-width": "1.5"
|
|
4174
4163
|
}, [
|
|
4175
|
-
|
|
4164
|
+
h("path", {
|
|
4176
4165
|
"stroke-linecap": "round",
|
|
4177
4166
|
"stroke-linejoin": "round",
|
|
4178
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"
|
|
4179
4168
|
})
|
|
4180
4169
|
], -1)
|
|
4181
|
-
])], 10,
|
|
4182
|
-
n.showSupportModeToggle && n.supportRequestMode ? (
|
|
4170
|
+
])], 10, Ei)) : B("", !0),
|
|
4171
|
+
n.showSupportModeToggle && n.supportRequestMode ? (x(), v("button", {
|
|
4183
4172
|
key: 1,
|
|
4184
4173
|
type: "button",
|
|
4185
|
-
class:
|
|
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]),
|
|
4186
4175
|
title: ((i = n.texts) == null ? void 0 : i.exitSupportMode) || "Exit support mode",
|
|
4187
4176
|
onClick: r[1] || (r[1] = (c) => s.$emit("toggle-support-mode"))
|
|
4188
4177
|
}, [
|
|
4189
|
-
r[4] || (r[4] =
|
|
4178
|
+
r[4] || (r[4] = h("svg", {
|
|
4190
4179
|
class: "w-3.5 h-3.5",
|
|
4191
4180
|
fill: "none",
|
|
4192
4181
|
viewBox: "0 0 24 24",
|
|
4193
4182
|
stroke: "currentColor",
|
|
4194
4183
|
"stroke-width": "2"
|
|
4195
4184
|
}, [
|
|
4196
|
-
|
|
4185
|
+
h("path", {
|
|
4197
4186
|
"stroke-linecap": "round",
|
|
4198
4187
|
"stroke-linejoin": "round",
|
|
4199
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"
|
|
4200
4189
|
})
|
|
4201
4190
|
], -1)),
|
|
4202
|
-
|
|
4203
|
-
r[5] || (r[5] =
|
|
4191
|
+
h("span", null, _(((a = n.texts) == null ? void 0 : a.supportLabel) || "Support"), 1),
|
|
4192
|
+
r[5] || (r[5] = h("svg", {
|
|
4204
4193
|
class: "w-3 h-3",
|
|
4205
4194
|
fill: "none",
|
|
4206
4195
|
viewBox: "0 0 24 24",
|
|
4207
4196
|
stroke: "currentColor",
|
|
4208
4197
|
"stroke-width": "2"
|
|
4209
4198
|
}, [
|
|
4210
|
-
|
|
4199
|
+
h("path", {
|
|
4211
4200
|
"stroke-linecap": "round",
|
|
4212
4201
|
"stroke-linejoin": "round",
|
|
4213
4202
|
d: "M6 18L18 6M6 6l12 12"
|
|
4214
4203
|
})
|
|
4215
4204
|
], -1))
|
|
4216
|
-
], 10,
|
|
4217
|
-
|
|
4205
|
+
], 10, Mi)) : B("", !0),
|
|
4206
|
+
h("button", {
|
|
4218
4207
|
disabled: !n.canSend && !n.sending,
|
|
4219
|
-
class:
|
|
4208
|
+
class: b(["h-9 w-9 rounded-xl flex items-center justify-center transition-all duration-200 flex-shrink-0", t.value]),
|
|
4220
4209
|
type: "button",
|
|
4221
4210
|
onClick: r[2] || (r[2] = et((c) => s.$emit("click"), ["prevent"]))
|
|
4222
4211
|
}, [
|
|
4223
|
-
n.sending ? (
|
|
4224
|
-
|
|
4212
|
+
n.sending ? (x(), v("svg", Ii, [...r[7] || (r[7] = [
|
|
4213
|
+
h("path", {
|
|
4225
4214
|
"fill-rule": "evenodd",
|
|
4226
4215
|
d: "M4.5 7.5a3 3 0 013-3h9a3 3 0 013 3v9a3 3 0 01-3 3h-9a3 3 0 01-3-3v-9z",
|
|
4227
4216
|
"clip-rule": "evenodd"
|
|
4228
4217
|
}, null, -1)
|
|
4229
|
-
])])) : (
|
|
4230
|
-
|
|
4218
|
+
])])) : (x(), v("svg", Li, [...r[6] || (r[6] = [
|
|
4219
|
+
h("path", {
|
|
4231
4220
|
"stroke-linecap": "round",
|
|
4232
4221
|
"stroke-linejoin": "round",
|
|
4233
4222
|
"stroke-width": "2",
|
|
4234
4223
|
d: "M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
|
|
4235
4224
|
}, null, -1)
|
|
4236
4225
|
])]))
|
|
4237
|
-
], 10,
|
|
4226
|
+
], 10, Ri)
|
|
4238
4227
|
]);
|
|
4239
4228
|
};
|
|
4240
4229
|
}
|
|
4241
|
-
}),
|
|
4230
|
+
}), Di = { class: "max-w-3xl mx-auto space-y-3" }, Oi = ["accept"], _i = ["title"], Ni = { class: "flex items-center" }, Pi = ["placeholder", "disabled"], zi = {
|
|
4242
4231
|
key: 0,
|
|
4243
4232
|
class: "flex justify-center"
|
|
4244
|
-
},
|
|
4233
|
+
}, Hi = /* @__PURE__ */ ue({
|
|
4245
4234
|
__name: "ChatInput",
|
|
4246
4235
|
props: {
|
|
4247
4236
|
modelValue: {},
|
|
@@ -4260,79 +4249,79 @@ const _o = /* @__PURE__ */ he({
|
|
|
4260
4249
|
},
|
|
4261
4250
|
emits: ["update:modelValue", "submit", "cancel", "suggestion-select", "toggle-support-mode", "context-link-click"],
|
|
4262
4251
|
setup(n, { emit: e }) {
|
|
4263
|
-
const t = n, s =
|
|
4252
|
+
const t = n, s = N(() => t.ui || {}), r = e, o = U(t.modelValue), i = U(null), a = U(null), c = U(!1), u = Io(), d = $o(
|
|
4264
4253
|
() => o.value,
|
|
4265
4254
|
(M) => {
|
|
4266
4255
|
o.value = M;
|
|
4267
4256
|
},
|
|
4268
4257
|
() => i.value
|
|
4269
|
-
),
|
|
4258
|
+
), f = Do(
|
|
4270
4259
|
() => t.suggestions,
|
|
4271
4260
|
() => t.hasHistory,
|
|
4272
4261
|
() => c.value,
|
|
4273
4262
|
() => o.value,
|
|
4274
4263
|
(M) => {
|
|
4275
|
-
r("suggestion-select", M),
|
|
4264
|
+
r("suggestion-select", M), _e(() => {
|
|
4276
4265
|
var I;
|
|
4277
4266
|
return (I = i.value) == null ? void 0 : I.focus();
|
|
4278
4267
|
});
|
|
4279
4268
|
}
|
|
4280
|
-
), { adjustTextareaHeight:
|
|
4269
|
+
), { adjustTextareaHeight: w } = Oo(() => i.value), m = N(() => t.supportRequestMode ? t.supportPlaceholder : t.placeholder), p = N(() => t.showSupportModeToggle ? t.supportRequestMode ? { paddingLeft: "3rem", paddingRight: "8rem" } : { paddingLeft: "3rem", paddingRight: "6rem" } : { paddingLeft: "3rem", paddingRight: "3.5rem" }), A = N(() => {
|
|
4281
4270
|
var I;
|
|
4282
4271
|
return (((I = o.value) == null ? void 0 : I.trim()) ?? "").length >= t.minLength ? !0 : u.hasAttachments.value;
|
|
4283
|
-
}),
|
|
4272
|
+
}), y = N(
|
|
4284
4273
|
() => !t.disabled && !t.sending && A.value && !u.isUploading.value
|
|
4285
4274
|
);
|
|
4286
4275
|
Ue(() => t.modelValue, (M) => {
|
|
4287
|
-
o.value = M,
|
|
4276
|
+
o.value = M, _e(w);
|
|
4288
4277
|
}), Ue(o, (M) => {
|
|
4289
|
-
r("update:modelValue", M),
|
|
4278
|
+
r("update:modelValue", M), _e(w), d.checkForMentions(M), f.updateSuggestionsVisibility();
|
|
4290
4279
|
}), Ue(() => t.suggestions, () => {
|
|
4291
|
-
|
|
4280
|
+
f.updateSuggestionsVisibility();
|
|
4292
4281
|
});
|
|
4293
|
-
function
|
|
4294
|
-
|
|
4282
|
+
function g() {
|
|
4283
|
+
w();
|
|
4295
4284
|
}
|
|
4296
4285
|
function S(M) {
|
|
4297
|
-
if (!d.handleMentionKeyDown(M) && !
|
|
4286
|
+
if (!d.handleMentionKeyDown(M) && !f.handleSuggestionKeyDown(M) && M.key === "Enter") {
|
|
4298
4287
|
if (M.shiftKey) return;
|
|
4299
|
-
!t.sending &&
|
|
4288
|
+
!t.sending && y.value && (M.preventDefault(), C());
|
|
4300
4289
|
}
|
|
4301
4290
|
}
|
|
4302
4291
|
function C() {
|
|
4303
|
-
if (!
|
|
4292
|
+
if (!y.value) return;
|
|
4304
4293
|
const M = u.buildPayload(), I = o.value.trim(), P = d.getMentions();
|
|
4305
4294
|
r("submit", {
|
|
4306
4295
|
message: I,
|
|
4307
4296
|
attachments: M,
|
|
4308
4297
|
mentions: P,
|
|
4309
4298
|
isSupportRequest: t.supportRequestMode
|
|
4310
|
-
}), o.value = "", u.clearAttachments(), d.clearMentions(),
|
|
4299
|
+
}), o.value = "", u.clearAttachments(), d.clearMentions(), _e(w);
|
|
4311
4300
|
}
|
|
4312
|
-
function
|
|
4313
|
-
t.sending ? r("cancel") :
|
|
4301
|
+
function T() {
|
|
4302
|
+
t.sending ? r("cancel") : y.value && C();
|
|
4314
4303
|
}
|
|
4315
4304
|
function z() {
|
|
4316
4305
|
var M;
|
|
4317
4306
|
t.disabled || t.sending || u.canAddMore.value && ((M = a.value) == null || M.click());
|
|
4318
4307
|
}
|
|
4319
4308
|
function F(M) {
|
|
4320
|
-
|
|
4309
|
+
f.handleSuggestionClick(M);
|
|
4321
4310
|
}
|
|
4322
4311
|
function V() {
|
|
4323
|
-
c.value = !0,
|
|
4312
|
+
c.value = !0, f.updateSuggestionsVisibility();
|
|
4324
4313
|
}
|
|
4325
4314
|
function E() {
|
|
4326
4315
|
c.value = !1, setTimeout(() => {
|
|
4327
|
-
|
|
4316
|
+
f.hideSuggestions(), d.showMentions.value = !1;
|
|
4328
4317
|
}, 200);
|
|
4329
4318
|
}
|
|
4330
4319
|
return xt(() => {
|
|
4331
|
-
|
|
4320
|
+
_e(w);
|
|
4332
4321
|
}), (M, I) => {
|
|
4333
4322
|
var P;
|
|
4334
|
-
return
|
|
4335
|
-
class:
|
|
4323
|
+
return x(), v("div", {
|
|
4324
|
+
class: b(["px-4 pb-4 bg-white dark:bg-gray-900 sticky bottom-0", s.value.root]),
|
|
4336
4325
|
onDragenter: I[6] || (I[6] = et(
|
|
4337
4326
|
//@ts-ignore
|
|
4338
4327
|
(...L) => D(u).handleDragEnter && D(u).handleDragEnter(...L),
|
|
@@ -4354,12 +4343,12 @@ const _o = /* @__PURE__ */ he({
|
|
|
4354
4343
|
["prevent"]
|
|
4355
4344
|
))
|
|
4356
4345
|
}, [
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4346
|
+
h("form", {
|
|
4347
|
+
class: b(s.value.form),
|
|
4348
|
+
onSubmit: et(C, ["prevent"])
|
|
4360
4349
|
}, [
|
|
4361
|
-
|
|
4362
|
-
|
|
4350
|
+
h("div", Di, [
|
|
4351
|
+
h("input", {
|
|
4363
4352
|
ref_key: "fileInputRef",
|
|
4364
4353
|
ref: a,
|
|
4365
4354
|
type: "file",
|
|
@@ -4368,8 +4357,8 @@ const _o = /* @__PURE__ */ he({
|
|
|
4368
4357
|
accept: D(u).acceptedFileTypes,
|
|
4369
4358
|
onChange: I[0] || (I[0] = //@ts-ignore
|
|
4370
4359
|
(...L) => D(u).handleFileSelect && D(u).handleFileSelect(...L))
|
|
4371
|
-
}, null, 40,
|
|
4372
|
-
D(u).hasAttachments.value ? (
|
|
4360
|
+
}, null, 40, Oi),
|
|
4361
|
+
D(u).hasAttachments.value ? (x(), Me(xi, {
|
|
4373
4362
|
key: 0,
|
|
4374
4363
|
attachments: D(u).attachments.value,
|
|
4375
4364
|
ui: s.value,
|
|
@@ -4378,19 +4367,19 @@ const _o = /* @__PURE__ */ he({
|
|
|
4378
4367
|
"format-file-size": D(u).formatFileSize,
|
|
4379
4368
|
onRemove: D(u).removeAttachment
|
|
4380
4369
|
}, null, 8, ["attachments", "ui", "texts", "is-image", "format-file-size", "onRemove"])) : B("", !0),
|
|
4381
|
-
|
|
4382
|
-
class:
|
|
4370
|
+
h("div", {
|
|
4371
|
+
class: b(["relative", s.value.inputContainer])
|
|
4383
4372
|
}, [
|
|
4384
|
-
D(
|
|
4373
|
+
D(f).showSuggestions.value && n.suggestions.length > 0 ? (x(), Me(Ai, {
|
|
4385
4374
|
key: 0,
|
|
4386
4375
|
ref: "suggestionsHandler.dropdownRef.value",
|
|
4387
4376
|
suggestions: n.suggestions,
|
|
4388
|
-
"selected-index": D(
|
|
4377
|
+
"selected-index": D(f).selectedSuggestionIndex.value,
|
|
4389
4378
|
ui: s.value,
|
|
4390
4379
|
onSelect: F,
|
|
4391
|
-
onHover: I[1] || (I[1] = (L) => D(
|
|
4380
|
+
onHover: I[1] || (I[1] = (L) => D(f).selectedSuggestionIndex.value = L)
|
|
4392
4381
|
}, null, 8, ["suggestions", "selected-index", "ui"])) : B("", !0),
|
|
4393
|
-
|
|
4382
|
+
me(mt, {
|
|
4394
4383
|
"enter-active-class": "transition ease-out duration-100",
|
|
4395
4384
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
4396
4385
|
"enter-to-class": "transform opacity-100 scale-100",
|
|
@@ -4399,7 +4388,7 @@ const _o = /* @__PURE__ */ he({
|
|
|
4399
4388
|
"leave-to-class": "transform opacity-0 scale-95"
|
|
4400
4389
|
}, {
|
|
4401
4390
|
default: Ce(() => [
|
|
4402
|
-
D(d).showMentions.value && D(d).mentionItems.value.length > 0 ? (
|
|
4391
|
+
D(d).showMentions.value && D(d).mentionItems.value.length > 0 ? (x(), Me(Po, {
|
|
4403
4392
|
key: 0,
|
|
4404
4393
|
items: D(d).mentionItems.value,
|
|
4405
4394
|
"selected-index": D(d).selectedMentionIndex.value,
|
|
@@ -4410,8 +4399,8 @@ const _o = /* @__PURE__ */ he({
|
|
|
4410
4399
|
]),
|
|
4411
4400
|
_: 1
|
|
4412
4401
|
}),
|
|
4413
|
-
|
|
4414
|
-
class:
|
|
4402
|
+
h("div", {
|
|
4403
|
+
class: b(["rounded-2xl border shadow-lg transition-all duration-200 bg-white dark:bg-gray-800", [
|
|
4415
4404
|
s.value.inputWrapper,
|
|
4416
4405
|
{
|
|
4417
4406
|
"border-primary shadow-primary/30": c.value || D(u).isDraggingFiles.value,
|
|
@@ -4419,19 +4408,19 @@ const _o = /* @__PURE__ */ he({
|
|
|
4419
4408
|
}
|
|
4420
4409
|
]])
|
|
4421
4410
|
}, [
|
|
4422
|
-
|
|
4411
|
+
h("button", {
|
|
4423
4412
|
type: "button",
|
|
4424
|
-
class:
|
|
4413
|
+
class: b(["absolute left-3 top-1/2 -translate-y-1/2 h-9 w-9 rounded-xl flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-primary transition z-10", s.value.attachButton]),
|
|
4425
4414
|
title: ((P = n.texts) == null ? void 0 : P.attachFiles) || "Attach files",
|
|
4426
4415
|
onClick: z
|
|
4427
4416
|
}, [...I[10] || (I[10] = [
|
|
4428
|
-
|
|
4417
|
+
h("svg", {
|
|
4429
4418
|
class: "w-5 h-5",
|
|
4430
4419
|
fill: "none",
|
|
4431
4420
|
viewBox: "0 0 24 24",
|
|
4432
4421
|
stroke: "currentColor"
|
|
4433
4422
|
}, [
|
|
4434
|
-
|
|
4423
|
+
h("path", {
|
|
4435
4424
|
"stroke-linecap": "round",
|
|
4436
4425
|
"stroke-linejoin": "round",
|
|
4437
4426
|
"stroke-width": "1.5",
|
|
@@ -4439,44 +4428,44 @@ const _o = /* @__PURE__ */ he({
|
|
|
4439
4428
|
})
|
|
4440
4429
|
], -1)
|
|
4441
4430
|
])], 10, _i),
|
|
4442
|
-
|
|
4443
|
-
Us(
|
|
4431
|
+
h("div", Ni, [
|
|
4432
|
+
Us(h("textarea", {
|
|
4444
4433
|
ref_key: "textareaRef",
|
|
4445
4434
|
ref: i,
|
|
4446
4435
|
"onUpdate:modelValue": I[3] || (I[3] = (L) => o.value = L),
|
|
4447
4436
|
rows: "1",
|
|
4448
4437
|
"data-ai-input": "",
|
|
4449
|
-
placeholder:
|
|
4438
|
+
placeholder: m.value,
|
|
4450
4439
|
disabled: n.disabled,
|
|
4451
|
-
class:
|
|
4452
|
-
style: un(
|
|
4453
|
-
onInput:
|
|
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(p.value),
|
|
4442
|
+
onInput: g,
|
|
4454
4443
|
onKeydown: S,
|
|
4455
4444
|
onFocus: V,
|
|
4456
4445
|
onBlur: E
|
|
4457
|
-
}, null, 46,
|
|
4446
|
+
}, null, 46, Pi), [
|
|
4458
4447
|
[qs, o.value]
|
|
4459
4448
|
])
|
|
4460
4449
|
]),
|
|
4461
|
-
|
|
4450
|
+
me($i, {
|
|
4462
4451
|
sending: n.sending,
|
|
4463
|
-
"can-send":
|
|
4452
|
+
"can-send": y.value,
|
|
4464
4453
|
"support-request-mode": n.supportRequestMode,
|
|
4465
4454
|
"show-support-mode-toggle": n.showSupportModeToggle,
|
|
4466
4455
|
ui: s.value,
|
|
4467
4456
|
texts: n.texts,
|
|
4468
4457
|
onToggleSupportMode: I[4] || (I[4] = (L) => M.$emit("toggle-support-mode")),
|
|
4469
|
-
onClick:
|
|
4458
|
+
onClick: T
|
|
4470
4459
|
}, null, 8, ["sending", "can-send", "support-request-mode", "show-support-mode-toggle", "ui", "texts"])
|
|
4471
4460
|
], 2)
|
|
4472
4461
|
], 2),
|
|
4473
|
-
|
|
4474
|
-
n.contextLinkText ? (
|
|
4475
|
-
|
|
4462
|
+
he(M.$slots, "context-link", {}, () => [
|
|
4463
|
+
n.contextLinkText ? (x(), v("div", zi, [
|
|
4464
|
+
h("button", {
|
|
4476
4465
|
type: "button",
|
|
4477
|
-
class:
|
|
4466
|
+
class: b(["text-xs text-gray-400 hover:text-primary transition-colors", s.value.contextLink]),
|
|
4478
4467
|
onClick: I[5] || (I[5] = (L) => M.$emit("context-link-click"))
|
|
4479
|
-
},
|
|
4468
|
+
}, _(n.contextLinkText), 3)
|
|
4480
4469
|
])) : B("", !0)
|
|
4481
4470
|
])
|
|
4482
4471
|
])
|
|
@@ -4484,7 +4473,7 @@ const _o = /* @__PURE__ */ he({
|
|
|
4484
4473
|
], 34);
|
|
4485
4474
|
};
|
|
4486
4475
|
}
|
|
4487
|
-
}),
|
|
4476
|
+
}), Fi = ["onClick"], Bi = /* @__PURE__ */ ue({
|
|
4488
4477
|
__name: "AiEmptyState",
|
|
4489
4478
|
props: {
|
|
4490
4479
|
ui: {},
|
|
@@ -4492,142 +4481,142 @@ const _o = /* @__PURE__ */ he({
|
|
|
4492
4481
|
},
|
|
4493
4482
|
emits: ["item-click"],
|
|
4494
4483
|
setup(n, { emit: e }) {
|
|
4495
|
-
const t = n, s = e, r = (
|
|
4496
|
-
var
|
|
4497
|
-
return (
|
|
4484
|
+
const t = n, s = e, r = (w) => {
|
|
4485
|
+
var p;
|
|
4486
|
+
return (p = t.texts) != null && p[w] ? t.texts[w] : le({
|
|
4498
4487
|
aiName: "aiName",
|
|
4499
4488
|
title: "emptyStateTitle",
|
|
4500
4489
|
description: "emptyStateDescription"
|
|
4501
|
-
}[
|
|
4502
|
-
}, o =
|
|
4503
|
-
function c(
|
|
4504
|
-
const
|
|
4505
|
-
...
|
|
4506
|
-
prompt: a(
|
|
4490
|
+
}[w]);
|
|
4491
|
+
}, o = N(() => t.ui || {}), { suggestions: i, resolvePrompt: a } = Ms();
|
|
4492
|
+
function c(w) {
|
|
4493
|
+
const m = {
|
|
4494
|
+
...w,
|
|
4495
|
+
prompt: a(w)
|
|
4507
4496
|
};
|
|
4508
|
-
s("item-click",
|
|
4497
|
+
s("item-click", m);
|
|
4509
4498
|
}
|
|
4510
|
-
function u(
|
|
4511
|
-
return
|
|
4499
|
+
function u(w) {
|
|
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";
|
|
4512
4501
|
}
|
|
4513
|
-
function d(
|
|
4514
|
-
const
|
|
4502
|
+
function d(w) {
|
|
4503
|
+
const m = w.category || "default", p = {
|
|
4515
4504
|
hr: "bg-blue-100 dark:bg-blue-900/30",
|
|
4516
4505
|
finance: "bg-green-100 dark:bg-green-900/30",
|
|
4517
4506
|
analytics: "bg-purple-100 dark:bg-purple-900/30",
|
|
4518
4507
|
support: "bg-amber-100 dark:bg-amber-900/30",
|
|
4519
4508
|
default: "bg-primary/10"
|
|
4520
4509
|
};
|
|
4521
|
-
return
|
|
4510
|
+
return p[m] || p.default;
|
|
4522
4511
|
}
|
|
4523
|
-
function
|
|
4524
|
-
const
|
|
4512
|
+
function f(w) {
|
|
4513
|
+
const m = w.category || "default", p = {
|
|
4525
4514
|
hr: "text-blue-600 dark:text-blue-400",
|
|
4526
4515
|
finance: "text-green-600 dark:text-green-400",
|
|
4527
4516
|
analytics: "text-purple-600 dark:text-purple-400",
|
|
4528
4517
|
support: "text-amber-600 dark:text-amber-400",
|
|
4529
4518
|
default: "text-primary"
|
|
4530
4519
|
};
|
|
4531
|
-
return
|
|
4520
|
+
return p[m] || p.default;
|
|
4532
4521
|
}
|
|
4533
|
-
return (
|
|
4534
|
-
class:
|
|
4522
|
+
return (w, m) => (x(), v("div", {
|
|
4523
|
+
class: b(["flex items-center justify-center p-4 h-full", o.value.root])
|
|
4535
4524
|
}, [
|
|
4536
|
-
|
|
4537
|
-
class:
|
|
4525
|
+
h("div", {
|
|
4526
|
+
class: b(["w-full max-w-4xl", o.value.content])
|
|
4538
4527
|
}, [
|
|
4539
|
-
|
|
4540
|
-
class:
|
|
4528
|
+
h("div", {
|
|
4529
|
+
class: b(["mb-8 text-center", o.value.header])
|
|
4541
4530
|
}, [
|
|
4542
|
-
|
|
4543
|
-
class:
|
|
4531
|
+
h("div", {
|
|
4532
|
+
class: b(["mb-3 inline-flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2 text-sm font-medium text-primary", o.value.badge])
|
|
4544
4533
|
}, [
|
|
4545
|
-
|
|
4534
|
+
m[0] || (m[0] = h("svg", {
|
|
4546
4535
|
class: "w-4 h-4",
|
|
4547
4536
|
fill: "none",
|
|
4548
4537
|
viewBox: "0 0 24 24",
|
|
4549
4538
|
stroke: "currentColor",
|
|
4550
4539
|
"stroke-width": "1.5"
|
|
4551
4540
|
}, [
|
|
4552
|
-
|
|
4541
|
+
h("path", {
|
|
4553
4542
|
"stroke-linecap": "round",
|
|
4554
4543
|
"stroke-linejoin": "round",
|
|
4555
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"
|
|
4556
4545
|
})
|
|
4557
4546
|
], -1)),
|
|
4558
|
-
|
|
4547
|
+
h("span", null, _(r("aiName")), 1)
|
|
4559
4548
|
], 2),
|
|
4560
|
-
|
|
4561
|
-
class:
|
|
4562
|
-
},
|
|
4563
|
-
|
|
4564
|
-
class:
|
|
4565
|
-
},
|
|
4549
|
+
h("h1", {
|
|
4550
|
+
class: b(["mb-3 text-4xl font-bold tracking-tight text-gray-900 dark:text-white", o.value.title])
|
|
4551
|
+
}, _(r("title")), 3),
|
|
4552
|
+
h("p", {
|
|
4553
|
+
class: b(["text-gray-600 dark:text-gray-400", o.value.description])
|
|
4554
|
+
}, _(r("description")), 3)
|
|
4566
4555
|
], 2),
|
|
4567
|
-
|
|
4568
|
-
class:
|
|
4556
|
+
h("div", {
|
|
4557
|
+
class: b(["mb-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-3", o.value.grid])
|
|
4569
4558
|
}, [
|
|
4570
|
-
(
|
|
4571
|
-
key:
|
|
4572
|
-
class:
|
|
4573
|
-
onClick: (
|
|
4559
|
+
(x(!0), v(we, null, Ne(D(i), (p, A) => (x(), v("button", {
|
|
4560
|
+
key: p.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, u(p)]]),
|
|
4562
|
+
onClick: (y) => c(p)
|
|
4574
4563
|
}, [
|
|
4575
|
-
|
|
4576
|
-
class:
|
|
4564
|
+
h("div", {
|
|
4565
|
+
class: b(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, d(p)]])
|
|
4577
4566
|
}, [
|
|
4578
|
-
|
|
4567
|
+
p.icon ? (x(), Me(nn(p.icon), {
|
|
4579
4568
|
key: 0,
|
|
4580
|
-
class:
|
|
4581
|
-
}, null, 8, ["class"])) : (
|
|
4569
|
+
class: b(["h-5 w-5", [o.value.suggestionIcon, f(p)]])
|
|
4570
|
+
}, null, 8, ["class"])) : (x(), v("svg", {
|
|
4582
4571
|
key: 1,
|
|
4583
|
-
class:
|
|
4572
|
+
class: b(["h-5 w-5", [o.value.suggestionIcon, f(p)]]),
|
|
4584
4573
|
fill: "none",
|
|
4585
4574
|
viewBox: "0 0 24 24",
|
|
4586
4575
|
stroke: "currentColor",
|
|
4587
4576
|
"stroke-width": "1.5"
|
|
4588
|
-
}, [...
|
|
4589
|
-
|
|
4577
|
+
}, [...m[1] || (m[1] = [
|
|
4578
|
+
h("path", {
|
|
4590
4579
|
"stroke-linecap": "round",
|
|
4591
4580
|
"stroke-linejoin": "round",
|
|
4592
4581
|
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"
|
|
4593
4582
|
}, null, -1)
|
|
4594
4583
|
])], 2))
|
|
4595
4584
|
], 2),
|
|
4596
|
-
|
|
4597
|
-
class:
|
|
4598
|
-
},
|
|
4599
|
-
|
|
4600
|
-
class:
|
|
4601
|
-
},
|
|
4602
|
-
], 10,
|
|
4585
|
+
h("h3", {
|
|
4586
|
+
class: b(["mb-1 text-sm font-semibold text-gray-900 dark:text-white", o.value.suggestionTitle])
|
|
4587
|
+
}, _(p.title), 3),
|
|
4588
|
+
h("p", {
|
|
4589
|
+
class: b(["text-xs text-gray-600 dark:text-gray-400", o.value.suggestionDescription])
|
|
4590
|
+
}, _(p.description), 3)
|
|
4591
|
+
], 10, Fi))), 128))
|
|
4603
4592
|
], 2)
|
|
4604
4593
|
], 2)
|
|
4605
4594
|
], 2));
|
|
4606
4595
|
}
|
|
4607
|
-
}),
|
|
4596
|
+
}), Ui = { class: "flex items-center gap-3" }, qi = {
|
|
4608
4597
|
key: 1,
|
|
4609
4598
|
class: "text-xs text-gray-400 dark:text-gray-500 font-medium"
|
|
4610
|
-
},
|
|
4599
|
+
}, ji = {
|
|
4611
4600
|
key: 1,
|
|
4612
4601
|
class: "flex items-center gap-2"
|
|
4613
|
-
},
|
|
4602
|
+
}, Wi = {
|
|
4614
4603
|
key: 0,
|
|
4615
4604
|
class: "flex items-center gap-2 ml-auto mr-3"
|
|
4616
|
-
},
|
|
4605
|
+
}, Ki = ["title"], Vi = ["title"], Gi = ["title"], Qi = {
|
|
4617
4606
|
key: 0,
|
|
4618
4607
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4619
4608
|
fill: "none",
|
|
4620
4609
|
viewBox: "0 0 24 24",
|
|
4621
4610
|
stroke: "currentColor",
|
|
4622
4611
|
"stroke-width": "1.5"
|
|
4623
|
-
},
|
|
4612
|
+
}, Zi = {
|
|
4624
4613
|
key: 1,
|
|
4625
4614
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4626
4615
|
fill: "none",
|
|
4627
4616
|
viewBox: "0 0 24 24",
|
|
4628
4617
|
stroke: "currentColor",
|
|
4629
4618
|
"stroke-width": "1.5"
|
|
4630
|
-
},
|
|
4619
|
+
}, Yi = /* @__PURE__ */ ue({
|
|
4631
4620
|
__name: "DrawerHeader",
|
|
4632
4621
|
props: {
|
|
4633
4622
|
ui: {},
|
|
@@ -4646,125 +4635,125 @@ const _o = /* @__PURE__ */ he({
|
|
|
4646
4635
|
setup(n) {
|
|
4647
4636
|
return (e, t) => {
|
|
4648
4637
|
var s, r, o, i, a, c;
|
|
4649
|
-
return
|
|
4650
|
-
class:
|
|
4638
|
+
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", (s = n.ui) == null ? void 0 : s.header])
|
|
4651
4640
|
}, [
|
|
4652
|
-
|
|
4653
|
-
n.isSetupMode ? (
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
])])) : (
|
|
4657
|
-
n.showNewChatButton && n.hasHistory ? (
|
|
4641
|
+
h("div", Ui, [
|
|
4642
|
+
n.isSetupMode ? (x(), v("div", ji, [...t[5] || (t[5] = [
|
|
4643
|
+
h("span", { class: "flex h-2 w-2 rounded-full bg-amber-500 animate-pulse" }, null, -1),
|
|
4644
|
+
h("span", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, "Setup Required", -1)
|
|
4645
|
+
])])) : (x(), v(we, { key: 0 }, [
|
|
4646
|
+
n.showNewChatButton && n.hasHistory ? (x(), v("button", {
|
|
4658
4647
|
key: 0,
|
|
4659
4648
|
type: "button",
|
|
4660
|
-
class:
|
|
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", (r = n.ui) == null ? void 0 : r.newChatButton]),
|
|
4661
4650
|
onClick: t[0] || (t[0] = (u) => e.$emit("new-chat"))
|
|
4662
4651
|
}, [
|
|
4663
|
-
t[4] || (t[4] =
|
|
4652
|
+
t[4] || (t[4] = h("svg", {
|
|
4664
4653
|
class: "w-4 h-4",
|
|
4665
4654
|
fill: "none",
|
|
4666
4655
|
viewBox: "0 0 24 24",
|
|
4667
4656
|
stroke: "currentColor",
|
|
4668
4657
|
"stroke-width": "1.5"
|
|
4669
4658
|
}, [
|
|
4670
|
-
|
|
4659
|
+
h("path", {
|
|
4671
4660
|
"stroke-linecap": "round",
|
|
4672
4661
|
"stroke-linejoin": "round",
|
|
4673
4662
|
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"
|
|
4674
4663
|
})
|
|
4675
4664
|
], -1)),
|
|
4676
|
-
|
|
4677
|
-
], 2)) : (
|
|
4665
|
+
h("span", null, _(n.t("newChat")), 1)
|
|
4666
|
+
], 2)) : (x(), v("span", qi, _(n.t("keyboardShortcutHint")), 1))
|
|
4678
4667
|
], 64))
|
|
4679
4668
|
]),
|
|
4680
|
-
n.showQuota && !n.isSetupMode ? (
|
|
4681
|
-
|
|
4669
|
+
n.showQuota && !n.isSetupMode ? (x(), v("div", Wi, [
|
|
4670
|
+
he(e.$slots, "quota", {}, () => {
|
|
4682
4671
|
var u, d;
|
|
4683
4672
|
return [
|
|
4684
|
-
n.quota.remaining > 0 ? (
|
|
4673
|
+
n.quota.remaining > 0 ? (x(), v("span", {
|
|
4685
4674
|
key: 0,
|
|
4686
|
-
class:
|
|
4687
|
-
},
|
|
4675
|
+
class: b(["text-xs text-green-600 dark:text-green-400", (u = n.ui) == null ? void 0 : u.quotaDisplay])
|
|
4676
|
+
}, _(n.quota.remaining) + " " + _(n.t("quotaRemaining")), 3)) : n.quota.remaining === 0 ? (x(), v("span", {
|
|
4688
4677
|
key: 1,
|
|
4689
|
-
class:
|
|
4690
|
-
},
|
|
4678
|
+
class: b(["text-xs text-red-600 dark:text-red-400", (d = n.ui) == null ? void 0 : d.quotaDisplay])
|
|
4679
|
+
}, _(n.t("noQuota")), 3)) : B("", !0)
|
|
4691
4680
|
];
|
|
4692
4681
|
})
|
|
4693
4682
|
])) : B("", !0),
|
|
4694
|
-
|
|
4695
|
-
class:
|
|
4683
|
+
h("div", {
|
|
4684
|
+
class: b(["flex items-center gap-1", (o = n.ui) == null ? void 0 : o.headerActions])
|
|
4696
4685
|
}, [
|
|
4697
|
-
n.showCloseButton ? (
|
|
4686
|
+
n.showCloseButton ? (x(), v("button", {
|
|
4698
4687
|
key: 0,
|
|
4699
4688
|
type: "button",
|
|
4700
|
-
class:
|
|
4689
|
+
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (i = n.ui) == null ? void 0 : i.headerActionButton]),
|
|
4701
4690
|
title: n.t("close"),
|
|
4702
4691
|
onClick: t[1] || (t[1] = (u) => e.$emit("close"))
|
|
4703
4692
|
}, [...t[6] || (t[6] = [
|
|
4704
|
-
|
|
4693
|
+
h("svg", {
|
|
4705
4694
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4706
4695
|
fill: "none",
|
|
4707
4696
|
viewBox: "0 0 24 24",
|
|
4708
4697
|
stroke: "currentColor",
|
|
4709
4698
|
"stroke-width": "1.5"
|
|
4710
4699
|
}, [
|
|
4711
|
-
|
|
4700
|
+
h("path", {
|
|
4712
4701
|
"stroke-linecap": "round",
|
|
4713
4702
|
"stroke-linejoin": "round",
|
|
4714
4703
|
d: "M6 18L18 6M6 6l12 12"
|
|
4715
4704
|
})
|
|
4716
4705
|
], -1)
|
|
4717
|
-
])], 10,
|
|
4718
|
-
n.showMinimizeButton ? (
|
|
4706
|
+
])], 10, Ki)) : B("", !0),
|
|
4707
|
+
n.showMinimizeButton ? (x(), v("button", {
|
|
4719
4708
|
key: 1,
|
|
4720
4709
|
type: "button",
|
|
4721
|
-
class:
|
|
4710
|
+
class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (a = n.ui) == null ? void 0 : a.headerActionButton]),
|
|
4722
4711
|
title: n.t("minimize"),
|
|
4723
4712
|
onClick: t[2] || (t[2] = (u) => e.$emit("minimize"))
|
|
4724
4713
|
}, [...t[7] || (t[7] = [
|
|
4725
|
-
|
|
4714
|
+
h("svg", {
|
|
4726
4715
|
class: "w-5 h-5 text-gray-600 dark:text-gray-400",
|
|
4727
4716
|
fill: "none",
|
|
4728
4717
|
viewBox: "0 0 24 24",
|
|
4729
4718
|
stroke: "currentColor",
|
|
4730
4719
|
"stroke-width": "1.5"
|
|
4731
4720
|
}, [
|
|
4732
|
-
|
|
4721
|
+
h("path", {
|
|
4733
4722
|
"stroke-linecap": "round",
|
|
4734
4723
|
"stroke-linejoin": "round",
|
|
4735
4724
|
d: "M5 12h14"
|
|
4736
4725
|
})
|
|
4737
4726
|
], -1)
|
|
4738
|
-
])], 10,
|
|
4739
|
-
n.showFullscreenToggle ? (
|
|
4727
|
+
])], 10, Vi)) : B("", !0),
|
|
4728
|
+
n.showFullscreenToggle ? (x(), v("button", {
|
|
4740
4729
|
key: 2,
|
|
4741
4730
|
type: "button",
|
|
4742
|
-
class:
|
|
4731
|
+
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]),
|
|
4743
4732
|
title: n.isFullscreen ? n.t("exitFullscreen") : n.t("fullscreen"),
|
|
4744
4733
|
onClick: t[3] || (t[3] = (u) => e.$emit("toggle-fullscreen"))
|
|
4745
4734
|
}, [
|
|
4746
|
-
n.isFullscreen ? (
|
|
4747
|
-
|
|
4735
|
+
n.isFullscreen ? (x(), v("svg", Zi, [...t[9] || (t[9] = [
|
|
4736
|
+
h("path", {
|
|
4748
4737
|
"stroke-linecap": "round",
|
|
4749
4738
|
"stroke-linejoin": "round",
|
|
4750
4739
|
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"
|
|
4751
4740
|
}, null, -1)
|
|
4752
|
-
])])) : (
|
|
4753
|
-
|
|
4741
|
+
])])) : (x(), v("svg", Qi, [...t[8] || (t[8] = [
|
|
4742
|
+
h("path", {
|
|
4754
4743
|
"stroke-linecap": "round",
|
|
4755
4744
|
"stroke-linejoin": "round",
|
|
4756
4745
|
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"
|
|
4757
4746
|
}, null, -1)
|
|
4758
4747
|
])]))
|
|
4759
|
-
], 10,
|
|
4748
|
+
], 10, Gi)) : B("", !0)
|
|
4760
4749
|
], 2)
|
|
4761
4750
|
], 2);
|
|
4762
4751
|
};
|
|
4763
4752
|
}
|
|
4764
|
-
}),
|
|
4753
|
+
}), 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 = {
|
|
4765
4754
|
key: 0,
|
|
4766
4755
|
class: "flex justify-center"
|
|
4767
|
-
},
|
|
4756
|
+
}, na = ["title"], sa = /* @__PURE__ */ ue({
|
|
4768
4757
|
__name: "DrawerMessageList",
|
|
4769
4758
|
props: {
|
|
4770
4759
|
messages: {},
|
|
@@ -4778,109 +4767,109 @@ const _o = /* @__PURE__ */ he({
|
|
|
4778
4767
|
setup(n) {
|
|
4779
4768
|
return (e, t) => {
|
|
4780
4769
|
var s, r, o;
|
|
4781
|
-
return
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
t[3] || (t[3] =
|
|
4770
|
+
return x(), v("div", Xi, [
|
|
4771
|
+
h("div", Ji, [
|
|
4772
|
+
h("div", ea, [
|
|
4773
|
+
t[3] || (t[3] = h("svg", {
|
|
4785
4774
|
class: "w-4 h-4",
|
|
4786
4775
|
fill: "none",
|
|
4787
4776
|
viewBox: "0 0 24 24",
|
|
4788
4777
|
stroke: "currentColor",
|
|
4789
4778
|
"stroke-width": "1.5"
|
|
4790
4779
|
}, [
|
|
4791
|
-
|
|
4780
|
+
h("path", {
|
|
4792
4781
|
"stroke-linecap": "round",
|
|
4793
4782
|
"stroke-linejoin": "round",
|
|
4794
4783
|
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"
|
|
4795
4784
|
})
|
|
4796
4785
|
], -1)),
|
|
4797
|
-
|
|
4786
|
+
h("span", null, _(n.t("title") || D(le)("aiName")), 1)
|
|
4798
4787
|
])
|
|
4799
4788
|
]),
|
|
4800
|
-
(
|
|
4789
|
+
(x(!0), v(we, null, Ne(n.messages, (i, a) => he(e.$slots, "message", {
|
|
4801
4790
|
key: i.id || a,
|
|
4802
4791
|
message: i,
|
|
4803
4792
|
isUser: i.role === "user",
|
|
4804
4793
|
isLoading: i.loading,
|
|
4805
4794
|
isStreaming: i.streaming
|
|
4806
4795
|
}, () => [
|
|
4807
|
-
|
|
4796
|
+
me(ai, {
|
|
4808
4797
|
message: i,
|
|
4809
4798
|
"loading-text": n.loadingMessage,
|
|
4810
4799
|
onCopy: t[0] || (t[0] = (c) => e.$emit("copy", c))
|
|
4811
4800
|
}, null, 8, ["message", "loading-text"])
|
|
4812
4801
|
])), 128)),
|
|
4813
|
-
n.quota.remaining === 0 ? (
|
|
4814
|
-
|
|
4802
|
+
n.quota.remaining === 0 ? (x(), v("div", ta, [
|
|
4803
|
+
h("button", {
|
|
4815
4804
|
type: "button",
|
|
4816
4805
|
class: "inline-flex items-center gap-2 px-6 py-3 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-all shadow-sm",
|
|
4817
4806
|
onClick: t[1] || (t[1] = (i) => e.$emit("contact-support"))
|
|
4818
4807
|
}, [
|
|
4819
|
-
t[4] || (t[4] =
|
|
4808
|
+
t[4] || (t[4] = h("svg", {
|
|
4820
4809
|
class: "w-5 h-5",
|
|
4821
4810
|
fill: "none",
|
|
4822
4811
|
stroke: "currentColor",
|
|
4823
4812
|
viewBox: "0 0 24 24"
|
|
4824
4813
|
}, [
|
|
4825
|
-
|
|
4814
|
+
h("path", {
|
|
4826
4815
|
"stroke-linecap": "round",
|
|
4827
4816
|
"stroke-linejoin": "round",
|
|
4828
4817
|
"stroke-width": "2",
|
|
4829
4818
|
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"
|
|
4830
4819
|
})
|
|
4831
4820
|
], -1)),
|
|
4832
|
-
|
|
4821
|
+
h("span", null, _(D(le)("contactSupport")), 1)
|
|
4833
4822
|
])
|
|
4834
4823
|
])) : B("", !0),
|
|
4835
|
-
n.error.message ? (
|
|
4824
|
+
n.error.message ? (x(), v("div", {
|
|
4836
4825
|
key: 1,
|
|
4837
|
-
class:
|
|
4826
|
+
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])
|
|
4838
4827
|
}, [
|
|
4839
|
-
|
|
4840
|
-
class:
|
|
4841
|
-
},
|
|
4842
|
-
|
|
4828
|
+
h("span", {
|
|
4829
|
+
class: b((r = n.ui) == null ? void 0 : r.errorMessage)
|
|
4830
|
+
}, _(n.error.message), 3),
|
|
4831
|
+
h("button", {
|
|
4843
4832
|
type: "button",
|
|
4844
|
-
class:
|
|
4833
|
+
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]),
|
|
4845
4834
|
title: n.t("retry"),
|
|
4846
4835
|
onClick: t[2] || (t[2] = (i) => e.$emit("retry"))
|
|
4847
4836
|
}, [...t[5] || (t[5] = [
|
|
4848
|
-
|
|
4837
|
+
h("svg", {
|
|
4849
4838
|
class: "w-4 h-4",
|
|
4850
4839
|
fill: "none",
|
|
4851
4840
|
stroke: "currentColor",
|
|
4852
4841
|
viewBox: "0 0 24 24"
|
|
4853
4842
|
}, [
|
|
4854
|
-
|
|
4843
|
+
h("path", {
|
|
4855
4844
|
"stroke-linecap": "round",
|
|
4856
4845
|
"stroke-linejoin": "round",
|
|
4857
4846
|
"stroke-width": "2",
|
|
4858
4847
|
d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
4859
4848
|
})
|
|
4860
4849
|
], -1)
|
|
4861
|
-
])], 10,
|
|
4850
|
+
])], 10, na)
|
|
4862
4851
|
], 2)) : B("", !0)
|
|
4863
4852
|
]);
|
|
4864
4853
|
};
|
|
4865
4854
|
}
|
|
4866
|
-
}),
|
|
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__ */ ue({
|
|
4867
4856
|
__name: "SetupGuide",
|
|
4868
4857
|
props: {
|
|
4869
4858
|
copied: { type: Boolean }
|
|
4870
4859
|
},
|
|
4871
4860
|
emits: ["copy"],
|
|
4872
4861
|
setup(n) {
|
|
4873
|
-
return (e, t) => (
|
|
4862
|
+
return (e, t) => (x(), v(we, null, [
|
|
4874
4863
|
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)),
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
t[1] || (t[1] =
|
|
4879
|
-
|
|
4864
|
+
h("div", ra, [
|
|
4865
|
+
h("div", oa, [
|
|
4866
|
+
h("div", ia, [
|
|
4867
|
+
t[1] || (t[1] = h("span", { class: "text-xs text-gray-400" }, "main.ts", -1)),
|
|
4868
|
+
h("button", {
|
|
4880
4869
|
type: "button",
|
|
4881
4870
|
class: "text-xs text-gray-400 hover:text-white transition-colors",
|
|
4882
4871
|
onClick: t[0] || (t[0] = (s) => e.$emit("copy"))
|
|
4883
|
-
},
|
|
4872
|
+
}, _(n.copied ? "✓ Copied" : "Copy"), 1)
|
|
4884
4873
|
]),
|
|
4885
4874
|
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>
|
|
4886
4875
|
|
|
@@ -4892,9 +4881,9 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4892
4881
|
<span class="text-blue-300">getAuthToken</span>: () => <span class="text-yellow-300">getToken</span>(),
|
|
4893
4882
|
})</code></pre>`, 1))
|
|
4894
4883
|
]),
|
|
4895
|
-
t[3] || (t[3] =
|
|
4884
|
+
t[3] || (t[3] = h("p", { class: "text-xs text-gray-400 dark:text-gray-500 mt-4 text-center" }, [
|
|
4896
4885
|
js(" Need help? Check the "),
|
|
4897
|
-
|
|
4886
|
+
h("a", {
|
|
4898
4887
|
href: "https://github.com/doderasoftware/restify-ai",
|
|
4899
4888
|
target: "_blank",
|
|
4900
4889
|
class: "text-primary hover:underline"
|
|
@@ -4903,16 +4892,16 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4903
4892
|
])
|
|
4904
4893
|
], 64));
|
|
4905
4894
|
}
|
|
4906
|
-
}),
|
|
4895
|
+
}), la = {
|
|
4907
4896
|
key: 0,
|
|
4908
4897
|
class: "absolute inset-0 bg-black/50 flex items-center justify-center z-10"
|
|
4909
|
-
},
|
|
4898
|
+
}, ua = {
|
|
4910
4899
|
key: 0,
|
|
4911
4900
|
class: "flex items-center gap-3 mb-4"
|
|
4912
|
-
},
|
|
4901
|
+
}, ca = { class: "text-lg font-semibold text-gray-900 dark:text-white" }, da = {
|
|
4913
4902
|
key: 1,
|
|
4914
4903
|
class: "text-lg font-semibold text-gray-900 dark:text-white mb-2"
|
|
4915
|
-
},
|
|
4904
|
+
}, ha = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, pa = { class: "flex justify-end gap-3" }, ss = /* @__PURE__ */ ue({
|
|
4916
4905
|
__name: "ConfirmDialog",
|
|
4917
4906
|
props: {
|
|
4918
4907
|
show: { type: Boolean },
|
|
@@ -4926,15 +4915,15 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4926
4915
|
},
|
|
4927
4916
|
emits: ["confirm", "cancel"],
|
|
4928
4917
|
setup(n) {
|
|
4929
|
-
const e = n, t =
|
|
4918
|
+
const e = n, t = N(() => {
|
|
4930
4919
|
var r, o;
|
|
4931
4920
|
return e.icon === "warning" ? (r = e.ui) == null ? void 0 : r.historyLimitModal : (o = e.ui) == null ? void 0 : o.closeConfirmModal;
|
|
4932
|
-
}), s =
|
|
4921
|
+
}), s = N(() => {
|
|
4933
4922
|
var i, a;
|
|
4934
4923
|
const r = e.confirmVariant === "danger" ? "bg-red-600 hover:bg-red-700" : "bg-primary-500 hover:bg-primary-600", o = e.confirmVariant === "danger" ? (i = e.ui) == null ? void 0 : i.closeConfirmButton : (a = e.ui) == null ? void 0 : a.historyLimitButton;
|
|
4935
4924
|
return [r, o];
|
|
4936
4925
|
});
|
|
4937
|
-
return (r, o) => (
|
|
4926
|
+
return (r, o) => (x(), Me(mt, {
|
|
4938
4927
|
"enter-active-class": "transition ease-out duration-200",
|
|
4939
4928
|
"enter-from-class": "opacity-0",
|
|
4940
4929
|
"enter-to-class": "opacity-100",
|
|
@@ -4945,40 +4934,40 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4945
4934
|
default: Ce(() => {
|
|
4946
4935
|
var i;
|
|
4947
4936
|
return [
|
|
4948
|
-
n.show ? (
|
|
4949
|
-
|
|
4950
|
-
class:
|
|
4937
|
+
n.show ? (x(), v("div", la, [
|
|
4938
|
+
h("div", {
|
|
4939
|
+
class: b(["bg-white dark:bg-gray-800 rounded-xl p-6 m-4 max-w-sm w-full shadow-xl", t.value])
|
|
4951
4940
|
}, [
|
|
4952
|
-
n.icon === "warning" ? (
|
|
4953
|
-
o[2] || (o[2] =
|
|
4954
|
-
|
|
4941
|
+
n.icon === "warning" ? (x(), v("div", ua, [
|
|
4942
|
+
o[2] || (o[2] = h("div", { class: "flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center" }, [
|
|
4943
|
+
h("svg", {
|
|
4955
4944
|
class: "w-5 h-5 text-amber-600 dark:text-amber-400",
|
|
4956
4945
|
fill: "none",
|
|
4957
4946
|
viewBox: "0 0 24 24",
|
|
4958
4947
|
stroke: "currentColor",
|
|
4959
4948
|
"stroke-width": "2"
|
|
4960
4949
|
}, [
|
|
4961
|
-
|
|
4950
|
+
h("path", {
|
|
4962
4951
|
"stroke-linecap": "round",
|
|
4963
4952
|
"stroke-linejoin": "round",
|
|
4964
4953
|
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
4965
4954
|
})
|
|
4966
4955
|
])
|
|
4967
4956
|
], -1)),
|
|
4968
|
-
|
|
4969
|
-
])) : (
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4957
|
+
h("h3", ca, _(n.title), 1)
|
|
4958
|
+
])) : (x(), v("h3", da, _(n.title), 1)),
|
|
4959
|
+
h("p", ha, _(n.message), 1),
|
|
4960
|
+
h("div", pa, [
|
|
4961
|
+
h("button", {
|
|
4973
4962
|
type: "button",
|
|
4974
|
-
class:
|
|
4963
|
+
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]),
|
|
4975
4964
|
onClick: o[0] || (o[0] = (a) => r.$emit("cancel"))
|
|
4976
|
-
},
|
|
4977
|
-
|
|
4965
|
+
}, _(n.cancelText), 3),
|
|
4966
|
+
h("button", {
|
|
4978
4967
|
type: "button",
|
|
4979
|
-
class:
|
|
4968
|
+
class: b(["px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors", s.value]),
|
|
4980
4969
|
onClick: o[1] || (o[1] = (a) => r.$emit("confirm"))
|
|
4981
|
-
},
|
|
4970
|
+
}, _(n.confirmText), 3)
|
|
4982
4971
|
])
|
|
4983
4972
|
], 2)
|
|
4984
4973
|
])) : B("", !0)
|
|
@@ -4987,13 +4976,13 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
4987
4976
|
_: 1
|
|
4988
4977
|
}));
|
|
4989
4978
|
}
|
|
4990
|
-
}),
|
|
4979
|
+
}), fa = {
|
|
4991
4980
|
key: 0,
|
|
4992
4981
|
class: "flex-1 flex flex-col items-center justify-center p-6 overflow-y-auto"
|
|
4993
|
-
},
|
|
4982
|
+
}, ga = {
|
|
4994
4983
|
key: 0,
|
|
4995
4984
|
class: "flex-1 flex flex-col overflow-y-auto"
|
|
4996
|
-
},
|
|
4985
|
+
}, ma = /* @__PURE__ */ ue({
|
|
4997
4986
|
__name: "AiChatDrawer",
|
|
4998
4987
|
props: {
|
|
4999
4988
|
modelValue: { type: Boolean },
|
|
@@ -5018,50 +5007,50 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5018
5007
|
},
|
|
5019
5008
|
emits: ["update:modelValue", "close", "contact-support", "new-chat"],
|
|
5020
5009
|
setup(n, { emit: e }) {
|
|
5021
|
-
const t = n, s = e, r =
|
|
5010
|
+
const t = n, s = e, r = N({
|
|
5022
5011
|
get: () => t.modelValue,
|
|
5023
|
-
set: (
|
|
5012
|
+
set: (O) => s("update:modelValue", O)
|
|
5024
5013
|
});
|
|
5025
|
-
function o(
|
|
5014
|
+
function o(O, K) {
|
|
5026
5015
|
var te;
|
|
5027
|
-
const G = (te = t.texts) == null ? void 0 : te[
|
|
5016
|
+
const G = (te = t.texts) == null ? void 0 : te[O];
|
|
5028
5017
|
if (G) {
|
|
5029
5018
|
let X = G;
|
|
5030
5019
|
if (K)
|
|
5031
|
-
for (const [J,
|
|
5032
|
-
X = X.replace(`{${J}}`, String(
|
|
5020
|
+
for (const [J, ce] of Object.entries(K))
|
|
5021
|
+
X = X.replace(`{${J}}`, String(ce));
|
|
5033
5022
|
return X;
|
|
5034
5023
|
}
|
|
5035
|
-
return le(
|
|
5024
|
+
return le(O, K);
|
|
5036
5025
|
}
|
|
5037
|
-
const i = We(), a =
|
|
5026
|
+
const i = We(), a = U(""), c = U(null), u = U(!1), d = U(!1), f = U(!1), { loadingMessage: w, startLoadingText: m, resetLoadingText: p } = Ro(
|
|
5038
5027
|
() => i.sending,
|
|
5039
5028
|
() => t.loadingText
|
|
5040
5029
|
), {
|
|
5041
5030
|
showHistoryLimitWarning: A,
|
|
5042
|
-
historyLimitReached:
|
|
5043
|
-
historyLimitDialogTitle:
|
|
5031
|
+
historyLimitReached: y,
|
|
5032
|
+
historyLimitDialogTitle: g,
|
|
5044
5033
|
historyLimitDialogMessage: S,
|
|
5045
5034
|
dismissHistoryLimitWarning: C,
|
|
5046
|
-
handleHistoryLimitAction:
|
|
5035
|
+
handleHistoryLimitAction: T,
|
|
5047
5036
|
checkHistoryLimit: z,
|
|
5048
5037
|
setPendingMessage: F
|
|
5049
|
-
} =
|
|
5038
|
+
} = Lo({
|
|
5050
5039
|
getHistoryLength: () => i.chatHistory.length,
|
|
5051
5040
|
getStoreLimit: () => i.chatHistoryLimit,
|
|
5052
5041
|
getConfig: () => t.historyLimit,
|
|
5053
5042
|
getTexts: () => t.texts,
|
|
5054
5043
|
onStartNewChat: () => i.clearChatHistory(),
|
|
5055
5044
|
onNewChatEmit: () => s("new-chat")
|
|
5056
|
-
}), V =
|
|
5045
|
+
}), V = N(() => !os()), E = N(() => tt("enableSupportMode") ?? !1), { suggestions: M, resolvePrompt: I } = Ms(), P = N(() => {
|
|
5057
5046
|
if (V.value) return [];
|
|
5058
|
-
const
|
|
5047
|
+
const O = a.value.toLowerCase().trim(), K = M.value || [];
|
|
5059
5048
|
let G = K;
|
|
5060
|
-
if (
|
|
5061
|
-
const te = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), X =
|
|
5049
|
+
if (O) {
|
|
5050
|
+
const te = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), X = O.split(/\s+/).filter((J) => !te.has(J));
|
|
5062
5051
|
X.length > 0 && (G = K.filter((J) => {
|
|
5063
|
-
const
|
|
5064
|
-
return X.every((Se) =>
|
|
5052
|
+
const ce = `${J.title} ${J.description || ""}`.toLowerCase();
|
|
5053
|
+
return X.every((Se) => ce.includes(Se));
|
|
5065
5054
|
}));
|
|
5066
5055
|
}
|
|
5067
5056
|
return G.slice(0, 5).map((te) => ({
|
|
@@ -5069,7 +5058,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5069
5058
|
title: te.title,
|
|
5070
5059
|
description: te.description || ""
|
|
5071
5060
|
}));
|
|
5072
|
-
}), L =
|
|
5061
|
+
}), L = N(() => ({
|
|
5073
5062
|
quota: i.quota,
|
|
5074
5063
|
isFullscreen: u.value,
|
|
5075
5064
|
hasHistory: i.chatHistory.length > 0,
|
|
@@ -5077,15 +5066,15 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5077
5066
|
onClose: He,
|
|
5078
5067
|
onMinimize: Re,
|
|
5079
5068
|
onToggleFullscreen: ze
|
|
5080
|
-
})), ne =
|
|
5069
|
+
})), ne = N(() => ({
|
|
5081
5070
|
modelValue: a.value,
|
|
5082
5071
|
sending: i.sending,
|
|
5083
5072
|
disabled: !1,
|
|
5084
5073
|
onSubmit: Le,
|
|
5085
5074
|
onCancel: () => i.cancelRequest()
|
|
5086
5075
|
}));
|
|
5087
|
-
function Te(
|
|
5088
|
-
const K = (M.value || []).find((G) => G.id ===
|
|
5076
|
+
function Te(O) {
|
|
5077
|
+
const K = (M.value || []).find((G) => G.id === O.id);
|
|
5089
5078
|
K && (a.value = I(K));
|
|
5090
5079
|
}
|
|
5091
5080
|
function ze() {
|
|
@@ -5095,10 +5084,10 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5095
5084
|
r.value = !1;
|
|
5096
5085
|
}
|
|
5097
5086
|
function He() {
|
|
5098
|
-
t.confirmClose && !V.value && i.chatHistory.length > 0 ?
|
|
5087
|
+
t.confirmClose && !V.value && i.chatHistory.length > 0 ? f.value = !0 : (r.value = !1, s("close"));
|
|
5099
5088
|
}
|
|
5100
5089
|
function bt() {
|
|
5101
|
-
|
|
5090
|
+
f.value = !1, i.clearChatHistory(), r.value = !1, s("close");
|
|
5102
5091
|
}
|
|
5103
5092
|
function Bt() {
|
|
5104
5093
|
s("contact-support");
|
|
@@ -5107,17 +5096,17 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5107
5096
|
i.toggleSupportMode();
|
|
5108
5097
|
}
|
|
5109
5098
|
async function Y() {
|
|
5110
|
-
await
|
|
5111
|
-
const
|
|
5112
|
-
|
|
5099
|
+
await _e();
|
|
5100
|
+
const O = document.getElementById("rai-chat-bottom");
|
|
5101
|
+
O && O.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
5113
5102
|
}
|
|
5114
|
-
function st(
|
|
5115
|
-
a.value =
|
|
5103
|
+
function st(O) {
|
|
5104
|
+
a.value = O.prompt, i.clearError();
|
|
5116
5105
|
}
|
|
5117
5106
|
function se() {
|
|
5118
5107
|
i.clearChatHistory(), s("new-chat");
|
|
5119
5108
|
}
|
|
5120
|
-
function Tt(
|
|
5109
|
+
function Tt(O) {
|
|
5121
5110
|
}
|
|
5122
5111
|
function Z() {
|
|
5123
5112
|
navigator.clipboard.writeText(`import { RestifyAiPlugin } from '@doderasoftware/restify-ai'
|
|
@@ -5133,22 +5122,22 @@ app.use(RestifyAiPlugin, {
|
|
|
5133
5122
|
}, 2e3);
|
|
5134
5123
|
}
|
|
5135
5124
|
async function Fe() {
|
|
5136
|
-
const
|
|
5137
|
-
|
|
5125
|
+
const O = await T();
|
|
5126
|
+
O && (await _e(), await Ve(O.message, O.attachments, O.mentions, O.isSupportRequest));
|
|
5138
5127
|
}
|
|
5139
|
-
async function Ve(
|
|
5140
|
-
i.clearError(),
|
|
5141
|
-
const X = await i.askQuestion(
|
|
5142
|
-
|
|
5128
|
+
async function Ve(O, K, G, te) {
|
|
5129
|
+
i.clearError(), m(), await _e(), Y();
|
|
5130
|
+
const X = await i.askQuestion(O, K, G, te);
|
|
5131
|
+
p(), X && Y();
|
|
5143
5132
|
}
|
|
5144
|
-
async function Le(
|
|
5145
|
-
const { message: K, attachments: G, mentions: te, isSupportRequest: X } =
|
|
5133
|
+
async function Le(O) {
|
|
5134
|
+
const { message: K, attachments: G, mentions: te, isSupportRequest: X } = O;
|
|
5146
5135
|
if (i.sending) return;
|
|
5147
|
-
const J = te.map((
|
|
5148
|
-
id:
|
|
5149
|
-
name:
|
|
5150
|
-
type:
|
|
5151
|
-
metadata:
|
|
5136
|
+
const J = te.map((ce) => ({
|
|
5137
|
+
id: ce.id,
|
|
5138
|
+
name: ce.name,
|
|
5139
|
+
type: ce.type || "unknown",
|
|
5140
|
+
metadata: ce.metadata
|
|
5152
5141
|
}));
|
|
5153
5142
|
if (!z()) {
|
|
5154
5143
|
F({ message: K, attachments: G, mentions: J, isSupportRequest: X });
|
|
@@ -5157,52 +5146,52 @@ app.use(RestifyAiPlugin, {
|
|
|
5157
5146
|
await Ve(K, G, J, X);
|
|
5158
5147
|
}
|
|
5159
5148
|
async function St() {
|
|
5160
|
-
|
|
5161
|
-
const
|
|
5162
|
-
|
|
5149
|
+
m();
|
|
5150
|
+
const O = await i.retry();
|
|
5151
|
+
p(), O && Y();
|
|
5163
5152
|
}
|
|
5164
|
-
function Ge(
|
|
5165
|
-
t.closeOnEscape &&
|
|
5153
|
+
function Ge(O) {
|
|
5154
|
+
t.closeOnEscape && O.key === "Escape" && r.value && (f.value ? f.value = !1 : Re());
|
|
5166
5155
|
}
|
|
5167
|
-
return Ue(() => t.modelValue, (
|
|
5168
|
-
|
|
5156
|
+
return Ue(() => t.modelValue, (O) => {
|
|
5157
|
+
O && t.autoFetchQuota && i.fetchQuota();
|
|
5169
5158
|
}, { immediate: !0 }), xt(() => {
|
|
5170
5159
|
window.addEventListener("keydown", Ge);
|
|
5171
5160
|
}), yt(() => {
|
|
5172
5161
|
window.removeEventListener("keydown", Ge);
|
|
5173
|
-
}), (
|
|
5174
|
-
|
|
5162
|
+
}), (O, K) => (x(), Me(Ws, { to: "body" }, [
|
|
5163
|
+
me(mt, { name: "rai-fade" }, {
|
|
5175
5164
|
default: Ce(() => {
|
|
5176
5165
|
var G;
|
|
5177
5166
|
return [
|
|
5178
|
-
r.value && n.showBackdrop ? (
|
|
5167
|
+
r.value && n.showBackdrop ? (x(), v("div", {
|
|
5179
5168
|
key: 0,
|
|
5180
|
-
class:
|
|
5169
|
+
class: b(["fixed inset-0 bg-black/30 z-40", (G = n.ui) == null ? void 0 : G.backdrop]),
|
|
5181
5170
|
onClick: K[0] || (K[0] = (te) => n.closeOnBackdropClick && Re())
|
|
5182
5171
|
}, null, 2)) : B("", !0)
|
|
5183
5172
|
];
|
|
5184
5173
|
}),
|
|
5185
5174
|
_: 1
|
|
5186
5175
|
}),
|
|
5187
|
-
|
|
5176
|
+
me(mt, {
|
|
5188
5177
|
name: n.position === "left" ? "rai-slide-right" : "rai-slide-left"
|
|
5189
5178
|
}, {
|
|
5190
5179
|
default: Ce(() => {
|
|
5191
5180
|
var G, te, X;
|
|
5192
5181
|
return [
|
|
5193
|
-
r.value ? (
|
|
5182
|
+
r.value ? (x(), v("aside", {
|
|
5194
5183
|
key: 0,
|
|
5195
|
-
class:
|
|
5184
|
+
class: b(["fixed bottom-0 z-50 flex-shrink-0 border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-2xl will-change-transform", [
|
|
5196
5185
|
n.position === "left" ? "left-0 border-r" : "right-0 border-l",
|
|
5197
5186
|
(G = n.ui) == null ? void 0 : G.drawer
|
|
5198
5187
|
]]),
|
|
5199
5188
|
style: un({ width: u.value ? n.fullscreenWidth : n.width, top: n.topOffset, height: `calc(100vh - ${n.topOffset})` })
|
|
5200
5189
|
}, [
|
|
5201
|
-
|
|
5202
|
-
class:
|
|
5190
|
+
h("div", {
|
|
5191
|
+
class: b(["h-full flex flex-col relative bg-white dark:bg-gray-900", (te = n.ui) == null ? void 0 : te.panel])
|
|
5203
5192
|
}, [
|
|
5204
|
-
|
|
5205
|
-
|
|
5193
|
+
he(O.$slots, "header", Pn(zn(L.value)), () => [
|
|
5194
|
+
me(Yi, {
|
|
5206
5195
|
ui: n.ui,
|
|
5207
5196
|
"is-setup-mode": V.value,
|
|
5208
5197
|
"show-new-chat-button": n.showNewChatButton,
|
|
@@ -5220,40 +5209,40 @@ app.use(RestifyAiPlugin, {
|
|
|
5220
5209
|
onToggleFullscreen: ze
|
|
5221
5210
|
}, {
|
|
5222
5211
|
quota: Ce(() => [
|
|
5223
|
-
|
|
5212
|
+
he(O.$slots, "quota", {
|
|
5224
5213
|
quota: D(i).quota
|
|
5225
5214
|
}, void 0, !0)
|
|
5226
5215
|
]),
|
|
5227
5216
|
_: 3
|
|
5228
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"])
|
|
5229
5218
|
], !0),
|
|
5230
|
-
|
|
5231
|
-
class:
|
|
5219
|
+
h("div", {
|
|
5220
|
+
class: b(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl": u.value }, (X = n.ui) == null ? void 0 : X.body]])
|
|
5232
5221
|
}, [
|
|
5233
|
-
V.value ? (
|
|
5234
|
-
|
|
5235
|
-
|
|
5222
|
+
V.value ? (x(), v("div", fa, [
|
|
5223
|
+
he(O.$slots, "setup", {}, () => [
|
|
5224
|
+
me(aa, {
|
|
5236
5225
|
copied: d.value,
|
|
5237
5226
|
onCopy: Z
|
|
5238
5227
|
}, null, 8, ["copied"])
|
|
5239
5228
|
], !0)
|
|
5240
|
-
])) : (
|
|
5241
|
-
D(i).chatHistory.length === 0 ? (
|
|
5242
|
-
|
|
5229
|
+
])) : (x(), v(we, { key: 1 }, [
|
|
5230
|
+
D(i).chatHistory.length === 0 ? (x(), v("div", ga, [
|
|
5231
|
+
he(O.$slots, "empty-state", {
|
|
5243
5232
|
suggestions: P.value,
|
|
5244
5233
|
onClick: st
|
|
5245
5234
|
}, () => [
|
|
5246
|
-
|
|
5235
|
+
me(Bi, { onItemClick: st })
|
|
5247
5236
|
], !0)
|
|
5248
|
-
])) : (
|
|
5237
|
+
])) : (x(), v("div", {
|
|
5249
5238
|
key: 1,
|
|
5250
5239
|
ref_key: "chatContainer",
|
|
5251
5240
|
ref: c,
|
|
5252
5241
|
class: "flex-1 overflow-y-auto py-6 pb-24"
|
|
5253
5242
|
}, [
|
|
5254
|
-
|
|
5243
|
+
me(sa, {
|
|
5255
5244
|
messages: D(i).chatHistory,
|
|
5256
|
-
"loading-message": D(
|
|
5245
|
+
"loading-message": D(w),
|
|
5257
5246
|
quota: D(i).quota,
|
|
5258
5247
|
error: D(i).error,
|
|
5259
5248
|
ui: n.ui,
|
|
@@ -5263,7 +5252,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5263
5252
|
onRetry: St
|
|
5264
5253
|
}, {
|
|
5265
5254
|
message: Ce((J) => [
|
|
5266
|
-
|
|
5255
|
+
he(O.$slots, "message", {
|
|
5267
5256
|
message: J.message,
|
|
5268
5257
|
isUser: J.isUser,
|
|
5269
5258
|
isLoading: J.isLoading,
|
|
@@ -5273,19 +5262,19 @@ app.use(RestifyAiPlugin, {
|
|
|
5273
5262
|
_: 3
|
|
5274
5263
|
}, 8, ["messages", "loading-message", "quota", "error", "ui"])
|
|
5275
5264
|
], 512)),
|
|
5276
|
-
K[3] || (K[3] =
|
|
5265
|
+
K[3] || (K[3] = h("div", {
|
|
5277
5266
|
id: "rai-chat-bottom",
|
|
5278
5267
|
class: "h-8"
|
|
5279
5268
|
}, null, -1)),
|
|
5280
|
-
|
|
5281
|
-
var J,
|
|
5269
|
+
he(O.$slots, "input", Pn(zn(ne.value)), () => {
|
|
5270
|
+
var J, ce;
|
|
5282
5271
|
return [
|
|
5283
|
-
|
|
5272
|
+
me(Hi, {
|
|
5284
5273
|
modelValue: a.value,
|
|
5285
5274
|
"onUpdate:modelValue": K[1] || (K[1] = (Se) => a.value = Se),
|
|
5286
5275
|
sending: D(i).sending,
|
|
5287
5276
|
placeholder: ((J = t.texts) == null ? void 0 : J.placeholder) || D(le)("inputPlaceholder"),
|
|
5288
|
-
"support-placeholder": ((
|
|
5277
|
+
"support-placeholder": ((ce = t.texts) == null ? void 0 : ce.supportPlaceholder) || D(le)("supportPlaceholder"),
|
|
5289
5278
|
suggestions: P.value,
|
|
5290
5279
|
"has-history": D(i).chatHistory.length > 0,
|
|
5291
5280
|
"support-request-mode": D(i).supportRequestMode,
|
|
@@ -5296,7 +5285,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5296
5285
|
onToggleSupportMode: vt
|
|
5297
5286
|
}, {
|
|
5298
5287
|
"context-link": Ce(() => [
|
|
5299
|
-
|
|
5288
|
+
he(O.$slots, "context-link", {}, void 0, !0)
|
|
5300
5289
|
]),
|
|
5301
5290
|
_: 3
|
|
5302
5291
|
}, 8, ["modelValue", "sending", "placeholder", "support-placeholder", "suggestions", "has-history", "support-request-mode", "show-support-mode-toggle", "onCancel"])
|
|
@@ -5305,8 +5294,8 @@ app.use(RestifyAiPlugin, {
|
|
|
5305
5294
|
], 64))
|
|
5306
5295
|
], 2)
|
|
5307
5296
|
], 2),
|
|
5308
|
-
|
|
5309
|
-
show:
|
|
5297
|
+
me(ss, {
|
|
5298
|
+
show: f.value,
|
|
5310
5299
|
title: o("closeConfirmTitle"),
|
|
5311
5300
|
message: o("closeConfirmMessage"),
|
|
5312
5301
|
"confirm-text": o("confirmClose"),
|
|
@@ -5314,14 +5303,14 @@ app.use(RestifyAiPlugin, {
|
|
|
5314
5303
|
ui: n.ui,
|
|
5315
5304
|
"confirm-variant": "danger",
|
|
5316
5305
|
onConfirm: bt,
|
|
5317
|
-
onCancel: K[2] || (K[2] = (J) =>
|
|
5306
|
+
onCancel: K[2] || (K[2] = (J) => f.value = !1)
|
|
5318
5307
|
}, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui"]),
|
|
5319
|
-
|
|
5308
|
+
me(ss, {
|
|
5320
5309
|
show: D(A),
|
|
5321
|
-
title: D(
|
|
5310
|
+
title: D(g),
|
|
5322
5311
|
message: D(S),
|
|
5323
5312
|
"confirm-text": o("startNewChat"),
|
|
5324
|
-
"cancel-text": D(
|
|
5313
|
+
"cancel-text": D(y) ? o("continueChat") : o("cancel"),
|
|
5325
5314
|
ui: n.ui,
|
|
5326
5315
|
icon: "warning",
|
|
5327
5316
|
"confirm-variant": "primary",
|
|
@@ -5335,7 +5324,73 @@ app.use(RestifyAiPlugin, {
|
|
|
5335
5324
|
}, 8, ["name"])
|
|
5336
5325
|
]));
|
|
5337
5326
|
}
|
|
5338
|
-
}),
|
|
5327
|
+
}), Ma = /* @__PURE__ */ Rs(ma, [["__scopeId", "data-v-dd240dd4"]]), Ra = /* @__PURE__ */ ue({
|
|
5328
|
+
__name: "ErrorBoundary",
|
|
5329
|
+
props: {
|
|
5330
|
+
title: { default: "Something went wrong" },
|
|
5331
|
+
message: { default: "An unexpected error occurred. Please try again." },
|
|
5332
|
+
retryText: { default: "Try Again" },
|
|
5333
|
+
showRetry: { type: Boolean, default: !0 },
|
|
5334
|
+
ui: {},
|
|
5335
|
+
onError: {}
|
|
5336
|
+
},
|
|
5337
|
+
emits: ["error", "reset"],
|
|
5338
|
+
setup(n, { expose: e, emit: t }) {
|
|
5339
|
+
const s = n, r = t, o = U(!1), i = U(null);
|
|
5340
|
+
Ks((c, u, d) => {
|
|
5341
|
+
var f;
|
|
5342
|
+
return o.value = !0, i.value = c, (f = s.onError) == null || f.call(s, c, d), r("error", c, d), !1;
|
|
5343
|
+
});
|
|
5344
|
+
function a() {
|
|
5345
|
+
o.value = !1, i.value = null, r("reset");
|
|
5346
|
+
}
|
|
5347
|
+
return e({
|
|
5348
|
+
hasError: o,
|
|
5349
|
+
error: i,
|
|
5350
|
+
reset: a
|
|
5351
|
+
}), (c, u) => o.value ? he(c.$slots, "error", {
|
|
5352
|
+
key: 1,
|
|
5353
|
+
error: i.value,
|
|
5354
|
+
reset: a
|
|
5355
|
+
}, () => {
|
|
5356
|
+
var d, f, w, m, p;
|
|
5357
|
+
return [
|
|
5358
|
+
h("div", {
|
|
5359
|
+
class: b(["flex flex-col items-center justify-center p-6 text-center", (d = n.ui) == null ? void 0 : d.container])
|
|
5360
|
+
}, [
|
|
5361
|
+
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", (f = n.ui) == null ? void 0 : f.iconContainer])
|
|
5363
|
+
}, [...u[0] || (u[0] = [
|
|
5364
|
+
h("svg", {
|
|
5365
|
+
class: "w-6 h-6 text-red-600 dark:text-red-400",
|
|
5366
|
+
fill: "none",
|
|
5367
|
+
viewBox: "0 0 24 24",
|
|
5368
|
+
stroke: "currentColor"
|
|
5369
|
+
}, [
|
|
5370
|
+
h("path", {
|
|
5371
|
+
"stroke-linecap": "round",
|
|
5372
|
+
"stroke-linejoin": "round",
|
|
5373
|
+
"stroke-width": "2",
|
|
5374
|
+
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
5375
|
+
})
|
|
5376
|
+
], -1)
|
|
5377
|
+
])], 2),
|
|
5378
|
+
h("h3", {
|
|
5379
|
+
class: b(["text-lg font-semibold text-gray-900 dark:text-white mb-2", (w = n.ui) == null ? void 0 : w.title])
|
|
5380
|
+
}, _(n.title), 3),
|
|
5381
|
+
h("p", {
|
|
5382
|
+
class: b(["text-sm text-gray-600 dark:text-gray-400 mb-4", (m = n.ui) == null ? void 0 : m.message])
|
|
5383
|
+
}, _(n.message), 3),
|
|
5384
|
+
n.showRetry ? (x(), v("button", {
|
|
5385
|
+
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", (p = n.ui) == null ? void 0 : p.retryButton]),
|
|
5387
|
+
onClick: a
|
|
5388
|
+
}, _(n.retryText), 3)) : B("", !0)
|
|
5389
|
+
], 2)
|
|
5390
|
+
];
|
|
5391
|
+
}) : he(c.$slots, "default", { key: 0 });
|
|
5392
|
+
}
|
|
5393
|
+
}), La = {
|
|
5339
5394
|
install(n, e) {
|
|
5340
5395
|
if (!e.endpoints || !e.getAuthToken) {
|
|
5341
5396
|
console.warn("[@doderasoftware/restify-ai] Plugin requires endpoints and getAuthToken options.");
|
|
@@ -5401,40 +5456,41 @@ app.use(RestifyAiPlugin, {
|
|
|
5401
5456
|
onFileUploadComplete: e.onFileUploadComplete,
|
|
5402
5457
|
onFileUploadError: e.onFileUploadError
|
|
5403
5458
|
};
|
|
5404
|
-
|
|
5459
|
+
Qs(t), n.provide("restify-ai-config", t);
|
|
5405
5460
|
}
|
|
5406
5461
|
};
|
|
5407
5462
|
export {
|
|
5408
5463
|
_o as AiAvatar,
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5464
|
+
Ma as AiChatDrawer,
|
|
5465
|
+
Bi as AiEmptyState,
|
|
5466
|
+
Hi as ChatInput,
|
|
5467
|
+
ai as ChatMessage,
|
|
5468
|
+
Fo as ChatMessageActions,
|
|
5414
5469
|
nt as ChatRoles,
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5470
|
+
Ra as ErrorBoundary,
|
|
5471
|
+
Po as MentionList,
|
|
5472
|
+
La as RestifyAiPlugin,
|
|
5473
|
+
Ea as UserAvatar,
|
|
5474
|
+
La as default,
|
|
5419
5475
|
rs as defaultLabels,
|
|
5420
|
-
|
|
5476
|
+
yr as formatMentionsForApi,
|
|
5421
5477
|
tt as getConfigValue,
|
|
5422
5478
|
le as getLabel,
|
|
5423
5479
|
ee as getRestifyAiConfig,
|
|
5424
5480
|
wa as getRestifyAiConfigOrThrow,
|
|
5425
|
-
|
|
5426
|
-
|
|
5481
|
+
So as getSuggestionsForPath,
|
|
5482
|
+
xr as groupMentionsByType,
|
|
5427
5483
|
os as isConfigured,
|
|
5428
|
-
|
|
5429
|
-
|
|
5484
|
+
Sa as registerSuggestionProvider,
|
|
5485
|
+
Qs as setRestifyAiConfig,
|
|
5430
5486
|
Cs as useAiContext,
|
|
5431
|
-
|
|
5487
|
+
Ca as useAiDrawerShortcut,
|
|
5432
5488
|
Ms as useAiSuggestions,
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5489
|
+
Ta as useChatErrorHandling,
|
|
5490
|
+
bo as useChatMarkdown,
|
|
5491
|
+
va as useChatScroll,
|
|
5492
|
+
Mo as useKeyboardShortcut,
|
|
5493
|
+
ba as useMentionParsing,
|
|
5494
|
+
Aa as usePageAiContext,
|
|
5439
5495
|
We as useRestifyAiStore
|
|
5440
5496
|
};
|