react-markdown-table-ts 1.2.2 → 1.3.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/index.cjs.js DELETED
@@ -1,4331 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var require$$0 = require('react');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
10
-
11
- /******************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
26
-
27
- var extendStatics = function(d, b) {
28
- extendStatics = Object.setPrototypeOf ||
29
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
31
- return extendStatics(d, b);
32
- };
33
-
34
- function __extends(d, b) {
35
- if (typeof b !== "function" && b !== null)
36
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
- extendStatics(d, b);
38
- function __() { this.constructor = d; }
39
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
- }
41
-
42
- var __assign = function() {
43
- __assign = Object.assign || function __assign(t) {
44
- for (var s, i = 1, n = arguments.length; i < n; i++) {
45
- s = arguments[i];
46
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
47
- }
48
- return t;
49
- };
50
- return __assign.apply(this, arguments);
51
- };
52
-
53
- function __spreadArray(to, from, pack) {
54
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
55
- if (ar || !(i in from)) {
56
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
57
- ar[i] = from[i];
58
- }
59
- }
60
- return to.concat(ar || Array.prototype.slice.call(from));
61
- }
62
-
63
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
64
- var e = new Error(message);
65
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
66
- };
67
-
68
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
69
-
70
- function getDefaultExportFromCjs (x) {
71
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
72
- }
73
-
74
- var jsxRuntime = {exports: {}};
75
-
76
- var reactJsxRuntime_production_min = {};
77
-
78
- /**
79
- * @license React
80
- * react-jsx-runtime.production.min.js
81
- *
82
- * Copyright (c) Facebook, Inc. and its affiliates.
83
- *
84
- * This source code is licensed under the MIT license found in the
85
- * LICENSE file in the root directory of this source tree.
86
- */
87
-
88
- var hasRequiredReactJsxRuntime_production_min;
89
-
90
- function requireReactJsxRuntime_production_min () {
91
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
92
- hasRequiredReactJsxRuntime_production_min = 1;
93
- var f=require$$0__default["default"],k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
94
- function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
95
- return reactJsxRuntime_production_min;
96
- }
97
-
98
- var reactJsxRuntime_development = {};
99
-
100
- /**
101
- * @license React
102
- * react-jsx-runtime.development.js
103
- *
104
- * Copyright (c) Facebook, Inc. and its affiliates.
105
- *
106
- * This source code is licensed under the MIT license found in the
107
- * LICENSE file in the root directory of this source tree.
108
- */
109
-
110
- var hasRequiredReactJsxRuntime_development;
111
-
112
- function requireReactJsxRuntime_development () {
113
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
114
- hasRequiredReactJsxRuntime_development = 1;
115
-
116
- if (process.env.NODE_ENV !== "production") {
117
- (function() {
118
-
119
- var React = require$$0__default["default"];
120
-
121
- // ATTENTION
122
- // When adding new symbols to this file,
123
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
124
- // The Symbol used to tag the ReactElement-like types.
125
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
126
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
127
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
128
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
129
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
130
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
131
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
132
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
133
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
134
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
135
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
136
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
137
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
138
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
139
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
140
- function getIteratorFn(maybeIterable) {
141
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
142
- return null;
143
- }
144
-
145
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
146
-
147
- if (typeof maybeIterator === 'function') {
148
- return maybeIterator;
149
- }
150
-
151
- return null;
152
- }
153
-
154
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
155
-
156
- function error(format) {
157
- {
158
- {
159
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
160
- args[_key2 - 1] = arguments[_key2];
161
- }
162
-
163
- printWarning('error', format, args);
164
- }
165
- }
166
- }
167
-
168
- function printWarning(level, format, args) {
169
- // When changing this logic, you might want to also
170
- // update consoleWithStackDev.www.js as well.
171
- {
172
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
173
- var stack = ReactDebugCurrentFrame.getStackAddendum();
174
-
175
- if (stack !== '') {
176
- format += '%s';
177
- args = args.concat([stack]);
178
- } // eslint-disable-next-line react-internal/safe-string-coercion
179
-
180
-
181
- var argsWithFormat = args.map(function (item) {
182
- return String(item);
183
- }); // Careful: RN currently depends on this prefix
184
-
185
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
186
- // breaks IE9: https://github.com/facebook/react/issues/13610
187
- // eslint-disable-next-line react-internal/no-production-logging
188
-
189
- Function.prototype.apply.call(console[level], console, argsWithFormat);
190
- }
191
- }
192
-
193
- // -----------------------------------------------------------------------------
194
-
195
- var enableScopeAPI = false; // Experimental Create Event Handle API.
196
- var enableCacheElement = false;
197
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
198
-
199
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
200
- // stuff. Intended to enable React core members to more easily debug scheduling
201
- // issues in DEV builds.
202
-
203
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
204
-
205
- var REACT_MODULE_REFERENCE;
206
-
207
- {
208
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
209
- }
210
-
211
- function isValidElementType(type) {
212
- if (typeof type === 'string' || typeof type === 'function') {
213
- return true;
214
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
215
-
216
-
217
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
218
- return true;
219
- }
220
-
221
- if (typeof type === 'object' && type !== null) {
222
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
223
- // types supported by any Flight configuration anywhere since
224
- // we don't know which Flight build this will end up being used
225
- // with.
226
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
227
- return true;
228
- }
229
- }
230
-
231
- return false;
232
- }
233
-
234
- function getWrappedName(outerType, innerType, wrapperName) {
235
- var displayName = outerType.displayName;
236
-
237
- if (displayName) {
238
- return displayName;
239
- }
240
-
241
- var functionName = innerType.displayName || innerType.name || '';
242
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
243
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
244
-
245
-
246
- function getContextName(type) {
247
- return type.displayName || 'Context';
248
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
249
-
250
-
251
- function getComponentNameFromType(type) {
252
- if (type == null) {
253
- // Host root, text node or just invalid type.
254
- return null;
255
- }
256
-
257
- {
258
- if (typeof type.tag === 'number') {
259
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
260
- }
261
- }
262
-
263
- if (typeof type === 'function') {
264
- return type.displayName || type.name || null;
265
- }
266
-
267
- if (typeof type === 'string') {
268
- return type;
269
- }
270
-
271
- switch (type) {
272
- case REACT_FRAGMENT_TYPE:
273
- return 'Fragment';
274
-
275
- case REACT_PORTAL_TYPE:
276
- return 'Portal';
277
-
278
- case REACT_PROFILER_TYPE:
279
- return 'Profiler';
280
-
281
- case REACT_STRICT_MODE_TYPE:
282
- return 'StrictMode';
283
-
284
- case REACT_SUSPENSE_TYPE:
285
- return 'Suspense';
286
-
287
- case REACT_SUSPENSE_LIST_TYPE:
288
- return 'SuspenseList';
289
-
290
- }
291
-
292
- if (typeof type === 'object') {
293
- switch (type.$$typeof) {
294
- case REACT_CONTEXT_TYPE:
295
- var context = type;
296
- return getContextName(context) + '.Consumer';
297
-
298
- case REACT_PROVIDER_TYPE:
299
- var provider = type;
300
- return getContextName(provider._context) + '.Provider';
301
-
302
- case REACT_FORWARD_REF_TYPE:
303
- return getWrappedName(type, type.render, 'ForwardRef');
304
-
305
- case REACT_MEMO_TYPE:
306
- var outerName = type.displayName || null;
307
-
308
- if (outerName !== null) {
309
- return outerName;
310
- }
311
-
312
- return getComponentNameFromType(type.type) || 'Memo';
313
-
314
- case REACT_LAZY_TYPE:
315
- {
316
- var lazyComponent = type;
317
- var payload = lazyComponent._payload;
318
- var init = lazyComponent._init;
319
-
320
- try {
321
- return getComponentNameFromType(init(payload));
322
- } catch (x) {
323
- return null;
324
- }
325
- }
326
-
327
- // eslint-disable-next-line no-fallthrough
328
- }
329
- }
330
-
331
- return null;
332
- }
333
-
334
- var assign = Object.assign;
335
-
336
- // Helpers to patch console.logs to avoid logging during side-effect free
337
- // replaying on render function. This currently only patches the object
338
- // lazily which won't cover if the log function was extracted eagerly.
339
- // We could also eagerly patch the method.
340
- var disabledDepth = 0;
341
- var prevLog;
342
- var prevInfo;
343
- var prevWarn;
344
- var prevError;
345
- var prevGroup;
346
- var prevGroupCollapsed;
347
- var prevGroupEnd;
348
-
349
- function disabledLog() {}
350
-
351
- disabledLog.__reactDisabledLog = true;
352
- function disableLogs() {
353
- {
354
- if (disabledDepth === 0) {
355
- /* eslint-disable react-internal/no-production-logging */
356
- prevLog = console.log;
357
- prevInfo = console.info;
358
- prevWarn = console.warn;
359
- prevError = console.error;
360
- prevGroup = console.group;
361
- prevGroupCollapsed = console.groupCollapsed;
362
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
363
-
364
- var props = {
365
- configurable: true,
366
- enumerable: true,
367
- value: disabledLog,
368
- writable: true
369
- }; // $FlowFixMe Flow thinks console is immutable.
370
-
371
- Object.defineProperties(console, {
372
- info: props,
373
- log: props,
374
- warn: props,
375
- error: props,
376
- group: props,
377
- groupCollapsed: props,
378
- groupEnd: props
379
- });
380
- /* eslint-enable react-internal/no-production-logging */
381
- }
382
-
383
- disabledDepth++;
384
- }
385
- }
386
- function reenableLogs() {
387
- {
388
- disabledDepth--;
389
-
390
- if (disabledDepth === 0) {
391
- /* eslint-disable react-internal/no-production-logging */
392
- var props = {
393
- configurable: true,
394
- enumerable: true,
395
- writable: true
396
- }; // $FlowFixMe Flow thinks console is immutable.
397
-
398
- Object.defineProperties(console, {
399
- log: assign({}, props, {
400
- value: prevLog
401
- }),
402
- info: assign({}, props, {
403
- value: prevInfo
404
- }),
405
- warn: assign({}, props, {
406
- value: prevWarn
407
- }),
408
- error: assign({}, props, {
409
- value: prevError
410
- }),
411
- group: assign({}, props, {
412
- value: prevGroup
413
- }),
414
- groupCollapsed: assign({}, props, {
415
- value: prevGroupCollapsed
416
- }),
417
- groupEnd: assign({}, props, {
418
- value: prevGroupEnd
419
- })
420
- });
421
- /* eslint-enable react-internal/no-production-logging */
422
- }
423
-
424
- if (disabledDepth < 0) {
425
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
426
- }
427
- }
428
- }
429
-
430
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
431
- var prefix;
432
- function describeBuiltInComponentFrame(name, source, ownerFn) {
433
- {
434
- if (prefix === undefined) {
435
- // Extract the VM specific prefix used by each line.
436
- try {
437
- throw Error();
438
- } catch (x) {
439
- var match = x.stack.trim().match(/\n( *(at )?)/);
440
- prefix = match && match[1] || '';
441
- }
442
- } // We use the prefix to ensure our stacks line up with native stack frames.
443
-
444
-
445
- return '\n' + prefix + name;
446
- }
447
- }
448
- var reentry = false;
449
- var componentFrameCache;
450
-
451
- {
452
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
453
- componentFrameCache = new PossiblyWeakMap();
454
- }
455
-
456
- function describeNativeComponentFrame(fn, construct) {
457
- // If something asked for a stack inside a fake render, it should get ignored.
458
- if ( !fn || reentry) {
459
- return '';
460
- }
461
-
462
- {
463
- var frame = componentFrameCache.get(fn);
464
-
465
- if (frame !== undefined) {
466
- return frame;
467
- }
468
- }
469
-
470
- var control;
471
- reentry = true;
472
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
473
-
474
- Error.prepareStackTrace = undefined;
475
- var previousDispatcher;
476
-
477
- {
478
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
479
- // for warnings.
480
-
481
- ReactCurrentDispatcher.current = null;
482
- disableLogs();
483
- }
484
-
485
- try {
486
- // This should throw.
487
- if (construct) {
488
- // Something should be setting the props in the constructor.
489
- var Fake = function () {
490
- throw Error();
491
- }; // $FlowFixMe
492
-
493
-
494
- Object.defineProperty(Fake.prototype, 'props', {
495
- set: function () {
496
- // We use a throwing setter instead of frozen or non-writable props
497
- // because that won't throw in a non-strict mode function.
498
- throw Error();
499
- }
500
- });
501
-
502
- if (typeof Reflect === 'object' && Reflect.construct) {
503
- // We construct a different control for this case to include any extra
504
- // frames added by the construct call.
505
- try {
506
- Reflect.construct(Fake, []);
507
- } catch (x) {
508
- control = x;
509
- }
510
-
511
- Reflect.construct(fn, [], Fake);
512
- } else {
513
- try {
514
- Fake.call();
515
- } catch (x) {
516
- control = x;
517
- }
518
-
519
- fn.call(Fake.prototype);
520
- }
521
- } else {
522
- try {
523
- throw Error();
524
- } catch (x) {
525
- control = x;
526
- }
527
-
528
- fn();
529
- }
530
- } catch (sample) {
531
- // This is inlined manually because closure doesn't do it for us.
532
- if (sample && control && typeof sample.stack === 'string') {
533
- // This extracts the first frame from the sample that isn't also in the control.
534
- // Skipping one frame that we assume is the frame that calls the two.
535
- var sampleLines = sample.stack.split('\n');
536
- var controlLines = control.stack.split('\n');
537
- var s = sampleLines.length - 1;
538
- var c = controlLines.length - 1;
539
-
540
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
541
- // We expect at least one stack frame to be shared.
542
- // Typically this will be the root most one. However, stack frames may be
543
- // cut off due to maximum stack limits. In this case, one maybe cut off
544
- // earlier than the other. We assume that the sample is longer or the same
545
- // and there for cut off earlier. So we should find the root most frame in
546
- // the sample somewhere in the control.
547
- c--;
548
- }
549
-
550
- for (; s >= 1 && c >= 0; s--, c--) {
551
- // Next we find the first one that isn't the same which should be the
552
- // frame that called our sample function and the control.
553
- if (sampleLines[s] !== controlLines[c]) {
554
- // In V8, the first line is describing the message but other VMs don't.
555
- // If we're about to return the first line, and the control is also on the same
556
- // line, that's a pretty good indicator that our sample threw at same line as
557
- // the control. I.e. before we entered the sample frame. So we ignore this result.
558
- // This can happen if you passed a class to function component, or non-function.
559
- if (s !== 1 || c !== 1) {
560
- do {
561
- s--;
562
- c--; // We may still have similar intermediate frames from the construct call.
563
- // The next one that isn't the same should be our match though.
564
-
565
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
566
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
567
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
568
- // but we have a user-provided "displayName"
569
- // splice it in to make the stack more readable.
570
-
571
-
572
- if (fn.displayName && _frame.includes('<anonymous>')) {
573
- _frame = _frame.replace('<anonymous>', fn.displayName);
574
- }
575
-
576
- {
577
- if (typeof fn === 'function') {
578
- componentFrameCache.set(fn, _frame);
579
- }
580
- } // Return the line we found.
581
-
582
-
583
- return _frame;
584
- }
585
- } while (s >= 1 && c >= 0);
586
- }
587
-
588
- break;
589
- }
590
- }
591
- }
592
- } finally {
593
- reentry = false;
594
-
595
- {
596
- ReactCurrentDispatcher.current = previousDispatcher;
597
- reenableLogs();
598
- }
599
-
600
- Error.prepareStackTrace = previousPrepareStackTrace;
601
- } // Fallback to just using the name if we couldn't make it throw.
602
-
603
-
604
- var name = fn ? fn.displayName || fn.name : '';
605
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
606
-
607
- {
608
- if (typeof fn === 'function') {
609
- componentFrameCache.set(fn, syntheticFrame);
610
- }
611
- }
612
-
613
- return syntheticFrame;
614
- }
615
- function describeFunctionComponentFrame(fn, source, ownerFn) {
616
- {
617
- return describeNativeComponentFrame(fn, false);
618
- }
619
- }
620
-
621
- function shouldConstruct(Component) {
622
- var prototype = Component.prototype;
623
- return !!(prototype && prototype.isReactComponent);
624
- }
625
-
626
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
627
-
628
- if (type == null) {
629
- return '';
630
- }
631
-
632
- if (typeof type === 'function') {
633
- {
634
- return describeNativeComponentFrame(type, shouldConstruct(type));
635
- }
636
- }
637
-
638
- if (typeof type === 'string') {
639
- return describeBuiltInComponentFrame(type);
640
- }
641
-
642
- switch (type) {
643
- case REACT_SUSPENSE_TYPE:
644
- return describeBuiltInComponentFrame('Suspense');
645
-
646
- case REACT_SUSPENSE_LIST_TYPE:
647
- return describeBuiltInComponentFrame('SuspenseList');
648
- }
649
-
650
- if (typeof type === 'object') {
651
- switch (type.$$typeof) {
652
- case REACT_FORWARD_REF_TYPE:
653
- return describeFunctionComponentFrame(type.render);
654
-
655
- case REACT_MEMO_TYPE:
656
- // Memo may contain any component type so we recursively resolve it.
657
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
658
-
659
- case REACT_LAZY_TYPE:
660
- {
661
- var lazyComponent = type;
662
- var payload = lazyComponent._payload;
663
- var init = lazyComponent._init;
664
-
665
- try {
666
- // Lazy may contain any component type so we recursively resolve it.
667
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
668
- } catch (x) {}
669
- }
670
- }
671
- }
672
-
673
- return '';
674
- }
675
-
676
- var hasOwnProperty = Object.prototype.hasOwnProperty;
677
-
678
- var loggedTypeFailures = {};
679
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
680
-
681
- function setCurrentlyValidatingElement(element) {
682
- {
683
- if (element) {
684
- var owner = element._owner;
685
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
686
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
687
- } else {
688
- ReactDebugCurrentFrame.setExtraStackFrame(null);
689
- }
690
- }
691
- }
692
-
693
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
694
- {
695
- // $FlowFixMe This is okay but Flow doesn't know it.
696
- var has = Function.call.bind(hasOwnProperty);
697
-
698
- for (var typeSpecName in typeSpecs) {
699
- if (has(typeSpecs, typeSpecName)) {
700
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
701
- // fail the render phase where it didn't fail before. So we log it.
702
- // After these have been cleaned up, we'll let them throw.
703
-
704
- try {
705
- // This is intentionally an invariant that gets caught. It's the same
706
- // behavior as without this statement except with a better message.
707
- if (typeof typeSpecs[typeSpecName] !== 'function') {
708
- // eslint-disable-next-line react-internal/prod-error-codes
709
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
710
- err.name = 'Invariant Violation';
711
- throw err;
712
- }
713
-
714
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
715
- } catch (ex) {
716
- error$1 = ex;
717
- }
718
-
719
- if (error$1 && !(error$1 instanceof Error)) {
720
- setCurrentlyValidatingElement(element);
721
-
722
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
723
-
724
- setCurrentlyValidatingElement(null);
725
- }
726
-
727
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
728
- // Only monitor this failure once because there tends to be a lot of the
729
- // same error.
730
- loggedTypeFailures[error$1.message] = true;
731
- setCurrentlyValidatingElement(element);
732
-
733
- error('Failed %s type: %s', location, error$1.message);
734
-
735
- setCurrentlyValidatingElement(null);
736
- }
737
- }
738
- }
739
- }
740
- }
741
-
742
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
743
-
744
- function isArray(a) {
745
- return isArrayImpl(a);
746
- }
747
-
748
- /*
749
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
750
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
751
- *
752
- * The functions in this module will throw an easier-to-understand,
753
- * easier-to-debug exception with a clear errors message message explaining the
754
- * problem. (Instead of a confusing exception thrown inside the implementation
755
- * of the `value` object).
756
- */
757
- // $FlowFixMe only called in DEV, so void return is not possible.
758
- function typeName(value) {
759
- {
760
- // toStringTag is needed for namespaced types like Temporal.Instant
761
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
762
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
763
- return type;
764
- }
765
- } // $FlowFixMe only called in DEV, so void return is not possible.
766
-
767
-
768
- function willCoercionThrow(value) {
769
- {
770
- try {
771
- testStringCoercion(value);
772
- return false;
773
- } catch (e) {
774
- return true;
775
- }
776
- }
777
- }
778
-
779
- function testStringCoercion(value) {
780
- // If you ended up here by following an exception call stack, here's what's
781
- // happened: you supplied an object or symbol value to React (as a prop, key,
782
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
783
- // coerce it to a string using `'' + value`, an exception was thrown.
784
- //
785
- // The most common types that will cause this exception are `Symbol` instances
786
- // and Temporal objects like `Temporal.Instant`. But any object that has a
787
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
788
- // exception. (Library authors do this to prevent users from using built-in
789
- // numeric operators like `+` or comparison operators like `>=` because custom
790
- // methods are needed to perform accurate arithmetic or comparison.)
791
- //
792
- // To fix the problem, coerce this object or symbol value to a string before
793
- // passing it to React. The most reliable way is usually `String(value)`.
794
- //
795
- // To find which value is throwing, check the browser or debugger console.
796
- // Before this exception was thrown, there should be `console.error` output
797
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
798
- // problem and how that type was used: key, atrribute, input value prop, etc.
799
- // In most cases, this console output also shows the component and its
800
- // ancestor components where the exception happened.
801
- //
802
- // eslint-disable-next-line react-internal/safe-string-coercion
803
- return '' + value;
804
- }
805
- function checkKeyStringCoercion(value) {
806
- {
807
- if (willCoercionThrow(value)) {
808
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
809
-
810
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
811
- }
812
- }
813
- }
814
-
815
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
816
- var RESERVED_PROPS = {
817
- key: true,
818
- ref: true,
819
- __self: true,
820
- __source: true
821
- };
822
- var specialPropKeyWarningShown;
823
- var specialPropRefWarningShown;
824
- var didWarnAboutStringRefs;
825
-
826
- {
827
- didWarnAboutStringRefs = {};
828
- }
829
-
830
- function hasValidRef(config) {
831
- {
832
- if (hasOwnProperty.call(config, 'ref')) {
833
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
834
-
835
- if (getter && getter.isReactWarning) {
836
- return false;
837
- }
838
- }
839
- }
840
-
841
- return config.ref !== undefined;
842
- }
843
-
844
- function hasValidKey(config) {
845
- {
846
- if (hasOwnProperty.call(config, 'key')) {
847
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
848
-
849
- if (getter && getter.isReactWarning) {
850
- return false;
851
- }
852
- }
853
- }
854
-
855
- return config.key !== undefined;
856
- }
857
-
858
- function warnIfStringRefCannotBeAutoConverted(config, self) {
859
- {
860
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
861
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
862
-
863
- if (!didWarnAboutStringRefs[componentName]) {
864
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
865
-
866
- didWarnAboutStringRefs[componentName] = true;
867
- }
868
- }
869
- }
870
- }
871
-
872
- function defineKeyPropWarningGetter(props, displayName) {
873
- {
874
- var warnAboutAccessingKey = function () {
875
- if (!specialPropKeyWarningShown) {
876
- specialPropKeyWarningShown = true;
877
-
878
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
879
- }
880
- };
881
-
882
- warnAboutAccessingKey.isReactWarning = true;
883
- Object.defineProperty(props, 'key', {
884
- get: warnAboutAccessingKey,
885
- configurable: true
886
- });
887
- }
888
- }
889
-
890
- function defineRefPropWarningGetter(props, displayName) {
891
- {
892
- var warnAboutAccessingRef = function () {
893
- if (!specialPropRefWarningShown) {
894
- specialPropRefWarningShown = true;
895
-
896
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
897
- }
898
- };
899
-
900
- warnAboutAccessingRef.isReactWarning = true;
901
- Object.defineProperty(props, 'ref', {
902
- get: warnAboutAccessingRef,
903
- configurable: true
904
- });
905
- }
906
- }
907
- /**
908
- * Factory method to create a new React element. This no longer adheres to
909
- * the class pattern, so do not use new to call it. Also, instanceof check
910
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
911
- * if something is a React Element.
912
- *
913
- * @param {*} type
914
- * @param {*} props
915
- * @param {*} key
916
- * @param {string|object} ref
917
- * @param {*} owner
918
- * @param {*} self A *temporary* helper to detect places where `this` is
919
- * different from the `owner` when React.createElement is called, so that we
920
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
921
- * functions, and as long as `this` and owner are the same, there will be no
922
- * change in behavior.
923
- * @param {*} source An annotation object (added by a transpiler or otherwise)
924
- * indicating filename, line number, and/or other information.
925
- * @internal
926
- */
927
-
928
-
929
- var ReactElement = function (type, key, ref, self, source, owner, props) {
930
- var element = {
931
- // This tag allows us to uniquely identify this as a React Element
932
- $$typeof: REACT_ELEMENT_TYPE,
933
- // Built-in properties that belong on the element
934
- type: type,
935
- key: key,
936
- ref: ref,
937
- props: props,
938
- // Record the component responsible for creating this element.
939
- _owner: owner
940
- };
941
-
942
- {
943
- // The validation flag is currently mutative. We put it on
944
- // an external backing store so that we can freeze the whole object.
945
- // This can be replaced with a WeakMap once they are implemented in
946
- // commonly used development environments.
947
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
948
- // the validation flag non-enumerable (where possible, which should
949
- // include every environment we run tests in), so the test framework
950
- // ignores it.
951
-
952
- Object.defineProperty(element._store, 'validated', {
953
- configurable: false,
954
- enumerable: false,
955
- writable: true,
956
- value: false
957
- }); // self and source are DEV only properties.
958
-
959
- Object.defineProperty(element, '_self', {
960
- configurable: false,
961
- enumerable: false,
962
- writable: false,
963
- value: self
964
- }); // Two elements created in two different places should be considered
965
- // equal for testing purposes and therefore we hide it from enumeration.
966
-
967
- Object.defineProperty(element, '_source', {
968
- configurable: false,
969
- enumerable: false,
970
- writable: false,
971
- value: source
972
- });
973
-
974
- if (Object.freeze) {
975
- Object.freeze(element.props);
976
- Object.freeze(element);
977
- }
978
- }
979
-
980
- return element;
981
- };
982
- /**
983
- * https://github.com/reactjs/rfcs/pull/107
984
- * @param {*} type
985
- * @param {object} props
986
- * @param {string} key
987
- */
988
-
989
- function jsxDEV(type, config, maybeKey, source, self) {
990
- {
991
- var propName; // Reserved names are extracted
992
-
993
- var props = {};
994
- var key = null;
995
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
996
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
997
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
998
- // but as an intermediary step, we will use jsxDEV for everything except
999
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
1000
- // key is explicitly declared to be undefined or not.
1001
-
1002
- if (maybeKey !== undefined) {
1003
- {
1004
- checkKeyStringCoercion(maybeKey);
1005
- }
1006
-
1007
- key = '' + maybeKey;
1008
- }
1009
-
1010
- if (hasValidKey(config)) {
1011
- {
1012
- checkKeyStringCoercion(config.key);
1013
- }
1014
-
1015
- key = '' + config.key;
1016
- }
1017
-
1018
- if (hasValidRef(config)) {
1019
- ref = config.ref;
1020
- warnIfStringRefCannotBeAutoConverted(config, self);
1021
- } // Remaining properties are added to a new props object
1022
-
1023
-
1024
- for (propName in config) {
1025
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1026
- props[propName] = config[propName];
1027
- }
1028
- } // Resolve default props
1029
-
1030
-
1031
- if (type && type.defaultProps) {
1032
- var defaultProps = type.defaultProps;
1033
-
1034
- for (propName in defaultProps) {
1035
- if (props[propName] === undefined) {
1036
- props[propName] = defaultProps[propName];
1037
- }
1038
- }
1039
- }
1040
-
1041
- if (key || ref) {
1042
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1043
-
1044
- if (key) {
1045
- defineKeyPropWarningGetter(props, displayName);
1046
- }
1047
-
1048
- if (ref) {
1049
- defineRefPropWarningGetter(props, displayName);
1050
- }
1051
- }
1052
-
1053
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1054
- }
1055
- }
1056
-
1057
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1058
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1059
-
1060
- function setCurrentlyValidatingElement$1(element) {
1061
- {
1062
- if (element) {
1063
- var owner = element._owner;
1064
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1065
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1066
- } else {
1067
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1068
- }
1069
- }
1070
- }
1071
-
1072
- var propTypesMisspellWarningShown;
1073
-
1074
- {
1075
- propTypesMisspellWarningShown = false;
1076
- }
1077
- /**
1078
- * Verifies the object is a ReactElement.
1079
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1080
- * @param {?object} object
1081
- * @return {boolean} True if `object` is a ReactElement.
1082
- * @final
1083
- */
1084
-
1085
-
1086
- function isValidElement(object) {
1087
- {
1088
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1089
- }
1090
- }
1091
-
1092
- function getDeclarationErrorAddendum() {
1093
- {
1094
- if (ReactCurrentOwner$1.current) {
1095
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1096
-
1097
- if (name) {
1098
- return '\n\nCheck the render method of `' + name + '`.';
1099
- }
1100
- }
1101
-
1102
- return '';
1103
- }
1104
- }
1105
-
1106
- function getSourceInfoErrorAddendum(source) {
1107
- {
1108
- if (source !== undefined) {
1109
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1110
- var lineNumber = source.lineNumber;
1111
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1112
- }
1113
-
1114
- return '';
1115
- }
1116
- }
1117
- /**
1118
- * Warn if there's no key explicitly set on dynamic arrays of children or
1119
- * object keys are not valid. This allows us to keep track of children between
1120
- * updates.
1121
- */
1122
-
1123
-
1124
- var ownerHasKeyUseWarning = {};
1125
-
1126
- function getCurrentComponentErrorInfo(parentType) {
1127
- {
1128
- var info = getDeclarationErrorAddendum();
1129
-
1130
- if (!info) {
1131
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1132
-
1133
- if (parentName) {
1134
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1135
- }
1136
- }
1137
-
1138
- return info;
1139
- }
1140
- }
1141
- /**
1142
- * Warn if the element doesn't have an explicit key assigned to it.
1143
- * This element is in an array. The array could grow and shrink or be
1144
- * reordered. All children that haven't already been validated are required to
1145
- * have a "key" property assigned to it. Error statuses are cached so a warning
1146
- * will only be shown once.
1147
- *
1148
- * @internal
1149
- * @param {ReactElement} element Element that requires a key.
1150
- * @param {*} parentType element's parent's type.
1151
- */
1152
-
1153
-
1154
- function validateExplicitKey(element, parentType) {
1155
- {
1156
- if (!element._store || element._store.validated || element.key != null) {
1157
- return;
1158
- }
1159
-
1160
- element._store.validated = true;
1161
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1162
-
1163
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1164
- return;
1165
- }
1166
-
1167
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1168
- // property, it may be the creator of the child that's responsible for
1169
- // assigning it a key.
1170
-
1171
- var childOwner = '';
1172
-
1173
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1174
- // Give the component that originally created this child.
1175
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1176
- }
1177
-
1178
- setCurrentlyValidatingElement$1(element);
1179
-
1180
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1181
-
1182
- setCurrentlyValidatingElement$1(null);
1183
- }
1184
- }
1185
- /**
1186
- * Ensure that every element either is passed in a static location, in an
1187
- * array with an explicit keys property defined, or in an object literal
1188
- * with valid key property.
1189
- *
1190
- * @internal
1191
- * @param {ReactNode} node Statically passed child of any type.
1192
- * @param {*} parentType node's parent's type.
1193
- */
1194
-
1195
-
1196
- function validateChildKeys(node, parentType) {
1197
- {
1198
- if (typeof node !== 'object') {
1199
- return;
1200
- }
1201
-
1202
- if (isArray(node)) {
1203
- for (var i = 0; i < node.length; i++) {
1204
- var child = node[i];
1205
-
1206
- if (isValidElement(child)) {
1207
- validateExplicitKey(child, parentType);
1208
- }
1209
- }
1210
- } else if (isValidElement(node)) {
1211
- // This element was passed in a valid location.
1212
- if (node._store) {
1213
- node._store.validated = true;
1214
- }
1215
- } else if (node) {
1216
- var iteratorFn = getIteratorFn(node);
1217
-
1218
- if (typeof iteratorFn === 'function') {
1219
- // Entry iterators used to provide implicit keys,
1220
- // but now we print a separate warning for them later.
1221
- if (iteratorFn !== node.entries) {
1222
- var iterator = iteratorFn.call(node);
1223
- var step;
1224
-
1225
- while (!(step = iterator.next()).done) {
1226
- if (isValidElement(step.value)) {
1227
- validateExplicitKey(step.value, parentType);
1228
- }
1229
- }
1230
- }
1231
- }
1232
- }
1233
- }
1234
- }
1235
- /**
1236
- * Given an element, validate that its props follow the propTypes definition,
1237
- * provided by the type.
1238
- *
1239
- * @param {ReactElement} element
1240
- */
1241
-
1242
-
1243
- function validatePropTypes(element) {
1244
- {
1245
- var type = element.type;
1246
-
1247
- if (type === null || type === undefined || typeof type === 'string') {
1248
- return;
1249
- }
1250
-
1251
- var propTypes;
1252
-
1253
- if (typeof type === 'function') {
1254
- propTypes = type.propTypes;
1255
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1256
- // Inner props are checked in the reconciler.
1257
- type.$$typeof === REACT_MEMO_TYPE)) {
1258
- propTypes = type.propTypes;
1259
- } else {
1260
- return;
1261
- }
1262
-
1263
- if (propTypes) {
1264
- // Intentionally inside to avoid triggering lazy initializers:
1265
- var name = getComponentNameFromType(type);
1266
- checkPropTypes(propTypes, element.props, 'prop', name, element);
1267
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1268
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1269
-
1270
- var _name = getComponentNameFromType(type);
1271
-
1272
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1273
- }
1274
-
1275
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1276
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1277
- }
1278
- }
1279
- }
1280
- /**
1281
- * Given a fragment, validate that it can only be provided with fragment props
1282
- * @param {ReactElement} fragment
1283
- */
1284
-
1285
-
1286
- function validateFragmentProps(fragment) {
1287
- {
1288
- var keys = Object.keys(fragment.props);
1289
-
1290
- for (var i = 0; i < keys.length; i++) {
1291
- var key = keys[i];
1292
-
1293
- if (key !== 'children' && key !== 'key') {
1294
- setCurrentlyValidatingElement$1(fragment);
1295
-
1296
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1297
-
1298
- setCurrentlyValidatingElement$1(null);
1299
- break;
1300
- }
1301
- }
1302
-
1303
- if (fragment.ref !== null) {
1304
- setCurrentlyValidatingElement$1(fragment);
1305
-
1306
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1307
-
1308
- setCurrentlyValidatingElement$1(null);
1309
- }
1310
- }
1311
- }
1312
-
1313
- var didWarnAboutKeySpread = {};
1314
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1315
- {
1316
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1317
- // succeed and there will likely be errors in render.
1318
-
1319
- if (!validType) {
1320
- var info = '';
1321
-
1322
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1323
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1324
- }
1325
-
1326
- var sourceInfo = getSourceInfoErrorAddendum(source);
1327
-
1328
- if (sourceInfo) {
1329
- info += sourceInfo;
1330
- } else {
1331
- info += getDeclarationErrorAddendum();
1332
- }
1333
-
1334
- var typeString;
1335
-
1336
- if (type === null) {
1337
- typeString = 'null';
1338
- } else if (isArray(type)) {
1339
- typeString = 'array';
1340
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1341
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1342
- info = ' Did you accidentally export a JSX literal instead of a component?';
1343
- } else {
1344
- typeString = typeof type;
1345
- }
1346
-
1347
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1348
- }
1349
-
1350
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1351
- // TODO: Drop this when these are no longer allowed as the type argument.
1352
-
1353
- if (element == null) {
1354
- return element;
1355
- } // Skip key warning if the type isn't valid since our key validation logic
1356
- // doesn't expect a non-string/function type and can throw confusing errors.
1357
- // We don't want exception behavior to differ between dev and prod.
1358
- // (Rendering will throw with a helpful message and as soon as the type is
1359
- // fixed, the key warnings will appear.)
1360
-
1361
-
1362
- if (validType) {
1363
- var children = props.children;
1364
-
1365
- if (children !== undefined) {
1366
- if (isStaticChildren) {
1367
- if (isArray(children)) {
1368
- for (var i = 0; i < children.length; i++) {
1369
- validateChildKeys(children[i], type);
1370
- }
1371
-
1372
- if (Object.freeze) {
1373
- Object.freeze(children);
1374
- }
1375
- } else {
1376
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1377
- }
1378
- } else {
1379
- validateChildKeys(children, type);
1380
- }
1381
- }
1382
- }
1383
-
1384
- {
1385
- if (hasOwnProperty.call(props, 'key')) {
1386
- var componentName = getComponentNameFromType(type);
1387
- var keys = Object.keys(props).filter(function (k) {
1388
- return k !== 'key';
1389
- });
1390
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1391
-
1392
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1393
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1394
-
1395
- error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1396
-
1397
- didWarnAboutKeySpread[componentName + beforeExample] = true;
1398
- }
1399
- }
1400
- }
1401
-
1402
- if (type === REACT_FRAGMENT_TYPE) {
1403
- validateFragmentProps(element);
1404
- } else {
1405
- validatePropTypes(element);
1406
- }
1407
-
1408
- return element;
1409
- }
1410
- } // These two functions exist to still get child warnings in dev
1411
- // even with the prod transform. This means that jsxDEV is purely
1412
- // opt-in behavior for better messages but that we won't stop
1413
- // giving you warnings if you use production apis.
1414
-
1415
- function jsxWithValidationStatic(type, props, key) {
1416
- {
1417
- return jsxWithValidation(type, props, key, true);
1418
- }
1419
- }
1420
- function jsxWithValidationDynamic(type, props, key) {
1421
- {
1422
- return jsxWithValidation(type, props, key, false);
1423
- }
1424
- }
1425
-
1426
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1427
- // for now we can ship identical prod functions
1428
-
1429
- var jsxs = jsxWithValidationStatic ;
1430
-
1431
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1432
- reactJsxRuntime_development.jsx = jsx;
1433
- reactJsxRuntime_development.jsxs = jsxs;
1434
- })();
1435
- }
1436
- return reactJsxRuntime_development;
1437
- }
1438
-
1439
- if (process.env.NODE_ENV === 'production') {
1440
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
1441
- } else {
1442
- jsxRuntime.exports = requireReactJsxRuntime_development();
1443
- }
1444
-
1445
- var jsxRuntimeExports = jsxRuntime.exports;
1446
-
1447
- var prism = {exports: {}};
1448
-
1449
- prism.exports;
1450
-
1451
- (function (module) {
1452
- /* **********************************************
1453
- Begin prism-core.js
1454
- ********************************************** */
1455
-
1456
- /// <reference lib="WebWorker"/>
1457
-
1458
- var _self = (typeof window !== 'undefined')
1459
- ? window // if in browser
1460
- : (
1461
- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
1462
- ? self // if in worker
1463
- : {} // if in node js
1464
- );
1465
-
1466
- /**
1467
- * Prism: Lightweight, robust, elegant syntax highlighting
1468
- *
1469
- * @license MIT <https://opensource.org/licenses/MIT>
1470
- * @author Lea Verou <https://lea.verou.me>
1471
- * @namespace
1472
- * @public
1473
- */
1474
- var Prism = (function (_self) {
1475
-
1476
- // Private helper vars
1477
- var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
1478
- var uniqueId = 0;
1479
-
1480
- // The grammar object for plaintext
1481
- var plainTextGrammar = {};
1482
-
1483
-
1484
- var _ = {
1485
- /**
1486
- * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
1487
- * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
1488
- * additional languages or plugins yourself.
1489
- *
1490
- * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
1491
- *
1492
- * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
1493
- * empty Prism object into the global scope before loading the Prism script like this:
1494
- *
1495
- * ```js
1496
- * window.Prism = window.Prism || {};
1497
- * Prism.manual = true;
1498
- * // add a new <script> to load Prism's script
1499
- * ```
1500
- *
1501
- * @default false
1502
- * @type {boolean}
1503
- * @memberof Prism
1504
- * @public
1505
- */
1506
- manual: _self.Prism && _self.Prism.manual,
1507
- /**
1508
- * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
1509
- * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
1510
- * own worker, you don't want it to do this.
1511
- *
1512
- * By setting this value to `true`, Prism will not add its own listeners to the worker.
1513
- *
1514
- * You obviously have to change this value before Prism executes. To do this, you can add an
1515
- * empty Prism object into the global scope before loading the Prism script like this:
1516
- *
1517
- * ```js
1518
- * window.Prism = window.Prism || {};
1519
- * Prism.disableWorkerMessageHandler = true;
1520
- * // Load Prism's script
1521
- * ```
1522
- *
1523
- * @default false
1524
- * @type {boolean}
1525
- * @memberof Prism
1526
- * @public
1527
- */
1528
- disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
1529
-
1530
- /**
1531
- * A namespace for utility methods.
1532
- *
1533
- * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
1534
- * change or disappear at any time.
1535
- *
1536
- * @namespace
1537
- * @memberof Prism
1538
- */
1539
- util: {
1540
- encode: function encode(tokens) {
1541
- if (tokens instanceof Token) {
1542
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
1543
- } else if (Array.isArray(tokens)) {
1544
- return tokens.map(encode);
1545
- } else {
1546
- return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
1547
- }
1548
- },
1549
-
1550
- /**
1551
- * Returns the name of the type of the given value.
1552
- *
1553
- * @param {any} o
1554
- * @returns {string}
1555
- * @example
1556
- * type(null) === 'Null'
1557
- * type(undefined) === 'Undefined'
1558
- * type(123) === 'Number'
1559
- * type('foo') === 'String'
1560
- * type(true) === 'Boolean'
1561
- * type([1, 2]) === 'Array'
1562
- * type({}) === 'Object'
1563
- * type(String) === 'Function'
1564
- * type(/abc+/) === 'RegExp'
1565
- */
1566
- type: function (o) {
1567
- return Object.prototype.toString.call(o).slice(8, -1);
1568
- },
1569
-
1570
- /**
1571
- * Returns a unique number for the given object. Later calls will still return the same number.
1572
- *
1573
- * @param {Object} obj
1574
- * @returns {number}
1575
- */
1576
- objId: function (obj) {
1577
- if (!obj['__id']) {
1578
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
1579
- }
1580
- return obj['__id'];
1581
- },
1582
-
1583
- /**
1584
- * Creates a deep clone of the given object.
1585
- *
1586
- * The main intended use of this function is to clone language definitions.
1587
- *
1588
- * @param {T} o
1589
- * @param {Record<number, any>} [visited]
1590
- * @returns {T}
1591
- * @template T
1592
- */
1593
- clone: function deepClone(o, visited) {
1594
- visited = visited || {};
1595
-
1596
- var clone; var id;
1597
- switch (_.util.type(o)) {
1598
- case 'Object':
1599
- id = _.util.objId(o);
1600
- if (visited[id]) {
1601
- return visited[id];
1602
- }
1603
- clone = /** @type {Record<string, any>} */ ({});
1604
- visited[id] = clone;
1605
-
1606
- for (var key in o) {
1607
- if (o.hasOwnProperty(key)) {
1608
- clone[key] = deepClone(o[key], visited);
1609
- }
1610
- }
1611
-
1612
- return /** @type {any} */ (clone);
1613
-
1614
- case 'Array':
1615
- id = _.util.objId(o);
1616
- if (visited[id]) {
1617
- return visited[id];
1618
- }
1619
- clone = [];
1620
- visited[id] = clone;
1621
-
1622
- (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
1623
- clone[i] = deepClone(v, visited);
1624
- });
1625
-
1626
- return /** @type {any} */ (clone);
1627
-
1628
- default:
1629
- return o;
1630
- }
1631
- },
1632
-
1633
- /**
1634
- * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
1635
- *
1636
- * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
1637
- *
1638
- * @param {Element} element
1639
- * @returns {string}
1640
- */
1641
- getLanguage: function (element) {
1642
- while (element) {
1643
- var m = lang.exec(element.className);
1644
- if (m) {
1645
- return m[1].toLowerCase();
1646
- }
1647
- element = element.parentElement;
1648
- }
1649
- return 'none';
1650
- },
1651
-
1652
- /**
1653
- * Sets the Prism `language-xxxx` class of the given element.
1654
- *
1655
- * @param {Element} element
1656
- * @param {string} language
1657
- * @returns {void}
1658
- */
1659
- setLanguage: function (element, language) {
1660
- // remove all `language-xxxx` classes
1661
- // (this might leave behind a leading space)
1662
- element.className = element.className.replace(RegExp(lang, 'gi'), '');
1663
-
1664
- // add the new `language-xxxx` class
1665
- // (using `classList` will automatically clean up spaces for us)
1666
- element.classList.add('language-' + language);
1667
- },
1668
-
1669
- /**
1670
- * Returns the script element that is currently executing.
1671
- *
1672
- * This does __not__ work for line script element.
1673
- *
1674
- * @returns {HTMLScriptElement | null}
1675
- */
1676
- currentScript: function () {
1677
- if (typeof document === 'undefined') {
1678
- return null;
1679
- }
1680
- if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
1681
- return /** @type {any} */ (document.currentScript);
1682
- }
1683
-
1684
- // IE11 workaround
1685
- // we'll get the src of the current script by parsing IE11's error stack trace
1686
- // this will not work for inline scripts
1687
-
1688
- try {
1689
- throw new Error();
1690
- } catch (err) {
1691
- // Get file src url from stack. Specifically works with the format of stack traces in IE.
1692
- // A stack will look like this:
1693
- //
1694
- // Error
1695
- // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
1696
- // at Global code (http://localhost/components/prism-core.js:606:1)
1697
-
1698
- var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
1699
- if (src) {
1700
- var scripts = document.getElementsByTagName('script');
1701
- for (var i in scripts) {
1702
- if (scripts[i].src == src) {
1703
- return scripts[i];
1704
- }
1705
- }
1706
- }
1707
- return null;
1708
- }
1709
- },
1710
-
1711
- /**
1712
- * Returns whether a given class is active for `element`.
1713
- *
1714
- * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
1715
- * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
1716
- * given class is just the given class with a `no-` prefix.
1717
- *
1718
- * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
1719
- * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
1720
- * ancestors have the given class or the negated version of it, then the default activation will be returned.
1721
- *
1722
- * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
1723
- * version of it, the class is considered active.
1724
- *
1725
- * @param {Element} element
1726
- * @param {string} className
1727
- * @param {boolean} [defaultActivation=false]
1728
- * @returns {boolean}
1729
- */
1730
- isActive: function (element, className, defaultActivation) {
1731
- var no = 'no-' + className;
1732
-
1733
- while (element) {
1734
- var classList = element.classList;
1735
- if (classList.contains(className)) {
1736
- return true;
1737
- }
1738
- if (classList.contains(no)) {
1739
- return false;
1740
- }
1741
- element = element.parentElement;
1742
- }
1743
- return !!defaultActivation;
1744
- }
1745
- },
1746
-
1747
- /**
1748
- * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
1749
- *
1750
- * @namespace
1751
- * @memberof Prism
1752
- * @public
1753
- */
1754
- languages: {
1755
- /**
1756
- * The grammar for plain, unformatted text.
1757
- */
1758
- plain: plainTextGrammar,
1759
- plaintext: plainTextGrammar,
1760
- text: plainTextGrammar,
1761
- txt: plainTextGrammar,
1762
-
1763
- /**
1764
- * Creates a deep copy of the language with the given id and appends the given tokens.
1765
- *
1766
- * If a token in `redef` also appears in the copied language, then the existing token in the copied language
1767
- * will be overwritten at its original position.
1768
- *
1769
- * ## Best practices
1770
- *
1771
- * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
1772
- * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
1773
- * understand the language definition because, normally, the order of tokens matters in Prism grammars.
1774
- *
1775
- * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
1776
- * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
1777
- *
1778
- * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
1779
- * @param {Grammar} redef The new tokens to append.
1780
- * @returns {Grammar} The new language created.
1781
- * @public
1782
- * @example
1783
- * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
1784
- * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
1785
- * // at its original position
1786
- * 'comment': { ... },
1787
- * // CSS doesn't have a 'color' token, so this token will be appended
1788
- * 'color': /\b(?:red|green|blue)\b/
1789
- * });
1790
- */
1791
- extend: function (id, redef) {
1792
- var lang = _.util.clone(_.languages[id]);
1793
-
1794
- for (var key in redef) {
1795
- lang[key] = redef[key];
1796
- }
1797
-
1798
- return lang;
1799
- },
1800
-
1801
- /**
1802
- * Inserts tokens _before_ another token in a language definition or any other grammar.
1803
- *
1804
- * ## Usage
1805
- *
1806
- * This helper method makes it easy to modify existing languages. For example, the CSS language definition
1807
- * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
1808
- * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
1809
- * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
1810
- * this:
1811
- *
1812
- * ```js
1813
- * Prism.languages.markup.style = {
1814
- * // token
1815
- * };
1816
- * ```
1817
- *
1818
- * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
1819
- * before existing tokens. For the CSS example above, you would use it like this:
1820
- *
1821
- * ```js
1822
- * Prism.languages.insertBefore('markup', 'cdata', {
1823
- * 'style': {
1824
- * // token
1825
- * }
1826
- * });
1827
- * ```
1828
- *
1829
- * ## Special cases
1830
- *
1831
- * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
1832
- * will be ignored.
1833
- *
1834
- * This behavior can be used to insert tokens after `before`:
1835
- *
1836
- * ```js
1837
- * Prism.languages.insertBefore('markup', 'comment', {
1838
- * 'comment': Prism.languages.markup.comment,
1839
- * // tokens after 'comment'
1840
- * });
1841
- * ```
1842
- *
1843
- * ## Limitations
1844
- *
1845
- * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
1846
- * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
1847
- * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
1848
- * deleting properties which is necessary to insert at arbitrary positions.
1849
- *
1850
- * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
1851
- * Instead, it will create a new object and replace all references to the target object with the new one. This
1852
- * can be done without temporarily deleting properties, so the iteration order is well-defined.
1853
- *
1854
- * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
1855
- * you hold the target object in a variable, then the value of the variable will not change.
1856
- *
1857
- * ```js
1858
- * var oldMarkup = Prism.languages.markup;
1859
- * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
1860
- *
1861
- * assert(oldMarkup !== Prism.languages.markup);
1862
- * assert(newMarkup === Prism.languages.markup);
1863
- * ```
1864
- *
1865
- * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
1866
- * object to be modified.
1867
- * @param {string} before The key to insert before.
1868
- * @param {Grammar} insert An object containing the key-value pairs to be inserted.
1869
- * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
1870
- * object to be modified.
1871
- *
1872
- * Defaults to `Prism.languages`.
1873
- * @returns {Grammar} The new grammar object.
1874
- * @public
1875
- */
1876
- insertBefore: function (inside, before, insert, root) {
1877
- root = root || /** @type {any} */ (_.languages);
1878
- var grammar = root[inside];
1879
- /** @type {Grammar} */
1880
- var ret = {};
1881
-
1882
- for (var token in grammar) {
1883
- if (grammar.hasOwnProperty(token)) {
1884
-
1885
- if (token == before) {
1886
- for (var newToken in insert) {
1887
- if (insert.hasOwnProperty(newToken)) {
1888
- ret[newToken] = insert[newToken];
1889
- }
1890
- }
1891
- }
1892
-
1893
- // Do not insert token which also occur in insert. See #1525
1894
- if (!insert.hasOwnProperty(token)) {
1895
- ret[token] = grammar[token];
1896
- }
1897
- }
1898
- }
1899
-
1900
- var old = root[inside];
1901
- root[inside] = ret;
1902
-
1903
- // Update references in other language definitions
1904
- _.languages.DFS(_.languages, function (key, value) {
1905
- if (value === old && key != inside) {
1906
- this[key] = ret;
1907
- }
1908
- });
1909
-
1910
- return ret;
1911
- },
1912
-
1913
- // Traverse a language definition with Depth First Search
1914
- DFS: function DFS(o, callback, type, visited) {
1915
- visited = visited || {};
1916
-
1917
- var objId = _.util.objId;
1918
-
1919
- for (var i in o) {
1920
- if (o.hasOwnProperty(i)) {
1921
- callback.call(o, i, o[i], type || i);
1922
-
1923
- var property = o[i];
1924
- var propertyType = _.util.type(property);
1925
-
1926
- if (propertyType === 'Object' && !visited[objId(property)]) {
1927
- visited[objId(property)] = true;
1928
- DFS(property, callback, null, visited);
1929
- } else if (propertyType === 'Array' && !visited[objId(property)]) {
1930
- visited[objId(property)] = true;
1931
- DFS(property, callback, i, visited);
1932
- }
1933
- }
1934
- }
1935
- }
1936
- },
1937
-
1938
- plugins: {},
1939
-
1940
- /**
1941
- * This is the most high-level function in Prism’s API.
1942
- * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
1943
- * each one of them.
1944
- *
1945
- * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
1946
- *
1947
- * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
1948
- * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
1949
- * @memberof Prism
1950
- * @public
1951
- */
1952
- highlightAll: function (async, callback) {
1953
- _.highlightAllUnder(document, async, callback);
1954
- },
1955
-
1956
- /**
1957
- * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
1958
- * {@link Prism.highlightElement} on each one of them.
1959
- *
1960
- * The following hooks will be run:
1961
- * 1. `before-highlightall`
1962
- * 2. `before-all-elements-highlight`
1963
- * 3. All hooks of {@link Prism.highlightElement} for each element.
1964
- *
1965
- * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
1966
- * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
1967
- * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
1968
- * @memberof Prism
1969
- * @public
1970
- */
1971
- highlightAllUnder: function (container, async, callback) {
1972
- var env = {
1973
- callback: callback,
1974
- container: container,
1975
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
1976
- };
1977
-
1978
- _.hooks.run('before-highlightall', env);
1979
-
1980
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
1981
-
1982
- _.hooks.run('before-all-elements-highlight', env);
1983
-
1984
- for (var i = 0, element; (element = env.elements[i++]);) {
1985
- _.highlightElement(element, async === true, env.callback);
1986
- }
1987
- },
1988
-
1989
- /**
1990
- * Highlights the code inside a single element.
1991
- *
1992
- * The following hooks will be run:
1993
- * 1. `before-sanity-check`
1994
- * 2. `before-highlight`
1995
- * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
1996
- * 4. `before-insert`
1997
- * 5. `after-highlight`
1998
- * 6. `complete`
1999
- *
2000
- * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
2001
- * the element's language.
2002
- *
2003
- * @param {Element} element The element containing the code.
2004
- * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
2005
- * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
2006
- * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
2007
- * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
2008
- *
2009
- * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
2010
- * asynchronous highlighting to work. You can build your own bundle on the
2011
- * [Download page](https://prismjs.com/download.html).
2012
- * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
2013
- * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
2014
- * @memberof Prism
2015
- * @public
2016
- */
2017
- highlightElement: function (element, async, callback) {
2018
- // Find language
2019
- var language = _.util.getLanguage(element);
2020
- var grammar = _.languages[language];
2021
-
2022
- // Set language on the element, if not present
2023
- _.util.setLanguage(element, language);
2024
-
2025
- // Set language on the parent, for styling
2026
- var parent = element.parentElement;
2027
- if (parent && parent.nodeName.toLowerCase() === 'pre') {
2028
- _.util.setLanguage(parent, language);
2029
- }
2030
-
2031
- var code = element.textContent;
2032
-
2033
- var env = {
2034
- element: element,
2035
- language: language,
2036
- grammar: grammar,
2037
- code: code
2038
- };
2039
-
2040
- function insertHighlightedCode(highlightedCode) {
2041
- env.highlightedCode = highlightedCode;
2042
-
2043
- _.hooks.run('before-insert', env);
2044
-
2045
- env.element.innerHTML = env.highlightedCode;
2046
-
2047
- _.hooks.run('after-highlight', env);
2048
- _.hooks.run('complete', env);
2049
- callback && callback.call(env.element);
2050
- }
2051
-
2052
- _.hooks.run('before-sanity-check', env);
2053
-
2054
- // plugins may change/add the parent/element
2055
- parent = env.element.parentElement;
2056
- if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
2057
- parent.setAttribute('tabindex', '0');
2058
- }
2059
-
2060
- if (!env.code) {
2061
- _.hooks.run('complete', env);
2062
- callback && callback.call(env.element);
2063
- return;
2064
- }
2065
-
2066
- _.hooks.run('before-highlight', env);
2067
-
2068
- if (!env.grammar) {
2069
- insertHighlightedCode(_.util.encode(env.code));
2070
- return;
2071
- }
2072
-
2073
- if (async && _self.Worker) {
2074
- var worker = new Worker(_.filename);
2075
-
2076
- worker.onmessage = function (evt) {
2077
- insertHighlightedCode(evt.data);
2078
- };
2079
-
2080
- worker.postMessage(JSON.stringify({
2081
- language: env.language,
2082
- code: env.code,
2083
- immediateClose: true
2084
- }));
2085
- } else {
2086
- insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
2087
- }
2088
- },
2089
-
2090
- /**
2091
- * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
2092
- * and the language definitions to use, and returns a string with the HTML produced.
2093
- *
2094
- * The following hooks will be run:
2095
- * 1. `before-tokenize`
2096
- * 2. `after-tokenize`
2097
- * 3. `wrap`: On each {@link Token}.
2098
- *
2099
- * @param {string} text A string with the code to be highlighted.
2100
- * @param {Grammar} grammar An object containing the tokens to use.
2101
- *
2102
- * Usually a language definition like `Prism.languages.markup`.
2103
- * @param {string} language The name of the language definition passed to `grammar`.
2104
- * @returns {string} The highlighted HTML.
2105
- * @memberof Prism
2106
- * @public
2107
- * @example
2108
- * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
2109
- */
2110
- highlight: function (text, grammar, language) {
2111
- var env = {
2112
- code: text,
2113
- grammar: grammar,
2114
- language: language
2115
- };
2116
- _.hooks.run('before-tokenize', env);
2117
- if (!env.grammar) {
2118
- throw new Error('The language "' + env.language + '" has no grammar.');
2119
- }
2120
- env.tokens = _.tokenize(env.code, env.grammar);
2121
- _.hooks.run('after-tokenize', env);
2122
- return Token.stringify(_.util.encode(env.tokens), env.language);
2123
- },
2124
-
2125
- /**
2126
- * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
2127
- * and the language definitions to use, and returns an array with the tokenized code.
2128
- *
2129
- * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
2130
- *
2131
- * This method could be useful in other contexts as well, as a very crude parser.
2132
- *
2133
- * @param {string} text A string with the code to be highlighted.
2134
- * @param {Grammar} grammar An object containing the tokens to use.
2135
- *
2136
- * Usually a language definition like `Prism.languages.markup`.
2137
- * @returns {TokenStream} An array of strings and tokens, a token stream.
2138
- * @memberof Prism
2139
- * @public
2140
- * @example
2141
- * let code = `var foo = 0;`;
2142
- * let tokens = Prism.tokenize(code, Prism.languages.javascript);
2143
- * tokens.forEach(token => {
2144
- * if (token instanceof Prism.Token && token.type === 'number') {
2145
- * console.log(`Found numeric literal: ${token.content}`);
2146
- * }
2147
- * });
2148
- */
2149
- tokenize: function (text, grammar) {
2150
- var rest = grammar.rest;
2151
- if (rest) {
2152
- for (var token in rest) {
2153
- grammar[token] = rest[token];
2154
- }
2155
-
2156
- delete grammar.rest;
2157
- }
2158
-
2159
- var tokenList = new LinkedList();
2160
- addAfter(tokenList, tokenList.head, text);
2161
-
2162
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
2163
-
2164
- return toArray(tokenList);
2165
- },
2166
-
2167
- /**
2168
- * @namespace
2169
- * @memberof Prism
2170
- * @public
2171
- */
2172
- hooks: {
2173
- all: {},
2174
-
2175
- /**
2176
- * Adds the given callback to the list of callbacks for the given hook.
2177
- *
2178
- * The callback will be invoked when the hook it is registered for is run.
2179
- * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
2180
- *
2181
- * One callback function can be registered to multiple hooks and the same hook multiple times.
2182
- *
2183
- * @param {string} name The name of the hook.
2184
- * @param {HookCallback} callback The callback function which is given environment variables.
2185
- * @public
2186
- */
2187
- add: function (name, callback) {
2188
- var hooks = _.hooks.all;
2189
-
2190
- hooks[name] = hooks[name] || [];
2191
-
2192
- hooks[name].push(callback);
2193
- },
2194
-
2195
- /**
2196
- * Runs a hook invoking all registered callbacks with the given environment variables.
2197
- *
2198
- * Callbacks will be invoked synchronously and in the order in which they were registered.
2199
- *
2200
- * @param {string} name The name of the hook.
2201
- * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
2202
- * @public
2203
- */
2204
- run: function (name, env) {
2205
- var callbacks = _.hooks.all[name];
2206
-
2207
- if (!callbacks || !callbacks.length) {
2208
- return;
2209
- }
2210
-
2211
- for (var i = 0, callback; (callback = callbacks[i++]);) {
2212
- callback(env);
2213
- }
2214
- }
2215
- },
2216
-
2217
- Token: Token
2218
- };
2219
- _self.Prism = _;
2220
-
2221
-
2222
- // Typescript note:
2223
- // The following can be used to import the Token type in JSDoc:
2224
- //
2225
- // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
2226
-
2227
- /**
2228
- * Creates a new token.
2229
- *
2230
- * @param {string} type See {@link Token#type type}
2231
- * @param {string | TokenStream} content See {@link Token#content content}
2232
- * @param {string|string[]} [alias] The alias(es) of the token.
2233
- * @param {string} [matchedStr=""] A copy of the full string this token was created from.
2234
- * @class
2235
- * @global
2236
- * @public
2237
- */
2238
- function Token(type, content, alias, matchedStr) {
2239
- /**
2240
- * The type of the token.
2241
- *
2242
- * This is usually the key of a pattern in a {@link Grammar}.
2243
- *
2244
- * @type {string}
2245
- * @see GrammarToken
2246
- * @public
2247
- */
2248
- this.type = type;
2249
- /**
2250
- * The strings or tokens contained by this token.
2251
- *
2252
- * This will be a token stream if the pattern matched also defined an `inside` grammar.
2253
- *
2254
- * @type {string | TokenStream}
2255
- * @public
2256
- */
2257
- this.content = content;
2258
- /**
2259
- * The alias(es) of the token.
2260
- *
2261
- * @type {string|string[]}
2262
- * @see GrammarToken
2263
- * @public
2264
- */
2265
- this.alias = alias;
2266
- // Copy of the full string this token was created from
2267
- this.length = (matchedStr || '').length | 0;
2268
- }
2269
-
2270
- /**
2271
- * A token stream is an array of strings and {@link Token Token} objects.
2272
- *
2273
- * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
2274
- * them.
2275
- *
2276
- * 1. No adjacent strings.
2277
- * 2. No empty strings.
2278
- *
2279
- * The only exception here is the token stream that only contains the empty string and nothing else.
2280
- *
2281
- * @typedef {Array<string | Token>} TokenStream
2282
- * @global
2283
- * @public
2284
- */
2285
-
2286
- /**
2287
- * Converts the given token or token stream to an HTML representation.
2288
- *
2289
- * The following hooks will be run:
2290
- * 1. `wrap`: On each {@link Token}.
2291
- *
2292
- * @param {string | Token | TokenStream} o The token or token stream to be converted.
2293
- * @param {string} language The name of current language.
2294
- * @returns {string} The HTML representation of the token or token stream.
2295
- * @memberof Token
2296
- * @static
2297
- */
2298
- Token.stringify = function stringify(o, language) {
2299
- if (typeof o == 'string') {
2300
- return o;
2301
- }
2302
- if (Array.isArray(o)) {
2303
- var s = '';
2304
- o.forEach(function (e) {
2305
- s += stringify(e, language);
2306
- });
2307
- return s;
2308
- }
2309
-
2310
- var env = {
2311
- type: o.type,
2312
- content: stringify(o.content, language),
2313
- tag: 'span',
2314
- classes: ['token', o.type],
2315
- attributes: {},
2316
- language: language
2317
- };
2318
-
2319
- var aliases = o.alias;
2320
- if (aliases) {
2321
- if (Array.isArray(aliases)) {
2322
- Array.prototype.push.apply(env.classes, aliases);
2323
- } else {
2324
- env.classes.push(aliases);
2325
- }
2326
- }
2327
-
2328
- _.hooks.run('wrap', env);
2329
-
2330
- var attributes = '';
2331
- for (var name in env.attributes) {
2332
- attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
2333
- }
2334
-
2335
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
2336
- };
2337
-
2338
- /**
2339
- * @param {RegExp} pattern
2340
- * @param {number} pos
2341
- * @param {string} text
2342
- * @param {boolean} lookbehind
2343
- * @returns {RegExpExecArray | null}
2344
- */
2345
- function matchPattern(pattern, pos, text, lookbehind) {
2346
- pattern.lastIndex = pos;
2347
- var match = pattern.exec(text);
2348
- if (match && lookbehind && match[1]) {
2349
- // change the match to remove the text matched by the Prism lookbehind group
2350
- var lookbehindLength = match[1].length;
2351
- match.index += lookbehindLength;
2352
- match[0] = match[0].slice(lookbehindLength);
2353
- }
2354
- return match;
2355
- }
2356
-
2357
- /**
2358
- * @param {string} text
2359
- * @param {LinkedList<string | Token>} tokenList
2360
- * @param {any} grammar
2361
- * @param {LinkedListNode<string | Token>} startNode
2362
- * @param {number} startPos
2363
- * @param {RematchOptions} [rematch]
2364
- * @returns {void}
2365
- * @private
2366
- *
2367
- * @typedef RematchOptions
2368
- * @property {string} cause
2369
- * @property {number} reach
2370
- */
2371
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
2372
- for (var token in grammar) {
2373
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
2374
- continue;
2375
- }
2376
-
2377
- var patterns = grammar[token];
2378
- patterns = Array.isArray(patterns) ? patterns : [patterns];
2379
-
2380
- for (var j = 0; j < patterns.length; ++j) {
2381
- if (rematch && rematch.cause == token + ',' + j) {
2382
- return;
2383
- }
2384
-
2385
- var patternObj = patterns[j];
2386
- var inside = patternObj.inside;
2387
- var lookbehind = !!patternObj.lookbehind;
2388
- var greedy = !!patternObj.greedy;
2389
- var alias = patternObj.alias;
2390
-
2391
- if (greedy && !patternObj.pattern.global) {
2392
- // Without the global flag, lastIndex won't work
2393
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
2394
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
2395
- }
2396
-
2397
- /** @type {RegExp} */
2398
- var pattern = patternObj.pattern || patternObj;
2399
-
2400
- for ( // iterate the token list and keep track of the current token/string position
2401
- var currentNode = startNode.next, pos = startPos;
2402
- currentNode !== tokenList.tail;
2403
- pos += currentNode.value.length, currentNode = currentNode.next
2404
- ) {
2405
-
2406
- if (rematch && pos >= rematch.reach) {
2407
- break;
2408
- }
2409
-
2410
- var str = currentNode.value;
2411
-
2412
- if (tokenList.length > text.length) {
2413
- // Something went terribly wrong, ABORT, ABORT!
2414
- return;
2415
- }
2416
-
2417
- if (str instanceof Token) {
2418
- continue;
2419
- }
2420
-
2421
- var removeCount = 1; // this is the to parameter of removeBetween
2422
- var match;
2423
-
2424
- if (greedy) {
2425
- match = matchPattern(pattern, pos, text, lookbehind);
2426
- if (!match || match.index >= text.length) {
2427
- break;
2428
- }
2429
-
2430
- var from = match.index;
2431
- var to = match.index + match[0].length;
2432
- var p = pos;
2433
-
2434
- // find the node that contains the match
2435
- p += currentNode.value.length;
2436
- while (from >= p) {
2437
- currentNode = currentNode.next;
2438
- p += currentNode.value.length;
2439
- }
2440
- // adjust pos (and p)
2441
- p -= currentNode.value.length;
2442
- pos = p;
2443
-
2444
- // the current node is a Token, then the match starts inside another Token, which is invalid
2445
- if (currentNode.value instanceof Token) {
2446
- continue;
2447
- }
2448
-
2449
- // find the last node which is affected by this match
2450
- for (
2451
- var k = currentNode;
2452
- k !== tokenList.tail && (p < to || typeof k.value === 'string');
2453
- k = k.next
2454
- ) {
2455
- removeCount++;
2456
- p += k.value.length;
2457
- }
2458
- removeCount--;
2459
-
2460
- // replace with the new match
2461
- str = text.slice(pos, p);
2462
- match.index -= pos;
2463
- } else {
2464
- match = matchPattern(pattern, 0, str, lookbehind);
2465
- if (!match) {
2466
- continue;
2467
- }
2468
- }
2469
-
2470
- // eslint-disable-next-line no-redeclare
2471
- var from = match.index;
2472
- var matchStr = match[0];
2473
- var before = str.slice(0, from);
2474
- var after = str.slice(from + matchStr.length);
2475
-
2476
- var reach = pos + str.length;
2477
- if (rematch && reach > rematch.reach) {
2478
- rematch.reach = reach;
2479
- }
2480
-
2481
- var removeFrom = currentNode.prev;
2482
-
2483
- if (before) {
2484
- removeFrom = addAfter(tokenList, removeFrom, before);
2485
- pos += before.length;
2486
- }
2487
-
2488
- removeRange(tokenList, removeFrom, removeCount);
2489
-
2490
- var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
2491
- currentNode = addAfter(tokenList, removeFrom, wrapped);
2492
-
2493
- if (after) {
2494
- addAfter(tokenList, currentNode, after);
2495
- }
2496
-
2497
- if (removeCount > 1) {
2498
- // at least one Token object was removed, so we have to do some rematching
2499
- // this can only happen if the current pattern is greedy
2500
-
2501
- /** @type {RematchOptions} */
2502
- var nestedRematch = {
2503
- cause: token + ',' + j,
2504
- reach: reach
2505
- };
2506
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
2507
-
2508
- // the reach might have been extended because of the rematching
2509
- if (rematch && nestedRematch.reach > rematch.reach) {
2510
- rematch.reach = nestedRematch.reach;
2511
- }
2512
- }
2513
- }
2514
- }
2515
- }
2516
- }
2517
-
2518
- /**
2519
- * @typedef LinkedListNode
2520
- * @property {T} value
2521
- * @property {LinkedListNode<T> | null} prev The previous node.
2522
- * @property {LinkedListNode<T> | null} next The next node.
2523
- * @template T
2524
- * @private
2525
- */
2526
-
2527
- /**
2528
- * @template T
2529
- * @private
2530
- */
2531
- function LinkedList() {
2532
- /** @type {LinkedListNode<T>} */
2533
- var head = { value: null, prev: null, next: null };
2534
- /** @type {LinkedListNode<T>} */
2535
- var tail = { value: null, prev: head, next: null };
2536
- head.next = tail;
2537
-
2538
- /** @type {LinkedListNode<T>} */
2539
- this.head = head;
2540
- /** @type {LinkedListNode<T>} */
2541
- this.tail = tail;
2542
- this.length = 0;
2543
- }
2544
-
2545
- /**
2546
- * Adds a new node with the given value to the list.
2547
- *
2548
- * @param {LinkedList<T>} list
2549
- * @param {LinkedListNode<T>} node
2550
- * @param {T} value
2551
- * @returns {LinkedListNode<T>} The added node.
2552
- * @template T
2553
- */
2554
- function addAfter(list, node, value) {
2555
- // assumes that node != list.tail && values.length >= 0
2556
- var next = node.next;
2557
-
2558
- var newNode = { value: value, prev: node, next: next };
2559
- node.next = newNode;
2560
- next.prev = newNode;
2561
- list.length++;
2562
-
2563
- return newNode;
2564
- }
2565
- /**
2566
- * Removes `count` nodes after the given node. The given node will not be removed.
2567
- *
2568
- * @param {LinkedList<T>} list
2569
- * @param {LinkedListNode<T>} node
2570
- * @param {number} count
2571
- * @template T
2572
- */
2573
- function removeRange(list, node, count) {
2574
- var next = node.next;
2575
- for (var i = 0; i < count && next !== list.tail; i++) {
2576
- next = next.next;
2577
- }
2578
- node.next = next;
2579
- next.prev = node;
2580
- list.length -= i;
2581
- }
2582
- /**
2583
- * @param {LinkedList<T>} list
2584
- * @returns {T[]}
2585
- * @template T
2586
- */
2587
- function toArray(list) {
2588
- var array = [];
2589
- var node = list.head.next;
2590
- while (node !== list.tail) {
2591
- array.push(node.value);
2592
- node = node.next;
2593
- }
2594
- return array;
2595
- }
2596
-
2597
-
2598
- if (!_self.document) {
2599
- if (!_self.addEventListener) {
2600
- // in Node.js
2601
- return _;
2602
- }
2603
-
2604
- if (!_.disableWorkerMessageHandler) {
2605
- // In worker
2606
- _self.addEventListener('message', function (evt) {
2607
- var message = JSON.parse(evt.data);
2608
- var lang = message.language;
2609
- var code = message.code;
2610
- var immediateClose = message.immediateClose;
2611
-
2612
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
2613
- if (immediateClose) {
2614
- _self.close();
2615
- }
2616
- }, false);
2617
- }
2618
-
2619
- return _;
2620
- }
2621
-
2622
- // Get current script and highlight
2623
- var script = _.util.currentScript();
2624
-
2625
- if (script) {
2626
- _.filename = script.src;
2627
-
2628
- if (script.hasAttribute('data-manual')) {
2629
- _.manual = true;
2630
- }
2631
- }
2632
-
2633
- function highlightAutomaticallyCallback() {
2634
- if (!_.manual) {
2635
- _.highlightAll();
2636
- }
2637
- }
2638
-
2639
- if (!_.manual) {
2640
- // If the document state is "loading", then we'll use DOMContentLoaded.
2641
- // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
2642
- // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
2643
- // might take longer one animation frame to execute which can create a race condition where only some plugins have
2644
- // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
2645
- // See https://github.com/PrismJS/prism/issues/2102
2646
- var readyState = document.readyState;
2647
- if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
2648
- document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
2649
- } else {
2650
- if (window.requestAnimationFrame) {
2651
- window.requestAnimationFrame(highlightAutomaticallyCallback);
2652
- } else {
2653
- window.setTimeout(highlightAutomaticallyCallback, 16);
2654
- }
2655
- }
2656
- }
2657
-
2658
- return _;
2659
-
2660
- }(_self));
2661
-
2662
- if (module.exports) {
2663
- module.exports = Prism;
2664
- }
2665
-
2666
- // hack for components to work correctly in node.js
2667
- if (typeof commonjsGlobal !== 'undefined') {
2668
- commonjsGlobal.Prism = Prism;
2669
- }
2670
-
2671
- // some additional documentation/types
2672
-
2673
- /**
2674
- * The expansion of a simple `RegExp` literal to support additional properties.
2675
- *
2676
- * @typedef GrammarToken
2677
- * @property {RegExp} pattern The regular expression of the token.
2678
- * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
2679
- * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
2680
- * @property {boolean} [greedy=false] Whether the token is greedy.
2681
- * @property {string|string[]} [alias] An optional alias or list of aliases.
2682
- * @property {Grammar} [inside] The nested grammar of this token.
2683
- *
2684
- * The `inside` grammar will be used to tokenize the text value of each token of this kind.
2685
- *
2686
- * This can be used to make nested and even recursive language definitions.
2687
- *
2688
- * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
2689
- * each another.
2690
- * @global
2691
- * @public
2692
- */
2693
-
2694
- /**
2695
- * @typedef Grammar
2696
- * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
2697
- * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
2698
- * @global
2699
- * @public
2700
- */
2701
-
2702
- /**
2703
- * A function which will invoked after an element was successfully highlighted.
2704
- *
2705
- * @callback HighlightCallback
2706
- * @param {Element} element The element successfully highlighted.
2707
- * @returns {void}
2708
- * @global
2709
- * @public
2710
- */
2711
-
2712
- /**
2713
- * @callback HookCallback
2714
- * @param {Object<string, any>} env The environment variables of the hook.
2715
- * @returns {void}
2716
- * @global
2717
- * @public
2718
- */
2719
-
2720
-
2721
- /* **********************************************
2722
- Begin prism-markup.js
2723
- ********************************************** */
2724
-
2725
- Prism.languages.markup = {
2726
- 'comment': {
2727
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
2728
- greedy: true
2729
- },
2730
- 'prolog': {
2731
- pattern: /<\?[\s\S]+?\?>/,
2732
- greedy: true
2733
- },
2734
- 'doctype': {
2735
- // https://www.w3.org/TR/xml/#NT-doctypedecl
2736
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
2737
- greedy: true,
2738
- inside: {
2739
- 'internal-subset': {
2740
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
2741
- lookbehind: true,
2742
- greedy: true,
2743
- inside: null // see below
2744
- },
2745
- 'string': {
2746
- pattern: /"[^"]*"|'[^']*'/,
2747
- greedy: true
2748
- },
2749
- 'punctuation': /^<!|>$|[[\]]/,
2750
- 'doctype-tag': /^DOCTYPE/i,
2751
- 'name': /[^\s<>'"]+/
2752
- }
2753
- },
2754
- 'cdata': {
2755
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2756
- greedy: true
2757
- },
2758
- 'tag': {
2759
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
2760
- greedy: true,
2761
- inside: {
2762
- 'tag': {
2763
- pattern: /^<\/?[^\s>\/]+/,
2764
- inside: {
2765
- 'punctuation': /^<\/?/,
2766
- 'namespace': /^[^\s>\/:]+:/
2767
- }
2768
- },
2769
- 'special-attr': [],
2770
- 'attr-value': {
2771
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
2772
- inside: {
2773
- 'punctuation': [
2774
- {
2775
- pattern: /^=/,
2776
- alias: 'attr-equals'
2777
- },
2778
- {
2779
- pattern: /^(\s*)["']|["']$/,
2780
- lookbehind: true
2781
- }
2782
- ]
2783
- }
2784
- },
2785
- 'punctuation': /\/?>/,
2786
- 'attr-name': {
2787
- pattern: /[^\s>\/]+/,
2788
- inside: {
2789
- 'namespace': /^[^\s>\/:]+:/
2790
- }
2791
- }
2792
-
2793
- }
2794
- },
2795
- 'entity': [
2796
- {
2797
- pattern: /&[\da-z]{1,8};/i,
2798
- alias: 'named-entity'
2799
- },
2800
- /&#x?[\da-f]{1,8};/i
2801
- ]
2802
- };
2803
-
2804
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
2805
- Prism.languages.markup['entity'];
2806
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
2807
-
2808
- // Plugin to make entity title show the real entity, idea by Roman Komarov
2809
- Prism.hooks.add('wrap', function (env) {
2810
-
2811
- if (env.type === 'entity') {
2812
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
2813
- }
2814
- });
2815
-
2816
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
2817
- /**
2818
- * Adds an inlined language to markup.
2819
- *
2820
- * An example of an inlined language is CSS with `<style>` tags.
2821
- *
2822
- * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
2823
- * case insensitive.
2824
- * @param {string} lang The language key.
2825
- * @example
2826
- * addInlined('style', 'css');
2827
- */
2828
- value: function addInlined(tagName, lang) {
2829
- var includedCdataInside = {};
2830
- includedCdataInside['language-' + lang] = {
2831
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
2832
- lookbehind: true,
2833
- inside: Prism.languages[lang]
2834
- };
2835
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
2836
-
2837
- var inside = {
2838
- 'included-cdata': {
2839
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2840
- inside: includedCdataInside
2841
- }
2842
- };
2843
- inside['language-' + lang] = {
2844
- pattern: /[\s\S]+/,
2845
- inside: Prism.languages[lang]
2846
- };
2847
-
2848
- var def = {};
2849
- def[tagName] = {
2850
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
2851
- lookbehind: true,
2852
- greedy: true,
2853
- inside: inside
2854
- };
2855
-
2856
- Prism.languages.insertBefore('markup', 'cdata', def);
2857
- }
2858
- });
2859
- Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
2860
- /**
2861
- * Adds an pattern to highlight languages embedded in HTML attributes.
2862
- *
2863
- * An example of an inlined language is CSS with `style` attributes.
2864
- *
2865
- * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
2866
- * case insensitive.
2867
- * @param {string} lang The language key.
2868
- * @example
2869
- * addAttribute('style', 'css');
2870
- */
2871
- value: function (attrName, lang) {
2872
- Prism.languages.markup.tag.inside['special-attr'].push({
2873
- pattern: RegExp(
2874
- /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
2875
- 'i'
2876
- ),
2877
- lookbehind: true,
2878
- inside: {
2879
- 'attr-name': /^[^\s=]+/,
2880
- 'attr-value': {
2881
- pattern: /=[\s\S]+/,
2882
- inside: {
2883
- 'value': {
2884
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
2885
- lookbehind: true,
2886
- alias: [lang, 'language-' + lang],
2887
- inside: Prism.languages[lang]
2888
- },
2889
- 'punctuation': [
2890
- {
2891
- pattern: /^=/,
2892
- alias: 'attr-equals'
2893
- },
2894
- /"|'/
2895
- ]
2896
- }
2897
- }
2898
- }
2899
- });
2900
- }
2901
- });
2902
-
2903
- Prism.languages.html = Prism.languages.markup;
2904
- Prism.languages.mathml = Prism.languages.markup;
2905
- Prism.languages.svg = Prism.languages.markup;
2906
-
2907
- Prism.languages.xml = Prism.languages.extend('markup', {});
2908
- Prism.languages.ssml = Prism.languages.xml;
2909
- Prism.languages.atom = Prism.languages.xml;
2910
- Prism.languages.rss = Prism.languages.xml;
2911
-
2912
-
2913
- /* **********************************************
2914
- Begin prism-css.js
2915
- ********************************************** */
2916
-
2917
- (function (Prism) {
2918
-
2919
- var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
2920
-
2921
- Prism.languages.css = {
2922
- 'comment': /\/\*[\s\S]*?\*\//,
2923
- 'atrule': {
2924
- pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
2925
- inside: {
2926
- 'rule': /^@[\w-]+/,
2927
- 'selector-function-argument': {
2928
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
2929
- lookbehind: true,
2930
- alias: 'selector'
2931
- },
2932
- 'keyword': {
2933
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
2934
- lookbehind: true
2935
- }
2936
- // See rest below
2937
- }
2938
- },
2939
- 'url': {
2940
- // https://drafts.csswg.org/css-values-3/#urls
2941
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
2942
- greedy: true,
2943
- inside: {
2944
- 'function': /^url/i,
2945
- 'punctuation': /^\(|\)$/,
2946
- 'string': {
2947
- pattern: RegExp('^' + string.source + '$'),
2948
- alias: 'url'
2949
- }
2950
- }
2951
- },
2952
- 'selector': {
2953
- pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
2954
- lookbehind: true
2955
- },
2956
- 'string': {
2957
- pattern: string,
2958
- greedy: true
2959
- },
2960
- 'property': {
2961
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
2962
- lookbehind: true
2963
- },
2964
- 'important': /!important\b/i,
2965
- 'function': {
2966
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
2967
- lookbehind: true
2968
- },
2969
- 'punctuation': /[(){};:,]/
2970
- };
2971
-
2972
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
2973
-
2974
- var markup = Prism.languages.markup;
2975
- if (markup) {
2976
- markup.tag.addInlined('style', 'css');
2977
- markup.tag.addAttribute('style', 'css');
2978
- }
2979
-
2980
- }(Prism));
2981
-
2982
-
2983
- /* **********************************************
2984
- Begin prism-clike.js
2985
- ********************************************** */
2986
-
2987
- Prism.languages.clike = {
2988
- 'comment': [
2989
- {
2990
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
2991
- lookbehind: true,
2992
- greedy: true
2993
- },
2994
- {
2995
- pattern: /(^|[^\\:])\/\/.*/,
2996
- lookbehind: true,
2997
- greedy: true
2998
- }
2999
- ],
3000
- 'string': {
3001
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
3002
- greedy: true
3003
- },
3004
- 'class-name': {
3005
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
3006
- lookbehind: true,
3007
- inside: {
3008
- 'punctuation': /[.\\]/
3009
- }
3010
- },
3011
- 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
3012
- 'boolean': /\b(?:false|true)\b/,
3013
- 'function': /\b\w+(?=\()/,
3014
- 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
3015
- 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
3016
- 'punctuation': /[{}[\];(),.:]/
3017
- };
3018
-
3019
-
3020
- /* **********************************************
3021
- Begin prism-javascript.js
3022
- ********************************************** */
3023
-
3024
- Prism.languages.javascript = Prism.languages.extend('clike', {
3025
- 'class-name': [
3026
- Prism.languages.clike['class-name'],
3027
- {
3028
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
3029
- lookbehind: true
3030
- }
3031
- ],
3032
- 'keyword': [
3033
- {
3034
- pattern: /((?:^|\})\s*)catch\b/,
3035
- lookbehind: true
3036
- },
3037
- {
3038
- 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/,
3039
- lookbehind: true
3040
- },
3041
- ],
3042
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
3043
- 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
3044
- 'number': {
3045
- pattern: RegExp(
3046
- /(^|[^\w$])/.source +
3047
- '(?:' +
3048
- (
3049
- // constant
3050
- /NaN|Infinity/.source +
3051
- '|' +
3052
- // binary integer
3053
- /0[bB][01]+(?:_[01]+)*n?/.source +
3054
- '|' +
3055
- // octal integer
3056
- /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
3057
- '|' +
3058
- // hexadecimal integer
3059
- /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
3060
- '|' +
3061
- // decimal bigint
3062
- /\d+(?:_\d+)*n/.source +
3063
- '|' +
3064
- // decimal number (integer or float) but no bigint
3065
- /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
3066
- ) +
3067
- ')' +
3068
- /(?![\w$])/.source
3069
- ),
3070
- lookbehind: true
3071
- },
3072
- 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
3073
- });
3074
-
3075
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
3076
-
3077
- Prism.languages.insertBefore('javascript', 'keyword', {
3078
- 'regex': {
3079
- pattern: RegExp(
3080
- // lookbehind
3081
- // eslint-disable-next-line regexp/no-dupe-characters-character-class
3082
- /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
3083
- // Regex pattern:
3084
- // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
3085
- // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
3086
- // with the only syntax, so we have to define 2 different regex patterns.
3087
- /\//.source +
3088
- '(?:' +
3089
- /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
3090
- '|' +
3091
- // `v` flag syntax. This supports 3 levels of nested character classes.
3092
- /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
3093
- ')' +
3094
- // lookahead
3095
- /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
3096
- ),
3097
- lookbehind: true,
3098
- greedy: true,
3099
- inside: {
3100
- 'regex-source': {
3101
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
3102
- lookbehind: true,
3103
- alias: 'language-regex',
3104
- inside: Prism.languages.regex
3105
- },
3106
- 'regex-delimiter': /^\/|\/$/,
3107
- 'regex-flags': /^[a-z]+$/,
3108
- }
3109
- },
3110
- // This must be declared before keyword because we use "function" inside the look-forward
3111
- 'function-variable': {
3112
- 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*=>))/,
3113
- alias: 'function'
3114
- },
3115
- 'parameter': [
3116
- {
3117
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
3118
- lookbehind: true,
3119
- inside: Prism.languages.javascript
3120
- },
3121
- {
3122
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
3123
- lookbehind: true,
3124
- inside: Prism.languages.javascript
3125
- },
3126
- {
3127
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
3128
- lookbehind: true,
3129
- inside: Prism.languages.javascript
3130
- },
3131
- {
3132
- 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*\{)/,
3133
- lookbehind: true,
3134
- inside: Prism.languages.javascript
3135
- }
3136
- ],
3137
- 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
3138
- });
3139
-
3140
- Prism.languages.insertBefore('javascript', 'string', {
3141
- 'hashbang': {
3142
- pattern: /^#!.*/,
3143
- greedy: true,
3144
- alias: 'comment'
3145
- },
3146
- 'template-string': {
3147
- pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
3148
- greedy: true,
3149
- inside: {
3150
- 'template-punctuation': {
3151
- pattern: /^`|`$/,
3152
- alias: 'string'
3153
- },
3154
- 'interpolation': {
3155
- pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
3156
- lookbehind: true,
3157
- inside: {
3158
- 'interpolation-punctuation': {
3159
- pattern: /^\$\{|\}$/,
3160
- alias: 'punctuation'
3161
- },
3162
- rest: Prism.languages.javascript
3163
- }
3164
- },
3165
- 'string': /[\s\S]+/
3166
- }
3167
- },
3168
- 'string-property': {
3169
- pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
3170
- lookbehind: true,
3171
- greedy: true,
3172
- alias: 'property'
3173
- }
3174
- });
3175
-
3176
- Prism.languages.insertBefore('javascript', 'operator', {
3177
- 'literal-property': {
3178
- pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
3179
- lookbehind: true,
3180
- alias: 'property'
3181
- },
3182
- });
3183
-
3184
- if (Prism.languages.markup) {
3185
- Prism.languages.markup.tag.addInlined('script', 'javascript');
3186
-
3187
- // add attribute support for all DOM events.
3188
- // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
3189
- Prism.languages.markup.tag.addAttribute(
3190
- /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,
3191
- 'javascript'
3192
- );
3193
- }
3194
-
3195
- Prism.languages.js = Prism.languages.javascript;
3196
-
3197
-
3198
- /* **********************************************
3199
- Begin prism-file-highlight.js
3200
- ********************************************** */
3201
-
3202
- (function () {
3203
-
3204
- if (typeof Prism === 'undefined' || typeof document === 'undefined') {
3205
- return;
3206
- }
3207
-
3208
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
3209
- if (!Element.prototype.matches) {
3210
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
3211
- }
3212
-
3213
- var LOADING_MESSAGE = 'Loading…';
3214
- var FAILURE_MESSAGE = function (status, message) {
3215
- return '✖ Error ' + status + ' while fetching file: ' + message;
3216
- };
3217
- var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
3218
-
3219
- var EXTENSIONS = {
3220
- 'js': 'javascript',
3221
- 'py': 'python',
3222
- 'rb': 'ruby',
3223
- 'ps1': 'powershell',
3224
- 'psm1': 'powershell',
3225
- 'sh': 'bash',
3226
- 'bat': 'batch',
3227
- 'h': 'c',
3228
- 'tex': 'latex'
3229
- };
3230
-
3231
- var STATUS_ATTR = 'data-src-status';
3232
- var STATUS_LOADING = 'loading';
3233
- var STATUS_LOADED = 'loaded';
3234
- var STATUS_FAILED = 'failed';
3235
-
3236
- var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
3237
- + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
3238
-
3239
- /**
3240
- * Loads the given file.
3241
- *
3242
- * @param {string} src The URL or path of the source file to load.
3243
- * @param {(result: string) => void} success
3244
- * @param {(reason: string) => void} error
3245
- */
3246
- function loadFile(src, success, error) {
3247
- var xhr = new XMLHttpRequest();
3248
- xhr.open('GET', src, true);
3249
- xhr.onreadystatechange = function () {
3250
- if (xhr.readyState == 4) {
3251
- if (xhr.status < 400 && xhr.responseText) {
3252
- success(xhr.responseText);
3253
- } else {
3254
- if (xhr.status >= 400) {
3255
- error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
3256
- } else {
3257
- error(FAILURE_EMPTY_MESSAGE);
3258
- }
3259
- }
3260
- }
3261
- };
3262
- xhr.send(null);
3263
- }
3264
-
3265
- /**
3266
- * Parses the given range.
3267
- *
3268
- * This returns a range with inclusive ends.
3269
- *
3270
- * @param {string | null | undefined} range
3271
- * @returns {[number, number | undefined] | undefined}
3272
- */
3273
- function parseRange(range) {
3274
- var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
3275
- if (m) {
3276
- var start = Number(m[1]);
3277
- var comma = m[2];
3278
- var end = m[3];
3279
-
3280
- if (!comma) {
3281
- return [start, start];
3282
- }
3283
- if (!end) {
3284
- return [start, undefined];
3285
- }
3286
- return [start, Number(end)];
3287
- }
3288
- return undefined;
3289
- }
3290
-
3291
- Prism.hooks.add('before-highlightall', function (env) {
3292
- env.selector += ', ' + SELECTOR;
3293
- });
3294
-
3295
- Prism.hooks.add('before-sanity-check', function (env) {
3296
- var pre = /** @type {HTMLPreElement} */ (env.element);
3297
- if (pre.matches(SELECTOR)) {
3298
- env.code = ''; // fast-path the whole thing and go to complete
3299
-
3300
- pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
3301
-
3302
- // add code element with loading message
3303
- var code = pre.appendChild(document.createElement('CODE'));
3304
- code.textContent = LOADING_MESSAGE;
3305
-
3306
- var src = pre.getAttribute('data-src');
3307
-
3308
- var language = env.language;
3309
- if (language === 'none') {
3310
- // the language might be 'none' because there is no language set;
3311
- // in this case, we want to use the extension as the language
3312
- var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
3313
- language = EXTENSIONS[extension] || extension;
3314
- }
3315
-
3316
- // set language classes
3317
- Prism.util.setLanguage(code, language);
3318
- Prism.util.setLanguage(pre, language);
3319
-
3320
- // preload the language
3321
- var autoloader = Prism.plugins.autoloader;
3322
- if (autoloader) {
3323
- autoloader.loadLanguages(language);
3324
- }
3325
-
3326
- // load file
3327
- loadFile(
3328
- src,
3329
- function (text) {
3330
- // mark as loaded
3331
- pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
3332
-
3333
- // handle data-range
3334
- var range = parseRange(pre.getAttribute('data-range'));
3335
- if (range) {
3336
- var lines = text.split(/\r\n?|\n/g);
3337
-
3338
- // the range is one-based and inclusive on both ends
3339
- var start = range[0];
3340
- var end = range[1] == null ? lines.length : range[1];
3341
-
3342
- if (start < 0) { start += lines.length; }
3343
- start = Math.max(0, Math.min(start - 1, lines.length));
3344
- if (end < 0) { end += lines.length; }
3345
- end = Math.max(0, Math.min(end, lines.length));
3346
-
3347
- text = lines.slice(start, end).join('\n');
3348
-
3349
- // add data-start for line numbers
3350
- if (!pre.hasAttribute('data-start')) {
3351
- pre.setAttribute('data-start', String(start + 1));
3352
- }
3353
- }
3354
-
3355
- // highlight code
3356
- code.textContent = text;
3357
- Prism.highlightElement(code);
3358
- },
3359
- function (error) {
3360
- // mark as failed
3361
- pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
3362
-
3363
- code.textContent = error;
3364
- }
3365
- );
3366
- }
3367
- });
3368
-
3369
- Prism.plugins.fileHighlight = {
3370
- /**
3371
- * Executes the File Highlight plugin for all matching `pre` elements under the given container.
3372
- *
3373
- * Note: Elements which are already loaded or currently loading will not be touched by this method.
3374
- *
3375
- * @param {ParentNode} [container=document]
3376
- */
3377
- highlight: function highlight(container) {
3378
- var elements = (container || document).querySelectorAll(SELECTOR);
3379
-
3380
- for (var i = 0, element; (element = elements[i++]);) {
3381
- Prism.highlightElement(element);
3382
- }
3383
- }
3384
- };
3385
-
3386
- var logged = false;
3387
- /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
3388
- Prism.fileHighlight = function () {
3389
- if (!logged) {
3390
- console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
3391
- logged = true;
3392
- }
3393
- Prism.plugins.fileHighlight.highlight.apply(this, arguments);
3394
- };
3395
-
3396
- }());
3397
- } (prism));
3398
-
3399
- var prismExports = prism.exports;
3400
- var Prism$1 = /*@__PURE__*/getDefaultExportFromCjs(prismExports);
3401
-
3402
- (function (Prism) {
3403
-
3404
- // Allow only one line break
3405
- var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
3406
-
3407
- /**
3408
- * This function is intended for the creation of the bold or italic pattern.
3409
- *
3410
- * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
3411
- *
3412
- * _Note:_ Keep in mind that this adds a capturing group.
3413
- *
3414
- * @param {string} pattern
3415
- * @returns {RegExp}
3416
- */
3417
- function createInline(pattern) {
3418
- pattern = pattern.replace(/<inner>/g, function () { return inner; });
3419
- return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
3420
- }
3421
-
3422
-
3423
- var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
3424
- var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () { return tableCell; });
3425
- var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
3426
-
3427
-
3428
- Prism.languages.markdown = Prism.languages.extend('markup', {});
3429
- Prism.languages.insertBefore('markdown', 'prolog', {
3430
- 'front-matter-block': {
3431
- pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
3432
- lookbehind: true,
3433
- greedy: true,
3434
- inside: {
3435
- 'punctuation': /^---|---$/,
3436
- 'front-matter': {
3437
- pattern: /\S+(?:\s+\S+)*/,
3438
- alias: ['yaml', 'language-yaml'],
3439
- inside: Prism.languages.yaml
3440
- }
3441
- }
3442
- },
3443
- 'blockquote': {
3444
- // > ...
3445
- pattern: /^>(?:[\t ]*>)*/m,
3446
- alias: 'punctuation'
3447
- },
3448
- 'table': {
3449
- pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
3450
- inside: {
3451
- 'table-data-rows': {
3452
- pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
3453
- lookbehind: true,
3454
- inside: {
3455
- 'table-data': {
3456
- pattern: RegExp(tableCell),
3457
- inside: Prism.languages.markdown
3458
- },
3459
- 'punctuation': /\|/
3460
- }
3461
- },
3462
- 'table-line': {
3463
- pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
3464
- lookbehind: true,
3465
- inside: {
3466
- 'punctuation': /\||:?-{3,}:?/
3467
- }
3468
- },
3469
- 'table-header-row': {
3470
- pattern: RegExp('^' + tableRow + '$'),
3471
- inside: {
3472
- 'table-header': {
3473
- pattern: RegExp(tableCell),
3474
- alias: 'important',
3475
- inside: Prism.languages.markdown
3476
- },
3477
- 'punctuation': /\|/
3478
- }
3479
- }
3480
- }
3481
- },
3482
- 'code': [
3483
- {
3484
- // Prefixed by 4 spaces or 1 tab and preceded by an empty line
3485
- pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
3486
- lookbehind: true,
3487
- alias: 'keyword'
3488
- },
3489
- {
3490
- // ```optional language
3491
- // code block
3492
- // ```
3493
- pattern: /^```[\s\S]*?^```$/m,
3494
- greedy: true,
3495
- inside: {
3496
- 'code-block': {
3497
- pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
3498
- lookbehind: true
3499
- },
3500
- 'code-language': {
3501
- pattern: /^(```).+/,
3502
- lookbehind: true
3503
- },
3504
- 'punctuation': /```/
3505
- }
3506
- }
3507
- ],
3508
- 'title': [
3509
- {
3510
- // title 1
3511
- // =======
3512
-
3513
- // title 2
3514
- // -------
3515
- pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
3516
- alias: 'important',
3517
- inside: {
3518
- punctuation: /==+$|--+$/
3519
- }
3520
- },
3521
- {
3522
- // # title 1
3523
- // ###### title 6
3524
- pattern: /(^\s*)#.+/m,
3525
- lookbehind: true,
3526
- alias: 'important',
3527
- inside: {
3528
- punctuation: /^#+|#+$/
3529
- }
3530
- }
3531
- ],
3532
- 'hr': {
3533
- // ***
3534
- // ---
3535
- // * * *
3536
- // -----------
3537
- pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
3538
- lookbehind: true,
3539
- alias: 'punctuation'
3540
- },
3541
- 'list': {
3542
- // * item
3543
- // + item
3544
- // - item
3545
- // 1. item
3546
- pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
3547
- lookbehind: true,
3548
- alias: 'punctuation'
3549
- },
3550
- 'url-reference': {
3551
- // [id]: http://example.com "Optional title"
3552
- // [id]: http://example.com 'Optional title'
3553
- // [id]: http://example.com (Optional title)
3554
- // [id]: <http://example.com> "Optional title"
3555
- pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
3556
- inside: {
3557
- 'variable': {
3558
- pattern: /^(!?\[)[^\]]+/,
3559
- lookbehind: true
3560
- },
3561
- 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
3562
- 'punctuation': /^[\[\]!:]|[<>]/
3563
- },
3564
- alias: 'url'
3565
- },
3566
- 'bold': {
3567
- // **strong**
3568
- // __strong__
3569
-
3570
- // allow one nested instance of italic text using the same delimiter
3571
- pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
3572
- lookbehind: true,
3573
- greedy: true,
3574
- inside: {
3575
- 'content': {
3576
- pattern: /(^..)[\s\S]+(?=..$)/,
3577
- lookbehind: true,
3578
- inside: {} // see below
3579
- },
3580
- 'punctuation': /\*\*|__/
3581
- }
3582
- },
3583
- 'italic': {
3584
- // *em*
3585
- // _em_
3586
-
3587
- // allow one nested instance of bold text using the same delimiter
3588
- pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
3589
- lookbehind: true,
3590
- greedy: true,
3591
- inside: {
3592
- 'content': {
3593
- pattern: /(^.)[\s\S]+(?=.$)/,
3594
- lookbehind: true,
3595
- inside: {} // see below
3596
- },
3597
- 'punctuation': /[*_]/
3598
- }
3599
- },
3600
- 'strike': {
3601
- // ~~strike through~~
3602
- // ~strike~
3603
- // eslint-disable-next-line regexp/strict
3604
- pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
3605
- lookbehind: true,
3606
- greedy: true,
3607
- inside: {
3608
- 'content': {
3609
- pattern: /(^~~?)[\s\S]+(?=\1$)/,
3610
- lookbehind: true,
3611
- inside: {} // see below
3612
- },
3613
- 'punctuation': /~~?/
3614
- }
3615
- },
3616
- 'code-snippet': {
3617
- // `code`
3618
- // ``code``
3619
- pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
3620
- lookbehind: true,
3621
- greedy: true,
3622
- alias: ['code', 'keyword']
3623
- },
3624
- 'url': {
3625
- // [example](http://example.com "Optional title")
3626
- // [example][id]
3627
- // [example] [id]
3628
- pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
3629
- lookbehind: true,
3630
- greedy: true,
3631
- inside: {
3632
- 'operator': /^!/,
3633
- 'content': {
3634
- pattern: /(^\[)[^\]]+(?=\])/,
3635
- lookbehind: true,
3636
- inside: {} // see below
3637
- },
3638
- 'variable': {
3639
- pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
3640
- lookbehind: true
3641
- },
3642
- 'url': {
3643
- pattern: /(^\]\()[^\s)]+/,
3644
- lookbehind: true
3645
- },
3646
- 'string': {
3647
- pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
3648
- lookbehind: true
3649
- }
3650
- }
3651
- }
3652
- });
3653
-
3654
- ['url', 'bold', 'italic', 'strike'].forEach(function (token) {
3655
- ['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (inside) {
3656
- if (token !== inside) {
3657
- Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
3658
- }
3659
- });
3660
- });
3661
-
3662
- Prism.hooks.add('after-tokenize', function (env) {
3663
- if (env.language !== 'markdown' && env.language !== 'md') {
3664
- return;
3665
- }
3666
-
3667
- function walkTokens(tokens) {
3668
- if (!tokens || typeof tokens === 'string') {
3669
- return;
3670
- }
3671
-
3672
- for (var i = 0, l = tokens.length; i < l; i++) {
3673
- var token = tokens[i];
3674
-
3675
- if (token.type !== 'code') {
3676
- walkTokens(token.content);
3677
- continue;
3678
- }
3679
-
3680
- /*
3681
- * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
3682
- * is optional. But the grammar is defined so that there is only one case we have to handle:
3683
- *
3684
- * token.content = [
3685
- * <span class="punctuation">```</span>,
3686
- * <span class="code-language">xxxx</span>,
3687
- * '\n', // exactly one new lines (\r or \n or \r\n)
3688
- * <span class="code-block">...</span>,
3689
- * '\n', // exactly one new lines again
3690
- * <span class="punctuation">```</span>
3691
- * ];
3692
- */
3693
-
3694
- var codeLang = token.content[1];
3695
- var codeBlock = token.content[3];
3696
-
3697
- if (codeLang && codeBlock &&
3698
- codeLang.type === 'code-language' && codeBlock.type === 'code-block' &&
3699
- typeof codeLang.content === 'string') {
3700
-
3701
- // this might be a language that Prism does not support
3702
-
3703
- // do some replacements to support C++, C#, and F#
3704
- var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp');
3705
- // only use the first word
3706
- lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
3707
- var alias = 'language-' + lang;
3708
-
3709
- // add alias
3710
- if (!codeBlock.alias) {
3711
- codeBlock.alias = [alias];
3712
- } else if (typeof codeBlock.alias === 'string') {
3713
- codeBlock.alias = [codeBlock.alias, alias];
3714
- } else {
3715
- codeBlock.alias.push(alias);
3716
- }
3717
- }
3718
- }
3719
- }
3720
-
3721
- walkTokens(env.tokens);
3722
- });
3723
-
3724
- Prism.hooks.add('wrap', function (env) {
3725
- if (env.type !== 'code-block') {
3726
- return;
3727
- }
3728
-
3729
- var codeLang = '';
3730
- for (var i = 0, l = env.classes.length; i < l; i++) {
3731
- var cls = env.classes[i];
3732
- var match = /language-(.+)/.exec(cls);
3733
- if (match) {
3734
- codeLang = match[1];
3735
- break;
3736
- }
3737
- }
3738
-
3739
- var grammar = Prism.languages[codeLang];
3740
-
3741
- if (!grammar) {
3742
- if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
3743
- var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
3744
- env.attributes['id'] = id;
3745
-
3746
- Prism.plugins.autoloader.loadLanguages(codeLang, function () {
3747
- var ele = document.getElementById(id);
3748
- if (ele) {
3749
- ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
3750
- }
3751
- });
3752
- }
3753
- } else {
3754
- env.content = Prism.highlight(textContent(env.content), grammar, codeLang);
3755
- }
3756
- });
3757
-
3758
- var tagPattern = RegExp(Prism.languages.markup.tag.pattern.source, 'gi');
3759
-
3760
- /**
3761
- * A list of known entity names.
3762
- *
3763
- * This will always be incomplete to save space. The current list is the one used by lowdash's unescape function.
3764
- *
3765
- * @see {@link https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/unescape.js#L2}
3766
- */
3767
- var KNOWN_ENTITY_NAMES = {
3768
- 'amp': '&',
3769
- 'lt': '<',
3770
- 'gt': '>',
3771
- 'quot': '"',
3772
- };
3773
-
3774
- // IE 11 doesn't support `String.fromCodePoint`
3775
- var fromCodePoint = String.fromCodePoint || String.fromCharCode;
3776
-
3777
- /**
3778
- * Returns the text content of a given HTML source code string.
3779
- *
3780
- * @param {string} html
3781
- * @returns {string}
3782
- */
3783
- function textContent(html) {
3784
- // remove all tags
3785
- var text = html.replace(tagPattern, '');
3786
-
3787
- // decode known entities
3788
- text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function (m, code) {
3789
- code = code.toLowerCase();
3790
-
3791
- if (code[0] === '#') {
3792
- var value;
3793
- if (code[1] === 'x') {
3794
- value = parseInt(code.slice(2), 16);
3795
- } else {
3796
- value = Number(code.slice(1));
3797
- }
3798
-
3799
- return fromCodePoint(value);
3800
- } else {
3801
- var known = KNOWN_ENTITY_NAMES[code];
3802
- if (known) {
3803
- return known;
3804
- }
3805
-
3806
- // unable to decode
3807
- return m;
3808
- }
3809
- });
3810
-
3811
- return text;
3812
- }
3813
-
3814
- Prism.languages.md = Prism.languages.markdown;
3815
-
3816
- }(Prism));
3817
-
3818
- (function () {
3819
-
3820
- if (typeof Prism === 'undefined' || typeof document === 'undefined') {
3821
- return;
3822
- }
3823
-
3824
- /**
3825
- * Plugin name which is used as a class name for <pre> which is activating the plugin
3826
- *
3827
- * @type {string}
3828
- */
3829
- var PLUGIN_NAME = 'line-numbers';
3830
-
3831
- /**
3832
- * Regular expression used for determining line breaks
3833
- *
3834
- * @type {RegExp}
3835
- */
3836
- var NEW_LINE_EXP = /\n(?!$)/g;
3837
-
3838
-
3839
- /**
3840
- * Global exports
3841
- */
3842
- var config = Prism.plugins.lineNumbers = {
3843
- /**
3844
- * Get node for provided line number
3845
- *
3846
- * @param {Element} element pre element
3847
- * @param {number} number line number
3848
- * @returns {Element|undefined}
3849
- */
3850
- getLine: function (element, number) {
3851
- if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
3852
- return;
3853
- }
3854
-
3855
- var lineNumberRows = element.querySelector('.line-numbers-rows');
3856
- if (!lineNumberRows) {
3857
- return;
3858
- }
3859
- var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
3860
- var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
3861
-
3862
- if (number < lineNumberStart) {
3863
- number = lineNumberStart;
3864
- }
3865
- if (number > lineNumberEnd) {
3866
- number = lineNumberEnd;
3867
- }
3868
-
3869
- var lineIndex = number - lineNumberStart;
3870
-
3871
- return lineNumberRows.children[lineIndex];
3872
- },
3873
-
3874
- /**
3875
- * Resizes the line numbers of the given element.
3876
- *
3877
- * This function will not add line numbers. It will only resize existing ones.
3878
- *
3879
- * @param {HTMLElement} element A `<pre>` element with line numbers.
3880
- * @returns {void}
3881
- */
3882
- resize: function (element) {
3883
- resizeElements([element]);
3884
- },
3885
-
3886
- /**
3887
- * Whether the plugin can assume that the units font sizes and margins are not depended on the size of
3888
- * the current viewport.
3889
- *
3890
- * Setting this to `true` will allow the plugin to do certain optimizations for better performance.
3891
- *
3892
- * Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
3893
- *
3894
- * @type {boolean}
3895
- */
3896
- assumeViewportIndependence: true
3897
- };
3898
-
3899
- /**
3900
- * Resizes the given elements.
3901
- *
3902
- * @param {HTMLElement[]} elements
3903
- */
3904
- function resizeElements(elements) {
3905
- elements = elements.filter(function (e) {
3906
- var codeStyles = getStyles(e);
3907
- var whiteSpace = codeStyles['white-space'];
3908
- return whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line';
3909
- });
3910
-
3911
- if (elements.length == 0) {
3912
- return;
3913
- }
3914
-
3915
- var infos = elements.map(function (element) {
3916
- var codeElement = element.querySelector('code');
3917
- var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
3918
- if (!codeElement || !lineNumbersWrapper) {
3919
- return undefined;
3920
- }
3921
-
3922
- /** @type {HTMLElement} */
3923
- var lineNumberSizer = element.querySelector('.line-numbers-sizer');
3924
- var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
3925
-
3926
- if (!lineNumberSizer) {
3927
- lineNumberSizer = document.createElement('span');
3928
- lineNumberSizer.className = 'line-numbers-sizer';
3929
-
3930
- codeElement.appendChild(lineNumberSizer);
3931
- }
3932
-
3933
- lineNumberSizer.innerHTML = '0';
3934
- lineNumberSizer.style.display = 'block';
3935
-
3936
- var oneLinerHeight = lineNumberSizer.getBoundingClientRect().height;
3937
- lineNumberSizer.innerHTML = '';
3938
-
3939
- return {
3940
- element: element,
3941
- lines: codeLines,
3942
- lineHeights: [],
3943
- oneLinerHeight: oneLinerHeight,
3944
- sizer: lineNumberSizer,
3945
- };
3946
- }).filter(Boolean);
3947
-
3948
- infos.forEach(function (info) {
3949
- var lineNumberSizer = info.sizer;
3950
- var lines = info.lines;
3951
- var lineHeights = info.lineHeights;
3952
- var oneLinerHeight = info.oneLinerHeight;
3953
-
3954
- lineHeights[lines.length - 1] = undefined;
3955
- lines.forEach(function (line, index) {
3956
- if (line && line.length > 1) {
3957
- var e = lineNumberSizer.appendChild(document.createElement('span'));
3958
- e.style.display = 'block';
3959
- e.textContent = line;
3960
- } else {
3961
- lineHeights[index] = oneLinerHeight;
3962
- }
3963
- });
3964
- });
3965
-
3966
- infos.forEach(function (info) {
3967
- var lineNumberSizer = info.sizer;
3968
- var lineHeights = info.lineHeights;
3969
-
3970
- var childIndex = 0;
3971
- for (var i = 0; i < lineHeights.length; i++) {
3972
- if (lineHeights[i] === undefined) {
3973
- lineHeights[i] = lineNumberSizer.children[childIndex++].getBoundingClientRect().height;
3974
- }
3975
- }
3976
- });
3977
-
3978
- infos.forEach(function (info) {
3979
- var lineNumberSizer = info.sizer;
3980
- var wrapper = info.element.querySelector('.line-numbers-rows');
3981
-
3982
- lineNumberSizer.style.display = 'none';
3983
- lineNumberSizer.innerHTML = '';
3984
-
3985
- info.lineHeights.forEach(function (height, lineNumber) {
3986
- wrapper.children[lineNumber].style.height = height + 'px';
3987
- });
3988
- });
3989
- }
3990
-
3991
- /**
3992
- * Returns style declarations for the element
3993
- *
3994
- * @param {Element} element
3995
- */
3996
- function getStyles(element) {
3997
- if (!element) {
3998
- return null;
3999
- }
4000
-
4001
- return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
4002
- }
4003
-
4004
- var lastWidth = undefined;
4005
- window.addEventListener('resize', function () {
4006
- if (config.assumeViewportIndependence && lastWidth === window.innerWidth) {
4007
- return;
4008
- }
4009
- lastWidth = window.innerWidth;
4010
-
4011
- resizeElements(Array.prototype.slice.call(document.querySelectorAll('pre.' + PLUGIN_NAME)));
4012
- });
4013
-
4014
- Prism.hooks.add('complete', function (env) {
4015
- if (!env.code) {
4016
- return;
4017
- }
4018
-
4019
- var code = /** @type {Element} */ (env.element);
4020
- var pre = /** @type {HTMLElement} */ (code.parentNode);
4021
-
4022
- // works only for <code> wrapped inside <pre> (not inline)
4023
- if (!pre || !/pre/i.test(pre.nodeName)) {
4024
- return;
4025
- }
4026
-
4027
- // Abort if line numbers already exists
4028
- if (code.querySelector('.line-numbers-rows')) {
4029
- return;
4030
- }
4031
-
4032
- // only add line numbers if <code> or one of its ancestors has the `line-numbers` class
4033
- if (!Prism.util.isActive(code, PLUGIN_NAME)) {
4034
- return;
4035
- }
4036
-
4037
- // Remove the class 'line-numbers' from the <code>
4038
- code.classList.remove(PLUGIN_NAME);
4039
- // Add the class 'line-numbers' to the <pre>
4040
- pre.classList.add(PLUGIN_NAME);
4041
-
4042
- var match = env.code.match(NEW_LINE_EXP);
4043
- var linesNum = match ? match.length + 1 : 1;
4044
- var lineNumbersWrapper;
4045
-
4046
- var lines = new Array(linesNum + 1).join('<span></span>');
4047
-
4048
- lineNumbersWrapper = document.createElement('span');
4049
- lineNumbersWrapper.setAttribute('aria-hidden', 'true');
4050
- lineNumbersWrapper.className = 'line-numbers-rows';
4051
- lineNumbersWrapper.innerHTML = lines;
4052
-
4053
- if (pre.hasAttribute('data-start')) {
4054
- pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
4055
- }
4056
-
4057
- env.element.appendChild(lineNumbersWrapper);
4058
-
4059
- resizeElements([pre]);
4060
-
4061
- Prism.hooks.run('line-numbers', env);
4062
- });
4063
-
4064
- Prism.hooks.add('line-numbers', function (env) {
4065
- env.plugins = env.plugins || {};
4066
- env.plugins.lineNumbers = true;
4067
- });
4068
-
4069
- }());
4070
-
4071
- /**
4072
- * @fileoverview Utilities for formatting and generating markdown tables with support
4073
- * for cell formatting, alignment, and width calculations.
4074
- */
4075
- var CellFormatter = /** @class */ (function () {
4076
- function CellFormatter(config) {
4077
- this.config = config;
4078
- this.padding = this.config.useTabs
4079
- ? "\t"
4080
- : this.config.hasPadding
4081
- ? " "
4082
- : "";
4083
- }
4084
- CellFormatter.prototype.formatCellContent = function (cell) {
4085
- var content = cell.content;
4086
- if (cell.code) {
4087
- content = "`".concat(content, "`");
4088
- }
4089
- if (cell.bold) {
4090
- content = "**".concat(content, "**");
4091
- }
4092
- if (cell.italic) {
4093
- content = "*".concat(content, "*");
4094
- }
4095
- if (cell.link) {
4096
- content = "[".concat(content, "](").concat(cell.link, ")");
4097
- }
4098
- return content;
4099
- };
4100
- CellFormatter.prototype.formatCell = function (cell, width) {
4101
- var content = this.formatCellContent(cell);
4102
- var alignment = cell.alignment || "inherit";
4103
- var effectiveAlignment = alignment === "inherit" ? "none" : alignment;
4104
- var paddedContent = "".concat(this.padding).concat(content).concat(this.padding);
4105
- var spacesToAdd = width - content.length;
4106
- if (spacesToAdd <= 0)
4107
- return paddedContent;
4108
- switch (effectiveAlignment) {
4109
- case "right":
4110
- return " ".repeat(spacesToAdd) + paddedContent;
4111
- case "center": {
4112
- var leftPad = Math.floor(spacesToAdd / 2);
4113
- var rightPad = spacesToAdd - leftPad;
4114
- return " ".repeat(leftPad) + paddedContent + " ".repeat(rightPad);
4115
- }
4116
- case "justify":
4117
- case "left":
4118
- case "none":
4119
- default:
4120
- return paddedContent + " ".repeat(spacesToAdd);
4121
- }
4122
- };
4123
- return CellFormatter;
4124
- }());
4125
- var AlignmentFormatter = /** @class */ (function () {
4126
- function AlignmentFormatter() {
4127
- }
4128
- AlignmentFormatter.formatIndicator = function (alignment, width) {
4129
- return this.indicators[alignment](width);
4130
- };
4131
- AlignmentFormatter.indicators = {
4132
- left: function (width) { return ":".concat("-".repeat(width - 1)); },
4133
- right: function (width) { return "".concat("-".repeat(width - 1), ":"); },
4134
- center: function (width) { return ":".concat("-".repeat(width - 2), ":"); },
4135
- none: function (width) { return "-".repeat(width); },
4136
- justify: function (width) { return "-".repeat(width); },
4137
- };
4138
- return AlignmentFormatter;
4139
- }());
4140
- var TableFormatter = /** @class */ (function () {
4141
- function TableFormatter(config) {
4142
- this.config = config;
4143
- this.cellFormatter = new CellFormatter(config);
4144
- this.adjustedAlignments = this.getAdjustedAlignments();
4145
- }
4146
- TableFormatter.prototype.getAdjustedAlignments = function () {
4147
- var defaultAlignment = "none";
4148
- var sanitizeAlignment = function (alignment) {
4149
- return alignment === "justify" ? "none" : alignment;
4150
- };
4151
- return this.config.columnAlignments.length < this.config.columnCount
4152
- ? __spreadArray(__spreadArray([], Array.from(this.config.columnAlignments).map(sanitizeAlignment), true), Array(this.config.columnCount - this.config.columnAlignments.length).fill(defaultAlignment), true) : Array.from(this.config.columnAlignments).map(sanitizeAlignment);
4153
- };
4154
- TableFormatter.prototype.formatRow = function (row) {
4155
- var _this = this;
4156
- var formattedCells = Array.from({ length: this.config.columnCount }, function (_, i) {
4157
- var _a, _b, _c;
4158
- var cell = (_a = row[i]) !== null && _a !== void 0 ? _a : { content: "" };
4159
- var width = (_c = (_b = _this.config.columnWidths) === null || _b === void 0 ? void 0 : _b[i]) !== null && _c !== void 0 ? _c : cell.content.length;
4160
- return _this.cellFormatter.formatCell(cell, width);
4161
- });
4162
- return "|".concat(formattedCells.join("|"), "|");
4163
- };
4164
- TableFormatter.prototype.formatAlignmentRow = function () {
4165
- var _this = this;
4166
- var padding = this.config.useTabs
4167
- ? "\t"
4168
- : this.config.hasPadding
4169
- ? " "
4170
- : "";
4171
- var formattedColumns = Array.from({ length: this.config.columnCount }, function (_, i) {
4172
- var _a, _b;
4173
- var alignment = _this.adjustedAlignments[i];
4174
- var width = (_b = (_a = _this.config.columnWidths) === null || _a === void 0 ? void 0 : _a[i]) !== null && _b !== void 0 ? _b : 3;
4175
- var indicator = AlignmentFormatter.formatIndicator(alignment, width);
4176
- return "".concat(padding).concat(indicator).concat(padding);
4177
- });
4178
- return "|".concat(formattedColumns.join("|"), "|");
4179
- };
4180
- return TableFormatter;
4181
- }());
4182
- function calculateColumnWidths(tableRows, maxColumnCount, config) {
4183
- var widths = new Array(maxColumnCount).fill(3);
4184
- var cellFormatter = new CellFormatter(config);
4185
- tableRows.forEach(function (row) {
4186
- for (var i = 0; i < maxColumnCount; i++) {
4187
- var cell = row[i];
4188
- if (cell) {
4189
- var formattedContent = cellFormatter["formatCellContent"](cell);
4190
- widths[i] = Math.max(widths[i], formattedContent.length);
4191
- }
4192
- }
4193
- });
4194
- return widths;
4195
- }
4196
- function generateMarkdownTableString(inputData, columnAlignments, canAdjustColumnWidths, useTabs, replaceNewlines, hasPadding) {
4197
- if (canAdjustColumnWidths === void 0) { canAdjustColumnWidths = true; }
4198
- if (useTabs === void 0) { useTabs = false; }
4199
- if (replaceNewlines === void 0) { replaceNewlines = false; }
4200
- if (hasPadding === void 0) { hasPadding = true; }
4201
- var maxColumnCount = Math.max.apply(Math, __spreadArray([inputData.inputDataHeader.length], inputData.inputDataBody.map(function (row) { return row.length; }), false));
4202
- var config = {
4203
- columnCount: maxColumnCount,
4204
- columnAlignments: columnAlignments,
4205
- columnWidths: canAdjustColumnWidths
4206
- ? calculateColumnWidths(__spreadArray([inputData.inputDataHeader], inputData.inputDataBody, true), maxColumnCount, {
4207
- columnCount: maxColumnCount,
4208
- columnAlignments: columnAlignments,
4209
- useTabs: useTabs,
4210
- replaceNewlines: replaceNewlines,
4211
- hasPadding: hasPadding,
4212
- })
4213
- : undefined,
4214
- useTabs: useTabs,
4215
- replaceNewlines: replaceNewlines,
4216
- hasPadding: hasPadding,
4217
- };
4218
- var tableFormatter = new TableFormatter(config);
4219
- var headerRow = tableFormatter.formatRow(inputData.inputDataHeader);
4220
- var alignmentRow = tableFormatter.formatAlignmentRow();
4221
- var bodyRows = inputData.inputDataBody
4222
- .map(function (row) { return tableFormatter.formatRow(row); })
4223
- .join("\n");
4224
- return "".concat(headerRow, "\n").concat(alignmentRow, "\n").concat(bodyRows).trimEnd();
4225
- }
4226
- function getColumnName(index) {
4227
- var columnName = "";
4228
- var currentIndex = index;
4229
- while (currentIndex >= 0) {
4230
- columnName = String.fromCharCode((currentIndex % 26) + 65) + columnName;
4231
- currentIndex = Math.floor(currentIndex / 26) - 1;
4232
- }
4233
- return columnName;
4234
- }
4235
- function generateAlphabetHeaders(columnCount) {
4236
- return Array.from({ length: columnCount }, function (_, i) { return getColumnName(i); });
4237
- }
4238
-
4239
- // src/validation.ts
4240
- /**
4241
- * Custom error class for handling Markdown table generation errors.
4242
- */
4243
- var MarkdownTableError = /** @class */ (function (_super) {
4244
- __extends(MarkdownTableError, _super);
4245
- function MarkdownTableError(message) {
4246
- var _this = _super.call(this, message) || this;
4247
- _this.name = "MarkdownTableError";
4248
- Object.setPrototypeOf(_this, MarkdownTableError.prototype);
4249
- return _this;
4250
- }
4251
- return MarkdownTableError;
4252
- }(Error));
4253
- /**
4254
- * Validates that the input data is a non-empty two-dimensional array.
4255
- * @param inputData - The data to validate
4256
- * @throws {MarkdownTableError} If validation fails
4257
- */
4258
- function validateInputData(inputData) {
4259
- if (inputData === null || !Array.isArray(inputData)) {
4260
- throw new MarkdownTableError("The 'data' prop must be a two-dimensional array.");
4261
- }
4262
- if (inputData.length === 0) {
4263
- throw new MarkdownTableError("The 'data' array must contain at least one row.");
4264
- }
4265
- }
4266
-
4267
- // CSS styles
4268
- var LIGHT_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
4269
- var DARK_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
4270
- var getTableData = function (inputData, hasHeader) {
4271
- return hasHeader
4272
- ? { inputDataHeader: inputData[0], inputDataBody: inputData.slice(1) }
4273
- : {
4274
- inputDataHeader: generateAlphabetHeaders(inputData[0].length).map(function (header) { return ({ content: header }); }),
4275
- inputDataBody: inputData,
4276
- };
4277
- };
4278
- var generateTableSyntax = function (inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding) {
4279
- try {
4280
- validateInputData(inputData);
4281
- var _a = getTableData(inputData, hasHeader), inputDataHeader = _a.inputDataHeader, inputDataBody = _a.inputDataBody;
4282
- return generateMarkdownTableString({ inputDataHeader: inputDataHeader, inputDataBody: inputDataBody }, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding);
4283
- }
4284
- catch (error) {
4285
- if (error instanceof MarkdownTableError) {
4286
- return "Error: ".concat(error.message);
4287
- }
4288
- throw error;
4289
- }
4290
- };
4291
- var applySyntaxHighlighting = function (preElementRef, markdownTableSyntax) {
4292
- require$$0.useEffect(function () {
4293
- var _a;
4294
- var codeElement = (_a = preElementRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('code');
4295
- if (codeElement && markdownTableSyntax) {
4296
- requestAnimationFrame(function () {
4297
- Prism$1.highlightElement(codeElement);
4298
- });
4299
- }
4300
- }, [markdownTableSyntax]);
4301
- };
4302
- var MarkdownTable = function (_a) {
4303
- var _b = _a.inputData, inputData = _b === void 0 ? null : _b, _c = _a.hasHeader, hasHeader = _c === void 0 ? true : _c, _d = _a.columnAlignments, columnAlignments = _d === void 0 ? [] : _d, _e = _a.isCompact, isCompact = _e === void 0 ? false : _e, _f = _a.hasTabs, hasTabs = _f === void 0 ? false : _f, _g = _a.hasPadding, hasPadding = _g === void 0 ? true : _g, _h = _a.convertLineBreaks, convertLineBreaks = _h === void 0 ? false : _h, className = _a.className, onGenerate = _a.onGenerate, _j = _a.theme, theme = _j === void 0 ? 'light' : _j, preStyle = _a.preStyle, _k = _a.topPadding, topPadding = _k === void 0 ? 16 : _k, minWidth = _a.minWidth;
4304
- var adjustColumnWidths = !isCompact;
4305
- var preElementRef = require$$0.useRef(null);
4306
- var markdownTableSyntax = require$$0.useMemo(function () {
4307
- return generateTableSyntax(inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, convertLineBreaks, hasPadding);
4308
- }, [
4309
- inputData,
4310
- hasHeader,
4311
- columnAlignments,
4312
- isCompact,
4313
- hasTabs,
4314
- convertLineBreaks,
4315
- hasPadding,
4316
- ]);
4317
- require$$0.useEffect(function () {
4318
- if (onGenerate) {
4319
- onGenerate(markdownTableSyntax);
4320
- }
4321
- }, [markdownTableSyntax, onGenerate]);
4322
- applySyntaxHighlighting(preElementRef, markdownTableSyntax);
4323
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("style", { children: [theme === 'light' ? LIGHT_THEME_CSS : DARK_THEME_CSS, "\n pre {\n position: relative;\n padding-top: ".concat(topPadding, "px !important;\n }\n pre::before {\n position: absolute;\n top: 8px;\n left: 12px;\n color: ").concat(theme === 'light' ? '#666' : '#999', ";\n letter-spacing: 2px;\n font-size: 12px;\n }\n ")] }), jsxRuntimeExports.jsx("div", { id: "MarkdownTable", style: {
4324
- position: 'relative',
4325
- isolation: 'isolate',
4326
- display: 'inline-block',
4327
- }, children: jsxRuntimeExports.jsx("pre", { ref: preElementRef, className: "".concat(className, " language-markdown line-numbers ").concat(theme === 'dark' ? 'dark-theme' : ''), style: __assign({ width: 'fit-content', minWidth: minWidth ? "".concat(minWidth, "px") : 'min-content', margin: 0 }, preStyle), children: jsxRuntimeExports.jsx("code", { className: "language-markdown", role: "code", children: markdownTableSyntax }) }) })] }));
4328
- };
4329
-
4330
- exports.MarkdownTable = MarkdownTable;
4331
- //# sourceMappingURL=index.cjs.js.map