@arborium/arborium 2.4.7 → 2.6.0

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/arborium.js CHANGED
@@ -1,4 +1,4 @@
1
- const x = "2.4.7", $ = [
1
+ const L = "2.6.0", _ = [
2
2
  "ada",
3
3
  "agda",
4
4
  "asciidoc",
@@ -71,6 +71,7 @@ const x = "2.4.7", $ = [
71
71
  "scala",
72
72
  "scheme",
73
73
  "scss",
74
+ "solidity",
74
75
  "sparql",
75
76
  "sql",
76
77
  "ssh-config",
@@ -97,204 +98,544 @@ const x = "2.4.7", $ = [
97
98
  "yuri",
98
99
  "zig",
99
100
  "zsh"
100
- ], L = {
101
+ ], M = [
102
+ {
103
+ name: "attribute",
104
+ tag: "at"
105
+ },
106
+ {
107
+ name: "constant",
108
+ tag: "co"
109
+ },
110
+ {
111
+ name: "constant.builtin",
112
+ tag: "co",
113
+ parentTag: "co"
114
+ },
115
+ {
116
+ name: "constructor",
117
+ tag: "cr"
118
+ },
119
+ {
120
+ name: "function.builtin",
121
+ tag: "fb",
122
+ parentTag: "f"
123
+ },
124
+ {
125
+ name: "function",
126
+ tag: "f"
127
+ },
128
+ {
129
+ name: "function.method",
130
+ tag: "f",
131
+ parentTag: "f"
132
+ },
133
+ {
134
+ name: "keyword",
135
+ tag: "k"
136
+ },
137
+ {
138
+ name: "keyword.conditional",
139
+ tag: "k",
140
+ parentTag: "k"
141
+ },
142
+ {
143
+ name: "keyword.coroutine",
144
+ tag: "k",
145
+ parentTag: "k"
146
+ },
147
+ {
148
+ name: "keyword.debug",
149
+ tag: "k",
150
+ parentTag: "k"
151
+ },
152
+ {
153
+ name: "keyword.exception",
154
+ tag: "k",
155
+ parentTag: "k"
156
+ },
157
+ {
158
+ name: "keyword.function",
159
+ tag: "k",
160
+ parentTag: "k"
161
+ },
162
+ {
163
+ name: "keyword.import",
164
+ tag: "k",
165
+ parentTag: "k"
166
+ },
167
+ {
168
+ name: "keyword.operator",
169
+ tag: "o",
170
+ parentTag: "k"
171
+ },
172
+ {
173
+ name: "keyword.repeat",
174
+ tag: "k",
175
+ parentTag: "k"
176
+ },
177
+ {
178
+ name: "keyword.return",
179
+ tag: "k",
180
+ parentTag: "k"
181
+ },
182
+ {
183
+ name: "keyword.type",
184
+ tag: "k",
185
+ parentTag: "k"
186
+ },
187
+ {
188
+ name: "operator",
189
+ tag: "o"
190
+ },
191
+ {
192
+ name: "property",
193
+ tag: "pr"
194
+ },
195
+ {
196
+ name: "punctuation",
197
+ tag: "p"
198
+ },
199
+ {
200
+ name: "punctuation.bracket",
201
+ tag: "p",
202
+ parentTag: "p"
203
+ },
204
+ {
205
+ name: "punctuation.delimiter",
206
+ tag: "p",
207
+ parentTag: "p"
208
+ },
209
+ {
210
+ name: "punctuation.special",
211
+ tag: "p",
212
+ parentTag: "p"
213
+ },
214
+ {
215
+ name: "string",
216
+ tag: "s"
217
+ },
218
+ {
219
+ name: "string.special",
220
+ tag: "s",
221
+ parentTag: "s"
222
+ },
223
+ {
224
+ name: "tag",
225
+ tag: "tg"
226
+ },
227
+ {
228
+ name: "tag.delimiter",
229
+ tag: "tg",
230
+ parentTag: "tg"
231
+ },
232
+ {
233
+ name: "tag.error",
234
+ tag: "err",
235
+ parentTag: "tg"
236
+ },
237
+ {
238
+ name: "type",
239
+ tag: "t"
240
+ },
241
+ {
242
+ name: "type.builtin",
243
+ tag: "t",
244
+ parentTag: "t"
245
+ },
246
+ {
247
+ name: "type.qualifier",
248
+ tag: "t",
249
+ parentTag: "t"
250
+ },
251
+ {
252
+ name: "variable",
253
+ tag: "v"
254
+ },
255
+ {
256
+ name: "variable.builtin",
257
+ tag: "v",
258
+ parentTag: "v"
259
+ },
260
+ {
261
+ name: "variable.parameter",
262
+ tag: "v",
263
+ parentTag: "v"
264
+ },
265
+ {
266
+ name: "comment",
267
+ tag: "c"
268
+ },
269
+ {
270
+ name: "comment.documentation",
271
+ tag: "c",
272
+ parentTag: "c"
273
+ },
274
+ {
275
+ name: "macro",
276
+ tag: "m"
277
+ },
278
+ {
279
+ name: "label",
280
+ tag: "l"
281
+ },
282
+ {
283
+ name: "diff.addition",
284
+ tag: "da"
285
+ },
286
+ {
287
+ name: "diff.deletion",
288
+ tag: "dd"
289
+ },
290
+ {
291
+ name: "number",
292
+ tag: "n"
293
+ },
294
+ {
295
+ name: "text.literal",
296
+ tag: "tl"
297
+ },
298
+ {
299
+ name: "text.emphasis",
300
+ tag: "em"
301
+ },
302
+ {
303
+ name: "text.strong",
304
+ tag: "st"
305
+ },
306
+ {
307
+ name: "text.uri",
308
+ tag: "tu"
309
+ },
310
+ {
311
+ name: "text.reference",
312
+ tag: "tr"
313
+ },
314
+ {
315
+ name: "string.escape",
316
+ tag: "se",
317
+ parentTag: "s"
318
+ },
319
+ {
320
+ name: "text.title",
321
+ tag: "tt"
322
+ },
323
+ {
324
+ name: "text.strikethrough",
325
+ tag: "ts"
326
+ },
327
+ {
328
+ name: "spell",
329
+ tag: ""
330
+ },
331
+ {
332
+ name: "embedded",
333
+ tag: "eb"
334
+ },
335
+ {
336
+ name: "error",
337
+ tag: "err"
338
+ },
339
+ {
340
+ name: "namespace",
341
+ tag: "ns"
342
+ },
343
+ {
344
+ name: "include",
345
+ tag: "k",
346
+ parentTag: "k"
347
+ },
348
+ {
349
+ name: "storageclass",
350
+ tag: "k",
351
+ parentTag: "k"
352
+ },
353
+ {
354
+ name: "repeat",
355
+ tag: "k",
356
+ parentTag: "k"
357
+ },
358
+ {
359
+ name: "conditional",
360
+ tag: "k",
361
+ parentTag: "k"
362
+ },
363
+ {
364
+ name: "exception",
365
+ tag: "k",
366
+ parentTag: "k"
367
+ },
368
+ {
369
+ name: "preproc",
370
+ tag: "pp"
371
+ },
372
+ {
373
+ name: "none",
374
+ tag: ""
375
+ },
376
+ {
377
+ name: "character",
378
+ tag: "ch",
379
+ parentTag: "s"
380
+ },
381
+ {
382
+ name: "character.special",
383
+ tag: "ch",
384
+ parentTag: "ch"
385
+ },
386
+ {
387
+ name: "variable.member",
388
+ tag: "pr",
389
+ parentTag: "v"
390
+ },
391
+ {
392
+ name: "function.definition",
393
+ tag: "f",
394
+ parentTag: "f"
395
+ },
396
+ {
397
+ name: "type.definition",
398
+ tag: "t",
399
+ parentTag: "t"
400
+ },
401
+ {
402
+ name: "function.call",
403
+ tag: "f",
404
+ parentTag: "f"
405
+ },
406
+ {
407
+ name: "keyword.modifier",
408
+ tag: "k",
409
+ parentTag: "k"
410
+ },
411
+ {
412
+ name: "keyword.directive",
413
+ tag: "k",
414
+ parentTag: "k"
415
+ },
416
+ {
417
+ name: "string.regexp",
418
+ tag: "sr",
419
+ parentTag: "s"
420
+ },
421
+ {
422
+ name: "nospell",
423
+ tag: ""
424
+ },
425
+ {
426
+ name: "float",
427
+ tag: "n",
428
+ parentTag: "n"
429
+ },
430
+ {
431
+ name: "boolean",
432
+ tag: "bo",
433
+ parentTag: "co"
434
+ }
435
+ ];
436
+ function y(t, a) {
437
+ const r = [...a].sort((n, o) => n.start - o.start);
438
+ let e = "", s = 0;
439
+ for (const n of r) {
440
+ if (n.start < s) continue;
441
+ n.start > s && (e += u(t.slice(s, n.start)));
442
+ const o = U(n.capture), i = u(t.slice(n.start, n.end));
443
+ o ? e += `<a-${o}>${i}</a-${o}>` : e += i, s = n.end;
444
+ }
445
+ return s < t.length && (e += u(t.slice(s))), e;
446
+ }
447
+ function U(t) {
448
+ return t.startsWith("keyword") || t === "include" || t === "conditional" ? "k" : t.startsWith("function") || t.startsWith("method") ? "f" : t.startsWith("string") || t === "character" ? "s" : t.startsWith("comment") ? "c" : t.startsWith("type") ? "t" : t.startsWith("variable") ? "v" : t.startsWith("number") || t === "float" ? "n" : t.startsWith("operator") ? "o" : t.startsWith("punctuation") ? "p" : t.startsWith("tag") ? "tg" : t.startsWith("attribute") ? "at" : null;
449
+ }
450
+ function u(t) {
451
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
452
+ }
453
+ const v = {
101
454
  manual: !1,
102
455
  theme: "one-dark",
103
456
  selector: "pre code",
104
457
  cdn: "jsdelivr",
105
- version: x,
458
+ version: L,
106
459
  // Precise version from manifest
107
460
  pluginsUrl: "",
108
461
  // Empty means use bundled manifest
109
- hostUrl: ""
462
+ hostUrl: "",
110
463
  // Empty means use CDN based on version
464
+ resolveJs: ({ baseUrl: t, path: a }) => import(
465
+ /* @vite-ignore */
466
+ `${t}/${a}`
467
+ ),
468
+ resolveWasm: ({ baseUrl: t, path: a }) => fetch(`${t}/${a}`)
111
469
  };
112
- let p = null, f = null, o = { ...L };
113
- const g = /* @__PURE__ */ new Map(), j = new Set($);
114
- let l = null, b = null;
115
- async function _() {
116
- if (o.pluginsUrl)
117
- return b || (b = (async () => {
118
- console.debug(`[arborium] Loading local plugins manifest from: ${o.pluginsUrl}`);
119
- const s = await fetch(o.pluginsUrl);
120
- if (!s.ok)
121
- throw new Error(`Failed to load plugins.json: ${s.status}`);
122
- l = await s.json(), console.debug(`[arborium] Loaded local manifest with ${l?.entries.length} entries`);
123
- })(), b);
470
+ let p = null, g = null, d = { ...v };
471
+ const h = /* @__PURE__ */ new Map(), T = new Set(_);
472
+ let l = null, m = null;
473
+ async function E(t) {
474
+ if (t.pluginsUrl)
475
+ return m || (m = (async () => {
476
+ console.debug(`[arborium] Loading local plugins manifest from: ${t.pluginsUrl}`);
477
+ const a = await fetch(t.pluginsUrl);
478
+ if (!a.ok)
479
+ throw new Error(`Failed to load plugins.json: ${a.status}`);
480
+ l = await a.json(), console.debug(`[arborium] Loaded local manifest with ${l?.entries.length} entries`);
481
+ })(), m);
124
482
  }
125
- function U(s) {
483
+ function W(t, a) {
126
484
  if (l) {
127
- const a = l.entries.find((r) => r.language === s);
128
- if (a)
129
- return a.local_js.substring(0, a.local_js.lastIndexOf("/"));
485
+ const n = l.entries.find((o) => o.language === t);
486
+ if (n)
487
+ return n.local_js.substring(0, n.local_js.lastIndexOf("/"));
130
488
  }
131
- const e = o.cdn, t = o.version;
132
- let n;
133
- return e === "jsdelivr" ? n = "https://cdn.jsdelivr.net/npm" : e === "unpkg" ? n = "https://unpkg.com" : n = e, `${n}/@arborium/${s}@${t}`;
489
+ const r = a.cdn, e = a.version;
490
+ let s;
491
+ return r === "jsdelivr" ? s = "https://cdn.jsdelivr.net/npm" : r === "unpkg" ? s = "https://unpkg.com" : s = r, `${s}/@arborium/${t}@${e}`;
134
492
  }
135
- async function w(s) {
136
- const e = g.get(s);
137
- if (e)
138
- return console.debug(`[arborium] Grammar '${s}' found in cache`), e;
139
- if (await _(), !j.has(s) && !l?.entries.some((t) => t.language === s))
140
- return console.debug(`[arborium] Grammar '${s}' not available`), null;
493
+ async function w(t, a) {
494
+ const r = h.get(t);
495
+ if (r)
496
+ return console.debug(`[arborium] Grammar '${t}' found in cache`), r;
497
+ if (await E(a), !T.has(t) && !l?.entries.some((e) => e.language === t))
498
+ return console.debug(`[arborium] Grammar '${t}' not available`), null;
141
499
  try {
142
- const t = U(s), n = `${t}/grammar.js`, a = `${t}/grammar_bg.wasm`;
143
- console.debug(`[arborium] Loading grammar '${s}' from ${n}`);
144
- const r = await import(
145
- /* @vite-ignore */
146
- n
147
- );
148
- await r.default(a);
149
- const i = r.language_id();
150
- i !== s && console.warn(`[arborium] Language ID mismatch: expected '${s}', got '${i}'`);
151
- const c = r.injection_languages(), y = {
152
- languageId: s,
153
- injectionLanguages: c,
154
- module: r,
155
- parse: (k) => {
156
- const m = r.create_session();
500
+ const e = W(t, a), s = a.resolveJs === v.resolveJs ? ` from ${e}/grammar.js` : "";
501
+ console.debug(`[arborium] Loading grammar '${t}'${s}`);
502
+ const n = await a.resolveJs({ language: t, baseUrl: e, path: "grammar.js" }), o = await a.resolveWasm({ language: t, baseUrl: e, path: "grammar_bg.wasm" });
503
+ await n.default({ module_or_path: o });
504
+ const i = n.language_id();
505
+ i !== t && console.warn(`[arborium] Language ID mismatch: expected '${t}', got '${i}'`);
506
+ const x = n.injection_languages(), k = {
507
+ languageId: t,
508
+ injectionLanguages: x,
509
+ module: n,
510
+ parse: ($) => {
511
+ const b = n.create_session();
157
512
  try {
158
- r.set_text(m, k);
159
- const u = r.parse(m);
513
+ n.set_text(b, $);
514
+ const c = n.parse(b);
160
515
  return {
161
- spans: u.spans || [],
162
- injections: u.injections || []
516
+ spans: c.spans || [],
517
+ injections: c.injections || []
163
518
  };
164
- } catch (u) {
165
- return console.error("[arborium] Parse error:", u), { spans: [], injections: [] };
519
+ } catch (c) {
520
+ return console.error("[arborium] Parse error:", c), { spans: [], injections: [] };
166
521
  } finally {
167
- r.free_session(m);
522
+ n.free_session(b);
168
523
  }
169
524
  }
170
525
  };
171
- return g.set(s, y), console.debug(`[arborium] Grammar '${s}' loaded successfully`), y;
172
- } catch (t) {
173
- return console.error(`[arborium] Failed to load grammar '${s}':`, t), null;
526
+ return h.set(t, k), console.debug(`[arborium] Grammar '${t}' loaded successfully`), k;
527
+ } catch (e) {
528
+ return console.error(`[arborium] Failed to load grammar '${t}':`, e), null;
174
529
  }
175
530
  }
176
- const d = /* @__PURE__ */ new Map();
177
- let T = 1;
178
- function E() {
531
+ const f = /* @__PURE__ */ new Map();
532
+ let C = 1;
533
+ function S(t) {
179
534
  window.arboriumHost = {
180
535
  /** Check if a language is available (sync) */
181
- isLanguageAvailable(s) {
182
- return j.has(s) || g.has(s);
536
+ isLanguageAvailable(a) {
537
+ return T.has(a) || h.has(a);
183
538
  },
184
539
  /** Load a grammar and return a handle (async) */
185
- async loadGrammar(s) {
186
- const e = await w(s);
187
- if (!e) return 0;
188
- for (const [n, a] of d)
189
- if (a === e) return n;
190
- const t = T++;
191
- return d.set(t, e), t;
540
+ async loadGrammar(a) {
541
+ const r = await w(a, t);
542
+ if (!r) return 0;
543
+ for (const [s, n] of f)
544
+ if (n === r) return s;
545
+ const e = C++;
546
+ return f.set(e, r), e;
192
547
  },
193
548
  /** Parse text using a grammar handle (sync) */
194
- parse(s, e) {
195
- const t = d.get(s);
196
- return t ? t.parse(e) : { spans: [], injections: [] };
549
+ parse(a, r) {
550
+ const e = f.get(a);
551
+ return e ? e.parse(r) : { spans: [], injections: [] };
197
552
  }
198
553
  };
199
554
  }
200
- function S() {
201
- if (o.hostUrl)
202
- return o.hostUrl;
203
- const s = o.cdn, e = o.version;
204
- let t;
205
- s === "jsdelivr" ? t = "https://cdn.jsdelivr.net/npm" : s === "unpkg" ? t = "https://unpkg.com" : t = s;
206
- const n = e === "latest" ? "" : `@${e}`;
207
- return `${t}/@arborium/arborium${n}/dist`;
555
+ function q(t) {
556
+ if (t.hostUrl)
557
+ return t.hostUrl;
558
+ const a = t.cdn, r = t.version;
559
+ let e;
560
+ a === "jsdelivr" ? e = "https://cdn.jsdelivr.net/npm" : a === "unpkg" ? e = "https://unpkg.com" : e = a;
561
+ const s = r === "latest" ? "" : `@${r}`;
562
+ return `${e}/@arborium/arborium${s}/dist`;
208
563
  }
209
- async function W() {
210
- return p || f || (f = (async () => {
211
- E();
212
- const s = S(), e = `${s}/arborium_host.js`, t = `${s}/arborium_host_bg.wasm`;
213
- console.debug(`[arborium] Loading host from ${e}`);
564
+ async function I(t) {
565
+ return p || g || (g = (async () => {
566
+ S(t);
567
+ const a = q(t), r = `${a}/arborium_host.js`, e = `${a}/arborium_host_bg.wasm`;
568
+ console.debug(`[arborium] Loading host from ${r}`);
214
569
  try {
215
- const n = await import(
570
+ const s = await import(
216
571
  /* @vite-ignore */
217
- e
572
+ r
218
573
  );
219
- return await n.default(t), p = {
220
- highlight: n.highlight,
221
- isLanguageAvailable: n.isLanguageAvailable
574
+ return await s.default(e), p = {
575
+ highlight: s.highlight,
576
+ isLanguageAvailable: s.isLanguageAvailable
222
577
  }, console.debug("[arborium] Host loaded successfully"), p;
223
- } catch (n) {
224
- return console.error("[arborium] Failed to load host:", n), null;
578
+ } catch (s) {
579
+ return console.error("[arborium] Failed to load host:", s), null;
225
580
  }
226
- })(), f);
581
+ })(), g);
227
582
  }
228
- async function R(s, e, t) {
229
- const n = await W();
230
- if (n)
583
+ async function P(t, a, r) {
584
+ const e = j(r), s = await I(e);
585
+ if (s)
231
586
  try {
232
- return n.highlight(s, e);
587
+ return s.highlight(t, a);
233
588
  } catch (i) {
234
589
  console.warn("Host highlight failed, falling back to JS:", i);
235
590
  }
236
- const a = await w(s);
237
- if (!a)
238
- return h(e);
239
- const r = a.parse(e);
240
- return v(e, r.spans);
591
+ const n = await w(t, e);
592
+ if (!n)
593
+ return u(a);
594
+ const o = n.parse(a);
595
+ return y(a, o.spans);
241
596
  }
242
- async function H(s, e) {
243
- const t = await w(s);
244
- if (!t) return null;
245
- const { module: n } = t;
597
+ async function A(t, a) {
598
+ const r = j(a), e = await w(t, r);
599
+ if (!e) return null;
600
+ const { module: s } = e;
246
601
  return {
247
- languageId: () => t.languageId,
248
- injectionLanguages: () => t.injectionLanguages,
249
- highlight: async (a) => {
250
- const r = t.parse(a);
251
- return v(a, r.spans);
602
+ languageId: () => e.languageId,
603
+ injectionLanguages: () => e.injectionLanguages,
604
+ highlight: async (n) => {
605
+ const o = e.parse(n);
606
+ return y(n, o.spans);
252
607
  },
253
- parse: (a) => t.parse(a),
608
+ parse: (n) => e.parse(n),
254
609
  createSession: () => {
255
- const a = n.create_session();
610
+ const n = s.create_session();
256
611
  return {
257
- setText: (r) => n.set_text(a, r),
612
+ setText: (o) => s.set_text(n, o),
258
613
  parse: () => {
259
614
  try {
260
- const r = n.parse(a);
615
+ const o = s.parse(n);
261
616
  return {
262
- spans: r.spans || [],
263
- injections: r.injections || []
617
+ spans: o.spans || [],
618
+ injections: o.injections || []
264
619
  };
265
- } catch (r) {
266
- return console.error("[arborium] Session parse error:", r), { spans: [], injections: [] };
620
+ } catch (o) {
621
+ return console.error("[arborium] Session parse error:", o), { spans: [], injections: [] };
267
622
  }
268
623
  },
269
- cancel: () => n.cancel(a),
270
- free: () => n.free_session(a)
624
+ cancel: () => s.cancel(n),
625
+ free: () => s.free_session(n)
271
626
  };
272
627
  },
273
628
  dispose: () => {
274
629
  }
275
630
  };
276
631
  }
277
- function v(s, e) {
278
- const t = [...e].sort((r, i) => r.start - i.start);
279
- let n = "", a = 0;
280
- for (const r of t) {
281
- if (r.start < a) continue;
282
- r.start > a && (n += h(s.slice(a, r.start)));
283
- const i = C(r.capture), c = h(s.slice(r.start, r.end));
284
- i ? n += `<a-${i}>${c}</a-${i}>` : n += c, a = r.end;
285
- }
286
- return a < s.length && (n += h(s.slice(a))), n;
287
- }
288
- function C(s) {
289
- return s.startsWith("keyword") || s === "include" || s === "conditional" ? "k" : s.startsWith("function") || s.startsWith("method") ? "f" : s.startsWith("string") || s === "character" ? "s" : s.startsWith("comment") ? "c" : s.startsWith("type") ? "t" : s.startsWith("variable") ? "v" : s.startsWith("number") || s === "float" ? "n" : s.startsWith("operator") ? "o" : s.startsWith("punctuation") ? "p" : s.startsWith("tag") ? "tg" : s.startsWith("attribute") ? "at" : null;
290
- }
291
- function h(s) {
292
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
632
+ function j(t) {
633
+ return t ? { ...d, ...t } : { ...d };
293
634
  }
294
- function M(s) {
295
- return s ? { ...o, ...s } : { ...o };
635
+ function G(t) {
636
+ d = { ...d, ...t };
296
637
  }
297
- const I = [
638
+ const R = [
298
639
  [/^#!.*\bpython[23]?\b/, "python"],
299
640
  [/^#!.*\bnode\b/, "javascript"],
300
641
  [/^#!.*\bdeno\b/, "typescript"],
@@ -307,7 +648,7 @@ const I = [
307
648
  [/^#!.*\bsh\b/, "bash"],
308
649
  [/^#!.*\blua\b/, "lua"],
309
650
  [/^#!.*\bawk\b/, "awk"]
310
- ], q = [
651
+ ], H = [
311
652
  // Rust - distinctive keywords
312
653
  [/\b(fn|impl|trait|pub\s+fn|let\s+mut|&mut|->)\b/, "rust"],
313
654
  // Go - distinctive keywords
@@ -367,23 +708,23 @@ const I = [
367
708
  // Zig
368
709
  [/\b(pub\s+fn|const\s+\w+\s*=|@import\(|comptime)\b/, "zig"]
369
710
  ];
370
- function P(s) {
371
- const e = s.split(`
711
+ function F(t) {
712
+ const a = t.split(`
372
713
  `)[0];
373
- for (const [t, n] of I)
374
- if (t.test(e))
375
- return n;
376
- for (const [t, n] of q)
377
- if (t.test(s))
378
- return n;
714
+ for (const [r, e] of R)
715
+ if (r.test(a))
716
+ return e;
717
+ for (const [r, e] of H)
718
+ if (r.test(t))
719
+ return e;
379
720
  return null;
380
721
  }
381
- function A(s) {
382
- const e = s.match(/\blanguage-(\w+)\b/);
383
- if (e) return e[1];
384
- const t = s.match(/\blang-(\w+)\b/);
385
- if (t) return t[1];
386
- const n = /* @__PURE__ */ new Set([
722
+ function O(t) {
723
+ const a = t.match(/\blanguage-(\w+)\b/);
724
+ if (a) return a[1];
725
+ const r = t.match(/\blang-(\w+)\b/);
726
+ if (r) return r[1];
727
+ const e = /* @__PURE__ */ new Set([
387
728
  "rust",
388
729
  "javascript",
389
730
  "typescript",
@@ -419,13 +760,13 @@ function A(s) {
419
760
  "console",
420
761
  "sh"
421
762
  ]);
422
- for (const a of s.split(/\s+/))
423
- if (n.has(a.toLowerCase()))
424
- return a.toLowerCase();
763
+ for (const s of t.split(/\s+/))
764
+ if (e.has(s.toLowerCase()))
765
+ return s.toLowerCase();
425
766
  return null;
426
767
  }
427
- function G(s) {
428
- const e = {
768
+ function z(t) {
769
+ const a = {
429
770
  js: "javascript",
430
771
  ts: "typescript",
431
772
  py: "python",
@@ -445,18 +786,20 @@ function G(s) {
445
786
  plaintext: "text",
446
787
  plain: "text",
447
788
  txt: "text"
448
- }, t = s.toLowerCase();
449
- return e[t] || t;
789
+ }, r = t.toLowerCase();
790
+ return a[r] || r;
450
791
  }
451
792
  export {
452
- $ as availableLanguages,
453
- P as detectLanguage,
454
- A as extractLanguageFromClass,
455
- M as getConfig,
456
- R as highlight,
457
- H as loadGrammar,
458
- G as normalizeLanguage,
459
- x as pluginVersion,
460
- v as spansToHtml
793
+ _ as availableLanguages,
794
+ F as detectLanguage,
795
+ O as extractLanguageFromClass,
796
+ j as getConfig,
797
+ P as highlight,
798
+ M as highlights,
799
+ A as loadGrammar,
800
+ z as normalizeLanguage,
801
+ L as pluginVersion,
802
+ G as setConfig,
803
+ y as spansToHtml
461
804
  };
462
805
  //# sourceMappingURL=arborium.js.map