@useknest/widget-core 0.1.0-beta.7 → 0.1.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +188 -183
- package/dist/streaming.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ export declare function getConfigApiUrl(baseUrl?: string): string;
|
|
|
9
9
|
export declare const FALLBACK_ERROR_MESSAGE = "Sorry, I didn't get a response.";
|
|
10
10
|
export declare const DEFAULT_ERROR_MESSAGE = "Unknown error occurred";
|
|
11
11
|
export declare const AUTH_ERROR_MESSAGE = "This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.";
|
|
12
|
+
export declare const USAGE_LIMIT_MESSAGE = "This chatbot has reached its usage limit. Please contact the site owner to upgrade their plan.";
|
|
12
13
|
export declare const DEFAULT_AVATAR_URL = "https://useknest.com/default-avatar.svg";
|
|
13
|
-
export declare const DEFAULT_BRAND_COLOR = "#
|
|
14
|
+
export declare const DEFAULT_BRAND_COLOR = "#3b82f6";
|
|
14
15
|
export declare const DEFAULT_WELCOME_MESSAGE = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?";
|
|
15
16
|
export declare const DEFAULT_EXAMPLE_QUESTIONS: string[];
|
|
16
17
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,QAAQ,YAAY,CAAC;AAIlC,eAAO,MAAM,mBAAmB,6CAA6C,CAAC;AAC9E,eAAO,MAAM,wBAAwB,mDAAmD,CAAC;AAEzF,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAExE;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAE1E;AAED,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAC9D,eAAO,MAAM,kBAAkB,iGACgE,CAAC;AAChG,eAAO,MAAM,kBAAkB,4CAA4C,CAAC;AAC5E,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,uBAAuB,mHAC6E,CAAC;AAClH,eAAO,MAAM,yBAAyB,UAIrC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,QAAQ,YAAY,CAAC;AAIlC,eAAO,MAAM,mBAAmB,6CAA6C,CAAC;AAC9E,eAAO,MAAM,wBAAwB,mDAAmD,CAAC;AAEzF,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAExE;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAE1E;AAED,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAC9D,eAAO,MAAM,kBAAkB,iGACgE,CAAC;AAChG,eAAO,MAAM,mBAAmB,mGACiE,CAAC;AAClG,eAAO,MAAM,kBAAkB,4CAA4C,CAAC;AAC5E,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,uBAAuB,mHAC6E,CAAC;AAClH,eAAO,MAAM,yBAAyB,UAIrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { WidgetMode, MessageRole, Source, Message, ChatMessageRequest, ChatMessageResponse, ChatApiError, WidgetConfig, SSEEvent } from './types';
|
|
2
|
-
export { DEFAULT_BASE_URL, API_PATH, getChatApiUrl, getConfigApiUrl, FALLBACK_ERROR_MESSAGE, DEFAULT_ERROR_MESSAGE, AUTH_ERROR_MESSAGE, DEFAULT_AVATAR_URL, DEFAULT_BRAND_COLOR, DEFAULT_WELCOME_MESSAGE, DEFAULT_EXAMPLE_QUESTIONS, PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from './constants';
|
|
2
|
+
export { DEFAULT_BASE_URL, API_PATH, getChatApiUrl, getConfigApiUrl, FALLBACK_ERROR_MESSAGE, DEFAULT_ERROR_MESSAGE, AUTH_ERROR_MESSAGE, USAGE_LIMIT_MESSAGE, DEFAULT_AVATAR_URL, DEFAULT_BRAND_COLOR, DEFAULT_WELCOME_MESSAGE, DEFAULT_EXAMPLE_QUESTIONS, PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from './constants';
|
|
3
3
|
export { fetchWidgetConfig } from './config';
|
|
4
4
|
export type { ConfigResult, ConfigErrorType } from './config';
|
|
5
5
|
export { streamChatMessage } from './streaming';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAG5F,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAG5F,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { createClient as he } from "@supabase/supabase-js";
|
|
2
2
|
import { marked as H } from "marked";
|
|
3
3
|
import * as j from "@sentry/browser";
|
|
4
|
-
const le = "https://useknest.com", ce = "/api/v1",
|
|
4
|
+
const le = "https://useknest.com", ce = "/api/v1", $e = "https://lghrsugmhzpccpriqhrx.supabase.co", Ge = "sb_publishable_-KUwilDA78QM849gk662FA_kEzMezNS";
|
|
5
5
|
function me(a = le) {
|
|
6
6
|
return `${a}${ce}/chat-messages`;
|
|
7
7
|
}
|
|
8
8
|
function Ae(a = le) {
|
|
9
9
|
return `${a}${ce}/widget-config`;
|
|
10
10
|
}
|
|
11
|
-
const Se = "Sorry, I didn't get a response.", Q = "Unknown error occurred", Te = "This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.",
|
|
11
|
+
const Se = "Sorry, I didn't get a response.", Q = "Unknown error occurred", Te = "This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.", be = "This chatbot has reached its usage limit. Please contact the site owner to upgrade their plan.", Be = "https://useknest.com/default-avatar.svg", He = "#3b82f6", Ye = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?", We = [
|
|
12
12
|
"How do I get started?",
|
|
13
13
|
"What features are available?",
|
|
14
14
|
"How do I integrate this?"
|
|
15
|
-
],
|
|
15
|
+
], Ie = "knest-widget-config-", ye = 1440 * 60 * 1e3;
|
|
16
16
|
function K(a) {
|
|
17
|
-
return
|
|
17
|
+
return Ie + a;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Re(a, d) {
|
|
20
20
|
try {
|
|
21
21
|
const t = localStorage.getItem(K(a));
|
|
22
22
|
if (!t) return null;
|
|
23
23
|
const { config: u, cachedAt: g } = JSON.parse(t);
|
|
24
|
-
return Date.now() - g >
|
|
24
|
+
return Date.now() - g > ye ? (localStorage.removeItem(K(a)), null) : (d && u.updatedAt, u);
|
|
25
25
|
} catch {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Oe(a, d) {
|
|
30
30
|
try {
|
|
31
31
|
const t = { config: d, cachedAt: Date.now() };
|
|
32
32
|
localStorage.setItem(K(a), JSON.stringify(t));
|
|
@@ -43,7 +43,7 @@ async function ee(a, d) {
|
|
|
43
43
|
});
|
|
44
44
|
if (t.ok) {
|
|
45
45
|
const g = await t.json();
|
|
46
|
-
return
|
|
46
|
+
return Oe(a, g), { config: g, error: null };
|
|
47
47
|
}
|
|
48
48
|
if (t.status === 401 || t.status === 403) {
|
|
49
49
|
const g = await t.json().catch(() => ({}));
|
|
@@ -55,17 +55,17 @@ async function ee(a, d) {
|
|
|
55
55
|
return console.error("Error fetching widget config:", t), { config: null, error: "network" };
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
59
|
-
const u =
|
|
58
|
+
async function ze(a, d, t) {
|
|
59
|
+
const u = Re(a);
|
|
60
60
|
return u ? (t && ee(a, d).then((g) => {
|
|
61
61
|
g.config && g.config.updatedAt !== u.updatedAt && t(g.config);
|
|
62
62
|
}), { config: u, error: null }) : ee(a, d);
|
|
63
63
|
}
|
|
64
|
-
let
|
|
65
|
-
async function
|
|
66
|
-
return x || (B &&
|
|
64
|
+
let k = null, B = !1, x = null;
|
|
65
|
+
async function Xe(a, d) {
|
|
66
|
+
return x || (B && k ? !0 : (x = (async () => {
|
|
67
67
|
try {
|
|
68
|
-
|
|
68
|
+
k = he(a, d, {
|
|
69
69
|
auth: {
|
|
70
70
|
// Persist session in localStorage for cross-page persistence.
|
|
71
71
|
persistSession: !0,
|
|
@@ -75,10 +75,10 @@ async function ze(a, d) {
|
|
|
75
75
|
});
|
|
76
76
|
const {
|
|
77
77
|
data: { session: t }
|
|
78
|
-
} = await
|
|
78
|
+
} = await k.auth.getSession();
|
|
79
79
|
if (t)
|
|
80
80
|
return B = !0, !0;
|
|
81
|
-
const { error: u } = await
|
|
81
|
+
const { error: u } = await k.auth.signInAnonymously();
|
|
82
82
|
return u ? (console.error("Widget auth error:", u.message), !1) : (B = !0, !0);
|
|
83
83
|
} catch (t) {
|
|
84
84
|
return console.error("Widget auth initialization failed:", t), !1;
|
|
@@ -87,86 +87,90 @@ async function ze(a, d) {
|
|
|
87
87
|
}
|
|
88
88
|
})(), x));
|
|
89
89
|
}
|
|
90
|
-
async function
|
|
91
|
-
if (!
|
|
90
|
+
async function Ne() {
|
|
91
|
+
if (!k)
|
|
92
92
|
return null;
|
|
93
93
|
const {
|
|
94
94
|
data: { session: a }
|
|
95
|
-
} = await
|
|
95
|
+
} = await k.auth.getSession();
|
|
96
96
|
return a?.access_token || null;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function ve() {
|
|
99
99
|
return B;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
return
|
|
101
|
+
function je() {
|
|
102
|
+
return k;
|
|
103
103
|
}
|
|
104
|
-
async function
|
|
104
|
+
async function Ke(a) {
|
|
105
105
|
const { publishableApiKey: d, content: t, threadId: u, callbacks: g, baseUrl: h } = a;
|
|
106
106
|
try {
|
|
107
|
-
if (!
|
|
107
|
+
if (!ve())
|
|
108
108
|
throw new Error("Widget not authenticated. Call initWidgetAuth() first.");
|
|
109
|
-
const
|
|
110
|
-
if (!
|
|
109
|
+
const S = await Ne();
|
|
110
|
+
if (!S)
|
|
111
111
|
throw new Error("No access token available. Please refresh and try again.");
|
|
112
112
|
const o = { content: t };
|
|
113
113
|
u && (o.threadId = u);
|
|
114
|
-
const
|
|
114
|
+
const m = await fetch(me(h), {
|
|
115
115
|
method: "POST",
|
|
116
116
|
headers: {
|
|
117
117
|
"Content-Type": "application/json",
|
|
118
118
|
"X-Api-Key": d,
|
|
119
|
-
Authorization: `Bearer ${
|
|
119
|
+
Authorization: `Bearer ${S}`
|
|
120
120
|
},
|
|
121
121
|
credentials: "include",
|
|
122
122
|
body: JSON.stringify(o)
|
|
123
123
|
});
|
|
124
|
-
if (!
|
|
125
|
-
if (
|
|
124
|
+
if (!m.ok) {
|
|
125
|
+
if (m.status === 401 || m.status === 403)
|
|
126
126
|
throw new Error(Te);
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (m.status === 429) {
|
|
128
|
+
const v = await m.json();
|
|
129
|
+
throw v.code === "USAGE_LIMIT_EXCEEDED" ? new Error(be) : new Error(v.error || "Rate limited");
|
|
130
|
+
}
|
|
131
|
+
const C = await m.json();
|
|
132
|
+
throw new Error(C.error || "Failed to send message");
|
|
129
133
|
}
|
|
130
|
-
const
|
|
131
|
-
if (!
|
|
134
|
+
const F = m.body?.getReader();
|
|
135
|
+
if (!F)
|
|
132
136
|
throw new Error("Response body is not readable");
|
|
133
|
-
const
|
|
137
|
+
const D = new TextDecoder();
|
|
134
138
|
let O = "", N = !1;
|
|
135
139
|
for (; ; ) {
|
|
136
|
-
const { done:
|
|
137
|
-
if (
|
|
138
|
-
O +=
|
|
139
|
-
const
|
|
140
|
+
const { done: C, value: v } = await F.read();
|
|
141
|
+
if (C) break;
|
|
142
|
+
O += D.decode(v, { stream: !0 });
|
|
143
|
+
const T = O.split(`
|
|
140
144
|
`);
|
|
141
|
-
O =
|
|
142
|
-
for (const
|
|
143
|
-
if (
|
|
145
|
+
O = T.pop() || "";
|
|
146
|
+
for (const f of T)
|
|
147
|
+
if (f.startsWith("data: "))
|
|
144
148
|
try {
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
else if (
|
|
149
|
-
|
|
150
|
-
else if (
|
|
151
|
-
g.onComplete && g.onComplete(
|
|
152
|
-
else if (
|
|
153
|
-
throw new Error(
|
|
154
|
-
} catch (
|
|
155
|
-
console.error("Error parsing SSE data:",
|
|
149
|
+
const E = JSON.parse(f.slice(6));
|
|
150
|
+
if (E.type === "init")
|
|
151
|
+
E.threadId && g.onInit && g.onInit(E.threadId);
|
|
152
|
+
else if (E.type === "content")
|
|
153
|
+
E.content && (N = !0, g.onContent(E.content));
|
|
154
|
+
else if (E.type === "complete")
|
|
155
|
+
g.onComplete && g.onComplete(E.sources || []);
|
|
156
|
+
else if (E.type === "error")
|
|
157
|
+
throw new Error(E.error || Q);
|
|
158
|
+
} catch (E) {
|
|
159
|
+
console.error("Error parsing SSE data:", E, f);
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
N || g.onError(Se);
|
|
159
|
-
} catch (
|
|
160
|
-
const o =
|
|
163
|
+
} catch (S) {
|
|
164
|
+
const o = S instanceof Error ? S.message : Q;
|
|
161
165
|
g.onError(o);
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
var te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
165
|
-
function
|
|
169
|
+
function Fe(a) {
|
|
166
170
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
167
171
|
}
|
|
168
172
|
var X = { exports: {} }, ne;
|
|
169
|
-
function
|
|
173
|
+
function Le() {
|
|
170
174
|
return ne || (ne = 1, (function(a) {
|
|
171
175
|
var d = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
172
176
|
/**
|
|
@@ -178,7 +182,7 @@ function Fe() {
|
|
|
178
182
|
* @public
|
|
179
183
|
*/
|
|
180
184
|
var t = (function(u) {
|
|
181
|
-
var g = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, h = 0,
|
|
185
|
+
var g = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, h = 0, S = {}, o = {
|
|
182
186
|
/**
|
|
183
187
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
184
188
|
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
@@ -234,7 +238,7 @@ function Fe() {
|
|
|
234
238
|
*/
|
|
235
239
|
util: {
|
|
236
240
|
encode: function n(e) {
|
|
237
|
-
return e instanceof
|
|
241
|
+
return e instanceof m ? new m(e.type, n(e.content), e.alias) : Array.isArray(e) ? e.map(n) : e.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
238
242
|
},
|
|
239
243
|
/**
|
|
240
244
|
* Returns the name of the type of the given value.
|
|
@@ -397,10 +401,10 @@ function Fe() {
|
|
|
397
401
|
/**
|
|
398
402
|
* The grammar for plain, unformatted text.
|
|
399
403
|
*/
|
|
400
|
-
plain:
|
|
401
|
-
plaintext:
|
|
402
|
-
text:
|
|
403
|
-
txt:
|
|
404
|
+
plain: S,
|
|
405
|
+
plaintext: S,
|
|
406
|
+
text: S,
|
|
407
|
+
txt: S,
|
|
404
408
|
/**
|
|
405
409
|
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
406
410
|
*
|
|
@@ -521,9 +525,9 @@ function Fe() {
|
|
|
521
525
|
r.hasOwnProperty(l) && (c[l] = r[l]);
|
|
522
526
|
r.hasOwnProperty(p) || (c[p] = i[p]);
|
|
523
527
|
}
|
|
524
|
-
var
|
|
525
|
-
return s[n] = c, o.languages.DFS(o.languages, function(b,
|
|
526
|
-
|
|
528
|
+
var A = s[n];
|
|
529
|
+
return s[n] = c, o.languages.DFS(o.languages, function(b, L) {
|
|
530
|
+
L === A && b != n && (this[b] = c);
|
|
527
531
|
}), c;
|
|
528
532
|
},
|
|
529
533
|
// Traverse a language definition with Depth First Search
|
|
@@ -533,8 +537,8 @@ function Fe() {
|
|
|
533
537
|
for (var p in e)
|
|
534
538
|
if (e.hasOwnProperty(p)) {
|
|
535
539
|
r.call(e, p, e[p], s || p);
|
|
536
|
-
var l = e[p],
|
|
537
|
-
|
|
540
|
+
var l = e[p], A = o.util.type(l);
|
|
541
|
+
A === "Object" && !i[c(l)] ? (i[c(l)] = !0, n(l, r, null, i)) : A === "Array" && !i[c(l)] && (i[c(l)] = !0, n(l, r, p, i));
|
|
538
542
|
}
|
|
539
543
|
}
|
|
540
544
|
},
|
|
@@ -618,28 +622,28 @@ function Fe() {
|
|
|
618
622
|
grammar: i,
|
|
619
623
|
code: p
|
|
620
624
|
};
|
|
621
|
-
function
|
|
622
|
-
l.highlightedCode =
|
|
625
|
+
function A(L) {
|
|
626
|
+
l.highlightedCode = L, o.hooks.run("before-insert", l), l.element.innerHTML = l.highlightedCode, o.hooks.run("after-highlight", l), o.hooks.run("complete", l), r && r.call(l.element);
|
|
623
627
|
}
|
|
624
628
|
if (o.hooks.run("before-sanity-check", l), c = l.element.parentElement, c && c.nodeName.toLowerCase() === "pre" && !c.hasAttribute("tabindex") && c.setAttribute("tabindex", "0"), !l.code) {
|
|
625
629
|
o.hooks.run("complete", l), r && r.call(l.element);
|
|
626
630
|
return;
|
|
627
631
|
}
|
|
628
632
|
if (o.hooks.run("before-highlight", l), !l.grammar) {
|
|
629
|
-
|
|
633
|
+
A(o.util.encode(l.code));
|
|
630
634
|
return;
|
|
631
635
|
}
|
|
632
636
|
if (e && u.Worker) {
|
|
633
637
|
var b = new Worker(o.filename);
|
|
634
|
-
b.onmessage = function(
|
|
635
|
-
|
|
638
|
+
b.onmessage = function(L) {
|
|
639
|
+
A(L.data);
|
|
636
640
|
}, b.postMessage(JSON.stringify({
|
|
637
641
|
language: l.language,
|
|
638
642
|
code: l.code,
|
|
639
643
|
immediateClose: !0
|
|
640
644
|
}));
|
|
641
645
|
} else
|
|
642
|
-
|
|
646
|
+
A(o.highlight(l.code, l.grammar, l.language));
|
|
643
647
|
},
|
|
644
648
|
/**
|
|
645
649
|
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
@@ -669,7 +673,7 @@ function Fe() {
|
|
|
669
673
|
};
|
|
670
674
|
if (o.hooks.run("before-tokenize", s), !s.grammar)
|
|
671
675
|
throw new Error('The language "' + s.language + '" has no grammar.');
|
|
672
|
-
return s.tokens = o.tokenize(s.code, s.grammar), o.hooks.run("after-tokenize", s),
|
|
676
|
+
return s.tokens = o.tokenize(s.code, s.grammar), o.hooks.run("after-tokenize", s), m.stringify(o.util.encode(s.tokens), s.language);
|
|
673
677
|
},
|
|
674
678
|
/**
|
|
675
679
|
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
@@ -703,7 +707,7 @@ function Fe() {
|
|
|
703
707
|
delete e.rest;
|
|
704
708
|
}
|
|
705
709
|
var i = new O();
|
|
706
|
-
return N(i, i.head, n),
|
|
710
|
+
return N(i, i.head, n), D(n, i, e, i.head, 0), v(i);
|
|
707
711
|
},
|
|
708
712
|
/**
|
|
709
713
|
* @namespace
|
|
@@ -744,19 +748,19 @@ function Fe() {
|
|
|
744
748
|
i(e);
|
|
745
749
|
}
|
|
746
750
|
},
|
|
747
|
-
Token:
|
|
751
|
+
Token: m
|
|
748
752
|
};
|
|
749
753
|
u.Prism = o;
|
|
750
|
-
function
|
|
754
|
+
function m(n, e, r, s) {
|
|
751
755
|
this.type = n, this.content = e, this.alias = r, this.length = (s || "").length | 0;
|
|
752
756
|
}
|
|
753
|
-
|
|
757
|
+
m.stringify = function n(e, r) {
|
|
754
758
|
if (typeof e == "string")
|
|
755
759
|
return e;
|
|
756
760
|
if (Array.isArray(e)) {
|
|
757
761
|
var s = "";
|
|
758
|
-
return e.forEach(function(
|
|
759
|
-
s += n(
|
|
762
|
+
return e.forEach(function(A) {
|
|
763
|
+
s += n(A, r);
|
|
760
764
|
}), s;
|
|
761
765
|
}
|
|
762
766
|
var i = {
|
|
@@ -773,7 +777,7 @@ function Fe() {
|
|
|
773
777
|
p += " " + l + '="' + (i.attributes[l] || "").replace(/"/g, """) + '"';
|
|
774
778
|
return "<" + i.tag + ' class="' + i.classes.join(" ") + '"' + p + ">" + i.content + "</" + i.tag + ">";
|
|
775
779
|
};
|
|
776
|
-
function
|
|
780
|
+
function F(n, e, r, s) {
|
|
777
781
|
n.lastIndex = e;
|
|
778
782
|
var i = n.exec(r);
|
|
779
783
|
if (i && s && i[1]) {
|
|
@@ -782,15 +786,15 @@ function Fe() {
|
|
|
782
786
|
}
|
|
783
787
|
return i;
|
|
784
788
|
}
|
|
785
|
-
function
|
|
789
|
+
function D(n, e, r, s, i, c) {
|
|
786
790
|
for (var p in r)
|
|
787
791
|
if (!(!r.hasOwnProperty(p) || !r[p])) {
|
|
788
792
|
var l = r[p];
|
|
789
793
|
l = Array.isArray(l) ? l : [l];
|
|
790
|
-
for (var
|
|
791
|
-
if (c && c.cause == p + "," +
|
|
794
|
+
for (var A = 0; A < l.length; ++A) {
|
|
795
|
+
if (c && c.cause == p + "," + A)
|
|
792
796
|
return;
|
|
793
|
-
var b = l[
|
|
797
|
+
var b = l[A], L = b.inside, q = !!b.lookbehind, V = !!b.greedy, ge = b.alias;
|
|
794
798
|
if (V && !b.pattern.global) {
|
|
795
799
|
var pe = b.pattern.toString().match(/[imsuy]*$/)[0];
|
|
796
800
|
b.pattern = RegExp(b.pattern.source, pe + "g");
|
|
@@ -799,32 +803,32 @@ function Fe() {
|
|
|
799
803
|
var _ = I.value;
|
|
800
804
|
if (e.length > n.length)
|
|
801
805
|
return;
|
|
802
|
-
if (!(_ instanceof
|
|
806
|
+
if (!(_ instanceof m)) {
|
|
803
807
|
var U = 1, y;
|
|
804
808
|
if (V) {
|
|
805
|
-
if (y =
|
|
809
|
+
if (y = F(Z, R, n, q), !y || y.index >= n.length)
|
|
806
810
|
break;
|
|
807
|
-
var M = y.index,
|
|
808
|
-
for (
|
|
809
|
-
I = I.next,
|
|
810
|
-
if (
|
|
811
|
+
var M = y.index, Ee = y.index + y[0].length, w = R;
|
|
812
|
+
for (w += I.value.length; M >= w; )
|
|
813
|
+
I = I.next, w += I.value.length;
|
|
814
|
+
if (w -= I.value.length, R = w, I.value instanceof m)
|
|
811
815
|
continue;
|
|
812
|
-
for (var P = I; P !== e.tail && (
|
|
813
|
-
U++,
|
|
814
|
-
U--, _ = n.slice(R,
|
|
815
|
-
} else if (y =
|
|
816
|
+
for (var P = I; P !== e.tail && (w < Ee || typeof P.value == "string"); P = P.next)
|
|
817
|
+
U++, w += P.value.length;
|
|
818
|
+
U--, _ = n.slice(R, w), y.index -= R;
|
|
819
|
+
} else if (y = F(Z, 0, _, q), !y)
|
|
816
820
|
continue;
|
|
817
821
|
var M = y.index, $ = y[0], Y = _.slice(0, M), J = _.slice(M + $.length), W = R + _.length;
|
|
818
822
|
c && W > c.reach && (c.reach = W);
|
|
819
823
|
var G = I.prev;
|
|
820
|
-
Y && (G = N(e, G, Y), R += Y.length),
|
|
821
|
-
var
|
|
822
|
-
if (I = N(e, G,
|
|
824
|
+
Y && (G = N(e, G, Y), R += Y.length), C(e, G, U);
|
|
825
|
+
var fe = new m(p, L ? o.tokenize($, L) : $, ge, $);
|
|
826
|
+
if (I = N(e, G, fe), J && N(e, I, J), U > 1) {
|
|
823
827
|
var z = {
|
|
824
|
-
cause: p + "," +
|
|
828
|
+
cause: p + "," + A,
|
|
825
829
|
reach: W
|
|
826
830
|
};
|
|
827
|
-
|
|
831
|
+
D(n, e, r, I.prev, R, z), c && z.reach > c.reach && (c.reach = z.reach);
|
|
828
832
|
}
|
|
829
833
|
}
|
|
830
834
|
}
|
|
@@ -839,12 +843,12 @@ function Fe() {
|
|
|
839
843
|
var s = e.next, i = { value: r, prev: e, next: s };
|
|
840
844
|
return e.next = i, s.prev = i, n.length++, i;
|
|
841
845
|
}
|
|
842
|
-
function
|
|
846
|
+
function C(n, e, r) {
|
|
843
847
|
for (var s = e.next, i = 0; i < r && s !== n.tail; i++)
|
|
844
848
|
s = s.next;
|
|
845
849
|
e.next = s, s.prev = e, n.length -= i;
|
|
846
850
|
}
|
|
847
|
-
function
|
|
851
|
+
function v(n) {
|
|
848
852
|
for (var e = [], r = n.head.next; r !== n.tail; )
|
|
849
853
|
e.push(r.value), r = r.next;
|
|
850
854
|
return e;
|
|
@@ -854,14 +858,14 @@ function Fe() {
|
|
|
854
858
|
var e = JSON.parse(n.data), r = e.language, s = e.code, i = e.immediateClose;
|
|
855
859
|
u.postMessage(o.highlight(s, o.languages[r], r)), i && u.close();
|
|
856
860
|
}, !1)), o;
|
|
857
|
-
var
|
|
858
|
-
|
|
859
|
-
function
|
|
861
|
+
var T = o.util.currentScript();
|
|
862
|
+
T && (o.filename = T.src, T.hasAttribute("data-manual") && (o.manual = !0));
|
|
863
|
+
function f() {
|
|
860
864
|
o.manual || o.highlightAll();
|
|
861
865
|
}
|
|
862
866
|
if (!o.manual) {
|
|
863
|
-
var
|
|
864
|
-
|
|
867
|
+
var E = document.readyState;
|
|
868
|
+
E === "loading" || E === "interactive" && T && T.defer ? document.addEventListener("DOMContentLoaded", f) : window.requestAnimationFrame ? window.requestAnimationFrame(f) : window.setTimeout(f, 16);
|
|
865
869
|
}
|
|
866
870
|
return o;
|
|
867
871
|
})(d);
|
|
@@ -957,31 +961,31 @@ function Fe() {
|
|
|
957
961
|
* addInlined('style', 'css');
|
|
958
962
|
*/
|
|
959
963
|
value: function(g, h) {
|
|
960
|
-
var
|
|
961
|
-
|
|
964
|
+
var S = {};
|
|
965
|
+
S["language-" + h] = {
|
|
962
966
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
963
967
|
lookbehind: !0,
|
|
964
968
|
inside: t.languages[h]
|
|
965
|
-
},
|
|
969
|
+
}, S.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
966
970
|
var o = {
|
|
967
971
|
"included-cdata": {
|
|
968
972
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
969
|
-
inside:
|
|
973
|
+
inside: S
|
|
970
974
|
}
|
|
971
975
|
};
|
|
972
976
|
o["language-" + h] = {
|
|
973
977
|
pattern: /[\s\S]+/,
|
|
974
978
|
inside: t.languages[h]
|
|
975
979
|
};
|
|
976
|
-
var
|
|
977
|
-
|
|
980
|
+
var m = {};
|
|
981
|
+
m[g] = {
|
|
978
982
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
979
983
|
return g;
|
|
980
984
|
}), "i"),
|
|
981
985
|
lookbehind: !0,
|
|
982
986
|
greedy: !0,
|
|
983
987
|
inside: o
|
|
984
|
-
}, t.languages.insertBefore("markup", "cdata",
|
|
988
|
+
}, t.languages.insertBefore("markup", "cdata", m);
|
|
985
989
|
}
|
|
986
990
|
}), Object.defineProperty(t.languages.markup.tag, "addAttribute", {
|
|
987
991
|
/**
|
|
@@ -1243,9 +1247,9 @@ function Fe() {
|
|
|
1243
1247
|
if (typeof t > "u" || typeof document > "u")
|
|
1244
1248
|
return;
|
|
1245
1249
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1246
|
-
var u = "Loading…", g = function(
|
|
1247
|
-
return "✖ Error " +
|
|
1248
|
-
}, h = "✖ Error: File does not exist or is empty",
|
|
1250
|
+
var u = "Loading…", g = function(T, f) {
|
|
1251
|
+
return "✖ Error " + T + " while fetching file: " + f;
|
|
1252
|
+
}, h = "✖ Error: File does not exist or is empty", S = {
|
|
1249
1253
|
js: "javascript",
|
|
1250
1254
|
py: "python",
|
|
1251
1255
|
rb: "ruby",
|
|
@@ -1255,52 +1259,52 @@ function Fe() {
|
|
|
1255
1259
|
bat: "batch",
|
|
1256
1260
|
h: "c",
|
|
1257
1261
|
tex: "latex"
|
|
1258
|
-
}, o = "data-src-status",
|
|
1259
|
-
function N(
|
|
1262
|
+
}, o = "data-src-status", m = "loading", F = "loaded", D = "failed", O = "pre[data-src]:not([" + o + '="' + F + '"]):not([' + o + '="' + m + '"])';
|
|
1263
|
+
function N(T, f, E) {
|
|
1260
1264
|
var n = new XMLHttpRequest();
|
|
1261
|
-
n.open("GET",
|
|
1262
|
-
n.readyState == 4 && (n.status < 400 && n.responseText ?
|
|
1265
|
+
n.open("GET", T, !0), n.onreadystatechange = function() {
|
|
1266
|
+
n.readyState == 4 && (n.status < 400 && n.responseText ? f(n.responseText) : n.status >= 400 ? E(g(n.status, n.statusText)) : E(h));
|
|
1263
1267
|
}, n.send(null);
|
|
1264
1268
|
}
|
|
1265
|
-
function
|
|
1266
|
-
var
|
|
1267
|
-
if (
|
|
1268
|
-
var
|
|
1269
|
-
return n ? e ? [
|
|
1269
|
+
function C(T) {
|
|
1270
|
+
var f = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(T || "");
|
|
1271
|
+
if (f) {
|
|
1272
|
+
var E = Number(f[1]), n = f[2], e = f[3];
|
|
1273
|
+
return n ? e ? [E, Number(e)] : [E, void 0] : [E, E];
|
|
1270
1274
|
}
|
|
1271
1275
|
}
|
|
1272
|
-
t.hooks.add("before-highlightall", function(
|
|
1273
|
-
|
|
1274
|
-
}), t.hooks.add("before-sanity-check", function(
|
|
1275
|
-
var
|
|
1276
|
+
t.hooks.add("before-highlightall", function(T) {
|
|
1277
|
+
T.selector += ", " + O;
|
|
1278
|
+
}), t.hooks.add("before-sanity-check", function(T) {
|
|
1279
|
+
var f = (
|
|
1276
1280
|
/** @type {HTMLPreElement} */
|
|
1277
|
-
|
|
1281
|
+
T.element
|
|
1278
1282
|
);
|
|
1279
|
-
if (
|
|
1280
|
-
|
|
1281
|
-
var
|
|
1282
|
-
|
|
1283
|
-
var n =
|
|
1283
|
+
if (f.matches(O)) {
|
|
1284
|
+
T.code = "", f.setAttribute(o, m);
|
|
1285
|
+
var E = f.appendChild(document.createElement("CODE"));
|
|
1286
|
+
E.textContent = u;
|
|
1287
|
+
var n = f.getAttribute("data-src"), e = T.language;
|
|
1284
1288
|
if (e === "none") {
|
|
1285
1289
|
var r = (/\.(\w+)$/.exec(n) || [, "none"])[1];
|
|
1286
|
-
e =
|
|
1290
|
+
e = S[r] || r;
|
|
1287
1291
|
}
|
|
1288
|
-
t.util.setLanguage(
|
|
1292
|
+
t.util.setLanguage(E, e), t.util.setLanguage(f, e);
|
|
1289
1293
|
var s = t.plugins.autoloader;
|
|
1290
1294
|
s && s.loadLanguages(e), N(
|
|
1291
1295
|
n,
|
|
1292
1296
|
function(i) {
|
|
1293
|
-
|
|
1294
|
-
var c =
|
|
1297
|
+
f.setAttribute(o, F);
|
|
1298
|
+
var c = C(f.getAttribute("data-range"));
|
|
1295
1299
|
if (c) {
|
|
1296
|
-
var p = i.split(/\r\n?|\n/g), l = c[0],
|
|
1297
|
-
l < 0 && (l += p.length), l = Math.max(0, Math.min(l - 1, p.length)),
|
|
1298
|
-
`),
|
|
1300
|
+
var p = i.split(/\r\n?|\n/g), l = c[0], A = c[1] == null ? p.length : c[1];
|
|
1301
|
+
l < 0 && (l += p.length), l = Math.max(0, Math.min(l - 1, p.length)), A < 0 && (A += p.length), A = Math.max(0, Math.min(A, p.length)), i = p.slice(l, A).join(`
|
|
1302
|
+
`), f.hasAttribute("data-start") || f.setAttribute("data-start", String(l + 1));
|
|
1299
1303
|
}
|
|
1300
|
-
|
|
1304
|
+
E.textContent = i, t.highlightElement(E);
|
|
1301
1305
|
},
|
|
1302
1306
|
function(i) {
|
|
1303
|
-
|
|
1307
|
+
f.setAttribute(o, D), E.textContent = i;
|
|
1304
1308
|
}
|
|
1305
1309
|
);
|
|
1306
1310
|
}
|
|
@@ -1312,22 +1316,22 @@ function Fe() {
|
|
|
1312
1316
|
*
|
|
1313
1317
|
* @param {ParentNode} [container=document]
|
|
1314
1318
|
*/
|
|
1315
|
-
highlight: function(
|
|
1316
|
-
for (var
|
|
1319
|
+
highlight: function(f) {
|
|
1320
|
+
for (var E = (f || document).querySelectorAll(O), n = 0, e; e = E[n++]; )
|
|
1317
1321
|
t.highlightElement(e);
|
|
1318
1322
|
}
|
|
1319
1323
|
};
|
|
1320
|
-
var
|
|
1324
|
+
var v = !1;
|
|
1321
1325
|
t.fileHighlight = function() {
|
|
1322
|
-
|
|
1326
|
+
v || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), v = !0), t.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1323
1327
|
};
|
|
1324
1328
|
})();
|
|
1325
1329
|
})(X)), X.exports;
|
|
1326
1330
|
}
|
|
1327
|
-
var
|
|
1328
|
-
const ae = /* @__PURE__ */
|
|
1331
|
+
var we = Le();
|
|
1332
|
+
const ae = /* @__PURE__ */ Fe(we);
|
|
1329
1333
|
var re = {}, se;
|
|
1330
|
-
function
|
|
1334
|
+
function Ce() {
|
|
1331
1335
|
return se || (se = 1, Prism.languages.python = {
|
|
1332
1336
|
comment: {
|
|
1333
1337
|
pattern: /(^|[^\\])#.*/,
|
|
@@ -1390,9 +1394,9 @@ function we() {
|
|
|
1390
1394
|
punctuation: /[{}[\];(),.:]/
|
|
1391
1395
|
}, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python), re;
|
|
1392
1396
|
}
|
|
1393
|
-
|
|
1397
|
+
Ce();
|
|
1394
1398
|
var ie = {}, oe;
|
|
1395
|
-
function
|
|
1399
|
+
function ke() {
|
|
1396
1400
|
return oe || (oe = 1, (function(a) {
|
|
1397
1401
|
a.languages.typescript = a.languages.extend("javascript", {
|
|
1398
1402
|
"class-name": {
|
|
@@ -1439,7 +1443,7 @@ function Ce() {
|
|
|
1439
1443
|
}), a.languages.ts = a.languages.typescript;
|
|
1440
1444
|
})(Prism)), ie;
|
|
1441
1445
|
}
|
|
1442
|
-
|
|
1446
|
+
ke();
|
|
1443
1447
|
(function(a) {
|
|
1444
1448
|
var d = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", t = {
|
|
1445
1449
|
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
@@ -1655,8 +1659,8 @@ Ce();
|
|
|
1655
1659
|
"operator",
|
|
1656
1660
|
"punctuation",
|
|
1657
1661
|
"number"
|
|
1658
|
-
], h = u.variable[1].inside,
|
|
1659
|
-
h[g[
|
|
1662
|
+
], h = u.variable[1].inside, S = 0; S < g.length; S++)
|
|
1663
|
+
h[g[S]] = a.languages.bash[g[S]];
|
|
1660
1664
|
a.languages.sh = a.languages.bash, a.languages.shell = a.languages.bash;
|
|
1661
1665
|
})(Prism);
|
|
1662
1666
|
Prism.languages.json = {
|
|
@@ -1945,7 +1949,7 @@ Prism.languages.sql = {
|
|
|
1945
1949
|
operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
|
|
1946
1950
|
punctuation: /[;[\]()`,.]/
|
|
1947
1951
|
};
|
|
1948
|
-
const
|
|
1952
|
+
const De = {
|
|
1949
1953
|
js: "javascript",
|
|
1950
1954
|
ts: "typescript",
|
|
1951
1955
|
shell: "bash",
|
|
@@ -1959,7 +1963,7 @@ H.setOptions({
|
|
|
1959
1963
|
});
|
|
1960
1964
|
const de = new H.Renderer();
|
|
1961
1965
|
de.code = ({ text: a, lang: d }) => {
|
|
1962
|
-
const t = d ?
|
|
1966
|
+
const t = d ? De[d] || d : "plaintext", u = ae.languages[t];
|
|
1963
1967
|
if (u) {
|
|
1964
1968
|
const h = ae.highlight(a, u, t);
|
|
1965
1969
|
return `<pre><code class="language-${t}">${h}</code></pre>`;
|
|
@@ -1967,10 +1971,10 @@ de.code = ({ text: a, lang: d }) => {
|
|
|
1967
1971
|
return `<pre><code>${a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</code></pre>`;
|
|
1968
1972
|
};
|
|
1969
1973
|
H.use({ renderer: de });
|
|
1970
|
-
function
|
|
1974
|
+
function qe(a) {
|
|
1971
1975
|
return H.parse(a);
|
|
1972
1976
|
}
|
|
1973
|
-
const
|
|
1977
|
+
const _e = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672", Pe = [
|
|
1974
1978
|
"@useknest",
|
|
1975
1979
|
"useknest",
|
|
1976
1980
|
"widget-core",
|
|
@@ -1980,18 +1984,18 @@ const De = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us
|
|
|
1980
1984
|
"widget.js",
|
|
1981
1985
|
"knest"
|
|
1982
1986
|
];
|
|
1983
|
-
function
|
|
1987
|
+
function xe(a) {
|
|
1984
1988
|
if (a.tags?.source === "knest-widget") return !0;
|
|
1985
1989
|
const d = a.exception?.values?.[0]?.stacktrace?.frames;
|
|
1986
1990
|
return !d || d.length === 0 ? !1 : d.some((t) => {
|
|
1987
1991
|
const u = t.filename || "";
|
|
1988
|
-
return
|
|
1992
|
+
return Pe.some((g) => u.includes(g));
|
|
1989
1993
|
});
|
|
1990
1994
|
}
|
|
1991
1995
|
let ue = !1;
|
|
1992
|
-
function
|
|
1996
|
+
function Ve() {
|
|
1993
1997
|
ue || (j.init({
|
|
1994
|
-
dsn:
|
|
1998
|
+
dsn: _e,
|
|
1995
1999
|
// Only capture errors, not performance data.
|
|
1996
2000
|
tracesSampleRate: 0,
|
|
1997
2001
|
integrations: [
|
|
@@ -2011,11 +2015,11 @@ function qe() {
|
|
|
2011
2015
|
},
|
|
2012
2016
|
// Filter out errors that don't originate from our widget code.
|
|
2013
2017
|
beforeSend(a) {
|
|
2014
|
-
return
|
|
2018
|
+
return xe(a) ? a : null;
|
|
2015
2019
|
}
|
|
2016
2020
|
}), ue = !0);
|
|
2017
2021
|
}
|
|
2018
|
-
function
|
|
2022
|
+
function Ze(a, d) {
|
|
2019
2023
|
const t = typeof a == "string" ? new Error(a) : a;
|
|
2020
2024
|
j.captureException(t, {
|
|
2021
2025
|
tags: { source: "knest-widget" },
|
|
@@ -2025,24 +2029,25 @@ function Ve(a, d) {
|
|
|
2025
2029
|
export {
|
|
2026
2030
|
ce as API_PATH,
|
|
2027
2031
|
Te as AUTH_ERROR_MESSAGE,
|
|
2028
|
-
|
|
2032
|
+
Be as DEFAULT_AVATAR_URL,
|
|
2029
2033
|
le as DEFAULT_BASE_URL,
|
|
2030
|
-
|
|
2034
|
+
He as DEFAULT_BRAND_COLOR,
|
|
2031
2035
|
Q as DEFAULT_ERROR_MESSAGE,
|
|
2032
|
-
|
|
2033
|
-
|
|
2036
|
+
We as DEFAULT_EXAMPLE_QUESTIONS,
|
|
2037
|
+
Ye as DEFAULT_WELCOME_MESSAGE,
|
|
2034
2038
|
Se as FALLBACK_ERROR_MESSAGE,
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2039
|
+
Ge as PUBLIC_SUPABASE_ANON_KEY,
|
|
2040
|
+
$e as PUBLIC_SUPABASE_URL,
|
|
2041
|
+
be as USAGE_LIMIT_MESSAGE,
|
|
2042
|
+
Ze as captureWidgetException,
|
|
2043
|
+
ze as fetchWidgetConfig,
|
|
2044
|
+
qe as formatContent,
|
|
2045
|
+
Ne as getAccessToken,
|
|
2041
2046
|
me as getChatApiUrl,
|
|
2042
2047
|
Ae as getConfigApiUrl,
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
+
je as getSupabaseClient,
|
|
2049
|
+
Xe as initWidgetAuth,
|
|
2050
|
+
Ve as initWidgetSentry,
|
|
2051
|
+
ve as isAuthenticated,
|
|
2052
|
+
Ke as streamChatMessage
|
|
2048
2053
|
};
|
package/dist/streaming.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsB,MAAM,EAAY,MAAM,SAAS,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC/B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,eAAe,CAAC;IAC3B,oGAAoG;IACpG,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoGpF"}
|