@useknest/widget-core 0.1.0-beta.1 → 0.1.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,43 +1,71 @@
1
- import { createClient as R } from "@supabase/supabase-js";
2
- import { marked as S } from "marked";
3
- import * as p from "@sentry/browser";
4
- const b = "https://useknest.com", I = "/api/v1";
5
- function C(e = b) {
6
- return `${e}${I}/chat-messages`;
1
+ import { createClient as he } from "@supabase/supabase-js";
2
+ import { marked as H } from "marked";
3
+ import * as j from "@sentry/browser";
4
+ const le = "https://useknest.com", ce = "/api/v1", Ge = "https://lghrsugmhzpccpriqhrx.supabase.co", Be = "sb_publishable_-KUwilDA78QM849gk662FA_kEzMezNS";
5
+ function me(a = le) {
6
+ return `${a}${ce}/chat-messages`;
7
7
  }
8
- function U(e = b) {
9
- return `${e}${I}/widget-config`;
8
+ function Ae(a = le) {
9
+ return `${a}${ce}/widget-config`;
10
10
  }
11
- const L = "Sorry, I didn't get a response.", m = "Unknown error occurred", W = "This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.", N = "https://useknest.com/default-avatar.svg", P = "#0d7a7f", v = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?", G = [
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.", He = "https://useknest.com/default-avatar.svg", Ye = "#3b82f6", We = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?", ze = [
12
12
  "How do I get started?",
13
13
  "What features are available?",
14
14
  "How do I integrate this?"
15
- ];
16
- async function H(e, o) {
15
+ ], Ie = "knest-widget-config-", ye = 1440 * 60 * 1e3;
16
+ function K(a) {
17
+ return Ie + a;
18
+ }
19
+ function Re(a, g) {
20
+ try {
21
+ const e = localStorage.getItem(K(a));
22
+ if (!e) return null;
23
+ const { config: u, cachedAt: c } = JSON.parse(e);
24
+ return Date.now() - c > ye ? (localStorage.removeItem(K(a)), null) : (g && u.updatedAt, u);
25
+ } catch {
26
+ return null;
27
+ }
28
+ }
29
+ function Oe(a, g) {
30
+ try {
31
+ const e = { config: g, cachedAt: Date.now() };
32
+ localStorage.setItem(K(a), JSON.stringify(e));
33
+ } catch {
34
+ }
35
+ }
36
+ async function ee(a, g) {
17
37
  try {
18
- const t = await fetch(U(o), {
38
+ const e = await fetch(Ae(g), {
19
39
  method: "GET",
20
40
  headers: {
21
- "X-Api-Key": e
41
+ "X-Api-Key": a
22
42
  }
23
43
  });
24
- if (t.ok)
25
- return { config: await t.json(), error: null };
26
- if (t.status === 401 || t.status === 403) {
27
- const n = await t.json().catch(() => ({}));
28
- return console.warn("Widget config auth error:", t.status, n), { config: null, error: "auth" };
44
+ if (e.ok) {
45
+ const c = await e.json();
46
+ return Oe(a, c), { config: c, error: null };
29
47
  }
30
- const s = await t.text();
31
- return console.warn("Failed to fetch widget config:", t.status, s), { config: null, error: "network" };
32
- } catch (t) {
33
- return console.error("Error fetching widget config:", t), { config: null, error: "network" };
48
+ if (e.status === 401 || e.status === 403) {
49
+ const c = await e.json().catch(() => ({}));
50
+ return console.warn("Widget config auth error:", e.status, c), { config: null, error: "auth" };
51
+ }
52
+ const u = await e.text();
53
+ return console.warn("Failed to fetch widget config:", e.status, u), { config: null, error: "network" };
54
+ } catch (e) {
55
+ return console.error("Error fetching widget config:", e), { config: null, error: "network" };
34
56
  }
35
57
  }
36
- let a = null, d = !1, u = null;
37
- async function K(e, o) {
38
- return u || (d && a ? !0 : (u = (async () => {
58
+ async function Xe(a, g, e) {
59
+ const u = Re(a);
60
+ return u ? (e && ee(a, g).then((c) => {
61
+ c.config && c.config.updatedAt !== u.updatedAt && e(c.config);
62
+ }), { config: u, error: null }) : ee(a, g);
63
+ }
64
+ let k = null, B = !1, x = null;
65
+ async function je(a, g) {
66
+ return x || (B && k ? !0 : (x = (async () => {
39
67
  try {
40
- a = R(e, o, {
68
+ k = he(a, g, {
41
69
  auth: {
42
70
  // Persist session in localStorage for cross-page persistence.
43
71
  persistSession: !0,
@@ -46,112 +74,1934 @@ async function K(e, o) {
46
74
  }
47
75
  });
48
76
  const {
49
- data: { session: t }
50
- } = await a.auth.getSession();
51
- if (t)
52
- return d = !0, !0;
53
- const { error: s } = await a.auth.signInAnonymously();
54
- return s ? (console.error("Widget auth error:", s.message), !1) : (d = !0, !0);
55
- } catch (t) {
56
- return console.error("Widget auth initialization failed:", t), !1;
77
+ data: { session: e }
78
+ } = await k.auth.getSession();
79
+ if (e)
80
+ return B = !0, !0;
81
+ const { error: u } = await k.auth.signInAnonymously();
82
+ return u ? (console.error("Widget auth error:", u.message), !1) : (B = !0, !0);
83
+ } catch (e) {
84
+ return console.error("Widget auth initialization failed:", e), !1;
57
85
  } finally {
58
- u = null;
86
+ x = null;
59
87
  }
60
- })(), u));
88
+ })(), x));
61
89
  }
62
- async function D() {
63
- if (!a)
90
+ async function ve() {
91
+ if (!k)
64
92
  return null;
65
93
  const {
66
- data: { session: e }
67
- } = await a.auth.getSession();
68
- return e?.access_token || null;
94
+ data: { session: a }
95
+ } = await k.auth.getSession();
96
+ return a?.access_token || null;
69
97
  }
70
- function O() {
71
- return d;
98
+ function Ne() {
99
+ return B;
72
100
  }
73
- function j() {
74
- return a;
101
+ function Fe() {
102
+ return k;
75
103
  }
76
- async function z(e) {
77
- const { publishableApiKey: o, content: t, threadId: s, callbacks: n, baseUrl: T } = e;
104
+ async function Ke(a) {
105
+ const { publishableApiKey: g, content: e, threadId: u, callbacks: c, baseUrl: h } = a;
78
106
  try {
79
- if (!O())
107
+ if (!Ne())
80
108
  throw new Error("Widget not authenticated. Call initWidgetAuth() first.");
81
- const i = await D();
82
- if (!i)
109
+ const S = await ve();
110
+ if (!S)
83
111
  throw new Error("No access token available. Please refresh and try again.");
84
- const l = { content: t };
85
- s && (l.threadId = s);
86
- const c = await fetch(C(T), {
112
+ const o = { content: e };
113
+ u && (o.threadId = u);
114
+ const m = await fetch(me(h), {
87
115
  method: "POST",
88
116
  headers: {
89
117
  "Content-Type": "application/json",
90
- "X-Api-Key": o,
91
- Authorization: `Bearer ${i}`
118
+ "X-Api-Key": g,
119
+ Authorization: `Bearer ${S}`
92
120
  },
93
121
  credentials: "include",
94
- body: JSON.stringify(l)
122
+ body: JSON.stringify(o)
95
123
  });
96
- if (!c.ok) {
97
- if (c.status === 401 || c.status === 403)
98
- throw new Error(W);
99
- const h = await c.json();
100
- throw new Error(h.error || "Failed to send message");
124
+ if (!m.ok) {
125
+ if (m.status === 401 || m.status === 403)
126
+ throw new Error(Te);
127
+ if (m.status === 429) {
128
+ const N = await m.json();
129
+ throw N.code === "USAGE_LIMIT_EXCEEDED" ? new Error(be) : new Error(N.error || "Rate limited");
130
+ }
131
+ const C = await m.json();
132
+ throw new Error(C.error || "Failed to send message");
101
133
  }
102
- const w = c.body?.getReader();
103
- if (!w)
134
+ const F = m.body?.getReader();
135
+ if (!F)
104
136
  throw new Error("Response body is not readable");
105
- const _ = new TextDecoder();
106
- let f = "", E = !1;
137
+ const D = new TextDecoder();
138
+ let v = "", R = !1;
107
139
  for (; ; ) {
108
- const { done: h, value: k } = await w.read();
109
- if (h) break;
110
- f += _.decode(k, { stream: !0 });
111
- const y = f.split(`
140
+ const { done: C, value: N } = await F.read();
141
+ if (C) break;
142
+ v += D.decode(N, { stream: !0 });
143
+ const T = v.split(`
112
144
  `);
113
- f = y.pop() || "";
114
- for (const g of y)
115
- if (g.startsWith("data: "))
145
+ v = T.pop() || "";
146
+ for (const E of T)
147
+ if (E.startsWith("data: "))
116
148
  try {
117
- const r = JSON.parse(g.slice(6));
118
- if (r.type === "init")
119
- r.threadId && n.onInit && n.onInit(r.threadId);
120
- else if (r.type === "content")
121
- r.content && (E = !0, n.onContent(r.content));
122
- else if (r.type === "complete")
123
- n.onComplete && n.onComplete(r.sources || []);
124
- else if (r.type === "error")
125
- throw new Error(r.error || m);
126
- } catch (r) {
127
- console.error("Error parsing SSE data:", r, g);
149
+ const p = JSON.parse(E.slice(6));
150
+ if (p.type === "init")
151
+ p.threadId && c.onInit && c.onInit(p.threadId);
152
+ else if (p.type === "content")
153
+ p.content && (R = !0, c.onContent(p.content));
154
+ else if (p.type === "complete")
155
+ c.onComplete && c.onComplete(p.sources || []);
156
+ else if (p.type === "done")
157
+ p.humanTakeover && (R = !0), c.onDone && c.onDone({ humanTakeover: p.humanTakeover });
158
+ else if (p.type === "error")
159
+ throw new Error(p.error || Q);
160
+ } catch (p) {
161
+ console.error("Error parsing SSE data:", p, E);
128
162
  }
129
163
  }
130
- E || n.onError(L);
131
- } catch (i) {
132
- const l = i instanceof Error ? i.message : m;
133
- n.onError(l);
164
+ R || c.onError(Se);
165
+ } catch (S) {
166
+ const o = S instanceof Error ? S.message : Q;
167
+ c.onError(o);
134
168
  }
135
169
  }
136
- S.setOptions({
170
+ var te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
171
+ function Le(a) {
172
+ return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
173
+ }
174
+ var X = { exports: {} }, ne;
175
+ function we() {
176
+ return ne || (ne = 1, (function(a) {
177
+ var g = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
178
+ /**
179
+ * Prism: Lightweight, robust, elegant syntax highlighting
180
+ *
181
+ * @license MIT <https://opensource.org/licenses/MIT>
182
+ * @author Lea Verou <https://lea.verou.me>
183
+ * @namespace
184
+ * @public
185
+ */
186
+ var e = (function(u) {
187
+ var c = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, h = 0, S = {}, o = {
188
+ /**
189
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
190
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
191
+ * additional languages or plugins yourself.
192
+ *
193
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
194
+ *
195
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
196
+ * empty Prism object into the global scope before loading the Prism script like this:
197
+ *
198
+ * ```js
199
+ * window.Prism = window.Prism || {};
200
+ * Prism.manual = true;
201
+ * // add a new <script> to load Prism's script
202
+ * ```
203
+ *
204
+ * @default false
205
+ * @type {boolean}
206
+ * @memberof Prism
207
+ * @public
208
+ */
209
+ manual: u.Prism && u.Prism.manual,
210
+ /**
211
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
212
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
213
+ * own worker, you don't want it to do this.
214
+ *
215
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
216
+ *
217
+ * You obviously have to change this value before Prism executes. To do this, you can add an
218
+ * empty Prism object into the global scope before loading the Prism script like this:
219
+ *
220
+ * ```js
221
+ * window.Prism = window.Prism || {};
222
+ * Prism.disableWorkerMessageHandler = true;
223
+ * // Load Prism's script
224
+ * ```
225
+ *
226
+ * @default false
227
+ * @type {boolean}
228
+ * @memberof Prism
229
+ * @public
230
+ */
231
+ disableWorkerMessageHandler: u.Prism && u.Prism.disableWorkerMessageHandler,
232
+ /**
233
+ * A namespace for utility methods.
234
+ *
235
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
236
+ * change or disappear at any time.
237
+ *
238
+ * @namespace
239
+ * @memberof Prism
240
+ */
241
+ util: {
242
+ encode: function n(t) {
243
+ return t instanceof m ? new m(t.type, n(t.content), t.alias) : Array.isArray(t) ? t.map(n) : t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
244
+ },
245
+ /**
246
+ * Returns the name of the type of the given value.
247
+ *
248
+ * @param {any} o
249
+ * @returns {string}
250
+ * @example
251
+ * type(null) === 'Null'
252
+ * type(undefined) === 'Undefined'
253
+ * type(123) === 'Number'
254
+ * type('foo') === 'String'
255
+ * type(true) === 'Boolean'
256
+ * type([1, 2]) === 'Array'
257
+ * type({}) === 'Object'
258
+ * type(String) === 'Function'
259
+ * type(/abc+/) === 'RegExp'
260
+ */
261
+ type: function(n) {
262
+ return Object.prototype.toString.call(n).slice(8, -1);
263
+ },
264
+ /**
265
+ * Returns a unique number for the given object. Later calls will still return the same number.
266
+ *
267
+ * @param {Object} obj
268
+ * @returns {number}
269
+ */
270
+ objId: function(n) {
271
+ return n.__id || Object.defineProperty(n, "__id", { value: ++h }), n.__id;
272
+ },
273
+ /**
274
+ * Creates a deep clone of the given object.
275
+ *
276
+ * The main intended use of this function is to clone language definitions.
277
+ *
278
+ * @param {T} o
279
+ * @param {Record<number, any>} [visited]
280
+ * @returns {T}
281
+ * @template T
282
+ */
283
+ clone: function n(t, r) {
284
+ r = r || {};
285
+ var s, i;
286
+ switch (o.util.type(t)) {
287
+ case "Object":
288
+ if (i = o.util.objId(t), r[i])
289
+ return r[i];
290
+ s = /** @type {Record<string, any>} */
291
+ {}, r[i] = s;
292
+ for (var d in t)
293
+ t.hasOwnProperty(d) && (s[d] = n(t[d], r));
294
+ return (
295
+ /** @type {any} */
296
+ s
297
+ );
298
+ case "Array":
299
+ return i = o.util.objId(t), r[i] ? r[i] : (s = [], r[i] = s, /** @type {Array} */
300
+ /** @type {any} */
301
+ t.forEach(function(f, l) {
302
+ s[l] = n(f, r);
303
+ }), /** @type {any} */
304
+ s);
305
+ default:
306
+ return t;
307
+ }
308
+ },
309
+ /**
310
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
311
+ *
312
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
313
+ *
314
+ * @param {Element} element
315
+ * @returns {string}
316
+ */
317
+ getLanguage: function(n) {
318
+ for (; n; ) {
319
+ var t = c.exec(n.className);
320
+ if (t)
321
+ return t[1].toLowerCase();
322
+ n = n.parentElement;
323
+ }
324
+ return "none";
325
+ },
326
+ /**
327
+ * Sets the Prism `language-xxxx` class of the given element.
328
+ *
329
+ * @param {Element} element
330
+ * @param {string} language
331
+ * @returns {void}
332
+ */
333
+ setLanguage: function(n, t) {
334
+ n.className = n.className.replace(RegExp(c, "gi"), ""), n.classList.add("language-" + t);
335
+ },
336
+ /**
337
+ * Returns the script element that is currently executing.
338
+ *
339
+ * This does __not__ work for line script element.
340
+ *
341
+ * @returns {HTMLScriptElement | null}
342
+ */
343
+ currentScript: function() {
344
+ if (typeof document > "u")
345
+ return null;
346
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT")
347
+ return (
348
+ /** @type {any} */
349
+ document.currentScript
350
+ );
351
+ try {
352
+ throw new Error();
353
+ } catch (s) {
354
+ var n = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(s.stack) || [])[1];
355
+ if (n) {
356
+ var t = document.getElementsByTagName("script");
357
+ for (var r in t)
358
+ if (t[r].src == n)
359
+ return t[r];
360
+ }
361
+ return null;
362
+ }
363
+ },
364
+ /**
365
+ * Returns whether a given class is active for `element`.
366
+ *
367
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
368
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
369
+ * given class is just the given class with a `no-` prefix.
370
+ *
371
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
372
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
373
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
374
+ *
375
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
376
+ * version of it, the class is considered active.
377
+ *
378
+ * @param {Element} element
379
+ * @param {string} className
380
+ * @param {boolean} [defaultActivation=false]
381
+ * @returns {boolean}
382
+ */
383
+ isActive: function(n, t, r) {
384
+ for (var s = "no-" + t; n; ) {
385
+ var i = n.classList;
386
+ if (i.contains(t))
387
+ return !0;
388
+ if (i.contains(s))
389
+ return !1;
390
+ n = n.parentElement;
391
+ }
392
+ return !!r;
393
+ }
394
+ },
395
+ /**
396
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
397
+ *
398
+ * @namespace
399
+ * @memberof Prism
400
+ * @public
401
+ */
402
+ languages: {
403
+ /**
404
+ * The grammar for plain, unformatted text.
405
+ */
406
+ plain: S,
407
+ plaintext: S,
408
+ text: S,
409
+ txt: S,
410
+ /**
411
+ * Creates a deep copy of the language with the given id and appends the given tokens.
412
+ *
413
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
414
+ * will be overwritten at its original position.
415
+ *
416
+ * ## Best practices
417
+ *
418
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
419
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
420
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
421
+ *
422
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
423
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
424
+ *
425
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
426
+ * @param {Grammar} redef The new tokens to append.
427
+ * @returns {Grammar} The new language created.
428
+ * @public
429
+ * @example
430
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
431
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
432
+ * // at its original position
433
+ * 'comment': { ... },
434
+ * // CSS doesn't have a 'color' token, so this token will be appended
435
+ * 'color': /\b(?:red|green|blue)\b/
436
+ * });
437
+ */
438
+ extend: function(n, t) {
439
+ var r = o.util.clone(o.languages[n]);
440
+ for (var s in t)
441
+ r[s] = t[s];
442
+ return r;
443
+ },
444
+ /**
445
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
446
+ *
447
+ * ## Usage
448
+ *
449
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
450
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
451
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
452
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
453
+ * this:
454
+ *
455
+ * ```js
456
+ * Prism.languages.markup.style = {
457
+ * // token
458
+ * };
459
+ * ```
460
+ *
461
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
462
+ * before existing tokens. For the CSS example above, you would use it like this:
463
+ *
464
+ * ```js
465
+ * Prism.languages.insertBefore('markup', 'cdata', {
466
+ * 'style': {
467
+ * // token
468
+ * }
469
+ * });
470
+ * ```
471
+ *
472
+ * ## Special cases
473
+ *
474
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
475
+ * will be ignored.
476
+ *
477
+ * This behavior can be used to insert tokens after `before`:
478
+ *
479
+ * ```js
480
+ * Prism.languages.insertBefore('markup', 'comment', {
481
+ * 'comment': Prism.languages.markup.comment,
482
+ * // tokens after 'comment'
483
+ * });
484
+ * ```
485
+ *
486
+ * ## Limitations
487
+ *
488
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
489
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
490
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
491
+ * deleting properties which is necessary to insert at arbitrary positions.
492
+ *
493
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
494
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
495
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
496
+ *
497
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
498
+ * you hold the target object in a variable, then the value of the variable will not change.
499
+ *
500
+ * ```js
501
+ * var oldMarkup = Prism.languages.markup;
502
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
503
+ *
504
+ * assert(oldMarkup !== Prism.languages.markup);
505
+ * assert(newMarkup === Prism.languages.markup);
506
+ * ```
507
+ *
508
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
509
+ * object to be modified.
510
+ * @param {string} before The key to insert before.
511
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
512
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
513
+ * object to be modified.
514
+ *
515
+ * Defaults to `Prism.languages`.
516
+ * @returns {Grammar} The new grammar object.
517
+ * @public
518
+ */
519
+ insertBefore: function(n, t, r, s) {
520
+ s = s || /** @type {any} */
521
+ o.languages;
522
+ var i = s[n], d = {};
523
+ for (var f in i)
524
+ if (i.hasOwnProperty(f)) {
525
+ if (f == t)
526
+ for (var l in r)
527
+ r.hasOwnProperty(l) && (d[l] = r[l]);
528
+ r.hasOwnProperty(f) || (d[f] = i[f]);
529
+ }
530
+ var A = s[n];
531
+ return s[n] = d, o.languages.DFS(o.languages, function(b, L) {
532
+ L === A && b != n && (this[b] = d);
533
+ }), d;
534
+ },
535
+ // Traverse a language definition with Depth First Search
536
+ DFS: function n(t, r, s, i) {
537
+ i = i || {};
538
+ var d = o.util.objId;
539
+ for (var f in t)
540
+ if (t.hasOwnProperty(f)) {
541
+ r.call(t, f, t[f], s || f);
542
+ var l = t[f], A = o.util.type(l);
543
+ A === "Object" && !i[d(l)] ? (i[d(l)] = !0, n(l, r, null, i)) : A === "Array" && !i[d(l)] && (i[d(l)] = !0, n(l, r, f, i));
544
+ }
545
+ }
546
+ },
547
+ plugins: {},
548
+ /**
549
+ * This is the most high-level function in Prism’s API.
550
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
551
+ * each one of them.
552
+ *
553
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
554
+ *
555
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
556
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
557
+ * @memberof Prism
558
+ * @public
559
+ */
560
+ highlightAll: function(n, t) {
561
+ o.highlightAllUnder(document, n, t);
562
+ },
563
+ /**
564
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
565
+ * {@link Prism.highlightElement} on each one of them.
566
+ *
567
+ * The following hooks will be run:
568
+ * 1. `before-highlightall`
569
+ * 2. `before-all-elements-highlight`
570
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
571
+ *
572
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
573
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
574
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
575
+ * @memberof Prism
576
+ * @public
577
+ */
578
+ highlightAllUnder: function(n, t, r) {
579
+ var s = {
580
+ callback: r,
581
+ container: n,
582
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
583
+ };
584
+ o.hooks.run("before-highlightall", s), s.elements = Array.prototype.slice.apply(s.container.querySelectorAll(s.selector)), o.hooks.run("before-all-elements-highlight", s);
585
+ for (var i = 0, d; d = s.elements[i++]; )
586
+ o.highlightElement(d, t === !0, s.callback);
587
+ },
588
+ /**
589
+ * Highlights the code inside a single element.
590
+ *
591
+ * The following hooks will be run:
592
+ * 1. `before-sanity-check`
593
+ * 2. `before-highlight`
594
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
595
+ * 4. `before-insert`
596
+ * 5. `after-highlight`
597
+ * 6. `complete`
598
+ *
599
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
600
+ * the element's language.
601
+ *
602
+ * @param {Element} element The element containing the code.
603
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
604
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
605
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
606
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
607
+ *
608
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
609
+ * asynchronous highlighting to work. You can build your own bundle on the
610
+ * [Download page](https://prismjs.com/download.html).
611
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
612
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
613
+ * @memberof Prism
614
+ * @public
615
+ */
616
+ highlightElement: function(n, t, r) {
617
+ var s = o.util.getLanguage(n), i = o.languages[s];
618
+ o.util.setLanguage(n, s);
619
+ var d = n.parentElement;
620
+ d && d.nodeName.toLowerCase() === "pre" && o.util.setLanguage(d, s);
621
+ var f = n.textContent, l = {
622
+ element: n,
623
+ language: s,
624
+ grammar: i,
625
+ code: f
626
+ };
627
+ function A(L) {
628
+ 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);
629
+ }
630
+ if (o.hooks.run("before-sanity-check", l), d = l.element.parentElement, d && d.nodeName.toLowerCase() === "pre" && !d.hasAttribute("tabindex") && d.setAttribute("tabindex", "0"), !l.code) {
631
+ o.hooks.run("complete", l), r && r.call(l.element);
632
+ return;
633
+ }
634
+ if (o.hooks.run("before-highlight", l), !l.grammar) {
635
+ A(o.util.encode(l.code));
636
+ return;
637
+ }
638
+ if (t && u.Worker) {
639
+ var b = new Worker(o.filename);
640
+ b.onmessage = function(L) {
641
+ A(L.data);
642
+ }, b.postMessage(JSON.stringify({
643
+ language: l.language,
644
+ code: l.code,
645
+ immediateClose: !0
646
+ }));
647
+ } else
648
+ A(o.highlight(l.code, l.grammar, l.language));
649
+ },
650
+ /**
651
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
652
+ * and the language definitions to use, and returns a string with the HTML produced.
653
+ *
654
+ * The following hooks will be run:
655
+ * 1. `before-tokenize`
656
+ * 2. `after-tokenize`
657
+ * 3. `wrap`: On each {@link Token}.
658
+ *
659
+ * @param {string} text A string with the code to be highlighted.
660
+ * @param {Grammar} grammar An object containing the tokens to use.
661
+ *
662
+ * Usually a language definition like `Prism.languages.markup`.
663
+ * @param {string} language The name of the language definition passed to `grammar`.
664
+ * @returns {string} The highlighted HTML.
665
+ * @memberof Prism
666
+ * @public
667
+ * @example
668
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
669
+ */
670
+ highlight: function(n, t, r) {
671
+ var s = {
672
+ code: n,
673
+ grammar: t,
674
+ language: r
675
+ };
676
+ if (o.hooks.run("before-tokenize", s), !s.grammar)
677
+ throw new Error('The language "' + s.language + '" has no grammar.');
678
+ return s.tokens = o.tokenize(s.code, s.grammar), o.hooks.run("after-tokenize", s), m.stringify(o.util.encode(s.tokens), s.language);
679
+ },
680
+ /**
681
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
682
+ * and the language definitions to use, and returns an array with the tokenized code.
683
+ *
684
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
685
+ *
686
+ * This method could be useful in other contexts as well, as a very crude parser.
687
+ *
688
+ * @param {string} text A string with the code to be highlighted.
689
+ * @param {Grammar} grammar An object containing the tokens to use.
690
+ *
691
+ * Usually a language definition like `Prism.languages.markup`.
692
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
693
+ * @memberof Prism
694
+ * @public
695
+ * @example
696
+ * let code = `var foo = 0;`;
697
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
698
+ * tokens.forEach(token => {
699
+ * if (token instanceof Prism.Token && token.type === 'number') {
700
+ * console.log(`Found numeric literal: ${token.content}`);
701
+ * }
702
+ * });
703
+ */
704
+ tokenize: function(n, t) {
705
+ var r = t.rest;
706
+ if (r) {
707
+ for (var s in r)
708
+ t[s] = r[s];
709
+ delete t.rest;
710
+ }
711
+ var i = new v();
712
+ return R(i, i.head, n), D(n, i, t, i.head, 0), N(i);
713
+ },
714
+ /**
715
+ * @namespace
716
+ * @memberof Prism
717
+ * @public
718
+ */
719
+ hooks: {
720
+ all: {},
721
+ /**
722
+ * Adds the given callback to the list of callbacks for the given hook.
723
+ *
724
+ * The callback will be invoked when the hook it is registered for is run.
725
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
726
+ *
727
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
728
+ *
729
+ * @param {string} name The name of the hook.
730
+ * @param {HookCallback} callback The callback function which is given environment variables.
731
+ * @public
732
+ */
733
+ add: function(n, t) {
734
+ var r = o.hooks.all;
735
+ r[n] = r[n] || [], r[n].push(t);
736
+ },
737
+ /**
738
+ * Runs a hook invoking all registered callbacks with the given environment variables.
739
+ *
740
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
741
+ *
742
+ * @param {string} name The name of the hook.
743
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
744
+ * @public
745
+ */
746
+ run: function(n, t) {
747
+ var r = o.hooks.all[n];
748
+ if (!(!r || !r.length))
749
+ for (var s = 0, i; i = r[s++]; )
750
+ i(t);
751
+ }
752
+ },
753
+ Token: m
754
+ };
755
+ u.Prism = o;
756
+ function m(n, t, r, s) {
757
+ this.type = n, this.content = t, this.alias = r, this.length = (s || "").length | 0;
758
+ }
759
+ m.stringify = function n(t, r) {
760
+ if (typeof t == "string")
761
+ return t;
762
+ if (Array.isArray(t)) {
763
+ var s = "";
764
+ return t.forEach(function(A) {
765
+ s += n(A, r);
766
+ }), s;
767
+ }
768
+ var i = {
769
+ type: t.type,
770
+ content: n(t.content, r),
771
+ tag: "span",
772
+ classes: ["token", t.type],
773
+ attributes: {},
774
+ language: r
775
+ }, d = t.alias;
776
+ d && (Array.isArray(d) ? Array.prototype.push.apply(i.classes, d) : i.classes.push(d)), o.hooks.run("wrap", i);
777
+ var f = "";
778
+ for (var l in i.attributes)
779
+ f += " " + l + '="' + (i.attributes[l] || "").replace(/"/g, "&quot;") + '"';
780
+ return "<" + i.tag + ' class="' + i.classes.join(" ") + '"' + f + ">" + i.content + "</" + i.tag + ">";
781
+ };
782
+ function F(n, t, r, s) {
783
+ n.lastIndex = t;
784
+ var i = n.exec(r);
785
+ if (i && s && i[1]) {
786
+ var d = i[1].length;
787
+ i.index += d, i[0] = i[0].slice(d);
788
+ }
789
+ return i;
790
+ }
791
+ function D(n, t, r, s, i, d) {
792
+ for (var f in r)
793
+ if (!(!r.hasOwnProperty(f) || !r[f])) {
794
+ var l = r[f];
795
+ l = Array.isArray(l) ? l : [l];
796
+ for (var A = 0; A < l.length; ++A) {
797
+ if (d && d.cause == f + "," + A)
798
+ return;
799
+ var b = l[A], L = b.inside, q = !!b.lookbehind, V = !!b.greedy, ge = b.alias;
800
+ if (V && !b.pattern.global) {
801
+ var pe = b.pattern.toString().match(/[imsuy]*$/)[0];
802
+ b.pattern = RegExp(b.pattern.source, pe + "g");
803
+ }
804
+ for (var Z = b.pattern || b, I = s.next, O = i; I !== t.tail && !(d && O >= d.reach); O += I.value.length, I = I.next) {
805
+ var _ = I.value;
806
+ if (t.length > n.length)
807
+ return;
808
+ if (!(_ instanceof m)) {
809
+ var U = 1, y;
810
+ if (V) {
811
+ if (y = F(Z, O, n, q), !y || y.index >= n.length)
812
+ break;
813
+ var M = y.index, fe = y.index + y[0].length, w = O;
814
+ for (w += I.value.length; M >= w; )
815
+ I = I.next, w += I.value.length;
816
+ if (w -= I.value.length, O = w, I.value instanceof m)
817
+ continue;
818
+ for (var P = I; P !== t.tail && (w < fe || typeof P.value == "string"); P = P.next)
819
+ U++, w += P.value.length;
820
+ U--, _ = n.slice(O, w), y.index -= O;
821
+ } else if (y = F(Z, 0, _, q), !y)
822
+ continue;
823
+ var M = y.index, $ = y[0], Y = _.slice(0, M), J = _.slice(M + $.length), W = O + _.length;
824
+ d && W > d.reach && (d.reach = W);
825
+ var G = I.prev;
826
+ Y && (G = R(t, G, Y), O += Y.length), C(t, G, U);
827
+ var Ee = new m(f, L ? o.tokenize($, L) : $, ge, $);
828
+ if (I = R(t, G, Ee), J && R(t, I, J), U > 1) {
829
+ var z = {
830
+ cause: f + "," + A,
831
+ reach: W
832
+ };
833
+ D(n, t, r, I.prev, O, z), d && z.reach > d.reach && (d.reach = z.reach);
834
+ }
835
+ }
836
+ }
837
+ }
838
+ }
839
+ }
840
+ function v() {
841
+ var n = { value: null, prev: null, next: null }, t = { value: null, prev: n, next: null };
842
+ n.next = t, this.head = n, this.tail = t, this.length = 0;
843
+ }
844
+ function R(n, t, r) {
845
+ var s = t.next, i = { value: r, prev: t, next: s };
846
+ return t.next = i, s.prev = i, n.length++, i;
847
+ }
848
+ function C(n, t, r) {
849
+ for (var s = t.next, i = 0; i < r && s !== n.tail; i++)
850
+ s = s.next;
851
+ t.next = s, s.prev = t, n.length -= i;
852
+ }
853
+ function N(n) {
854
+ for (var t = [], r = n.head.next; r !== n.tail; )
855
+ t.push(r.value), r = r.next;
856
+ return t;
857
+ }
858
+ if (!u.document)
859
+ return u.addEventListener && (o.disableWorkerMessageHandler || u.addEventListener("message", function(n) {
860
+ var t = JSON.parse(n.data), r = t.language, s = t.code, i = t.immediateClose;
861
+ u.postMessage(o.highlight(s, o.languages[r], r)), i && u.close();
862
+ }, !1)), o;
863
+ var T = o.util.currentScript();
864
+ T && (o.filename = T.src, T.hasAttribute("data-manual") && (o.manual = !0));
865
+ function E() {
866
+ o.manual || o.highlightAll();
867
+ }
868
+ if (!o.manual) {
869
+ var p = document.readyState;
870
+ p === "loading" || p === "interactive" && T && T.defer ? document.addEventListener("DOMContentLoaded", E) : window.requestAnimationFrame ? window.requestAnimationFrame(E) : window.setTimeout(E, 16);
871
+ }
872
+ return o;
873
+ })(g);
874
+ a.exports && (a.exports = e), typeof te < "u" && (te.Prism = e), e.languages.markup = {
875
+ comment: {
876
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
877
+ greedy: !0
878
+ },
879
+ prolog: {
880
+ pattern: /<\?[\s\S]+?\?>/,
881
+ greedy: !0
882
+ },
883
+ doctype: {
884
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
885
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
886
+ greedy: !0,
887
+ inside: {
888
+ "internal-subset": {
889
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
890
+ lookbehind: !0,
891
+ greedy: !0,
892
+ inside: null
893
+ // see below
894
+ },
895
+ string: {
896
+ pattern: /"[^"]*"|'[^']*'/,
897
+ greedy: !0
898
+ },
899
+ punctuation: /^<!|>$|[[\]]/,
900
+ "doctype-tag": /^DOCTYPE/i,
901
+ name: /[^\s<>'"]+/
902
+ }
903
+ },
904
+ cdata: {
905
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
906
+ greedy: !0
907
+ },
908
+ tag: {
909
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
910
+ greedy: !0,
911
+ inside: {
912
+ tag: {
913
+ pattern: /^<\/?[^\s>\/]+/,
914
+ inside: {
915
+ punctuation: /^<\/?/,
916
+ namespace: /^[^\s>\/:]+:/
917
+ }
918
+ },
919
+ "special-attr": [],
920
+ "attr-value": {
921
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
922
+ inside: {
923
+ punctuation: [
924
+ {
925
+ pattern: /^=/,
926
+ alias: "attr-equals"
927
+ },
928
+ {
929
+ pattern: /^(\s*)["']|["']$/,
930
+ lookbehind: !0
931
+ }
932
+ ]
933
+ }
934
+ },
935
+ punctuation: /\/?>/,
936
+ "attr-name": {
937
+ pattern: /[^\s>\/]+/,
938
+ inside: {
939
+ namespace: /^[^\s>\/:]+:/
940
+ }
941
+ }
942
+ }
943
+ },
944
+ entity: [
945
+ {
946
+ pattern: /&[\da-z]{1,8};/i,
947
+ alias: "named-entity"
948
+ },
949
+ /&#x?[\da-f]{1,8};/i
950
+ ]
951
+ }, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(u) {
952
+ u.type === "entity" && (u.attributes.title = u.content.replace(/&amp;/, "&"));
953
+ }), Object.defineProperty(e.languages.markup.tag, "addInlined", {
954
+ /**
955
+ * Adds an inlined language to markup.
956
+ *
957
+ * An example of an inlined language is CSS with `<style>` tags.
958
+ *
959
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
960
+ * case insensitive.
961
+ * @param {string} lang The language key.
962
+ * @example
963
+ * addInlined('style', 'css');
964
+ */
965
+ value: function(c, h) {
966
+ var S = {};
967
+ S["language-" + h] = {
968
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
969
+ lookbehind: !0,
970
+ inside: e.languages[h]
971
+ }, S.cdata = /^<!\[CDATA\[|\]\]>$/i;
972
+ var o = {
973
+ "included-cdata": {
974
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
975
+ inside: S
976
+ }
977
+ };
978
+ o["language-" + h] = {
979
+ pattern: /[\s\S]+/,
980
+ inside: e.languages[h]
981
+ };
982
+ var m = {};
983
+ m[c] = {
984
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
985
+ return c;
986
+ }), "i"),
987
+ lookbehind: !0,
988
+ greedy: !0,
989
+ inside: o
990
+ }, e.languages.insertBefore("markup", "cdata", m);
991
+ }
992
+ }), Object.defineProperty(e.languages.markup.tag, "addAttribute", {
993
+ /**
994
+ * Adds an pattern to highlight languages embedded in HTML attributes.
995
+ *
996
+ * An example of an inlined language is CSS with `style` attributes.
997
+ *
998
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
999
+ * case insensitive.
1000
+ * @param {string} lang The language key.
1001
+ * @example
1002
+ * addAttribute('style', 'css');
1003
+ */
1004
+ value: function(u, c) {
1005
+ e.languages.markup.tag.inside["special-attr"].push({
1006
+ pattern: RegExp(
1007
+ /(^|["'\s])/.source + "(?:" + u + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1008
+ "i"
1009
+ ),
1010
+ lookbehind: !0,
1011
+ inside: {
1012
+ "attr-name": /^[^\s=]+/,
1013
+ "attr-value": {
1014
+ pattern: /=[\s\S]+/,
1015
+ inside: {
1016
+ value: {
1017
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1018
+ lookbehind: !0,
1019
+ alias: [c, "language-" + c],
1020
+ inside: e.languages[c]
1021
+ },
1022
+ punctuation: [
1023
+ {
1024
+ pattern: /^=/,
1025
+ alias: "attr-equals"
1026
+ },
1027
+ /"|'/
1028
+ ]
1029
+ }
1030
+ }
1031
+ }
1032
+ });
1033
+ }
1034
+ }), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, (function(u) {
1035
+ var c = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1036
+ u.languages.css = {
1037
+ comment: /\/\*[\s\S]*?\*\//,
1038
+ atrule: {
1039
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + c.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1040
+ inside: {
1041
+ rule: /^@[\w-]+/,
1042
+ "selector-function-argument": {
1043
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1044
+ lookbehind: !0,
1045
+ alias: "selector"
1046
+ },
1047
+ keyword: {
1048
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1049
+ lookbehind: !0
1050
+ }
1051
+ // See rest below
1052
+ }
1053
+ },
1054
+ url: {
1055
+ // https://drafts.csswg.org/css-values-3/#urls
1056
+ pattern: RegExp("\\burl\\((?:" + c.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1057
+ greedy: !0,
1058
+ inside: {
1059
+ function: /^url/i,
1060
+ punctuation: /^\(|\)$/,
1061
+ string: {
1062
+ pattern: RegExp("^" + c.source + "$"),
1063
+ alias: "url"
1064
+ }
1065
+ }
1066
+ },
1067
+ selector: {
1068
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + c.source + ")*(?=\\s*\\{)"),
1069
+ lookbehind: !0
1070
+ },
1071
+ string: {
1072
+ pattern: c,
1073
+ greedy: !0
1074
+ },
1075
+ property: {
1076
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1077
+ lookbehind: !0
1078
+ },
1079
+ important: /!important\b/i,
1080
+ function: {
1081
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1082
+ lookbehind: !0
1083
+ },
1084
+ punctuation: /[(){};:,]/
1085
+ }, u.languages.css.atrule.inside.rest = u.languages.css;
1086
+ var h = u.languages.markup;
1087
+ h && (h.tag.addInlined("style", "css"), h.tag.addAttribute("style", "css"));
1088
+ })(e), e.languages.clike = {
1089
+ comment: [
1090
+ {
1091
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1092
+ lookbehind: !0,
1093
+ greedy: !0
1094
+ },
1095
+ {
1096
+ pattern: /(^|[^\\:])\/\/.*/,
1097
+ lookbehind: !0,
1098
+ greedy: !0
1099
+ }
1100
+ ],
1101
+ string: {
1102
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1103
+ greedy: !0
1104
+ },
1105
+ "class-name": {
1106
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1107
+ lookbehind: !0,
1108
+ inside: {
1109
+ punctuation: /[.\\]/
1110
+ }
1111
+ },
1112
+ keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1113
+ boolean: /\b(?:false|true)\b/,
1114
+ function: /\b\w+(?=\()/,
1115
+ number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1116
+ operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1117
+ punctuation: /[{}[\];(),.:]/
1118
+ }, e.languages.javascript = e.languages.extend("clike", {
1119
+ "class-name": [
1120
+ e.languages.clike["class-name"],
1121
+ {
1122
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1123
+ lookbehind: !0
1124
+ }
1125
+ ],
1126
+ keyword: [
1127
+ {
1128
+ pattern: /((?:^|\})\s*)catch\b/,
1129
+ lookbehind: !0
1130
+ },
1131
+ {
1132
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1133
+ lookbehind: !0
1134
+ }
1135
+ ],
1136
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1137
+ function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1138
+ number: {
1139
+ pattern: RegExp(
1140
+ /(^|[^\w$])/.source + "(?:" + // constant
1141
+ (/NaN|Infinity/.source + "|" + // binary integer
1142
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1143
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1144
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1145
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1146
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1147
+ ),
1148
+ lookbehind: !0
1149
+ },
1150
+ operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1151
+ }), e.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, e.languages.insertBefore("javascript", "keyword", {
1152
+ regex: {
1153
+ pattern: RegExp(
1154
+ // lookbehind
1155
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1156
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1157
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1158
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1159
+ // with the only syntax, so we have to define 2 different regex patterns.
1160
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1161
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1162
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1163
+ ),
1164
+ lookbehind: !0,
1165
+ greedy: !0,
1166
+ inside: {
1167
+ "regex-source": {
1168
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1169
+ lookbehind: !0,
1170
+ alias: "language-regex",
1171
+ inside: e.languages.regex
1172
+ },
1173
+ "regex-delimiter": /^\/|\/$/,
1174
+ "regex-flags": /^[a-z]+$/
1175
+ }
1176
+ },
1177
+ // This must be declared before keyword because we use "function" inside the look-forward
1178
+ "function-variable": {
1179
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1180
+ alias: "function"
1181
+ },
1182
+ parameter: [
1183
+ {
1184
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1185
+ lookbehind: !0,
1186
+ inside: e.languages.javascript
1187
+ },
1188
+ {
1189
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1190
+ lookbehind: !0,
1191
+ inside: e.languages.javascript
1192
+ },
1193
+ {
1194
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1195
+ lookbehind: !0,
1196
+ inside: e.languages.javascript
1197
+ },
1198
+ {
1199
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1200
+ lookbehind: !0,
1201
+ inside: e.languages.javascript
1202
+ }
1203
+ ],
1204
+ constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1205
+ }), e.languages.insertBefore("javascript", "string", {
1206
+ hashbang: {
1207
+ pattern: /^#!.*/,
1208
+ greedy: !0,
1209
+ alias: "comment"
1210
+ },
1211
+ "template-string": {
1212
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1213
+ greedy: !0,
1214
+ inside: {
1215
+ "template-punctuation": {
1216
+ pattern: /^`|`$/,
1217
+ alias: "string"
1218
+ },
1219
+ interpolation: {
1220
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1221
+ lookbehind: !0,
1222
+ inside: {
1223
+ "interpolation-punctuation": {
1224
+ pattern: /^\$\{|\}$/,
1225
+ alias: "punctuation"
1226
+ },
1227
+ rest: e.languages.javascript
1228
+ }
1229
+ },
1230
+ string: /[\s\S]+/
1231
+ }
1232
+ },
1233
+ "string-property": {
1234
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1235
+ lookbehind: !0,
1236
+ greedy: !0,
1237
+ alias: "property"
1238
+ }
1239
+ }), e.languages.insertBefore("javascript", "operator", {
1240
+ "literal-property": {
1241
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1242
+ lookbehind: !0,
1243
+ alias: "property"
1244
+ }
1245
+ }), e.languages.markup && (e.languages.markup.tag.addInlined("script", "javascript"), e.languages.markup.tag.addAttribute(
1246
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1247
+ "javascript"
1248
+ )), e.languages.js = e.languages.javascript, (function() {
1249
+ if (typeof e > "u" || typeof document > "u")
1250
+ return;
1251
+ Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
1252
+ var u = "Loading…", c = function(T, E) {
1253
+ return "✖ Error " + T + " while fetching file: " + E;
1254
+ }, h = "✖ Error: File does not exist or is empty", S = {
1255
+ js: "javascript",
1256
+ py: "python",
1257
+ rb: "ruby",
1258
+ ps1: "powershell",
1259
+ psm1: "powershell",
1260
+ sh: "bash",
1261
+ bat: "batch",
1262
+ h: "c",
1263
+ tex: "latex"
1264
+ }, o = "data-src-status", m = "loading", F = "loaded", D = "failed", v = "pre[data-src]:not([" + o + '="' + F + '"]):not([' + o + '="' + m + '"])';
1265
+ function R(T, E, p) {
1266
+ var n = new XMLHttpRequest();
1267
+ n.open("GET", T, !0), n.onreadystatechange = function() {
1268
+ n.readyState == 4 && (n.status < 400 && n.responseText ? E(n.responseText) : n.status >= 400 ? p(c(n.status, n.statusText)) : p(h));
1269
+ }, n.send(null);
1270
+ }
1271
+ function C(T) {
1272
+ var E = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(T || "");
1273
+ if (E) {
1274
+ var p = Number(E[1]), n = E[2], t = E[3];
1275
+ return n ? t ? [p, Number(t)] : [p, void 0] : [p, p];
1276
+ }
1277
+ }
1278
+ e.hooks.add("before-highlightall", function(T) {
1279
+ T.selector += ", " + v;
1280
+ }), e.hooks.add("before-sanity-check", function(T) {
1281
+ var E = (
1282
+ /** @type {HTMLPreElement} */
1283
+ T.element
1284
+ );
1285
+ if (E.matches(v)) {
1286
+ T.code = "", E.setAttribute(o, m);
1287
+ var p = E.appendChild(document.createElement("CODE"));
1288
+ p.textContent = u;
1289
+ var n = E.getAttribute("data-src"), t = T.language;
1290
+ if (t === "none") {
1291
+ var r = (/\.(\w+)$/.exec(n) || [, "none"])[1];
1292
+ t = S[r] || r;
1293
+ }
1294
+ e.util.setLanguage(p, t), e.util.setLanguage(E, t);
1295
+ var s = e.plugins.autoloader;
1296
+ s && s.loadLanguages(t), R(
1297
+ n,
1298
+ function(i) {
1299
+ E.setAttribute(o, F);
1300
+ var d = C(E.getAttribute("data-range"));
1301
+ if (d) {
1302
+ var f = i.split(/\r\n?|\n/g), l = d[0], A = d[1] == null ? f.length : d[1];
1303
+ l < 0 && (l += f.length), l = Math.max(0, Math.min(l - 1, f.length)), A < 0 && (A += f.length), A = Math.max(0, Math.min(A, f.length)), i = f.slice(l, A).join(`
1304
+ `), E.hasAttribute("data-start") || E.setAttribute("data-start", String(l + 1));
1305
+ }
1306
+ p.textContent = i, e.highlightElement(p);
1307
+ },
1308
+ function(i) {
1309
+ E.setAttribute(o, D), p.textContent = i;
1310
+ }
1311
+ );
1312
+ }
1313
+ }), e.plugins.fileHighlight = {
1314
+ /**
1315
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1316
+ *
1317
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1318
+ *
1319
+ * @param {ParentNode} [container=document]
1320
+ */
1321
+ highlight: function(E) {
1322
+ for (var p = (E || document).querySelectorAll(v), n = 0, t; t = p[n++]; )
1323
+ e.highlightElement(t);
1324
+ }
1325
+ };
1326
+ var N = !1;
1327
+ e.fileHighlight = function() {
1328
+ N || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), N = !0), e.plugins.fileHighlight.highlight.apply(this, arguments);
1329
+ };
1330
+ })();
1331
+ })(X)), X.exports;
1332
+ }
1333
+ var Ce = we();
1334
+ const ae = /* @__PURE__ */ Le(Ce);
1335
+ var re = {}, se;
1336
+ function ke() {
1337
+ return se || (se = 1, Prism.languages.python = {
1338
+ comment: {
1339
+ pattern: /(^|[^\\])#.*/,
1340
+ lookbehind: !0,
1341
+ greedy: !0
1342
+ },
1343
+ "string-interpolation": {
1344
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1345
+ greedy: !0,
1346
+ inside: {
1347
+ interpolation: {
1348
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
1349
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1350
+ lookbehind: !0,
1351
+ inside: {
1352
+ "format-spec": {
1353
+ pattern: /(:)[^:(){}]+(?=\}$)/,
1354
+ lookbehind: !0
1355
+ },
1356
+ "conversion-option": {
1357
+ pattern: /![sra](?=[:}]$)/,
1358
+ alias: "punctuation"
1359
+ },
1360
+ rest: null
1361
+ }
1362
+ },
1363
+ string: /[\s\S]+/
1364
+ }
1365
+ },
1366
+ "triple-quoted-string": {
1367
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1368
+ greedy: !0,
1369
+ alias: "string"
1370
+ },
1371
+ string: {
1372
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1373
+ greedy: !0
1374
+ },
1375
+ function: {
1376
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1377
+ lookbehind: !0
1378
+ },
1379
+ "class-name": {
1380
+ pattern: /(\bclass\s+)\w+/i,
1381
+ lookbehind: !0
1382
+ },
1383
+ decorator: {
1384
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
1385
+ lookbehind: !0,
1386
+ alias: ["annotation", "punctuation"],
1387
+ inside: {
1388
+ punctuation: /\./
1389
+ }
1390
+ },
1391
+ keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
1392
+ builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
1393
+ boolean: /\b(?:False|None|True)\b/,
1394
+ number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
1395
+ operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1396
+ punctuation: /[{}[\];(),.:]/
1397
+ }, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python), re;
1398
+ }
1399
+ ke();
1400
+ var ie = {}, oe;
1401
+ function De() {
1402
+ return oe || (oe = 1, (function(a) {
1403
+ a.languages.typescript = a.languages.extend("javascript", {
1404
+ "class-name": {
1405
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
1406
+ lookbehind: !0,
1407
+ greedy: !0,
1408
+ inside: null
1409
+ // see below
1410
+ },
1411
+ builtin: /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
1412
+ }), a.languages.typescript.keyword.push(
1413
+ /\b(?:abstract|declare|is|keyof|readonly|require)\b/,
1414
+ // keywords that have to be followed by an identifier
1415
+ /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
1416
+ // This is for `import type *, {}`
1417
+ /\btype\b(?=\s*(?:[\{*]|$))/
1418
+ ), delete a.languages.typescript.parameter, delete a.languages.typescript["literal-property"];
1419
+ var g = a.languages.extend("typescript", {});
1420
+ delete g["class-name"], a.languages.typescript["class-name"].inside = g, a.languages.insertBefore("typescript", "function", {
1421
+ decorator: {
1422
+ pattern: /@[$\w\xA0-\uFFFF]+/,
1423
+ inside: {
1424
+ at: {
1425
+ pattern: /^@/,
1426
+ alias: "operator"
1427
+ },
1428
+ function: /^[\s\S]+/
1429
+ }
1430
+ },
1431
+ "generic-function": {
1432
+ // e.g. foo<T extends "bar" | "baz">( ...
1433
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
1434
+ greedy: !0,
1435
+ inside: {
1436
+ function: /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
1437
+ generic: {
1438
+ pattern: /<[\s\S]+/,
1439
+ // everything after the first <
1440
+ alias: "class-name",
1441
+ inside: g
1442
+ }
1443
+ }
1444
+ }
1445
+ }), a.languages.ts = a.languages.typescript;
1446
+ })(Prism)), ie;
1447
+ }
1448
+ De();
1449
+ (function(a) {
1450
+ var g = "\\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", e = {
1451
+ pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1452
+ lookbehind: !0,
1453
+ alias: "punctuation",
1454
+ // this looks reasonably well in all themes
1455
+ inside: null
1456
+ // see below
1457
+ }, u = {
1458
+ bash: e,
1459
+ environment: {
1460
+ pattern: RegExp("\\$" + g),
1461
+ alias: "constant"
1462
+ },
1463
+ variable: [
1464
+ // [0]: Arithmetic Environment
1465
+ {
1466
+ pattern: /\$?\(\([\s\S]+?\)\)/,
1467
+ greedy: !0,
1468
+ inside: {
1469
+ // If there is a $ sign at the beginning highlight $(( and )) as variable
1470
+ variable: [
1471
+ {
1472
+ pattern: /(^\$\(\([\s\S]+)\)\)/,
1473
+ lookbehind: !0
1474
+ },
1475
+ /^\$\(\(/
1476
+ ],
1477
+ number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
1478
+ // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
1479
+ operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
1480
+ // If there is no $ sign at the beginning highlight (( and )) as punctuation
1481
+ punctuation: /\(\(?|\)\)?|,|;/
1482
+ }
1483
+ },
1484
+ // [1]: Command Substitution
1485
+ {
1486
+ pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
1487
+ greedy: !0,
1488
+ inside: {
1489
+ variable: /^\$\(|^`|\)$|`$/
1490
+ }
1491
+ },
1492
+ // [2]: Brace expansion
1493
+ {
1494
+ pattern: /\$\{[^}]+\}/,
1495
+ greedy: !0,
1496
+ inside: {
1497
+ operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
1498
+ punctuation: /[\[\]]/,
1499
+ environment: {
1500
+ pattern: RegExp("(\\{)" + g),
1501
+ lookbehind: !0,
1502
+ alias: "constant"
1503
+ }
1504
+ }
1505
+ },
1506
+ /\$(?:\w+|[#?*!@$])/
1507
+ ],
1508
+ // Escape sequences from echo and printf's manuals, and escaped quotes.
1509
+ entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
1510
+ };
1511
+ a.languages.bash = {
1512
+ shebang: {
1513
+ pattern: /^#!\s*\/.*/,
1514
+ alias: "important"
1515
+ },
1516
+ comment: {
1517
+ pattern: /(^|[^"{\\$])#.*/,
1518
+ lookbehind: !0
1519
+ },
1520
+ "function-name": [
1521
+ // a) function foo {
1522
+ // b) foo() {
1523
+ // c) function foo() {
1524
+ // but not “foo {”
1525
+ {
1526
+ // a) and c)
1527
+ pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
1528
+ lookbehind: !0,
1529
+ alias: "function"
1530
+ },
1531
+ {
1532
+ // b)
1533
+ pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
1534
+ alias: "function"
1535
+ }
1536
+ ],
1537
+ // Highlight variable names as variables in for and select beginnings.
1538
+ "for-or-select": {
1539
+ pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
1540
+ alias: "variable",
1541
+ lookbehind: !0
1542
+ },
1543
+ // Highlight variable names as variables in the left-hand part
1544
+ // of assignments (“=” and “+=”).
1545
+ "assign-left": {
1546
+ pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
1547
+ inside: {
1548
+ environment: {
1549
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + g),
1550
+ lookbehind: !0,
1551
+ alias: "constant"
1552
+ }
1553
+ },
1554
+ alias: "variable",
1555
+ lookbehind: !0
1556
+ },
1557
+ // Highlight parameter names as variables
1558
+ parameter: {
1559
+ pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
1560
+ alias: "variable",
1561
+ lookbehind: !0
1562
+ },
1563
+ string: [
1564
+ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
1565
+ {
1566
+ pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
1567
+ lookbehind: !0,
1568
+ greedy: !0,
1569
+ inside: u
1570
+ },
1571
+ // Here-document with quotes around the tag
1572
+ // → No expansion (so no “inside”).
1573
+ {
1574
+ pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
1575
+ lookbehind: !0,
1576
+ greedy: !0,
1577
+ inside: {
1578
+ bash: e
1579
+ }
1580
+ },
1581
+ // “Normal” string
1582
+ {
1583
+ // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
1584
+ pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
1585
+ lookbehind: !0,
1586
+ greedy: !0,
1587
+ inside: u
1588
+ },
1589
+ {
1590
+ // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
1591
+ pattern: /(^|[^$\\])'[^']*'/,
1592
+ lookbehind: !0,
1593
+ greedy: !0
1594
+ },
1595
+ {
1596
+ // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
1597
+ pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
1598
+ greedy: !0,
1599
+ inside: {
1600
+ entity: u.entity
1601
+ }
1602
+ }
1603
+ ],
1604
+ environment: {
1605
+ pattern: RegExp("\\$?" + g),
1606
+ alias: "constant"
1607
+ },
1608
+ variable: u.variable,
1609
+ function: {
1610
+ pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
1611
+ lookbehind: !0
1612
+ },
1613
+ keyword: {
1614
+ pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
1615
+ lookbehind: !0
1616
+ },
1617
+ // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
1618
+ builtin: {
1619
+ pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
1620
+ lookbehind: !0,
1621
+ // Alias added to make those easier to distinguish from strings.
1622
+ alias: "class-name"
1623
+ },
1624
+ boolean: {
1625
+ pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
1626
+ lookbehind: !0
1627
+ },
1628
+ "file-descriptor": {
1629
+ pattern: /\B&\d\b/,
1630
+ alias: "important"
1631
+ },
1632
+ operator: {
1633
+ // Lots of redirections here, but not just that.
1634
+ pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
1635
+ inside: {
1636
+ "file-descriptor": {
1637
+ pattern: /^\d/,
1638
+ alias: "important"
1639
+ }
1640
+ }
1641
+ },
1642
+ punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
1643
+ number: {
1644
+ pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
1645
+ lookbehind: !0
1646
+ }
1647
+ }, e.inside = a.languages.bash;
1648
+ for (var c = [
1649
+ "comment",
1650
+ "function-name",
1651
+ "for-or-select",
1652
+ "assign-left",
1653
+ "parameter",
1654
+ "string",
1655
+ "environment",
1656
+ "function",
1657
+ "keyword",
1658
+ "builtin",
1659
+ "boolean",
1660
+ "file-descriptor",
1661
+ "operator",
1662
+ "punctuation",
1663
+ "number"
1664
+ ], h = u.variable[1].inside, S = 0; S < c.length; S++)
1665
+ h[c[S]] = a.languages.bash[c[S]];
1666
+ a.languages.sh = a.languages.bash, a.languages.shell = a.languages.bash;
1667
+ })(Prism);
1668
+ Prism.languages.json = {
1669
+ property: {
1670
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1671
+ lookbehind: !0,
1672
+ greedy: !0
1673
+ },
1674
+ string: {
1675
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1676
+ lookbehind: !0,
1677
+ greedy: !0
1678
+ },
1679
+ comment: {
1680
+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1681
+ greedy: !0
1682
+ },
1683
+ number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1684
+ punctuation: /[{}[\],]/,
1685
+ operator: /:/,
1686
+ boolean: /\b(?:false|true)\b/,
1687
+ null: {
1688
+ pattern: /\bnull\b/,
1689
+ alias: "keyword"
1690
+ }
1691
+ };
1692
+ Prism.languages.webmanifest = Prism.languages.json;
1693
+ (function(a) {
1694
+ var g = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1695
+ a.languages.css = {
1696
+ comment: /\/\*[\s\S]*?\*\//,
1697
+ atrule: {
1698
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + g.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1699
+ inside: {
1700
+ rule: /^@[\w-]+/,
1701
+ "selector-function-argument": {
1702
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1703
+ lookbehind: !0,
1704
+ alias: "selector"
1705
+ },
1706
+ keyword: {
1707
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1708
+ lookbehind: !0
1709
+ }
1710
+ // See rest below
1711
+ }
1712
+ },
1713
+ url: {
1714
+ // https://drafts.csswg.org/css-values-3/#urls
1715
+ pattern: RegExp("\\burl\\((?:" + g.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1716
+ greedy: !0,
1717
+ inside: {
1718
+ function: /^url/i,
1719
+ punctuation: /^\(|\)$/,
1720
+ string: {
1721
+ pattern: RegExp("^" + g.source + "$"),
1722
+ alias: "url"
1723
+ }
1724
+ }
1725
+ },
1726
+ selector: {
1727
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + g.source + ")*(?=\\s*\\{)"),
1728
+ lookbehind: !0
1729
+ },
1730
+ string: {
1731
+ pattern: g,
1732
+ greedy: !0
1733
+ },
1734
+ property: {
1735
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1736
+ lookbehind: !0
1737
+ },
1738
+ important: /!important\b/i,
1739
+ function: {
1740
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1741
+ lookbehind: !0
1742
+ },
1743
+ punctuation: /[(){};:,]/
1744
+ }, a.languages.css.atrule.inside.rest = a.languages.css;
1745
+ var e = a.languages.markup;
1746
+ e && (e.tag.addInlined("style", "css"), e.tag.addAttribute("style", "css"));
1747
+ })(Prism);
1748
+ Prism.languages.markup = {
1749
+ comment: {
1750
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1751
+ greedy: !0
1752
+ },
1753
+ prolog: {
1754
+ pattern: /<\?[\s\S]+?\?>/,
1755
+ greedy: !0
1756
+ },
1757
+ doctype: {
1758
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1759
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1760
+ greedy: !0,
1761
+ inside: {
1762
+ "internal-subset": {
1763
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1764
+ lookbehind: !0,
1765
+ greedy: !0,
1766
+ inside: null
1767
+ // see below
1768
+ },
1769
+ string: {
1770
+ pattern: /"[^"]*"|'[^']*'/,
1771
+ greedy: !0
1772
+ },
1773
+ punctuation: /^<!|>$|[[\]]/,
1774
+ "doctype-tag": /^DOCTYPE/i,
1775
+ name: /[^\s<>'"]+/
1776
+ }
1777
+ },
1778
+ cdata: {
1779
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1780
+ greedy: !0
1781
+ },
1782
+ tag: {
1783
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1784
+ greedy: !0,
1785
+ inside: {
1786
+ tag: {
1787
+ pattern: /^<\/?[^\s>\/]+/,
1788
+ inside: {
1789
+ punctuation: /^<\/?/,
1790
+ namespace: /^[^\s>\/:]+:/
1791
+ }
1792
+ },
1793
+ "special-attr": [],
1794
+ "attr-value": {
1795
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1796
+ inside: {
1797
+ punctuation: [
1798
+ {
1799
+ pattern: /^=/,
1800
+ alias: "attr-equals"
1801
+ },
1802
+ {
1803
+ pattern: /^(\s*)["']|["']$/,
1804
+ lookbehind: !0
1805
+ }
1806
+ ]
1807
+ }
1808
+ },
1809
+ punctuation: /\/?>/,
1810
+ "attr-name": {
1811
+ pattern: /[^\s>\/]+/,
1812
+ inside: {
1813
+ namespace: /^[^\s>\/:]+:/
1814
+ }
1815
+ }
1816
+ }
1817
+ },
1818
+ entity: [
1819
+ {
1820
+ pattern: /&[\da-z]{1,8};/i,
1821
+ alias: "named-entity"
1822
+ },
1823
+ /&#x?[\da-f]{1,8};/i
1824
+ ]
1825
+ };
1826
+ Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity;
1827
+ Prism.languages.markup.doctype.inside["internal-subset"].inside = Prism.languages.markup;
1828
+ Prism.hooks.add("wrap", function(a) {
1829
+ a.type === "entity" && (a.attributes.title = a.content.replace(/&amp;/, "&"));
1830
+ });
1831
+ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
1832
+ /**
1833
+ * Adds an inlined language to markup.
1834
+ *
1835
+ * An example of an inlined language is CSS with `<style>` tags.
1836
+ *
1837
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1838
+ * case insensitive.
1839
+ * @param {string} lang The language key.
1840
+ * @example
1841
+ * addInlined('style', 'css');
1842
+ */
1843
+ value: function(g, e) {
1844
+ var u = {};
1845
+ u["language-" + e] = {
1846
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1847
+ lookbehind: !0,
1848
+ inside: Prism.languages[e]
1849
+ }, u.cdata = /^<!\[CDATA\[|\]\]>$/i;
1850
+ var c = {
1851
+ "included-cdata": {
1852
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1853
+ inside: u
1854
+ }
1855
+ };
1856
+ c["language-" + e] = {
1857
+ pattern: /[\s\S]+/,
1858
+ inside: Prism.languages[e]
1859
+ };
1860
+ var h = {};
1861
+ h[g] = {
1862
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1863
+ return g;
1864
+ }), "i"),
1865
+ lookbehind: !0,
1866
+ greedy: !0,
1867
+ inside: c
1868
+ }, Prism.languages.insertBefore("markup", "cdata", h);
1869
+ }
1870
+ });
1871
+ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
1872
+ /**
1873
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1874
+ *
1875
+ * An example of an inlined language is CSS with `style` attributes.
1876
+ *
1877
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1878
+ * case insensitive.
1879
+ * @param {string} lang The language key.
1880
+ * @example
1881
+ * addAttribute('style', 'css');
1882
+ */
1883
+ value: function(a, g) {
1884
+ Prism.languages.markup.tag.inside["special-attr"].push({
1885
+ pattern: RegExp(
1886
+ /(^|["'\s])/.source + "(?:" + a + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1887
+ "i"
1888
+ ),
1889
+ lookbehind: !0,
1890
+ inside: {
1891
+ "attr-name": /^[^\s=]+/,
1892
+ "attr-value": {
1893
+ pattern: /=[\s\S]+/,
1894
+ inside: {
1895
+ value: {
1896
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1897
+ lookbehind: !0,
1898
+ alias: [g, "language-" + g],
1899
+ inside: Prism.languages[g]
1900
+ },
1901
+ punctuation: [
1902
+ {
1903
+ pattern: /^=/,
1904
+ alias: "attr-equals"
1905
+ },
1906
+ /"|'/
1907
+ ]
1908
+ }
1909
+ }
1910
+ }
1911
+ });
1912
+ }
1913
+ });
1914
+ Prism.languages.html = Prism.languages.markup;
1915
+ Prism.languages.mathml = Prism.languages.markup;
1916
+ Prism.languages.svg = Prism.languages.markup;
1917
+ Prism.languages.xml = Prism.languages.extend("markup", {});
1918
+ Prism.languages.ssml = Prism.languages.xml;
1919
+ Prism.languages.atom = Prism.languages.xml;
1920
+ Prism.languages.rss = Prism.languages.xml;
1921
+ Prism.languages.sql = {
1922
+ comment: {
1923
+ pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
1924
+ lookbehind: !0
1925
+ },
1926
+ variable: [
1927
+ {
1928
+ pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
1929
+ greedy: !0
1930
+ },
1931
+ /@[\w.$]+/
1932
+ ],
1933
+ string: {
1934
+ pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
1935
+ greedy: !0,
1936
+ lookbehind: !0
1937
+ },
1938
+ identifier: {
1939
+ pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
1940
+ greedy: !0,
1941
+ lookbehind: !0,
1942
+ inside: {
1943
+ punctuation: /^`|`$/
1944
+ }
1945
+ },
1946
+ function: /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
1947
+ // Should we highlight user defined functions too?
1948
+ keyword: /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
1949
+ boolean: /\b(?:FALSE|NULL|TRUE)\b/i,
1950
+ number: /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
1951
+ operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
1952
+ punctuation: /[;[\]()`,.]/
1953
+ };
1954
+ const _e = {
1955
+ js: "javascript",
1956
+ ts: "typescript",
1957
+ shell: "bash",
1958
+ sh: "bash",
1959
+ html: "markup",
1960
+ xml: "markup"
1961
+ };
1962
+ H.setOptions({
137
1963
  breaks: !0,
138
1964
  gfm: !0
139
1965
  });
140
- function B(e) {
141
- return e.split(/\n\s*\n/).map((t) => t.trim()).filter((t) => t).map((t) => ({
142
- html: S.parseInline(t)
143
- }));
144
- }
145
- const F = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672";
146
- let A = !1;
147
- function $() {
148
- A || (p.init({
149
- dsn: F,
1966
+ const de = new H.Renderer();
1967
+ de.code = ({ text: a, lang: g }) => {
1968
+ const e = g ? _e[g] || g : "plaintext", u = ae.languages[e];
1969
+ if (u) {
1970
+ const h = ae.highlight(a, u, e);
1971
+ return `<pre><code class="language-${e}">${h}</code></pre>`;
1972
+ }
1973
+ return `<pre><code>${a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</code></pre>`;
1974
+ };
1975
+ H.use({ renderer: de });
1976
+ function qe(a) {
1977
+ return H.parse(a);
1978
+ }
1979
+ const Pe = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672", xe = [
1980
+ "@useknest",
1981
+ "useknest",
1982
+ "widget-core",
1983
+ "widget-web",
1984
+ "widget-react",
1985
+ "widget.umd.js",
1986
+ "widget.js",
1987
+ "knest"
1988
+ ];
1989
+ function Ue(a) {
1990
+ if (a.tags?.source === "knest-widget") return !0;
1991
+ const g = a.exception?.values?.[0]?.stacktrace?.frames;
1992
+ return !g || g.length === 0 ? !1 : g.some((e) => {
1993
+ const u = e.filename || "";
1994
+ return xe.some((c) => u.includes(c));
1995
+ });
1996
+ }
1997
+ let ue = !1;
1998
+ function Ve() {
1999
+ ue || (j.init({
2000
+ dsn: Pe,
150
2001
  // Only capture errors, not performance data.
151
2002
  tracesSampleRate: 0,
152
- // Minimal breadcrumbs to reduce noise.
153
2003
  integrations: [
154
- p.breadcrumbsIntegration({
2004
+ j.breadcrumbsIntegration({
155
2005
  console: !1,
156
2006
  dom: !0,
157
2007
  fetch: !0,
@@ -164,35 +2014,55 @@ function $() {
164
2014
  tags: {
165
2015
  source: "knest-widget"
166
2016
  }
2017
+ },
2018
+ // Filter out errors that don't originate from our widget code.
2019
+ beforeSend(a) {
2020
+ return Ue(a) ? a : null;
167
2021
  }
168
- }), A = !0);
2022
+ }), ue = !0);
169
2023
  }
170
- function X(e, o) {
171
- const t = typeof e == "string" ? new Error(e) : e;
172
- p.captureException(t, {
2024
+ function Ze(a, g) {
2025
+ const e = typeof a == "string" ? new Error(a) : a;
2026
+ j.captureException(e, {
173
2027
  tags: { source: "knest-widget" },
174
- extra: o
2028
+ extra: g
175
2029
  });
176
2030
  }
2031
+ function Je(a, g) {
2032
+ const e = Fe();
2033
+ if (!e)
2034
+ return () => {
2035
+ };
2036
+ const u = e.channel(`thread:${a}`).on("broadcast", { event: "new-message" }, (c) => {
2037
+ g(c.payload);
2038
+ }).subscribe();
2039
+ return () => {
2040
+ u.unsubscribe();
2041
+ };
2042
+ }
177
2043
  export {
178
- I as API_PATH,
179
- W as AUTH_ERROR_MESSAGE,
180
- N as DEFAULT_AVATAR_URL,
181
- b as DEFAULT_BASE_URL,
182
- P as DEFAULT_BRAND_COLOR,
183
- m as DEFAULT_ERROR_MESSAGE,
184
- G as DEFAULT_EXAMPLE_QUESTIONS,
185
- v as DEFAULT_WELCOME_MESSAGE,
186
- L as FALLBACK_ERROR_MESSAGE,
187
- X as captureWidgetException,
188
- H as fetchWidgetConfig,
189
- B as formatContent,
190
- D as getAccessToken,
191
- C as getChatApiUrl,
192
- U as getConfigApiUrl,
193
- j as getSupabaseClient,
194
- K as initWidgetAuth,
195
- $ as initWidgetSentry,
196
- O as isAuthenticated,
197
- z as streamChatMessage
2044
+ ce as API_PATH,
2045
+ Te as AUTH_ERROR_MESSAGE,
2046
+ He as DEFAULT_AVATAR_URL,
2047
+ le as DEFAULT_BASE_URL,
2048
+ Ye as DEFAULT_BRAND_COLOR,
2049
+ Q as DEFAULT_ERROR_MESSAGE,
2050
+ ze as DEFAULT_EXAMPLE_QUESTIONS,
2051
+ We as DEFAULT_WELCOME_MESSAGE,
2052
+ Se as FALLBACK_ERROR_MESSAGE,
2053
+ Be as PUBLIC_SUPABASE_ANON_KEY,
2054
+ Ge as PUBLIC_SUPABASE_URL,
2055
+ be as USAGE_LIMIT_MESSAGE,
2056
+ Ze as captureWidgetException,
2057
+ Xe as fetchWidgetConfig,
2058
+ qe as formatContent,
2059
+ ve as getAccessToken,
2060
+ me as getChatApiUrl,
2061
+ Ae as getConfigApiUrl,
2062
+ Fe as getSupabaseClient,
2063
+ je as initWidgetAuth,
2064
+ Ve as initWidgetSentry,
2065
+ Ne as isAuthenticated,
2066
+ Ke as streamChatMessage,
2067
+ Je as subscribeToThread
198
2068
  };