sherick-ui 1.0.3 → 1.0.5
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 +51 -3774
- package/dist/index.d.ts +22 -23
- package/dist/index.esm.js +23 -3746
- package/package.json +4 -8
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var React = require('react');
|
|
3
5
|
var clsx = require('clsx');
|
|
4
6
|
var tailwindMerge = require('tailwind-merge');
|
|
5
|
-
var React$1 = require('react');
|
|
6
7
|
var classVarianceAuthority = require('class-variance-authority');
|
|
7
8
|
var lucideReact = require('lucide-react');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
9
|
+
var NextImage = require('next/image');
|
|
10
|
+
var reactDom = require('react-dom');
|
|
10
11
|
var ReactMarkdown = require('react-markdown');
|
|
11
12
|
var remarkGfm = require('remark-gfm');
|
|
12
13
|
var rehypeKatex = require('rehype-katex');
|
|
13
14
|
var remarkMath = require('remark-math');
|
|
14
15
|
var prismReactRenderer = require('prism-react-renderer');
|
|
15
|
-
var Prism
|
|
16
|
+
var Prism = require('prismjs');
|
|
16
17
|
|
|
17
18
|
function _extends() {
|
|
18
19
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -24,40 +25,6 @@ function _extends() {
|
|
|
24
25
|
}, _extends.apply(null, arguments);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
/******************************************************************************
|
|
28
|
-
Copyright (c) Microsoft Corporation.
|
|
29
|
-
|
|
30
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
31
|
-
purpose with or without fee is hereby granted.
|
|
32
|
-
|
|
33
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
34
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
35
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
36
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
37
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */
|
|
41
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function __rest(s, e) {
|
|
45
|
-
var t = {};
|
|
46
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
-
t[p] = s[p];
|
|
48
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
-
t[p[i]] = s[p[i]];
|
|
52
|
-
}
|
|
53
|
-
return t;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
57
|
-
var e = new Error(message);
|
|
58
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
28
|
var cn = function cn() {
|
|
62
29
|
var inputs = [];
|
|
63
30
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -116,11 +83,11 @@ function Spinner(_a) {
|
|
|
116
83
|
show = _a.show,
|
|
117
84
|
children = _a.children,
|
|
118
85
|
className = _a.className;
|
|
119
|
-
return /*#__PURE__*/React
|
|
86
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
120
87
|
className: spinnerVariants({
|
|
121
88
|
show: show
|
|
122
89
|
})
|
|
123
|
-
}, /*#__PURE__*/React
|
|
90
|
+
}, /*#__PURE__*/React.createElement(lucideReact.Loader2, {
|
|
124
91
|
className: cn(loaderVariants({
|
|
125
92
|
size: size
|
|
126
93
|
}), className)
|
|
@@ -136,7 +103,7 @@ var ActionButton = function ActionButton(_a) {
|
|
|
136
103
|
_c = _a.loading,
|
|
137
104
|
loading = _c === void 0 ? false : _c,
|
|
138
105
|
onClick = _a.onClick,
|
|
139
|
-
props = __rest(_a, ["children", "variant", "icon", "className", "loading", "onClick"]);
|
|
106
|
+
props = tslib.__rest(_a, ["children", "variant", "icon", "className", "loading", "onClick"]);
|
|
140
107
|
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
141
108
|
className: cn("px-6 py-4 rounded-4xl bg-opacity-20 hover:bg-opacity-40 transition-all flex items-center justify-center", (styleMap === null || styleMap === void 0 ? void 0 : styleMap[variant]) || styleMap["primary"], loading ? "cursor-not-allowed opacity-60" : "cursor-pointer", className),
|
|
142
109
|
onClick: onClick
|
|
@@ -155,11 +122,11 @@ var Dropdown = function Dropdown(_a) {
|
|
|
155
122
|
onSelect = _a.onSelect,
|
|
156
123
|
selected = _a.selected,
|
|
157
124
|
className = _a.className,
|
|
158
|
-
props = __rest(_a, ["options", "variant", "onSelect", "selected", "className"]);
|
|
159
|
-
var _c = React
|
|
125
|
+
props = tslib.__rest(_a, ["options", "variant", "onSelect", "selected", "className"]);
|
|
126
|
+
var _c = React.useState(false),
|
|
160
127
|
isOpen = _c[0],
|
|
161
128
|
setIsOpen = _c[1];
|
|
162
|
-
React
|
|
129
|
+
React.useEffect(function () {
|
|
163
130
|
// When escape key is pressed, close the dropdown.
|
|
164
131
|
var handleKeyDown = function handleKeyDown(event) {
|
|
165
132
|
if (event.key === "Escape") {
|
|
@@ -216,8 +183,8 @@ var Search = function Search(_a) {
|
|
|
216
183
|
className = _a.className,
|
|
217
184
|
_c = _a.loading,
|
|
218
185
|
loading = _c === void 0 ? false : _c,
|
|
219
|
-
props = __rest(_a, ["onSearch", "variant", "className", "loading"]);
|
|
220
|
-
var inputRef = React
|
|
186
|
+
props = tslib.__rest(_a, ["onSearch", "variant", "className", "loading"]);
|
|
187
|
+
var inputRef = React.useRef(null);
|
|
221
188
|
var debounce = function debounce(func, delay) {
|
|
222
189
|
var timer;
|
|
223
190
|
return function () {
|
|
@@ -264,11 +231,11 @@ var Input = function Input(_a) {
|
|
|
264
231
|
className = _a.className,
|
|
265
232
|
required = _a.required,
|
|
266
233
|
error = _a.error,
|
|
267
|
-
props = __rest(_a, ["placeholder", "label", "onChange", "defaultValue", "className", "required", "error"]);
|
|
268
|
-
var _b = React
|
|
234
|
+
props = tslib.__rest(_a, ["placeholder", "label", "onChange", "defaultValue", "className", "required", "error"]);
|
|
235
|
+
var _b = React.useState(defaultValue || ""),
|
|
269
236
|
value = _b[0],
|
|
270
237
|
setValue = _b[1];
|
|
271
|
-
React
|
|
238
|
+
React.useEffect(function () {
|
|
272
239
|
if (defaultValue) setValue(defaultValue || "");
|
|
273
240
|
}, [defaultValue]);
|
|
274
241
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -288,1622 +255,6 @@ var Input = function Input(_a) {
|
|
|
288
255
|
}));
|
|
289
256
|
};
|
|
290
257
|
|
|
291
|
-
function getDefaultExportFromCjs (x) {
|
|
292
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
var imageExternal = {};
|
|
296
|
-
|
|
297
|
-
var _interop_require_default = {};
|
|
298
|
-
|
|
299
|
-
var hasRequired_interop_require_default;
|
|
300
|
-
|
|
301
|
-
function require_interop_require_default () {
|
|
302
|
-
if (hasRequired_interop_require_default) return _interop_require_default;
|
|
303
|
-
hasRequired_interop_require_default = 1;
|
|
304
|
-
|
|
305
|
-
_interop_require_default._ = _interop_require_default._interop_require_default = _interop_require_default$1;
|
|
306
|
-
function _interop_require_default$1(obj) {
|
|
307
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
308
|
-
}
|
|
309
|
-
return _interop_require_default;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
var getImgProps = {};
|
|
313
|
-
|
|
314
|
-
var warnOnce = {};
|
|
315
|
-
|
|
316
|
-
var hasRequiredWarnOnce;
|
|
317
|
-
|
|
318
|
-
function requireWarnOnce () {
|
|
319
|
-
if (hasRequiredWarnOnce) return warnOnce;
|
|
320
|
-
hasRequiredWarnOnce = 1;
|
|
321
|
-
(function (exports) {
|
|
322
|
-
Object.defineProperty(exports, "__esModule", {
|
|
323
|
-
value: true
|
|
324
|
-
});
|
|
325
|
-
Object.defineProperty(exports, "warnOnce", {
|
|
326
|
-
enumerable: true,
|
|
327
|
-
get: function() {
|
|
328
|
-
return warnOnce;
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
let warnOnce = (_)=>{};
|
|
332
|
-
if (process.env.NODE_ENV !== "production") {
|
|
333
|
-
const warnings = new Set();
|
|
334
|
-
warnOnce = (msg)=>{
|
|
335
|
-
if (!warnings.has(msg)) {
|
|
336
|
-
console.warn(msg);
|
|
337
|
-
}
|
|
338
|
-
warnings.add(msg);
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
} (warnOnce));
|
|
344
|
-
return warnOnce;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
var imageBlurSvg = {};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* A shared function, used on both client and server, to generate a SVG blur placeholder.
|
|
351
|
-
*/
|
|
352
|
-
|
|
353
|
-
var hasRequiredImageBlurSvg;
|
|
354
|
-
|
|
355
|
-
function requireImageBlurSvg () {
|
|
356
|
-
if (hasRequiredImageBlurSvg) return imageBlurSvg;
|
|
357
|
-
hasRequiredImageBlurSvg = 1;
|
|
358
|
-
(function (exports) {
|
|
359
|
-
Object.defineProperty(exports, "__esModule", {
|
|
360
|
-
value: true
|
|
361
|
-
});
|
|
362
|
-
Object.defineProperty(exports, "getImageBlurSvg", {
|
|
363
|
-
enumerable: true,
|
|
364
|
-
get: function() {
|
|
365
|
-
return getImageBlurSvg;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
function getImageBlurSvg(param) {
|
|
369
|
-
let { widthInt, heightInt, blurWidth, blurHeight, blurDataURL, objectFit } = param;
|
|
370
|
-
const std = 20;
|
|
371
|
-
const svgWidth = blurWidth ? blurWidth * 40 : widthInt;
|
|
372
|
-
const svgHeight = blurHeight ? blurHeight * 40 : heightInt;
|
|
373
|
-
const viewBox = svgWidth && svgHeight ? "viewBox='0 0 " + svgWidth + " " + svgHeight + "'" : "";
|
|
374
|
-
const preserveAspectRatio = viewBox ? "none" : objectFit === "contain" ? "xMidYMid" : objectFit === "cover" ? "xMidYMid slice" : "none";
|
|
375
|
-
return "%3Csvg xmlns='http://www.w3.org/2000/svg' " + viewBox + "%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='" + std + "'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='" + std + "'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='" + preserveAspectRatio + "' style='filter: url(%23b);' href='" + blurDataURL + "'/%3E%3C/svg%3E";
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
} (imageBlurSvg));
|
|
380
|
-
return imageBlurSvg;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
var imageConfig = {};
|
|
384
|
-
|
|
385
|
-
var hasRequiredImageConfig;
|
|
386
|
-
|
|
387
|
-
function requireImageConfig () {
|
|
388
|
-
if (hasRequiredImageConfig) return imageConfig;
|
|
389
|
-
hasRequiredImageConfig = 1;
|
|
390
|
-
(function (exports) {
|
|
391
|
-
Object.defineProperty(exports, "__esModule", {
|
|
392
|
-
value: true
|
|
393
|
-
});
|
|
394
|
-
function _export(target, all) {
|
|
395
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
396
|
-
enumerable: true,
|
|
397
|
-
get: all[name]
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
_export(exports, {
|
|
401
|
-
VALID_LOADERS: function() {
|
|
402
|
-
return VALID_LOADERS;
|
|
403
|
-
},
|
|
404
|
-
imageConfigDefault: function() {
|
|
405
|
-
return imageConfigDefault;
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
const VALID_LOADERS = [
|
|
409
|
-
"default",
|
|
410
|
-
"imgix",
|
|
411
|
-
"cloudinary",
|
|
412
|
-
"akamai",
|
|
413
|
-
"custom"
|
|
414
|
-
];
|
|
415
|
-
const imageConfigDefault = {
|
|
416
|
-
deviceSizes: [
|
|
417
|
-
640,
|
|
418
|
-
750,
|
|
419
|
-
828,
|
|
420
|
-
1080,
|
|
421
|
-
1200,
|
|
422
|
-
1920,
|
|
423
|
-
2048,
|
|
424
|
-
3840
|
|
425
|
-
],
|
|
426
|
-
imageSizes: [
|
|
427
|
-
16,
|
|
428
|
-
32,
|
|
429
|
-
48,
|
|
430
|
-
64,
|
|
431
|
-
96,
|
|
432
|
-
128,
|
|
433
|
-
256,
|
|
434
|
-
384
|
|
435
|
-
],
|
|
436
|
-
path: "/_next/image",
|
|
437
|
-
loader: "default",
|
|
438
|
-
loaderFile: "",
|
|
439
|
-
domains: [],
|
|
440
|
-
disableStaticImages: false,
|
|
441
|
-
minimumCacheTTL: 60,
|
|
442
|
-
formats: [
|
|
443
|
-
"image/webp"
|
|
444
|
-
],
|
|
445
|
-
dangerouslyAllowSVG: false,
|
|
446
|
-
contentSecurityPolicy: "script-src 'none'; frame-src 'none'; sandbox;",
|
|
447
|
-
contentDispositionType: "inline",
|
|
448
|
-
remotePatterns: [],
|
|
449
|
-
unoptimized: false
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
} (imageConfig));
|
|
454
|
-
return imageConfig;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
var hasRequiredGetImgProps;
|
|
458
|
-
|
|
459
|
-
function requireGetImgProps () {
|
|
460
|
-
if (hasRequiredGetImgProps) return getImgProps;
|
|
461
|
-
hasRequiredGetImgProps = 1;
|
|
462
|
-
(function (exports) {
|
|
463
|
-
Object.defineProperty(exports, "__esModule", {
|
|
464
|
-
value: true
|
|
465
|
-
});
|
|
466
|
-
Object.defineProperty(exports, "getImgProps", {
|
|
467
|
-
enumerable: true,
|
|
468
|
-
get: function() {
|
|
469
|
-
return getImgProps;
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
const _warnonce = requireWarnOnce();
|
|
473
|
-
const _imageblursvg = requireImageBlurSvg();
|
|
474
|
-
const _imageconfig = requireImageConfig();
|
|
475
|
-
const VALID_LOADING_VALUES = [
|
|
476
|
-
"lazy",
|
|
477
|
-
"eager",
|
|
478
|
-
undefined
|
|
479
|
-
];
|
|
480
|
-
function isStaticRequire(src) {
|
|
481
|
-
return src.default !== undefined;
|
|
482
|
-
}
|
|
483
|
-
function isStaticImageData(src) {
|
|
484
|
-
return src.src !== undefined;
|
|
485
|
-
}
|
|
486
|
-
function isStaticImport(src) {
|
|
487
|
-
return typeof src === "object" && (isStaticRequire(src) || isStaticImageData(src));
|
|
488
|
-
}
|
|
489
|
-
const allImgs = new Map();
|
|
490
|
-
let perfObserver;
|
|
491
|
-
function getInt(x) {
|
|
492
|
-
if (typeof x === "undefined") {
|
|
493
|
-
return x;
|
|
494
|
-
}
|
|
495
|
-
if (typeof x === "number") {
|
|
496
|
-
return Number.isFinite(x) ? x : NaN;
|
|
497
|
-
}
|
|
498
|
-
if (typeof x === "string" && /^[0-9]+$/.test(x)) {
|
|
499
|
-
return parseInt(x, 10);
|
|
500
|
-
}
|
|
501
|
-
return NaN;
|
|
502
|
-
}
|
|
503
|
-
function getWidths(param, width, sizes) {
|
|
504
|
-
let { deviceSizes, allSizes } = param;
|
|
505
|
-
if (sizes) {
|
|
506
|
-
// Find all the "vw" percent sizes used in the sizes prop
|
|
507
|
-
const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g;
|
|
508
|
-
const percentSizes = [];
|
|
509
|
-
for(let match; match = viewportWidthRe.exec(sizes); match){
|
|
510
|
-
percentSizes.push(parseInt(match[2]));
|
|
511
|
-
}
|
|
512
|
-
if (percentSizes.length) {
|
|
513
|
-
const smallestRatio = Math.min(...percentSizes) * 0.01;
|
|
514
|
-
return {
|
|
515
|
-
widths: allSizes.filter((s)=>s >= deviceSizes[0] * smallestRatio),
|
|
516
|
-
kind: "w"
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
widths: allSizes,
|
|
521
|
-
kind: "w"
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
if (typeof width !== "number") {
|
|
525
|
-
return {
|
|
526
|
-
widths: deviceSizes,
|
|
527
|
-
kind: "w"
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
const widths = [
|
|
531
|
-
...new Set(// > This means that most OLED screens that say they are 3x resolution,
|
|
532
|
-
// > are actually 3x in the green color, but only 1.5x in the red and
|
|
533
|
-
// > blue colors. Showing a 3x resolution image in the app vs a 2x
|
|
534
|
-
// > resolution image will be visually the same, though the 3x image
|
|
535
|
-
// > takes significantly more data. Even true 3x resolution screens are
|
|
536
|
-
// > wasteful as the human eye cannot see that level of detail without
|
|
537
|
-
// > something like a magnifying glass.
|
|
538
|
-
// https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
|
|
539
|
-
[
|
|
540
|
-
width,
|
|
541
|
-
width * 2 /*, width * 3*/
|
|
542
|
-
].map((w)=>allSizes.find((p)=>p >= w) || allSizes[allSizes.length - 1]))
|
|
543
|
-
];
|
|
544
|
-
return {
|
|
545
|
-
widths,
|
|
546
|
-
kind: "x"
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
function generateImgAttrs(param) {
|
|
550
|
-
let { config, src, unoptimized, width, quality, sizes, loader } = param;
|
|
551
|
-
if (unoptimized) {
|
|
552
|
-
return {
|
|
553
|
-
src,
|
|
554
|
-
srcSet: undefined,
|
|
555
|
-
sizes: undefined
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
const { widths, kind } = getWidths(config, width, sizes);
|
|
559
|
-
const last = widths.length - 1;
|
|
560
|
-
return {
|
|
561
|
-
sizes: !sizes && kind === "w" ? "100vw" : sizes,
|
|
562
|
-
srcSet: widths.map((w, i)=>loader({
|
|
563
|
-
config,
|
|
564
|
-
src,
|
|
565
|
-
quality,
|
|
566
|
-
width: w
|
|
567
|
-
}) + " " + (kind === "w" ? w : i + 1) + kind).join(", "),
|
|
568
|
-
// It's intended to keep `src` the last attribute because React updates
|
|
569
|
-
// attributes in order. If we keep `src` the first one, Safari will
|
|
570
|
-
// immediately start to fetch `src`, before `sizes` and `srcSet` are even
|
|
571
|
-
// updated by React. That causes multiple unnecessary requests if `srcSet`
|
|
572
|
-
// and `sizes` are defined.
|
|
573
|
-
// This bug cannot be reproduced in Chrome or Firefox.
|
|
574
|
-
src: loader({
|
|
575
|
-
config,
|
|
576
|
-
src,
|
|
577
|
-
quality,
|
|
578
|
-
width: widths[last]
|
|
579
|
-
})
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
function getImgProps(param, _state) {
|
|
583
|
-
let { src, sizes, unoptimized = false, priority = false, loading, className, quality, width, height, fill = false, style, overrideSrc, onLoad, onLoadingComplete, placeholder = "empty", blurDataURL, fetchPriority, layout, objectFit, objectPosition, lazyBoundary, lazyRoot, ...rest } = param;
|
|
584
|
-
const { imgConf, showAltText, blurComplete, defaultLoader } = _state;
|
|
585
|
-
let config;
|
|
586
|
-
let c = imgConf || _imageconfig.imageConfigDefault;
|
|
587
|
-
if ("allSizes" in c) {
|
|
588
|
-
config = c;
|
|
589
|
-
} else {
|
|
590
|
-
const allSizes = [
|
|
591
|
-
...c.deviceSizes,
|
|
592
|
-
...c.imageSizes
|
|
593
|
-
].sort((a, b)=>a - b);
|
|
594
|
-
const deviceSizes = c.deviceSizes.sort((a, b)=>a - b);
|
|
595
|
-
config = {
|
|
596
|
-
...c,
|
|
597
|
-
allSizes,
|
|
598
|
-
deviceSizes
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
if (typeof defaultLoader === "undefined") {
|
|
602
|
-
throw new Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config");
|
|
603
|
-
}
|
|
604
|
-
let loader = rest.loader || defaultLoader;
|
|
605
|
-
// Remove property so it's not spread on <img> element
|
|
606
|
-
delete rest.loader;
|
|
607
|
-
delete rest.srcSet;
|
|
608
|
-
// This special value indicates that the user
|
|
609
|
-
// didn't define a "loader" prop or "loader" config.
|
|
610
|
-
const isDefaultLoader = "__next_img_default" in loader;
|
|
611
|
-
if (isDefaultLoader) {
|
|
612
|
-
if (config.loader === "custom") {
|
|
613
|
-
throw new Error('Image with src "' + src + '" is missing "loader" prop.' + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader");
|
|
614
|
-
}
|
|
615
|
-
} else {
|
|
616
|
-
// The user defined a "loader" prop or config.
|
|
617
|
-
// Since the config object is internal only, we
|
|
618
|
-
// must not pass it to the user-defined "loader".
|
|
619
|
-
const customImageLoader = loader;
|
|
620
|
-
loader = (obj)=>{
|
|
621
|
-
const { config: _, ...opts } = obj;
|
|
622
|
-
return customImageLoader(opts);
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
if (layout) {
|
|
626
|
-
if (layout === "fill") {
|
|
627
|
-
fill = true;
|
|
628
|
-
}
|
|
629
|
-
const layoutToStyle = {
|
|
630
|
-
intrinsic: {
|
|
631
|
-
maxWidth: "100%",
|
|
632
|
-
height: "auto"
|
|
633
|
-
},
|
|
634
|
-
responsive: {
|
|
635
|
-
width: "100%",
|
|
636
|
-
height: "auto"
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
const layoutToSizes = {
|
|
640
|
-
responsive: "100vw",
|
|
641
|
-
fill: "100vw"
|
|
642
|
-
};
|
|
643
|
-
const layoutStyle = layoutToStyle[layout];
|
|
644
|
-
if (layoutStyle) {
|
|
645
|
-
style = {
|
|
646
|
-
...style,
|
|
647
|
-
...layoutStyle
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
const layoutSizes = layoutToSizes[layout];
|
|
651
|
-
if (layoutSizes && !sizes) {
|
|
652
|
-
sizes = layoutSizes;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
let staticSrc = "";
|
|
656
|
-
let widthInt = getInt(width);
|
|
657
|
-
let heightInt = getInt(height);
|
|
658
|
-
let blurWidth;
|
|
659
|
-
let blurHeight;
|
|
660
|
-
if (isStaticImport(src)) {
|
|
661
|
-
const staticImageData = isStaticRequire(src) ? src.default : src;
|
|
662
|
-
if (!staticImageData.src) {
|
|
663
|
-
throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received " + JSON.stringify(staticImageData));
|
|
664
|
-
}
|
|
665
|
-
if (!staticImageData.height || !staticImageData.width) {
|
|
666
|
-
throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received " + JSON.stringify(staticImageData));
|
|
667
|
-
}
|
|
668
|
-
blurWidth = staticImageData.blurWidth;
|
|
669
|
-
blurHeight = staticImageData.blurHeight;
|
|
670
|
-
blurDataURL = blurDataURL || staticImageData.blurDataURL;
|
|
671
|
-
staticSrc = staticImageData.src;
|
|
672
|
-
if (!fill) {
|
|
673
|
-
if (!widthInt && !heightInt) {
|
|
674
|
-
widthInt = staticImageData.width;
|
|
675
|
-
heightInt = staticImageData.height;
|
|
676
|
-
} else if (widthInt && !heightInt) {
|
|
677
|
-
const ratio = widthInt / staticImageData.width;
|
|
678
|
-
heightInt = Math.round(staticImageData.height * ratio);
|
|
679
|
-
} else if (!widthInt && heightInt) {
|
|
680
|
-
const ratio = heightInt / staticImageData.height;
|
|
681
|
-
widthInt = Math.round(staticImageData.width * ratio);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
src = typeof src === "string" ? src : staticSrc;
|
|
686
|
-
let isLazy = !priority && (loading === "lazy" || typeof loading === "undefined");
|
|
687
|
-
if (!src || src.startsWith("data:") || src.startsWith("blob:")) {
|
|
688
|
-
// https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
|
|
689
|
-
unoptimized = true;
|
|
690
|
-
isLazy = false;
|
|
691
|
-
}
|
|
692
|
-
if (config.unoptimized) {
|
|
693
|
-
unoptimized = true;
|
|
694
|
-
}
|
|
695
|
-
if (isDefaultLoader && src.endsWith(".svg") && !config.dangerouslyAllowSVG) {
|
|
696
|
-
// Special case to make svg serve as-is to avoid proxying
|
|
697
|
-
// through the built-in Image Optimization API.
|
|
698
|
-
unoptimized = true;
|
|
699
|
-
}
|
|
700
|
-
if (priority) {
|
|
701
|
-
fetchPriority = "high";
|
|
702
|
-
}
|
|
703
|
-
const qualityInt = getInt(quality);
|
|
704
|
-
if (process.env.NODE_ENV !== "production") {
|
|
705
|
-
if (config.output === "export" && isDefaultLoader && !unoptimized) {
|
|
706
|
-
throw new Error("Image Optimization using the default loader is not compatible with `{ output: 'export' }`.\n Possible solutions:\n - Remove `{ output: 'export' }` and run \"next start\" to run server mode including the Image Optimization API.\n - Configure `{ images: { unoptimized: true } }` in `next.config.js` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api");
|
|
707
|
-
}
|
|
708
|
-
if (!src) {
|
|
709
|
-
// React doesn't show the stack trace and there's
|
|
710
|
-
// no `src` to help identify which image, so we
|
|
711
|
-
// instead console.error(ref) during mount.
|
|
712
|
-
unoptimized = true;
|
|
713
|
-
} else {
|
|
714
|
-
if (fill) {
|
|
715
|
-
if (width) {
|
|
716
|
-
throw new Error('Image with src "' + src + '" has both "width" and "fill" properties. Only one should be used.');
|
|
717
|
-
}
|
|
718
|
-
if (height) {
|
|
719
|
-
throw new Error('Image with src "' + src + '" has both "height" and "fill" properties. Only one should be used.');
|
|
720
|
-
}
|
|
721
|
-
if ((style == null ? void 0 : style.position) && style.position !== "absolute") {
|
|
722
|
-
throw new Error('Image with src "' + src + '" has both "fill" and "style.position" properties. Images with "fill" always use position absolute - it cannot be modified.');
|
|
723
|
-
}
|
|
724
|
-
if ((style == null ? void 0 : style.width) && style.width !== "100%") {
|
|
725
|
-
throw new Error('Image with src "' + src + '" has both "fill" and "style.width" properties. Images with "fill" always use width 100% - it cannot be modified.');
|
|
726
|
-
}
|
|
727
|
-
if ((style == null ? void 0 : style.height) && style.height !== "100%") {
|
|
728
|
-
throw new Error('Image with src "' + src + '" has both "fill" and "style.height" properties. Images with "fill" always use height 100% - it cannot be modified.');
|
|
729
|
-
}
|
|
730
|
-
} else {
|
|
731
|
-
if (typeof widthInt === "undefined") {
|
|
732
|
-
throw new Error('Image with src "' + src + '" is missing required "width" property.');
|
|
733
|
-
} else if (isNaN(widthInt)) {
|
|
734
|
-
throw new Error('Image with src "' + src + '" has invalid "width" property. Expected a numeric value in pixels but received "' + width + '".');
|
|
735
|
-
}
|
|
736
|
-
if (typeof heightInt === "undefined") {
|
|
737
|
-
throw new Error('Image with src "' + src + '" is missing required "height" property.');
|
|
738
|
-
} else if (isNaN(heightInt)) {
|
|
739
|
-
throw new Error('Image with src "' + src + '" has invalid "height" property. Expected a numeric value in pixels but received "' + height + '".');
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
if (!VALID_LOADING_VALUES.includes(loading)) {
|
|
744
|
-
throw new Error('Image with src "' + src + '" has invalid "loading" property. Provided "' + loading + '" should be one of ' + VALID_LOADING_VALUES.map(String).join(",") + ".");
|
|
745
|
-
}
|
|
746
|
-
if (priority && loading === "lazy") {
|
|
747
|
-
throw new Error('Image with src "' + src + '" has both "priority" and "loading=\'lazy\'" properties. Only one should be used.');
|
|
748
|
-
}
|
|
749
|
-
if (placeholder !== "empty" && placeholder !== "blur" && !placeholder.startsWith("data:image/")) {
|
|
750
|
-
throw new Error('Image with src "' + src + '" has invalid "placeholder" property "' + placeholder + '".');
|
|
751
|
-
}
|
|
752
|
-
if (placeholder !== "empty") {
|
|
753
|
-
if (widthInt && heightInt && widthInt * heightInt < 1600) {
|
|
754
|
-
(0, _warnonce.warnOnce)('Image with src "' + src + '" is smaller than 40x40. Consider removing the "placeholder" property to improve performance.');
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
if (placeholder === "blur" && !blurDataURL) {
|
|
758
|
-
const VALID_BLUR_EXT = [
|
|
759
|
-
"jpeg",
|
|
760
|
-
"png",
|
|
761
|
-
"webp",
|
|
762
|
-
"avif"
|
|
763
|
-
] // should match next-image-loader
|
|
764
|
-
;
|
|
765
|
-
throw new Error('Image with src "' + src + '" has "placeholder=\'blur\'" property but is missing the "blurDataURL" property.\n Possible solutions:\n - Add a "blurDataURL" property, the contents should be a small Data URL to represent the image\n - Change the "src" property to a static import with one of the supported file types: ' + VALID_BLUR_EXT.join(",") + ' (animated images not supported)\n - Remove the "placeholder" property, effectively no blur effect\n Read more: https://nextjs.org/docs/messages/placeholder-blur-data-url');
|
|
766
|
-
}
|
|
767
|
-
if ("ref" in rest) {
|
|
768
|
-
(0, _warnonce.warnOnce)('Image with src "' + src + '" is using unsupported "ref" property. Consider using the "onLoad" property instead.');
|
|
769
|
-
}
|
|
770
|
-
if (!unoptimized && !isDefaultLoader) {
|
|
771
|
-
const urlStr = loader({
|
|
772
|
-
config,
|
|
773
|
-
src,
|
|
774
|
-
width: widthInt || 400,
|
|
775
|
-
quality: qualityInt || 75
|
|
776
|
-
});
|
|
777
|
-
let url;
|
|
778
|
-
try {
|
|
779
|
-
url = new URL(urlStr);
|
|
780
|
-
} catch (err) {}
|
|
781
|
-
if (urlStr === src || url && url.pathname === src && !url.search) {
|
|
782
|
-
(0, _warnonce.warnOnce)('Image with src "' + src + '" has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.' + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader-width");
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
if (onLoadingComplete) {
|
|
786
|
-
(0, _warnonce.warnOnce)('Image with src "' + src + '" is using deprecated "onLoadingComplete" property. Please use the "onLoad" property instead.');
|
|
787
|
-
}
|
|
788
|
-
for (const [legacyKey, legacyValue] of Object.entries({
|
|
789
|
-
layout,
|
|
790
|
-
objectFit,
|
|
791
|
-
objectPosition,
|
|
792
|
-
lazyBoundary,
|
|
793
|
-
lazyRoot
|
|
794
|
-
})){
|
|
795
|
-
if (legacyValue) {
|
|
796
|
-
(0, _warnonce.warnOnce)('Image with src "' + src + '" has legacy prop "' + legacyKey + '". Did you forget to run the codemod?' + "\nRead more: https://nextjs.org/docs/messages/next-image-upgrade-to-13");
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
if (typeof window !== "undefined" && !perfObserver && window.PerformanceObserver) {
|
|
800
|
-
perfObserver = new PerformanceObserver((entryList)=>{
|
|
801
|
-
for (const entry of entryList.getEntries()){
|
|
802
|
-
var _entry_element;
|
|
803
|
-
// @ts-ignore - missing "LargestContentfulPaint" class with "element" prop
|
|
804
|
-
const imgSrc = (entry == null ? void 0 : (_entry_element = entry.element) == null ? void 0 : _entry_element.src) || "";
|
|
805
|
-
const lcpImage = allImgs.get(imgSrc);
|
|
806
|
-
if (lcpImage && !lcpImage.priority && lcpImage.placeholder === "empty" && !lcpImage.src.startsWith("data:") && !lcpImage.src.startsWith("blob:")) {
|
|
807
|
-
// https://web.dev/lcp/#measure-lcp-in-javascript
|
|
808
|
-
(0, _warnonce.warnOnce)('Image with src "' + lcpImage.src + '" was detected as the Largest Contentful Paint (LCP). Please add the "priority" property if this image is above the fold.' + "\nRead more: https://nextjs.org/docs/api-reference/next/image#priority");
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
try {
|
|
813
|
-
perfObserver.observe({
|
|
814
|
-
type: "largest-contentful-paint",
|
|
815
|
-
buffered: true
|
|
816
|
-
});
|
|
817
|
-
} catch (err) {
|
|
818
|
-
// Log error but don't crash the app
|
|
819
|
-
console.error(err);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
const imgStyle = Object.assign(fill ? {
|
|
824
|
-
position: "absolute",
|
|
825
|
-
height: "100%",
|
|
826
|
-
width: "100%",
|
|
827
|
-
left: 0,
|
|
828
|
-
top: 0,
|
|
829
|
-
right: 0,
|
|
830
|
-
bottom: 0,
|
|
831
|
-
objectFit,
|
|
832
|
-
objectPosition
|
|
833
|
-
} : {}, showAltText ? {} : {
|
|
834
|
-
color: "transparent"
|
|
835
|
-
}, style);
|
|
836
|
-
const backgroundImage = !blurComplete && placeholder !== "empty" ? placeholder === "blur" ? 'url("data:image/svg+xml;charset=utf-8,' + (0, _imageblursvg.getImageBlurSvg)({
|
|
837
|
-
widthInt,
|
|
838
|
-
heightInt,
|
|
839
|
-
blurWidth,
|
|
840
|
-
blurHeight,
|
|
841
|
-
blurDataURL: blurDataURL || "",
|
|
842
|
-
objectFit: imgStyle.objectFit
|
|
843
|
-
}) + '")' : 'url("' + placeholder + '")' // assume `data:image/`
|
|
844
|
-
: null;
|
|
845
|
-
let placeholderStyle = backgroundImage ? {
|
|
846
|
-
backgroundSize: imgStyle.objectFit || "cover",
|
|
847
|
-
backgroundPosition: imgStyle.objectPosition || "50% 50%",
|
|
848
|
-
backgroundRepeat: "no-repeat",
|
|
849
|
-
backgroundImage
|
|
850
|
-
} : {};
|
|
851
|
-
if (process.env.NODE_ENV === "development") {
|
|
852
|
-
if (placeholderStyle.backgroundImage && placeholder === "blur" && (blurDataURL == null ? void 0 : blurDataURL.startsWith("/"))) {
|
|
853
|
-
// During `next dev`, we don't want to generate blur placeholders with webpack
|
|
854
|
-
// because it can delay starting the dev server. Instead, `next-image-loader.js`
|
|
855
|
-
// will inline a special url to lazily generate the blur placeholder at request time.
|
|
856
|
-
placeholderStyle.backgroundImage = 'url("' + blurDataURL + '")';
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
const imgAttributes = generateImgAttrs({
|
|
860
|
-
config,
|
|
861
|
-
src,
|
|
862
|
-
unoptimized,
|
|
863
|
-
width: widthInt,
|
|
864
|
-
quality: qualityInt,
|
|
865
|
-
sizes,
|
|
866
|
-
loader
|
|
867
|
-
});
|
|
868
|
-
if (process.env.NODE_ENV !== "production") {
|
|
869
|
-
if (typeof window !== "undefined") {
|
|
870
|
-
let fullUrl;
|
|
871
|
-
try {
|
|
872
|
-
fullUrl = new URL(imgAttributes.src);
|
|
873
|
-
} catch (e) {
|
|
874
|
-
fullUrl = new URL(imgAttributes.src, window.location.href);
|
|
875
|
-
}
|
|
876
|
-
allImgs.set(fullUrl.href, {
|
|
877
|
-
src,
|
|
878
|
-
priority,
|
|
879
|
-
placeholder
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
const props = {
|
|
884
|
-
...rest,
|
|
885
|
-
loading: isLazy ? "lazy" : loading,
|
|
886
|
-
fetchPriority,
|
|
887
|
-
width: widthInt,
|
|
888
|
-
height: heightInt,
|
|
889
|
-
decoding: "async",
|
|
890
|
-
className,
|
|
891
|
-
style: {
|
|
892
|
-
...imgStyle,
|
|
893
|
-
...placeholderStyle
|
|
894
|
-
},
|
|
895
|
-
sizes: imgAttributes.sizes,
|
|
896
|
-
srcSet: imgAttributes.srcSet,
|
|
897
|
-
src: overrideSrc || imgAttributes.src
|
|
898
|
-
};
|
|
899
|
-
const meta = {
|
|
900
|
-
unoptimized,
|
|
901
|
-
priority,
|
|
902
|
-
placeholder,
|
|
903
|
-
fill
|
|
904
|
-
};
|
|
905
|
-
return {
|
|
906
|
-
props,
|
|
907
|
-
meta
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
} (getImgProps));
|
|
913
|
-
return getImgProps;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
var imageComponent = {exports: {}};
|
|
917
|
-
|
|
918
|
-
var _interop_require_wildcard = {};
|
|
919
|
-
|
|
920
|
-
var hasRequired_interop_require_wildcard;
|
|
921
|
-
|
|
922
|
-
function require_interop_require_wildcard () {
|
|
923
|
-
if (hasRequired_interop_require_wildcard) return _interop_require_wildcard;
|
|
924
|
-
hasRequired_interop_require_wildcard = 1;
|
|
925
|
-
|
|
926
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
927
|
-
if (typeof WeakMap !== "function") return null;
|
|
928
|
-
|
|
929
|
-
var cacheBabelInterop = new WeakMap();
|
|
930
|
-
var cacheNodeInterop = new WeakMap();
|
|
931
|
-
|
|
932
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
933
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
934
|
-
})(nodeInterop);
|
|
935
|
-
}
|
|
936
|
-
_interop_require_wildcard._ = _interop_require_wildcard._interop_require_wildcard = _interop_require_wildcard$1;
|
|
937
|
-
function _interop_require_wildcard$1(obj, nodeInterop) {
|
|
938
|
-
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
939
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj };
|
|
940
|
-
|
|
941
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
942
|
-
|
|
943
|
-
if (cache && cache.has(obj)) return cache.get(obj);
|
|
944
|
-
|
|
945
|
-
var newObj = { __proto__: null };
|
|
946
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
947
|
-
|
|
948
|
-
for (var key in obj) {
|
|
949
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
950
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
951
|
-
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
952
|
-
else newObj[key] = obj[key];
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
newObj.default = obj;
|
|
957
|
-
|
|
958
|
-
if (cache) cache.set(obj, newObj);
|
|
959
|
-
|
|
960
|
-
return newObj;
|
|
961
|
-
}
|
|
962
|
-
return _interop_require_wildcard;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
var head = {exports: {}};
|
|
966
|
-
|
|
967
|
-
var sideEffect = {};
|
|
968
|
-
|
|
969
|
-
var hasRequiredSideEffect;
|
|
970
|
-
|
|
971
|
-
function requireSideEffect () {
|
|
972
|
-
if (hasRequiredSideEffect) return sideEffect;
|
|
973
|
-
hasRequiredSideEffect = 1;
|
|
974
|
-
(function (exports) {
|
|
975
|
-
Object.defineProperty(exports, "__esModule", {
|
|
976
|
-
value: true
|
|
977
|
-
});
|
|
978
|
-
Object.defineProperty(exports, "default", {
|
|
979
|
-
enumerable: true,
|
|
980
|
-
get: function() {
|
|
981
|
-
return SideEffect;
|
|
982
|
-
}
|
|
983
|
-
});
|
|
984
|
-
const _react = React$1;
|
|
985
|
-
const isServer = typeof window === "undefined";
|
|
986
|
-
const useClientOnlyLayoutEffect = isServer ? ()=>{} : _react.useLayoutEffect;
|
|
987
|
-
const useClientOnlyEffect = isServer ? ()=>{} : _react.useEffect;
|
|
988
|
-
function SideEffect(props) {
|
|
989
|
-
const { headManager, reduceComponentsToState } = props;
|
|
990
|
-
function emitChange() {
|
|
991
|
-
if (headManager && headManager.mountedInstances) {
|
|
992
|
-
const headElements = _react.Children.toArray(Array.from(headManager.mountedInstances).filter(Boolean));
|
|
993
|
-
headManager.updateHead(reduceComponentsToState(headElements, props));
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
if (isServer) {
|
|
997
|
-
var _headManager_mountedInstances;
|
|
998
|
-
headManager == null ? void 0 : (_headManager_mountedInstances = headManager.mountedInstances) == null ? void 0 : _headManager_mountedInstances.add(props.children);
|
|
999
|
-
emitChange();
|
|
1000
|
-
}
|
|
1001
|
-
useClientOnlyLayoutEffect(()=>{
|
|
1002
|
-
var _headManager_mountedInstances;
|
|
1003
|
-
headManager == null ? void 0 : (_headManager_mountedInstances = headManager.mountedInstances) == null ? void 0 : _headManager_mountedInstances.add(props.children);
|
|
1004
|
-
return ()=>{
|
|
1005
|
-
var _headManager_mountedInstances;
|
|
1006
|
-
headManager == null ? void 0 : (_headManager_mountedInstances = headManager.mountedInstances) == null ? void 0 : _headManager_mountedInstances.delete(props.children);
|
|
1007
|
-
};
|
|
1008
|
-
});
|
|
1009
|
-
// We need to call `updateHead` method whenever the `SideEffect` is trigger in all
|
|
1010
|
-
// life-cycles: mount, update, unmount. However, if there are multiple `SideEffect`s
|
|
1011
|
-
// being rendered, we only trigger the method from the last one.
|
|
1012
|
-
// This is ensured by keeping the last unflushed `updateHead` in the `_pendingUpdate`
|
|
1013
|
-
// singleton in the layout effect pass, and actually trigger it in the effect pass.
|
|
1014
|
-
useClientOnlyLayoutEffect(()=>{
|
|
1015
|
-
if (headManager) {
|
|
1016
|
-
headManager._pendingUpdate = emitChange;
|
|
1017
|
-
}
|
|
1018
|
-
return ()=>{
|
|
1019
|
-
if (headManager) {
|
|
1020
|
-
headManager._pendingUpdate = emitChange;
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
});
|
|
1024
|
-
useClientOnlyEffect(()=>{
|
|
1025
|
-
if (headManager && headManager._pendingUpdate) {
|
|
1026
|
-
headManager._pendingUpdate();
|
|
1027
|
-
headManager._pendingUpdate = null;
|
|
1028
|
-
}
|
|
1029
|
-
return ()=>{
|
|
1030
|
-
if (headManager && headManager._pendingUpdate) {
|
|
1031
|
-
headManager._pendingUpdate();
|
|
1032
|
-
headManager._pendingUpdate = null;
|
|
1033
|
-
}
|
|
1034
|
-
};
|
|
1035
|
-
});
|
|
1036
|
-
return null;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
} (sideEffect));
|
|
1041
|
-
return sideEffect;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
var ampContext_sharedRuntime = {};
|
|
1045
|
-
|
|
1046
|
-
var hasRequiredAmpContext_sharedRuntime;
|
|
1047
|
-
|
|
1048
|
-
function requireAmpContext_sharedRuntime () {
|
|
1049
|
-
if (hasRequiredAmpContext_sharedRuntime) return ampContext_sharedRuntime;
|
|
1050
|
-
hasRequiredAmpContext_sharedRuntime = 1;
|
|
1051
|
-
(function (exports) {
|
|
1052
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1053
|
-
value: true
|
|
1054
|
-
});
|
|
1055
|
-
Object.defineProperty(exports, "AmpStateContext", {
|
|
1056
|
-
enumerable: true,
|
|
1057
|
-
get: function() {
|
|
1058
|
-
return AmpStateContext;
|
|
1059
|
-
}
|
|
1060
|
-
});
|
|
1061
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1062
|
-
const _react = /*#__PURE__*/ _interop_require_default._(React$1);
|
|
1063
|
-
const AmpStateContext = _react.default.createContext({});
|
|
1064
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1065
|
-
AmpStateContext.displayName = "AmpStateContext";
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
} (ampContext_sharedRuntime));
|
|
1070
|
-
return ampContext_sharedRuntime;
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
var headManagerContext_sharedRuntime = {};
|
|
1074
|
-
|
|
1075
|
-
var hasRequiredHeadManagerContext_sharedRuntime;
|
|
1076
|
-
|
|
1077
|
-
function requireHeadManagerContext_sharedRuntime () {
|
|
1078
|
-
if (hasRequiredHeadManagerContext_sharedRuntime) return headManagerContext_sharedRuntime;
|
|
1079
|
-
hasRequiredHeadManagerContext_sharedRuntime = 1;
|
|
1080
|
-
(function (exports) {
|
|
1081
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1082
|
-
value: true
|
|
1083
|
-
});
|
|
1084
|
-
Object.defineProperty(exports, "HeadManagerContext", {
|
|
1085
|
-
enumerable: true,
|
|
1086
|
-
get: function() {
|
|
1087
|
-
return HeadManagerContext;
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1091
|
-
const _react = /*#__PURE__*/ _interop_require_default._(React$1);
|
|
1092
|
-
const HeadManagerContext = _react.default.createContext({});
|
|
1093
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1094
|
-
HeadManagerContext.displayName = "HeadManagerContext";
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
} (headManagerContext_sharedRuntime));
|
|
1099
|
-
return headManagerContext_sharedRuntime;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
var ampMode = {};
|
|
1103
|
-
|
|
1104
|
-
var hasRequiredAmpMode;
|
|
1105
|
-
|
|
1106
|
-
function requireAmpMode () {
|
|
1107
|
-
if (hasRequiredAmpMode) return ampMode;
|
|
1108
|
-
hasRequiredAmpMode = 1;
|
|
1109
|
-
(function (exports) {
|
|
1110
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1111
|
-
value: true
|
|
1112
|
-
});
|
|
1113
|
-
Object.defineProperty(exports, "isInAmpMode", {
|
|
1114
|
-
enumerable: true,
|
|
1115
|
-
get: function() {
|
|
1116
|
-
return isInAmpMode;
|
|
1117
|
-
}
|
|
1118
|
-
});
|
|
1119
|
-
function isInAmpMode(param) {
|
|
1120
|
-
let { ampFirst = false, hybrid = false, hasQuery = false } = param === void 0 ? {} : param;
|
|
1121
|
-
return ampFirst || hybrid && hasQuery;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
} (ampMode));
|
|
1126
|
-
return ampMode;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
var hasRequiredHead;
|
|
1130
|
-
|
|
1131
|
-
function requireHead () {
|
|
1132
|
-
if (hasRequiredHead) return head.exports;
|
|
1133
|
-
hasRequiredHead = 1;
|
|
1134
|
-
(function (module, exports) {
|
|
1135
|
-
"use client";
|
|
1136
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1137
|
-
value: true
|
|
1138
|
-
});
|
|
1139
|
-
function _export(target, all) {
|
|
1140
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
1141
|
-
enumerable: true,
|
|
1142
|
-
get: all[name]
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
_export(exports, {
|
|
1146
|
-
default: function() {
|
|
1147
|
-
return _default;
|
|
1148
|
-
},
|
|
1149
|
-
defaultHead: function() {
|
|
1150
|
-
return defaultHead;
|
|
1151
|
-
}
|
|
1152
|
-
});
|
|
1153
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1154
|
-
const _interop_require_wildcard = /*@__PURE__*/ require_interop_require_wildcard();
|
|
1155
|
-
const _jsxruntime = require$$2;
|
|
1156
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(React$1);
|
|
1157
|
-
const _sideeffect = /*#__PURE__*/ _interop_require_default._(requireSideEffect());
|
|
1158
|
-
const _ampcontextsharedruntime = requireAmpContext_sharedRuntime();
|
|
1159
|
-
const _headmanagercontextsharedruntime = requireHeadManagerContext_sharedRuntime();
|
|
1160
|
-
const _ampmode = requireAmpMode();
|
|
1161
|
-
const _warnonce = requireWarnOnce();
|
|
1162
|
-
function defaultHead(inAmpMode) {
|
|
1163
|
-
if (inAmpMode === void 0) inAmpMode = false;
|
|
1164
|
-
const head = [
|
|
1165
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
|
1166
|
-
charSet: "utf-8"
|
|
1167
|
-
})
|
|
1168
|
-
];
|
|
1169
|
-
if (!inAmpMode) {
|
|
1170
|
-
head.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
|
1171
|
-
name: "viewport",
|
|
1172
|
-
content: "width=device-width"
|
|
1173
|
-
}));
|
|
1174
|
-
}
|
|
1175
|
-
return head;
|
|
1176
|
-
}
|
|
1177
|
-
function onlyReactElement(list, child) {
|
|
1178
|
-
// React children can be "string" or "number" in this case we ignore them for backwards compat
|
|
1179
|
-
if (typeof child === "string" || typeof child === "number") {
|
|
1180
|
-
return list;
|
|
1181
|
-
}
|
|
1182
|
-
// Adds support for React.Fragment
|
|
1183
|
-
if (child.type === _react.default.Fragment) {
|
|
1184
|
-
return list.concat(// @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[]
|
|
1185
|
-
_react.default.Children.toArray(child.props.children).reduce(// @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[]
|
|
1186
|
-
(fragmentList, fragmentChild)=>{
|
|
1187
|
-
if (typeof fragmentChild === "string" || typeof fragmentChild === "number") {
|
|
1188
|
-
return fragmentList;
|
|
1189
|
-
}
|
|
1190
|
-
return fragmentList.concat(fragmentChild);
|
|
1191
|
-
}, []));
|
|
1192
|
-
}
|
|
1193
|
-
return list.concat(child);
|
|
1194
|
-
}
|
|
1195
|
-
const METATYPES = [
|
|
1196
|
-
"name",
|
|
1197
|
-
"httpEquiv",
|
|
1198
|
-
"charSet",
|
|
1199
|
-
"itemProp"
|
|
1200
|
-
];
|
|
1201
|
-
/*
|
|
1202
|
-
returns a function for filtering head child elements
|
|
1203
|
-
which shouldn't be duplicated, like <title/>
|
|
1204
|
-
Also adds support for deduplicated `key` properties
|
|
1205
|
-
*/ function unique() {
|
|
1206
|
-
const keys = new Set();
|
|
1207
|
-
const tags = new Set();
|
|
1208
|
-
const metaTypes = new Set();
|
|
1209
|
-
const metaCategories = {};
|
|
1210
|
-
return (h)=>{
|
|
1211
|
-
let isUnique = true;
|
|
1212
|
-
let hasKey = false;
|
|
1213
|
-
if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
|
|
1214
|
-
hasKey = true;
|
|
1215
|
-
const key = h.key.slice(h.key.indexOf("$") + 1);
|
|
1216
|
-
if (keys.has(key)) {
|
|
1217
|
-
isUnique = false;
|
|
1218
|
-
} else {
|
|
1219
|
-
keys.add(key);
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
// eslint-disable-next-line default-case
|
|
1223
|
-
switch(h.type){
|
|
1224
|
-
case "title":
|
|
1225
|
-
case "base":
|
|
1226
|
-
if (tags.has(h.type)) {
|
|
1227
|
-
isUnique = false;
|
|
1228
|
-
} else {
|
|
1229
|
-
tags.add(h.type);
|
|
1230
|
-
}
|
|
1231
|
-
break;
|
|
1232
|
-
case "meta":
|
|
1233
|
-
for(let i = 0, len = METATYPES.length; i < len; i++){
|
|
1234
|
-
const metatype = METATYPES[i];
|
|
1235
|
-
if (!h.props.hasOwnProperty(metatype)) continue;
|
|
1236
|
-
if (metatype === "charSet") {
|
|
1237
|
-
if (metaTypes.has(metatype)) {
|
|
1238
|
-
isUnique = false;
|
|
1239
|
-
} else {
|
|
1240
|
-
metaTypes.add(metatype);
|
|
1241
|
-
}
|
|
1242
|
-
} else {
|
|
1243
|
-
const category = h.props[metatype];
|
|
1244
|
-
const categories = metaCategories[metatype] || new Set();
|
|
1245
|
-
if ((metatype !== "name" || !hasKey) && categories.has(category)) {
|
|
1246
|
-
isUnique = false;
|
|
1247
|
-
} else {
|
|
1248
|
-
categories.add(category);
|
|
1249
|
-
metaCategories[metatype] = categories;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
break;
|
|
1254
|
-
}
|
|
1255
|
-
return isUnique;
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
/**
|
|
1259
|
-
*
|
|
1260
|
-
* @param headChildrenElements List of children of <Head>
|
|
1261
|
-
*/ function reduceComponents(headChildrenElements, props) {
|
|
1262
|
-
const { inAmpMode } = props;
|
|
1263
|
-
return headChildrenElements.reduce(onlyReactElement, []).reverse().concat(defaultHead(inAmpMode).reverse()).filter(unique()).reverse().map((c, i)=>{
|
|
1264
|
-
const key = c.key || i;
|
|
1265
|
-
if (process.env.NODE_ENV !== "development" && process.env.__NEXT_OPTIMIZE_FONTS && !inAmpMode) {
|
|
1266
|
-
if (c.type === "link" && c.props["href"] && // TODO(prateekbh@): Replace this with const from `constants` when the tree shaking works.
|
|
1267
|
-
[
|
|
1268
|
-
"https://fonts.googleapis.com/css",
|
|
1269
|
-
"https://use.typekit.net/"
|
|
1270
|
-
].some((url)=>c.props["href"].startsWith(url))) {
|
|
1271
|
-
const newProps = {
|
|
1272
|
-
...c.props || {}
|
|
1273
|
-
};
|
|
1274
|
-
newProps["data-href"] = newProps["href"];
|
|
1275
|
-
newProps["href"] = undefined;
|
|
1276
|
-
// Add this attribute to make it easy to identify optimized tags
|
|
1277
|
-
newProps["data-optimized-fonts"] = true;
|
|
1278
|
-
return /*#__PURE__*/ _react.default.cloneElement(c, newProps);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
if (process.env.NODE_ENV === "development") {
|
|
1282
|
-
// omit JSON-LD structured data snippets from the warning
|
|
1283
|
-
if (c.type === "script" && c.props["type"] !== "application/ld+json") {
|
|
1284
|
-
const srcMessage = c.props["src"] ? '<script> tag with src="' + c.props["src"] + '"' : "inline <script>";
|
|
1285
|
-
(0, _warnonce.warnOnce)("Do not add <script> tags using next/head (see " + srcMessage + "). Use next/script instead. \nSee more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component");
|
|
1286
|
-
} else if (c.type === "link" && c.props["rel"] === "stylesheet") {
|
|
1287
|
-
(0, _warnonce.warnOnce)('Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="' + c.props["href"] + '"). Use Document instead. \nSee more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component');
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
return /*#__PURE__*/ _react.default.cloneElement(c, {
|
|
1291
|
-
key
|
|
1292
|
-
});
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
/**
|
|
1296
|
-
* This component injects elements to `<head>` of your page.
|
|
1297
|
-
* To avoid duplicated `tags` in `<head>` you can use the `key` property, which will make sure every tag is only rendered once.
|
|
1298
|
-
*/ function Head(param) {
|
|
1299
|
-
let { children } = param;
|
|
1300
|
-
const ampState = (0, _react.useContext)(_ampcontextsharedruntime.AmpStateContext);
|
|
1301
|
-
const headManager = (0, _react.useContext)(_headmanagercontextsharedruntime.HeadManagerContext);
|
|
1302
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_sideeffect.default, {
|
|
1303
|
-
reduceComponentsToState: reduceComponents,
|
|
1304
|
-
headManager: headManager,
|
|
1305
|
-
inAmpMode: (0, _ampmode.isInAmpMode)(ampState),
|
|
1306
|
-
children: children
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
const _default = Head;
|
|
1310
|
-
|
|
1311
|
-
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
1312
|
-
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
1313
|
-
Object.assign(exports.default, exports);
|
|
1314
|
-
module.exports = exports.default;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
} (head, head.exports));
|
|
1319
|
-
return head.exports;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
var imageConfigContext_sharedRuntime = {};
|
|
1323
|
-
|
|
1324
|
-
var hasRequiredImageConfigContext_sharedRuntime;
|
|
1325
|
-
|
|
1326
|
-
function requireImageConfigContext_sharedRuntime () {
|
|
1327
|
-
if (hasRequiredImageConfigContext_sharedRuntime) return imageConfigContext_sharedRuntime;
|
|
1328
|
-
hasRequiredImageConfigContext_sharedRuntime = 1;
|
|
1329
|
-
(function (exports) {
|
|
1330
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1331
|
-
value: true
|
|
1332
|
-
});
|
|
1333
|
-
Object.defineProperty(exports, "ImageConfigContext", {
|
|
1334
|
-
enumerable: true,
|
|
1335
|
-
get: function() {
|
|
1336
|
-
return ImageConfigContext;
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1339
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1340
|
-
const _react = /*#__PURE__*/ _interop_require_default._(React$1);
|
|
1341
|
-
const _imageconfig = requireImageConfig();
|
|
1342
|
-
const ImageConfigContext = _react.default.createContext(_imageconfig.imageConfigDefault);
|
|
1343
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1344
|
-
ImageConfigContext.displayName = "ImageConfigContext";
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
} (imageConfigContext_sharedRuntime));
|
|
1349
|
-
return imageConfigContext_sharedRuntime;
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
var routerContext_sharedRuntime = {};
|
|
1353
|
-
|
|
1354
|
-
var hasRequiredRouterContext_sharedRuntime;
|
|
1355
|
-
|
|
1356
|
-
function requireRouterContext_sharedRuntime () {
|
|
1357
|
-
if (hasRequiredRouterContext_sharedRuntime) return routerContext_sharedRuntime;
|
|
1358
|
-
hasRequiredRouterContext_sharedRuntime = 1;
|
|
1359
|
-
(function (exports) {
|
|
1360
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1361
|
-
value: true
|
|
1362
|
-
});
|
|
1363
|
-
Object.defineProperty(exports, "RouterContext", {
|
|
1364
|
-
enumerable: true,
|
|
1365
|
-
get: function() {
|
|
1366
|
-
return RouterContext;
|
|
1367
|
-
}
|
|
1368
|
-
});
|
|
1369
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1370
|
-
const _react = /*#__PURE__*/ _interop_require_default._(React$1);
|
|
1371
|
-
const RouterContext = _react.default.createContext(null);
|
|
1372
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1373
|
-
RouterContext.displayName = "RouterContext";
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
} (routerContext_sharedRuntime));
|
|
1378
|
-
return routerContext_sharedRuntime;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
var imageLoader = {};
|
|
1382
|
-
|
|
1383
|
-
var matchRemotePattern = {};
|
|
1384
|
-
|
|
1385
|
-
var picomatch = {exports: {}};
|
|
1386
|
-
|
|
1387
|
-
var hasRequiredPicomatch;
|
|
1388
|
-
|
|
1389
|
-
function requirePicomatch () {
|
|
1390
|
-
if (hasRequiredPicomatch) return picomatch.exports;
|
|
1391
|
-
hasRequiredPicomatch = 1;
|
|
1392
|
-
(()=>{var t={170:(t,e,u)=>{const n=u(510);const isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){const t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}if(typeof process!=="undefined"&&process.platform){return process.platform==="win32"}return false};function picomatch(t,e,u=false){if(e&&(e.windows===null||e.windows===undefined)){e={...e,windows:isWindows()};}return n(t,e,u)}Object.assign(picomatch,n);t.exports=picomatch;},154:t=>{const e="\\\\/";const u=`[^${e}]`;const n="\\.";const o="\\+";const s="\\?";const r="\\/";const a="(?=.)";const i="[^/]";const c=`(?:${r}|$)`;const p=`(?:^|${r})`;const l=`${n}{1,2}${c}`;const f=`(?!${n})`;const A=`(?!${p}${l})`;const _=`(?!${n}{0,1}${c})`;const R=`(?!${l})`;const E=`[^.${r}]`;const h=`${i}*?`;const g="/";const b={DOT_LITERAL:n,PLUS_LITERAL:o,QMARK_LITERAL:s,SLASH_LITERAL:r,ONE_CHAR:a,QMARK:i,END_ANCHOR:c,DOTS_SLASH:l,NO_DOT:f,NO_DOTS:A,NO_DOT_SLASH:_,NO_DOTS_SLASH:R,QMARK_NO_DOT:E,STAR:h,START_ANCHOR:p,SEP:g};const C={...b,SLASH_LITERAL:`[${e}]`,QMARK:u,STAR:`${u}*?`,DOTS_SLASH:`${n}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${e}])${n}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"};const y={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};t.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===true?C:b}};},697:(t,e,u)=>{const n=u(154);const o=u(96);const{MAX_LENGTH:s,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_BACKREF:i,REPLACEMENTS:c}=n;const expandRange=(t,e)=>{if(typeof e.expandRange==="function"){return e.expandRange(...t,e)}t.sort();const u=`[${t.join("-")}]`;try{new RegExp(u);}catch(e){return t.map((t=>o.escapeRegex(t))).join("..")}return u};const syntaxError=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`;const parse=(t,e)=>{if(typeof t!=="string"){throw new TypeError("Expected a string")}t=c[t]||t;const u={...e};const p=typeof u.maxLength==="number"?Math.min(s,u.maxLength):s;let l=t.length;if(l>p){throw new SyntaxError(`Input length: ${l}, exceeds maximum allowed length: ${p}`)}const f={type:"bos",value:"",output:u.prepend||""};const A=[f];const _=u.capture?"":"?:";const R=n.globChars(u.windows);const E=n.extglobChars(R);const{DOT_LITERAL:h,PLUS_LITERAL:g,SLASH_LITERAL:b,ONE_CHAR:C,DOTS_SLASH:y,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:S,QMARK:H,QMARK_NO_DOT:v,STAR:d,START_ANCHOR:L}=R;const globstar=t=>`(${_}(?:(?!${L}${t.dot?y:h}).)*?)`;const T=u.dot?"":$;const O=u.dot?H:v;let k=u.bash===true?globstar(u):d;if(u.capture){k=`(${k})`;}if(typeof u.noext==="boolean"){u.noextglob=u.noext;}const m={input:t,index:-1,start:0,dot:u.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:A};t=o.removePrefix(t,m);l=t.length;const w=[];const N=[];const I=[];let B=f;let G;const eos=()=>m.index===l-1;const D=m.peek=(e=1)=>t[m.index+e];const M=m.advance=()=>t[++m.index]||"";const remaining=()=>t.slice(m.index+1);const consume=(t="",e=0)=>{m.consumed+=t;m.index+=e;};const append=t=>{m.output+=t.output!=null?t.output:t.value;consume(t.value);};const negate=()=>{let t=1;while(D()==="!"&&(D(2)!=="("||D(3)==="?")){M();m.start++;t++;}if(t%2===0){return false}m.negated=true;m.start++;return true};const increment=t=>{m[t]++;I.push(t);};const decrement=t=>{m[t]--;I.pop();};const push=t=>{if(B.type==="globstar"){const e=m.braces>0&&(t.type==="comma"||t.type==="brace");const u=t.extglob===true||w.length&&(t.type==="pipe"||t.type==="paren");if(t.type!=="slash"&&t.type!=="paren"&&!e&&!u){m.output=m.output.slice(0,-B.output.length);B.type="star";B.value="*";B.output=k;m.output+=B.output;}}if(w.length&&t.type!=="paren"){w[w.length-1].inner+=t.value;}if(t.value||t.output)append(t);if(B&&B.type==="text"&&t.type==="text"){B.output=(B.output||B.value)+t.value;B.value+=t.value;return}t.prev=B;A.push(t);B=t;};const extglobOpen=(t,e)=>{const n={...E[e],conditions:1,inner:""};n.prev=B;n.parens=m.parens;n.output=m.output;const o=(u.capture?"(":"")+n.open;increment("parens");push({type:t,value:e,output:m.output?"":C});push({type:"paren",extglob:true,value:M(),output:o});w.push(n);};const extglobClose=t=>{let n=t.close+(u.capture?")":"");let o;if(t.type==="negate"){let s=k;if(t.inner&&t.inner.length>1&&t.inner.includes("/")){s=globstar(u);}if(s!==k||eos()||/^\)+$/.test(remaining())){n=t.close=`)$))${s}`;}if(t.inner.includes("*")&&(o=remaining())&&/^\.[^\\/.]+$/.test(o)){const u=parse(o,{...e,fastpaths:false}).output;n=t.close=`)${u})${s})`;}if(t.prev.type==="bos"){m.negatedExtglob=true;}}push({type:"paren",extglob:true,value:G,output:n});decrement("parens");};if(u.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(t)){let n=false;let s=t.replace(i,((t,e,u,o,s,r)=>{if(o==="\\"){n=true;return t}if(o==="?"){if(e){return e+o+(s?H.repeat(s.length):"")}if(r===0){return O+(s?H.repeat(s.length):"")}return H.repeat(u.length)}if(o==="."){return h.repeat(u.length)}if(o==="*"){if(e){return e+o+(s?k:"")}return k}return e?t:`\\${t}`}));if(n===true){if(u.unescape===true){s=s.replace(/\\/g,"");}else {s=s.replace(/\\+/g,(t=>t.length%2===0?"\\\\":t?"\\":""));}}if(s===t&&u.contains===true){m.output=t;return m}m.output=o.wrapOutput(s,m,e);return m}while(!eos()){G=M();if(G==="\0"){continue}if(G==="\\"){const t=D();if(t==="/"&&u.bash!==true){continue}if(t==="."||t===";"){continue}if(!t){G+="\\";push({type:"text",value:G});continue}const e=/^\\+/.exec(remaining());let n=0;if(e&&e[0].length>2){n=e[0].length;m.index+=n;if(n%2!==0){G+="\\";}}if(u.unescape===true){G=M();}else {G+=M();}if(m.brackets===0){push({type:"text",value:G});continue}}if(m.brackets>0&&(G!=="]"||B.value==="["||B.value==="[^")){if(u.posix!==false&&G===":"){const t=B.value.slice(1);if(t.includes("[")){B.posix=true;if(t.includes(":")){const t=B.value.lastIndexOf("[");const e=B.value.slice(0,t);const u=B.value.slice(t+2);const n=r[u];if(n){B.value=e+n;m.backtrack=true;M();if(!f.output&&A.indexOf(B)===1){f.output=C;}continue}}}}if(G==="["&&D()!==":"||G==="-"&&D()==="]"){G=`\\${G}`;}if(G==="]"&&(B.value==="["||B.value==="[^")){G=`\\${G}`;}if(u.posix===true&&G==="!"&&B.value==="["){G="^";}B.value+=G;append({value:G});continue}if(m.quotes===1&&G!=='"'){G=o.escapeRegex(G);B.value+=G;append({value:G});continue}if(G==='"'){m.quotes=m.quotes===1?0:1;if(u.keepQuotes===true){push({type:"text",value:G});}continue}if(G==="("){increment("parens");push({type:"paren",value:G});continue}if(G===")"){if(m.parens===0&&u.strictBrackets===true){throw new SyntaxError(syntaxError("opening","("))}const t=w[w.length-1];if(t&&m.parens===t.parens+1){extglobClose(w.pop());continue}push({type:"paren",value:G,output:m.parens?")":"\\)"});decrement("parens");continue}if(G==="["){if(u.nobracket===true||!remaining().includes("]")){if(u.nobracket!==true&&u.strictBrackets===true){throw new SyntaxError(syntaxError("closing","]"))}G=`\\${G}`;}else {increment("brackets");}push({type:"bracket",value:G});continue}if(G==="]"){if(u.nobracket===true||B&&B.type==="bracket"&&B.value.length===1){push({type:"text",value:G,output:`\\${G}`});continue}if(m.brackets===0){if(u.strictBrackets===true){throw new SyntaxError(syntaxError("opening","["))}push({type:"text",value:G,output:`\\${G}`});continue}decrement("brackets");const t=B.value.slice(1);if(B.posix!==true&&t[0]==="^"&&!t.includes("/")){G=`/${G}`;}B.value+=G;append({value:G});if(u.literalBrackets===false||o.hasRegexChars(t)){continue}const e=o.escapeRegex(B.value);m.output=m.output.slice(0,-B.value.length);if(u.literalBrackets===true){m.output+=e;B.value=e;continue}B.value=`(${_}${e}|${B.value})`;m.output+=B.value;continue}if(G==="{"&&u.nobrace!==true){increment("braces");const t={type:"brace",value:G,output:"(",outputIndex:m.output.length,tokensIndex:m.tokens.length};N.push(t);push(t);continue}if(G==="}"){const t=N[N.length-1];if(u.nobrace===true||!t){push({type:"text",value:G,output:G});continue}let e=")";if(t.dots===true){const t=A.slice();const n=[];for(let e=t.length-1;e>=0;e--){A.pop();if(t[e].type==="brace"){break}if(t[e].type!=="dots"){n.unshift(t[e].value);}}e=expandRange(n,u);m.backtrack=true;}if(t.comma!==true&&t.dots!==true){const u=m.output.slice(0,t.outputIndex);const n=m.tokens.slice(t.tokensIndex);t.value=t.output="\\{";G=e="\\}";m.output=u;for(const t of n){m.output+=t.output||t.value;}}push({type:"brace",value:G,output:e});decrement("braces");N.pop();continue}if(G==="|"){if(w.length>0){w[w.length-1].conditions++;}push({type:"text",value:G});continue}if(G===","){let t=G;const e=N[N.length-1];if(e&&I[I.length-1]==="braces"){e.comma=true;t="|";}push({type:"comma",value:G,output:t});continue}if(G==="/"){if(B.type==="dot"&&m.index===m.start+1){m.start=m.index+1;m.consumed="";m.output="";A.pop();B=f;continue}push({type:"slash",value:G,output:b});continue}if(G==="."){if(m.braces>0&&B.type==="dot"){if(B.value===".")B.output=h;const t=N[N.length-1];B.type="dots";B.output+=G;B.value+=G;t.dots=true;continue}if(m.braces+m.parens===0&&B.type!=="bos"&&B.type!=="slash"){push({type:"text",value:G,output:h});continue}push({type:"dot",value:G,output:h});continue}if(G==="?"){const t=B&&B.value==="(";if(!t&&u.noextglob!==true&&D()==="("&&D(2)!=="?"){extglobOpen("qmark",G);continue}if(B&&B.type==="paren"){const t=D();let e=G;if(B.value==="("&&!/[!=<:]/.test(t)||t==="<"&&!/<([!=]|\w+>)/.test(remaining())){e=`\\${G}`;}push({type:"text",value:G,output:e});continue}if(u.dot!==true&&(B.type==="slash"||B.type==="bos")){push({type:"qmark",value:G,output:v});continue}push({type:"qmark",value:G,output:H});continue}if(G==="!"){if(u.noextglob!==true&&D()==="("){if(D(2)!=="?"||!/[!=<:]/.test(D(3))){extglobOpen("negate",G);continue}}if(u.nonegate!==true&&m.index===0){negate();continue}}if(G==="+"){if(u.noextglob!==true&&D()==="("&&D(2)!=="?"){extglobOpen("plus",G);continue}if(B&&B.value==="("||u.regex===false){push({type:"plus",value:G,output:g});continue}if(B&&(B.type==="bracket"||B.type==="paren"||B.type==="brace")||m.parens>0){push({type:"plus",value:G});continue}push({type:"plus",value:g});continue}if(G==="@"){if(u.noextglob!==true&&D()==="("&&D(2)!=="?"){push({type:"at",extglob:true,value:G,output:""});continue}push({type:"text",value:G});continue}if(G!=="*"){if(G==="$"||G==="^"){G=`\\${G}`;}const t=a.exec(remaining());if(t){G+=t[0];m.index+=t[0].length;}push({type:"text",value:G});continue}if(B&&(B.type==="globstar"||B.star===true)){B.type="star";B.star=true;B.value+=G;B.output=k;m.backtrack=true;m.globstar=true;consume(G);continue}let e=remaining();if(u.noextglob!==true&&/^\([^?]/.test(e)){extglobOpen("star",G);continue}if(B.type==="star"){if(u.noglobstar===true){consume(G);continue}const n=B.prev;const o=n.prev;const s=n.type==="slash"||n.type==="bos";const r=o&&(o.type==="star"||o.type==="globstar");if(u.bash===true&&(!s||e[0]&&e[0]!=="/")){push({type:"star",value:G,output:""});continue}const a=m.braces>0&&(n.type==="comma"||n.type==="brace");const i=w.length&&(n.type==="pipe"||n.type==="paren");if(!s&&n.type!=="paren"&&!a&&!i){push({type:"star",value:G,output:""});continue}while(e.slice(0,3)==="/**"){const u=t[m.index+4];if(u&&u!=="/"){break}e=e.slice(3);consume("/**",3);}if(n.type==="bos"&&eos()){B.type="globstar";B.value+=G;B.output=globstar(u);m.output=B.output;m.globstar=true;consume(G);continue}if(n.type==="slash"&&n.prev.type!=="bos"&&!r&&eos()){m.output=m.output.slice(0,-(n.output+B.output).length);n.output=`(?:${n.output}`;B.type="globstar";B.output=globstar(u)+(u.strictSlashes?")":"|$)");B.value+=G;m.globstar=true;m.output+=n.output+B.output;consume(G);continue}if(n.type==="slash"&&n.prev.type!=="bos"&&e[0]==="/"){const t=e[1]!==void 0?"|$":"";m.output=m.output.slice(0,-(n.output+B.output).length);n.output=`(?:${n.output}`;B.type="globstar";B.output=`${globstar(u)}${b}|${b}${t})`;B.value+=G;m.output+=n.output+B.output;m.globstar=true;consume(G+M());push({type:"slash",value:"/",output:""});continue}if(n.type==="bos"&&e[0]==="/"){B.type="globstar";B.value+=G;B.output=`(?:^|${b}|${globstar(u)}${b})`;m.output=B.output;m.globstar=true;consume(G+M());push({type:"slash",value:"/",output:""});continue}m.output=m.output.slice(0,-B.output.length);B.type="globstar";B.output=globstar(u);B.value+=G;m.output+=B.output;m.globstar=true;consume(G);continue}const n={type:"star",value:G,output:k};if(u.bash===true){n.output=".*?";if(B.type==="bos"||B.type==="slash"){n.output=T+n.output;}push(n);continue}if(B&&(B.type==="bracket"||B.type==="paren")&&u.regex===true){n.output=G;push(n);continue}if(m.index===m.start||B.type==="slash"||B.type==="dot"){if(B.type==="dot"){m.output+=x;B.output+=x;}else if(u.dot===true){m.output+=S;B.output+=S;}else {m.output+=T;B.output+=T;}if(D()!=="*"){m.output+=C;B.output+=C;}}push(n);}while(m.brackets>0){if(u.strictBrackets===true)throw new SyntaxError(syntaxError("closing","]"));m.output=o.escapeLast(m.output,"[");decrement("brackets");}while(m.parens>0){if(u.strictBrackets===true)throw new SyntaxError(syntaxError("closing",")"));m.output=o.escapeLast(m.output,"(");decrement("parens");}while(m.braces>0){if(u.strictBrackets===true)throw new SyntaxError(syntaxError("closing","}"));m.output=o.escapeLast(m.output,"{");decrement("braces");}if(u.strictSlashes!==true&&(B.type==="star"||B.type==="bracket")){push({type:"maybe_slash",value:"",output:`${b}?`});}if(m.backtrack===true){m.output="";for(const t of m.tokens){m.output+=t.output!=null?t.output:t.value;if(t.suffix){m.output+=t.suffix;}}}return m};parse.fastpaths=(t,e)=>{const u={...e};const r=typeof u.maxLength==="number"?Math.min(s,u.maxLength):s;const a=t.length;if(a>r){throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${r}`)}t=c[t]||t;const{DOT_LITERAL:i,SLASH_LITERAL:p,ONE_CHAR:l,DOTS_SLASH:f,NO_DOT:A,NO_DOTS:_,NO_DOTS_SLASH:R,STAR:E,START_ANCHOR:h}=n.globChars(u.windows);const g=u.dot?_:A;const b=u.dot?R:A;const C=u.capture?"":"?:";const y={negated:false,prefix:""};let $=u.bash===true?".*?":E;if(u.capture){$=`(${$})`;}const globstar=t=>{if(t.noglobstar===true)return $;return `(${C}(?:(?!${h}${t.dot?f:i}).)*?)`};const create=t=>{switch(t){case"*":return `${g}${l}${$}`;case".*":return `${i}${l}${$}`;case"*.*":return `${g}${$}${i}${l}${$}`;case"*/*":return `${g}${$}${p}${l}${b}${$}`;case"**":return g+globstar(u);case"**/*":return `(?:${g}${globstar(u)}${p})?${b}${l}${$}`;case"**/*.*":return `(?:${g}${globstar(u)}${p})?${b}${$}${i}${l}${$}`;case"**/.*":return `(?:${g}${globstar(u)}${p})?${i}${l}${$}`;default:{const e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;const u=create(e[1]);if(!u)return;return u+i+e[2]}}};const x=o.removePrefix(t,y);let S=create(x);if(S&&u.strictSlashes!==true){S+=`${p}?`;}return S};t.exports=parse;},510:(t,e,u)=>{const n=u(716);const o=u(697);const s=u(96);const r=u(154);const isObject=t=>t&&typeof t==="object"&&!Array.isArray(t);const picomatch=(t,e,u=false)=>{if(Array.isArray(t)){const n=t.map((t=>picomatch(t,e,u)));const arrayMatcher=t=>{for(const e of n){const u=e(t);if(u)return u}return false};return arrayMatcher}const n=isObject(t)&&t.tokens&&t.input;if(t===""||typeof t!=="string"&&!n){throw new TypeError("Expected pattern to be a non-empty string")}const o=e||{};const s=o.windows;const r=n?picomatch.compileRe(t,e):picomatch.makeRe(t,e,false,true);const a=r.state;delete r.state;let isIgnored=()=>false;if(o.ignore){const t={...e,ignore:null,onMatch:null,onResult:null};isIgnored=picomatch(o.ignore,t,u);}const matcher=(u,n=false)=>{const{isMatch:i,match:c,output:p}=picomatch.test(u,r,e,{glob:t,posix:s});const l={glob:t,state:a,regex:r,posix:s,input:u,output:p,match:c,isMatch:i};if(typeof o.onResult==="function"){o.onResult(l);}if(i===false){l.isMatch=false;return n?l:false}if(isIgnored(u)){if(typeof o.onIgnore==="function"){o.onIgnore(l);}l.isMatch=false;return n?l:false}if(typeof o.onMatch==="function"){o.onMatch(l);}return n?l:true};if(u){matcher.state=a;}return matcher};picomatch.test=(t,e,u,{glob:n,posix:o}={})=>{if(typeof t!=="string"){throw new TypeError("Expected input to be a string")}if(t===""){return {isMatch:false,output:""}}const r=u||{};const a=r.format||(o?s.toPosixSlashes:null);let i=t===n;let c=i&&a?a(t):t;if(i===false){c=a?a(t):t;i=c===n;}if(i===false||r.capture===true){if(r.matchBase===true||r.basename===true){i=picomatch.matchBase(t,e,u,o);}else {i=e.exec(c);}}return {isMatch:Boolean(i),match:i,output:c}};picomatch.matchBase=(t,e,u)=>{const n=e instanceof RegExp?e:picomatch.makeRe(e,u);return n.test(s.basename(t))};picomatch.isMatch=(t,e,u)=>picomatch(e,u)(t);picomatch.parse=(t,e)=>{if(Array.isArray(t))return t.map((t=>picomatch.parse(t,e)));return o(t,{...e,fastpaths:false})};picomatch.scan=(t,e)=>n(t,e);picomatch.compileRe=(t,e,u=false,n=false)=>{if(u===true){return t.output}const o=e||{};const s=o.contains?"":"^";const r=o.contains?"":"$";let a=`${s}(?:${t.output})${r}`;if(t&&t.negated===true){a=`^(?!${a}).*$`;}const i=picomatch.toRegex(a,e);if(n===true){i.state=t;}return i};picomatch.makeRe=(t,e={},u=false,n=false)=>{if(!t||typeof t!=="string"){throw new TypeError("Expected a non-empty string")}let s={negated:false,fastpaths:true};if(e.fastpaths!==false&&(t[0]==="."||t[0]==="*")){s.output=o.fastpaths(t,e);}if(!s.output){s=o(t,e);}return picomatch.compileRe(s,e,u,n)};picomatch.toRegex=(t,e)=>{try{const u=e||{};return new RegExp(t,u.flags||(u.nocase?"i":""))}catch(t){if(e&&e.debug===true)throw t;return /$^/}};picomatch.constants=r;t.exports=picomatch;},716:(t,e,u)=>{const n=u(96);const{CHAR_ASTERISK:o,CHAR_AT:s,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:a,CHAR_DOT:i,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:p,CHAR_LEFT_CURLY_BRACE:l,CHAR_LEFT_PARENTHESES:f,CHAR_LEFT_SQUARE_BRACKET:A,CHAR_PLUS:_,CHAR_QUESTION_MARK:R,CHAR_RIGHT_CURLY_BRACE:E,CHAR_RIGHT_PARENTHESES:h,CHAR_RIGHT_SQUARE_BRACKET:g}=u(154);const isPathSeparator=t=>t===p||t===r;const depth=t=>{if(t.isPrefix!==true){t.depth=t.isGlobstar?Infinity:1;}};const scan=(t,e)=>{const u=e||{};const b=t.length-1;const C=u.parts===true||u.scanToEnd===true;const y=[];const $=[];const x=[];let S=t;let H=-1;let v=0;let d=0;let L=false;let T=false;let O=false;let k=false;let m=false;let w=false;let N=false;let I=false;let B=false;let G=false;let D=0;let M;let P;let K={value:"",depth:0,isGlob:false};const eos=()=>H>=b;const peek=()=>S.charCodeAt(H+1);const advance=()=>{M=P;return S.charCodeAt(++H)};while(H<b){P=advance();let t;if(P===r){N=K.backslashes=true;P=advance();if(P===l){w=true;}continue}if(w===true||P===l){D++;while(eos()!==true&&(P=advance())){if(P===r){N=K.backslashes=true;advance();continue}if(P===l){D++;continue}if(w!==true&&P===i&&(P=advance())===i){L=K.isBrace=true;O=K.isGlob=true;G=true;if(C===true){continue}break}if(w!==true&&P===a){L=K.isBrace=true;O=K.isGlob=true;G=true;if(C===true){continue}break}if(P===E){D--;if(D===0){w=false;L=K.isBrace=true;G=true;break}}}if(C===true){continue}break}if(P===p){y.push(H);$.push(K);K={value:"",depth:0,isGlob:false};if(G===true)continue;if(M===i&&H===v+1){v+=2;continue}d=H+1;continue}if(u.noext!==true){const t=P===_||P===s||P===o||P===R||P===c;if(t===true&&peek()===f){O=K.isGlob=true;k=K.isExtglob=true;G=true;if(P===c&&H===v){B=true;}if(C===true){while(eos()!==true&&(P=advance())){if(P===r){N=K.backslashes=true;P=advance();continue}if(P===h){O=K.isGlob=true;G=true;break}}continue}break}}if(P===o){if(M===o)m=K.isGlobstar=true;O=K.isGlob=true;G=true;if(C===true){continue}break}if(P===R){O=K.isGlob=true;G=true;if(C===true){continue}break}if(P===A){while(eos()!==true&&(t=advance())){if(t===r){N=K.backslashes=true;advance();continue}if(t===g){T=K.isBracket=true;O=K.isGlob=true;G=true;break}}if(C===true){continue}break}if(u.nonegate!==true&&P===c&&H===v){I=K.negated=true;v++;continue}if(u.noparen!==true&&P===f){O=K.isGlob=true;if(C===true){while(eos()!==true&&(P=advance())){if(P===f){N=K.backslashes=true;P=advance();continue}if(P===h){G=true;break}}continue}break}if(O===true){G=true;if(C===true){continue}break}}if(u.noext===true){k=false;O=false;}let U=S;let X="";let F="";if(v>0){X=S.slice(0,v);S=S.slice(v);d-=v;}if(U&&O===true&&d>0){U=S.slice(0,d);F=S.slice(d);}else if(O===true){U="";F=S;}else {U=S;}if(U&&U!==""&&U!=="/"&&U!==S){if(isPathSeparator(U.charCodeAt(U.length-1))){U=U.slice(0,-1);}}if(u.unescape===true){if(F)F=n.removeBackslashes(F);if(U&&N===true){U=n.removeBackslashes(U);}}const Q={prefix:X,input:t,start:v,base:U,glob:F,isBrace:L,isBracket:T,isGlob:O,isExtglob:k,isGlobstar:m,negated:I,negatedExtglob:B};if(u.tokens===true){Q.maxDepth=0;if(!isPathSeparator(P)){$.push(K);}Q.tokens=$;}if(u.parts===true||u.tokens===true){let e;for(let n=0;n<y.length;n++){const o=e?e+1:v;const s=y[n];const r=t.slice(o,s);if(u.tokens){if(n===0&&v!==0){$[n].isPrefix=true;$[n].value=X;}else {$[n].value=r;}depth($[n]);Q.maxDepth+=$[n].depth;}if(n!==0||r!==""){x.push(r);}e=s;}if(e&&e+1<t.length){const n=t.slice(e+1);x.push(n);if(u.tokens){$[$.length-1].value=n;depth($[$.length-1]);Q.maxDepth+=$[$.length-1].depth;}}Q.slashes=y;Q.parts=x;}return Q};t.exports=scan;},96:(t,e,u)=>{const{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:r}=u(154);e.isObject=t=>t!==null&&typeof t==="object"&&!Array.isArray(t);e.hasRegexChars=t=>s.test(t);e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t);e.escapeRegex=t=>t.replace(r,"\\$1");e.toPosixSlashes=t=>t.replace(n,"/");e.removeBackslashes=t=>t.replace(o,(t=>t==="\\"?"":t));e.escapeLast=(t,u,n)=>{const o=t.lastIndexOf(u,n);if(o===-1)return t;if(t[o-1]==="\\")return e.escapeLast(t,u,o-1);return `${t.slice(0,o)}\\${t.slice(o)}`};e.removePrefix=(t,e={})=>{let u=t;if(u.startsWith("./")){u=u.slice(2);e.prefix="./";}return u};e.wrapOutput=(t,e={},u={})=>{const n=u.contains?"":"^";const o=u.contains?"":"$";let s=`${n}(?:${t})${o}`;if(e.negated===true){s=`(?:^(?!${s}).*$)`;}return s};e.basename=(t,{windows:e}={})=>{const u=t.split(e?/[\\/]/:"/");const n=u[u.length-1];if(n===""){return u[u.length-2]}return n};}};var e={};function __nccwpck_require__(u){var n=e[u];if(n!==undefined){return n.exports}var o=e[u]={exports:{}};var s=true;try{t[u](o,o.exports,__nccwpck_require__);s=false;}finally{if(s)delete e[u];}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var u=__nccwpck_require__(170);picomatch.exports=u;})();
|
|
1393
|
-
return picomatch.exports;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
var hasRequiredMatchRemotePattern;
|
|
1397
|
-
|
|
1398
|
-
function requireMatchRemotePattern () {
|
|
1399
|
-
if (hasRequiredMatchRemotePattern) return matchRemotePattern;
|
|
1400
|
-
hasRequiredMatchRemotePattern = 1;
|
|
1401
|
-
(function (exports) {
|
|
1402
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1403
|
-
value: true
|
|
1404
|
-
});
|
|
1405
|
-
function _export(target, all) {
|
|
1406
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
1407
|
-
enumerable: true,
|
|
1408
|
-
get: all[name]
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
_export(exports, {
|
|
1412
|
-
hasMatch: function() {
|
|
1413
|
-
return hasMatch;
|
|
1414
|
-
},
|
|
1415
|
-
matchRemotePattern: function() {
|
|
1416
|
-
return matchRemotePattern;
|
|
1417
|
-
}
|
|
1418
|
-
});
|
|
1419
|
-
const _picomatch = requirePicomatch();
|
|
1420
|
-
function matchRemotePattern(pattern, url) {
|
|
1421
|
-
if (pattern.protocol !== undefined) {
|
|
1422
|
-
const actualProto = url.protocol.slice(0, -1);
|
|
1423
|
-
if (pattern.protocol !== actualProto) {
|
|
1424
|
-
return false;
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
if (pattern.port !== undefined) {
|
|
1428
|
-
if (pattern.port !== url.port) {
|
|
1429
|
-
return false;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
if (pattern.hostname === undefined) {
|
|
1433
|
-
throw new Error("Pattern should define hostname but found\n" + JSON.stringify(pattern));
|
|
1434
|
-
} else {
|
|
1435
|
-
if (!(0, _picomatch.makeRe)(pattern.hostname).test(url.hostname)) {
|
|
1436
|
-
return false;
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
var _pattern_pathname;
|
|
1440
|
-
if (!(0, _picomatch.makeRe)((_pattern_pathname = pattern.pathname) != null ? _pattern_pathname : "**", {
|
|
1441
|
-
dot: true
|
|
1442
|
-
}).test(url.pathname)) {
|
|
1443
|
-
return false;
|
|
1444
|
-
}
|
|
1445
|
-
return true;
|
|
1446
|
-
}
|
|
1447
|
-
function hasMatch(domains, remotePatterns, url) {
|
|
1448
|
-
return domains.some((domain)=>url.hostname === domain) || remotePatterns.some((p)=>matchRemotePattern(p, url));
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
} (matchRemotePattern));
|
|
1453
|
-
return matchRemotePattern;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
var hasRequiredImageLoader;
|
|
1457
|
-
|
|
1458
|
-
function requireImageLoader () {
|
|
1459
|
-
if (hasRequiredImageLoader) return imageLoader;
|
|
1460
|
-
hasRequiredImageLoader = 1;
|
|
1461
|
-
(function (exports) {
|
|
1462
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1463
|
-
value: true
|
|
1464
|
-
});
|
|
1465
|
-
Object.defineProperty(exports, "default", {
|
|
1466
|
-
enumerable: true,
|
|
1467
|
-
get: function() {
|
|
1468
|
-
return _default;
|
|
1469
|
-
}
|
|
1470
|
-
});
|
|
1471
|
-
function defaultLoader(param) {
|
|
1472
|
-
let { config, src, width, quality } = param;
|
|
1473
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1474
|
-
const missingValues = [];
|
|
1475
|
-
// these should always be provided but make sure they are
|
|
1476
|
-
if (!src) missingValues.push("src");
|
|
1477
|
-
if (!width) missingValues.push("width");
|
|
1478
|
-
if (missingValues.length > 0) {
|
|
1479
|
-
throw new Error("Next Image Optimization requires " + missingValues.join(", ") + " to be provided. Make sure you pass them as props to the `next/image` component. Received: " + JSON.stringify({
|
|
1480
|
-
src,
|
|
1481
|
-
width,
|
|
1482
|
-
quality
|
|
1483
|
-
}));
|
|
1484
|
-
}
|
|
1485
|
-
if (src.startsWith("//")) {
|
|
1486
|
-
throw new Error('Failed to parse src "' + src + '" on `next/image`, protocol-relative URL (//) must be changed to an absolute URL (http:// or https://)');
|
|
1487
|
-
}
|
|
1488
|
-
if (!src.startsWith("/") && (config.domains || config.remotePatterns)) {
|
|
1489
|
-
let parsedSrc;
|
|
1490
|
-
try {
|
|
1491
|
-
parsedSrc = new URL(src);
|
|
1492
|
-
} catch (err) {
|
|
1493
|
-
console.error(err);
|
|
1494
|
-
throw new Error('Failed to parse src "' + src + '" on `next/image`, if using relative image it must start with a leading slash "/" or be an absolute URL (http:// or https://)');
|
|
1495
|
-
}
|
|
1496
|
-
if (process.env.NODE_ENV !== "test" && // micromatch isn't compatible with edge runtime
|
|
1497
|
-
process.env.NEXT_RUNTIME !== "edge") {
|
|
1498
|
-
// We use dynamic require because this should only error in development
|
|
1499
|
-
const { hasMatch } = requireMatchRemotePattern();
|
|
1500
|
-
if (!hasMatch(config.domains, config.remotePatterns, parsedSrc)) {
|
|
1501
|
-
throw new Error("Invalid src prop (" + src + ') on `next/image`, hostname "' + parsedSrc.hostname + '" is not configured under images in your `next.config.js`\n' + "See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host");
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
return config.path + "?url=" + encodeURIComponent(src) + "&w=" + width + "&q=" + (quality || 75) + (process.env.NEXT_DEPLOYMENT_ID ? "&dpl=" + process.env.NEXT_DEPLOYMENT_ID : "");
|
|
1507
|
-
}
|
|
1508
|
-
// We use this to determine if the import is the default loader
|
|
1509
|
-
// or a custom loader defined by the user in next.config.js
|
|
1510
|
-
defaultLoader.__next_img_default = true;
|
|
1511
|
-
const _default = defaultLoader;
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
} (imageLoader));
|
|
1515
|
-
return imageLoader;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
var hasRequiredImageComponent;
|
|
1519
|
-
|
|
1520
|
-
function requireImageComponent () {
|
|
1521
|
-
if (hasRequiredImageComponent) return imageComponent.exports;
|
|
1522
|
-
hasRequiredImageComponent = 1;
|
|
1523
|
-
(function (module, exports) {
|
|
1524
|
-
"use client";
|
|
1525
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1526
|
-
value: true
|
|
1527
|
-
});
|
|
1528
|
-
Object.defineProperty(exports, "Image", {
|
|
1529
|
-
enumerable: true,
|
|
1530
|
-
get: function() {
|
|
1531
|
-
return Image;
|
|
1532
|
-
}
|
|
1533
|
-
});
|
|
1534
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1535
|
-
const _interop_require_wildcard = /*@__PURE__*/ require_interop_require_wildcard();
|
|
1536
|
-
const _jsxruntime = require$$2;
|
|
1537
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(React$1);
|
|
1538
|
-
const _reactdom = /*#__PURE__*/ _interop_require_default._(require$$4);
|
|
1539
|
-
const _head = /*#__PURE__*/ _interop_require_default._(requireHead());
|
|
1540
|
-
const _getimgprops = requireGetImgProps();
|
|
1541
|
-
const _imageconfig = requireImageConfig();
|
|
1542
|
-
const _imageconfigcontextsharedruntime = requireImageConfigContext_sharedRuntime();
|
|
1543
|
-
const _warnonce = requireWarnOnce();
|
|
1544
|
-
const _routercontextsharedruntime = requireRouterContext_sharedRuntime();
|
|
1545
|
-
const _imageloader = /*#__PURE__*/ _interop_require_default._(requireImageLoader());
|
|
1546
|
-
// This is replaced by webpack define plugin
|
|
1547
|
-
const configEnv = process.env.__NEXT_IMAGE_OPTS;
|
|
1548
|
-
if (typeof window === "undefined") {
|
|
1549
|
-
globalThis.__NEXT_IMAGE_IMPORTED = true;
|
|
1550
|
-
}
|
|
1551
|
-
// See https://stackoverflow.com/q/39777833/266535 for why we use this ref
|
|
1552
|
-
// handler instead of the img's onLoad attribute.
|
|
1553
|
-
function handleLoading(img, placeholder, onLoadRef, onLoadingCompleteRef, setBlurComplete, unoptimized, sizesInput) {
|
|
1554
|
-
const src = img == null ? void 0 : img.src;
|
|
1555
|
-
if (!img || img["data-loaded-src"] === src) {
|
|
1556
|
-
return;
|
|
1557
|
-
}
|
|
1558
|
-
img["data-loaded-src"] = src;
|
|
1559
|
-
const p = "decode" in img ? img.decode() : Promise.resolve();
|
|
1560
|
-
p.catch(()=>{}).then(()=>{
|
|
1561
|
-
if (!img.parentElement || !img.isConnected) {
|
|
1562
|
-
// Exit early in case of race condition:
|
|
1563
|
-
// - onload() is called
|
|
1564
|
-
// - decode() is called but incomplete
|
|
1565
|
-
// - unmount is called
|
|
1566
|
-
// - decode() completes
|
|
1567
|
-
return;
|
|
1568
|
-
}
|
|
1569
|
-
if (placeholder !== "empty") {
|
|
1570
|
-
setBlurComplete(true);
|
|
1571
|
-
}
|
|
1572
|
-
if (onLoadRef == null ? void 0 : onLoadRef.current) {
|
|
1573
|
-
// Since we don't have the SyntheticEvent here,
|
|
1574
|
-
// we must create one with the same shape.
|
|
1575
|
-
// See https://reactjs.org/docs/events.html
|
|
1576
|
-
const event = new Event("load");
|
|
1577
|
-
Object.defineProperty(event, "target", {
|
|
1578
|
-
writable: false,
|
|
1579
|
-
value: img
|
|
1580
|
-
});
|
|
1581
|
-
let prevented = false;
|
|
1582
|
-
let stopped = false;
|
|
1583
|
-
onLoadRef.current({
|
|
1584
|
-
...event,
|
|
1585
|
-
nativeEvent: event,
|
|
1586
|
-
currentTarget: img,
|
|
1587
|
-
target: img,
|
|
1588
|
-
isDefaultPrevented: ()=>prevented,
|
|
1589
|
-
isPropagationStopped: ()=>stopped,
|
|
1590
|
-
persist: ()=>{},
|
|
1591
|
-
preventDefault: ()=>{
|
|
1592
|
-
prevented = true;
|
|
1593
|
-
event.preventDefault();
|
|
1594
|
-
},
|
|
1595
|
-
stopPropagation: ()=>{
|
|
1596
|
-
stopped = true;
|
|
1597
|
-
event.stopPropagation();
|
|
1598
|
-
}
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
if (onLoadingCompleteRef == null ? void 0 : onLoadingCompleteRef.current) {
|
|
1602
|
-
onLoadingCompleteRef.current(img);
|
|
1603
|
-
}
|
|
1604
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1605
|
-
const origSrc = new URL(src, "http://n").searchParams.get("url") || src;
|
|
1606
|
-
if (img.getAttribute("data-nimg") === "fill") {
|
|
1607
|
-
if (!unoptimized && (!sizesInput || sizesInput === "100vw")) {
|
|
1608
|
-
let widthViewportRatio = img.getBoundingClientRect().width / window.innerWidth;
|
|
1609
|
-
if (widthViewportRatio < 0.6) {
|
|
1610
|
-
if (sizesInput === "100vw") {
|
|
1611
|
-
(0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" prop and "sizes" prop of "100vw", but image is not rendered at full viewport width. Please adjust "sizes" to improve page performance. Read more: https://nextjs.org/docs/api-reference/next/image#sizes');
|
|
1612
|
-
} else {
|
|
1613
|
-
(0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" but is missing "sizes" prop. Please add it to improve page performance. Read more: https://nextjs.org/docs/api-reference/next/image#sizes');
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
if (img.parentElement) {
|
|
1618
|
-
const { position } = window.getComputedStyle(img.parentElement);
|
|
1619
|
-
const valid = [
|
|
1620
|
-
"absolute",
|
|
1621
|
-
"fixed",
|
|
1622
|
-
"relative"
|
|
1623
|
-
];
|
|
1624
|
-
if (!valid.includes(position)) {
|
|
1625
|
-
(0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" and parent element with invalid "position". Provided "' + position + '" should be one of ' + valid.map(String).join(",") + ".");
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
if (img.height === 0) {
|
|
1629
|
-
(0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" and a height value of 0. This is likely because the parent element of the image has not been styled to have a set height.');
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
const heightModified = img.height.toString() !== img.getAttribute("height");
|
|
1633
|
-
const widthModified = img.width.toString() !== img.getAttribute("width");
|
|
1634
|
-
if (heightModified && !widthModified || !heightModified && widthModified) {
|
|
1635
|
-
(0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has either width or height modified, but not the other. If you use CSS to change the size of your image, also include the styles \'width: "auto"\' or \'height: "auto"\' to maintain the aspect ratio.');
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
});
|
|
1639
|
-
}
|
|
1640
|
-
function getDynamicProps(fetchPriority) {
|
|
1641
|
-
const [majorStr, minorStr] = _react.version.split(".", 2);
|
|
1642
|
-
const major = parseInt(majorStr, 10);
|
|
1643
|
-
const minor = parseInt(minorStr, 10);
|
|
1644
|
-
if (major > 18 || major === 18 && minor >= 3) {
|
|
1645
|
-
// In React 18.3.0 or newer, we must use camelCase
|
|
1646
|
-
// prop to avoid "Warning: Invalid DOM property".
|
|
1647
|
-
// See https://github.com/facebook/react/pull/25927
|
|
1648
|
-
return {
|
|
1649
|
-
fetchPriority
|
|
1650
|
-
};
|
|
1651
|
-
}
|
|
1652
|
-
// In React 18.2.0 or older, we must use lowercase prop
|
|
1653
|
-
// to avoid "Warning: Invalid DOM property".
|
|
1654
|
-
return {
|
|
1655
|
-
fetchpriority: fetchPriority
|
|
1656
|
-
};
|
|
1657
|
-
}
|
|
1658
|
-
const ImageElement = /*#__PURE__*/ (0, _react.forwardRef)((param, forwardedRef)=>{
|
|
1659
|
-
let { src, srcSet, sizes, height, width, decoding, className, style, fetchPriority, placeholder, loading, unoptimized, fill, onLoadRef, onLoadingCompleteRef, setBlurComplete, setShowAltText, sizesInput, onLoad, onError, ...rest } = param;
|
|
1660
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)("img", {
|
|
1661
|
-
...rest,
|
|
1662
|
-
...getDynamicProps(fetchPriority),
|
|
1663
|
-
// It's intended to keep `loading` before `src` because React updates
|
|
1664
|
-
// props in order which causes Safari/Firefox to not lazy load properly.
|
|
1665
|
-
// See https://github.com/facebook/react/issues/25883
|
|
1666
|
-
loading: loading,
|
|
1667
|
-
width: width,
|
|
1668
|
-
height: height,
|
|
1669
|
-
decoding: decoding,
|
|
1670
|
-
"data-nimg": fill ? "fill" : "1",
|
|
1671
|
-
className: className,
|
|
1672
|
-
style: style,
|
|
1673
|
-
// It's intended to keep `src` the last attribute because React updates
|
|
1674
|
-
// attributes in order. If we keep `src` the first one, Safari will
|
|
1675
|
-
// immediately start to fetch `src`, before `sizes` and `srcSet` are even
|
|
1676
|
-
// updated by React. That causes multiple unnecessary requests if `srcSet`
|
|
1677
|
-
// and `sizes` are defined.
|
|
1678
|
-
// This bug cannot be reproduced in Chrome or Firefox.
|
|
1679
|
-
sizes: sizes,
|
|
1680
|
-
srcSet: srcSet,
|
|
1681
|
-
src: src,
|
|
1682
|
-
ref: (0, _react.useCallback)((img)=>{
|
|
1683
|
-
if (forwardedRef) {
|
|
1684
|
-
if (typeof forwardedRef === "function") forwardedRef(img);
|
|
1685
|
-
else if (typeof forwardedRef === "object") {
|
|
1686
|
-
// @ts-ignore - .current is read only it's usually assigned by react internally
|
|
1687
|
-
forwardedRef.current = img;
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
if (!img) {
|
|
1691
|
-
return;
|
|
1692
|
-
}
|
|
1693
|
-
if (onError) {
|
|
1694
|
-
// If the image has an error before react hydrates, then the error is lost.
|
|
1695
|
-
// The workaround is to wait until the image is mounted which is after hydration,
|
|
1696
|
-
// then we set the src again to trigger the error handler (if there was an error).
|
|
1697
|
-
// eslint-disable-next-line no-self-assign
|
|
1698
|
-
img.src = img.src;
|
|
1699
|
-
}
|
|
1700
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1701
|
-
if (!src) {
|
|
1702
|
-
console.error('Image is missing required "src" property:', img);
|
|
1703
|
-
}
|
|
1704
|
-
if (img.getAttribute("alt") === null) {
|
|
1705
|
-
console.error('Image is missing required "alt" property. Please add Alternative Text to describe the image for screen readers and search engines.');
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
if (img.complete) {
|
|
1709
|
-
handleLoading(img, placeholder, onLoadRef, onLoadingCompleteRef, setBlurComplete, unoptimized, sizesInput);
|
|
1710
|
-
}
|
|
1711
|
-
}, [
|
|
1712
|
-
src,
|
|
1713
|
-
placeholder,
|
|
1714
|
-
onLoadRef,
|
|
1715
|
-
onLoadingCompleteRef,
|
|
1716
|
-
setBlurComplete,
|
|
1717
|
-
onError,
|
|
1718
|
-
unoptimized,
|
|
1719
|
-
sizesInput,
|
|
1720
|
-
forwardedRef
|
|
1721
|
-
]),
|
|
1722
|
-
onLoad: (event)=>{
|
|
1723
|
-
const img = event.currentTarget;
|
|
1724
|
-
handleLoading(img, placeholder, onLoadRef, onLoadingCompleteRef, setBlurComplete, unoptimized, sizesInput);
|
|
1725
|
-
},
|
|
1726
|
-
onError: (event)=>{
|
|
1727
|
-
// if the real image fails to load, this will ensure "alt" is visible
|
|
1728
|
-
setShowAltText(true);
|
|
1729
|
-
if (placeholder !== "empty") {
|
|
1730
|
-
// If the real image fails to load, this will still remove the placeholder.
|
|
1731
|
-
setBlurComplete(true);
|
|
1732
|
-
}
|
|
1733
|
-
if (onError) {
|
|
1734
|
-
onError(event);
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
});
|
|
1738
|
-
});
|
|
1739
|
-
function ImagePreload(param) {
|
|
1740
|
-
let { isAppRouter, imgAttributes } = param;
|
|
1741
|
-
const opts = {
|
|
1742
|
-
as: "image",
|
|
1743
|
-
imageSrcSet: imgAttributes.srcSet,
|
|
1744
|
-
imageSizes: imgAttributes.sizes,
|
|
1745
|
-
crossOrigin: imgAttributes.crossOrigin,
|
|
1746
|
-
referrerPolicy: imgAttributes.referrerPolicy,
|
|
1747
|
-
...getDynamicProps(imgAttributes.fetchPriority)
|
|
1748
|
-
};
|
|
1749
|
-
if (isAppRouter && _reactdom.default.preload) {
|
|
1750
|
-
// See https://github.com/facebook/react/pull/26940
|
|
1751
|
-
_reactdom.default.preload(imgAttributes.src, // @ts-expect-error TODO: upgrade to `@types/react-dom@18.3.x`
|
|
1752
|
-
opts);
|
|
1753
|
-
return null;
|
|
1754
|
-
}
|
|
1755
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_head.default, {
|
|
1756
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
|
|
1757
|
-
rel: "preload",
|
|
1758
|
-
// Note how we omit the `href` attribute, as it would only be relevant
|
|
1759
|
-
// for browsers that do not support `imagesrcset`, and in those cases
|
|
1760
|
-
// it would cause the incorrect image to be preloaded.
|
|
1761
|
-
//
|
|
1762
|
-
// https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset
|
|
1763
|
-
href: imgAttributes.srcSet ? undefined : imgAttributes.src,
|
|
1764
|
-
...opts
|
|
1765
|
-
}, "__nimg-" + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes)
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
const Image = /*#__PURE__*/ (0, _react.forwardRef)((props, forwardedRef)=>{
|
|
1769
|
-
const pagesRouter = (0, _react.useContext)(_routercontextsharedruntime.RouterContext);
|
|
1770
|
-
// We're in the app directory if there is no pages router.
|
|
1771
|
-
const isAppRouter = !pagesRouter;
|
|
1772
|
-
const configContext = (0, _react.useContext)(_imageconfigcontextsharedruntime.ImageConfigContext);
|
|
1773
|
-
const config = (0, _react.useMemo)(()=>{
|
|
1774
|
-
const c = configEnv || configContext || _imageconfig.imageConfigDefault;
|
|
1775
|
-
const allSizes = [
|
|
1776
|
-
...c.deviceSizes,
|
|
1777
|
-
...c.imageSizes
|
|
1778
|
-
].sort((a, b)=>a - b);
|
|
1779
|
-
const deviceSizes = c.deviceSizes.sort((a, b)=>a - b);
|
|
1780
|
-
return {
|
|
1781
|
-
...c,
|
|
1782
|
-
allSizes,
|
|
1783
|
-
deviceSizes
|
|
1784
|
-
};
|
|
1785
|
-
}, [
|
|
1786
|
-
configContext
|
|
1787
|
-
]);
|
|
1788
|
-
const { onLoad, onLoadingComplete } = props;
|
|
1789
|
-
const onLoadRef = (0, _react.useRef)(onLoad);
|
|
1790
|
-
(0, _react.useEffect)(()=>{
|
|
1791
|
-
onLoadRef.current = onLoad;
|
|
1792
|
-
}, [
|
|
1793
|
-
onLoad
|
|
1794
|
-
]);
|
|
1795
|
-
const onLoadingCompleteRef = (0, _react.useRef)(onLoadingComplete);
|
|
1796
|
-
(0, _react.useEffect)(()=>{
|
|
1797
|
-
onLoadingCompleteRef.current = onLoadingComplete;
|
|
1798
|
-
}, [
|
|
1799
|
-
onLoadingComplete
|
|
1800
|
-
]);
|
|
1801
|
-
const [blurComplete, setBlurComplete] = (0, _react.useState)(false);
|
|
1802
|
-
const [showAltText, setShowAltText] = (0, _react.useState)(false);
|
|
1803
|
-
const { props: imgAttributes, meta: imgMeta } = (0, _getimgprops.getImgProps)(props, {
|
|
1804
|
-
defaultLoader: _imageloader.default,
|
|
1805
|
-
imgConf: config,
|
|
1806
|
-
blurComplete,
|
|
1807
|
-
showAltText
|
|
1808
|
-
});
|
|
1809
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
1810
|
-
children: [
|
|
1811
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(ImageElement, {
|
|
1812
|
-
...imgAttributes,
|
|
1813
|
-
unoptimized: imgMeta.unoptimized,
|
|
1814
|
-
placeholder: imgMeta.placeholder,
|
|
1815
|
-
fill: imgMeta.fill,
|
|
1816
|
-
onLoadRef: onLoadRef,
|
|
1817
|
-
onLoadingCompleteRef: onLoadingCompleteRef,
|
|
1818
|
-
setBlurComplete: setBlurComplete,
|
|
1819
|
-
setShowAltText: setShowAltText,
|
|
1820
|
-
sizesInput: props.sizes,
|
|
1821
|
-
ref: forwardedRef
|
|
1822
|
-
}),
|
|
1823
|
-
imgMeta.priority ? /*#__PURE__*/ (0, _jsxruntime.jsx)(ImagePreload, {
|
|
1824
|
-
isAppRouter: isAppRouter,
|
|
1825
|
-
imgAttributes: imgAttributes
|
|
1826
|
-
}) : null
|
|
1827
|
-
]
|
|
1828
|
-
});
|
|
1829
|
-
});
|
|
1830
|
-
|
|
1831
|
-
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
1832
|
-
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
1833
|
-
Object.assign(exports.default, exports);
|
|
1834
|
-
module.exports = exports.default;
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
} (imageComponent, imageComponent.exports));
|
|
1839
|
-
return imageComponent.exports;
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
var hasRequiredImageExternal;
|
|
1843
|
-
|
|
1844
|
-
function requireImageExternal () {
|
|
1845
|
-
if (hasRequiredImageExternal) return imageExternal;
|
|
1846
|
-
hasRequiredImageExternal = 1;
|
|
1847
|
-
(function (exports) {
|
|
1848
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1849
|
-
value: true
|
|
1850
|
-
});
|
|
1851
|
-
function _export(target, all) {
|
|
1852
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
1853
|
-
enumerable: true,
|
|
1854
|
-
get: all[name]
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
_export(exports, {
|
|
1858
|
-
default: function() {
|
|
1859
|
-
return _default;
|
|
1860
|
-
},
|
|
1861
|
-
getImageProps: function() {
|
|
1862
|
-
return getImageProps;
|
|
1863
|
-
}
|
|
1864
|
-
});
|
|
1865
|
-
const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
|
|
1866
|
-
const _getimgprops = requireGetImgProps();
|
|
1867
|
-
const _imagecomponent = requireImageComponent();
|
|
1868
|
-
const _imageloader = /*#__PURE__*/ _interop_require_default._(requireImageLoader());
|
|
1869
|
-
function getImageProps(imgProps) {
|
|
1870
|
-
const { props } = (0, _getimgprops.getImgProps)(imgProps, {
|
|
1871
|
-
defaultLoader: _imageloader.default,
|
|
1872
|
-
// This is replaced by webpack define plugin
|
|
1873
|
-
imgConf: process.env.__NEXT_IMAGE_OPTS
|
|
1874
|
-
});
|
|
1875
|
-
// Normally we don't care about undefined props because we pass to JSX,
|
|
1876
|
-
// but this exported function could be used by the end user for anything
|
|
1877
|
-
// so we delete undefined props to clean it up a little.
|
|
1878
|
-
for (const [key, value] of Object.entries(props)){
|
|
1879
|
-
if (value === undefined) {
|
|
1880
|
-
delete props[key];
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
return {
|
|
1884
|
-
props
|
|
1885
|
-
};
|
|
1886
|
-
}
|
|
1887
|
-
const _default = _imagecomponent.Image;
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
} (imageExternal));
|
|
1891
|
-
return imageExternal;
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
var image;
|
|
1895
|
-
var hasRequiredImage;
|
|
1896
|
-
|
|
1897
|
-
function requireImage () {
|
|
1898
|
-
if (hasRequiredImage) return image;
|
|
1899
|
-
hasRequiredImage = 1;
|
|
1900
|
-
image = requireImageExternal();
|
|
1901
|
-
return image;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
var imageExports = requireImage();
|
|
1905
|
-
var NextImage = /*@__PURE__*/getDefaultExportFromCjs(imageExports);
|
|
1906
|
-
|
|
1907
258
|
var sizeMap = {
|
|
1908
259
|
sm: {
|
|
1909
260
|
element: 32,
|
|
@@ -1925,7 +276,7 @@ var Avatar = function Avatar(_a) {
|
|
|
1925
276
|
_f = _a.size,
|
|
1926
277
|
size = _f === void 0 ? "md" : _f,
|
|
1927
278
|
className = _a.className,
|
|
1928
|
-
props = __rest(_a, ["src", "alt", "size", "className"]);
|
|
279
|
+
props = tslib.__rest(_a, ["src", "alt", "size", "className"]);
|
|
1929
280
|
return /*#__PURE__*/React.createElement("div", {
|
|
1930
281
|
className: cn("rounded-4xl overflow-hidden", ((_b = sizeMap[size]) === null || _b === void 0 ? void 0 : _b.styles) || ((_c = sizeMap["md"]) === null || _c === void 0 ? void 0 : _c.styles), className)
|
|
1931
282
|
}, /*#__PURE__*/React.createElement(NextImage, _extends({
|
|
@@ -1945,9 +296,9 @@ var Textarea = function Textarea(_a) {
|
|
|
1945
296
|
className = _a.className,
|
|
1946
297
|
required = _a.required,
|
|
1947
298
|
error = _a.error,
|
|
1948
|
-
props = __rest(_a, ["placeholder", "label", "onChange", "defaultValue", "className", "required", "error"]);
|
|
1949
|
-
var textareaRef = React
|
|
1950
|
-
React
|
|
299
|
+
props = tslib.__rest(_a, ["placeholder", "label", "onChange", "defaultValue", "className", "required", "error"]);
|
|
300
|
+
var textareaRef = React.useRef(null);
|
|
301
|
+
React.useEffect(function () {
|
|
1951
302
|
if (defaultValue && textareaRef.current) textareaRef.current.value = defaultValue;
|
|
1952
303
|
}, [defaultValue]);
|
|
1953
304
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -1970,12 +321,12 @@ var Tooltip = function Tooltip(_a) {
|
|
|
1970
321
|
var children = _a.children,
|
|
1971
322
|
content = _a.content,
|
|
1972
323
|
className = _a.className,
|
|
1973
|
-
props = __rest(_a, ["children", "content", "className"]);
|
|
1974
|
-
var id = React
|
|
1975
|
-
var _b = React
|
|
324
|
+
props = tslib.__rest(_a, ["children", "content", "className"]);
|
|
325
|
+
var id = React.useId();
|
|
326
|
+
var _b = React.useState(false),
|
|
1976
327
|
show = _b[0],
|
|
1977
328
|
setShow = _b[1];
|
|
1978
|
-
React
|
|
329
|
+
React.useEffect(function () {
|
|
1979
330
|
var handleMouseEnter = function handleMouseEnter() {
|
|
1980
331
|
return setShow(true);
|
|
1981
332
|
};
|
|
@@ -2030,9 +381,9 @@ function Modal(_a) {
|
|
|
2030
381
|
open = _a.open,
|
|
2031
382
|
onClose = _a.onClose,
|
|
2032
383
|
className = _a.className;
|
|
2033
|
-
var modalRef = React
|
|
2034
|
-
var previouslyFocusedElement = React
|
|
2035
|
-
React
|
|
384
|
+
var modalRef = React.useRef(null);
|
|
385
|
+
var previouslyFocusedElement = React.useRef(null);
|
|
386
|
+
React.useEffect(function () {
|
|
2036
387
|
var _a;
|
|
2037
388
|
if (open) {
|
|
2038
389
|
previouslyFocusedElement.current = document.activeElement;
|
|
@@ -2053,7 +404,7 @@ function Modal(_a) {
|
|
|
2053
404
|
}
|
|
2054
405
|
}, [open, onClose]);
|
|
2055
406
|
if (!open) return null;
|
|
2056
|
-
return /*#__PURE__*/
|
|
407
|
+
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
2057
408
|
className: "fixed inset-0 z-50",
|
|
2058
409
|
role: "dialog",
|
|
2059
410
|
"aria-modal": "true",
|
|
@@ -2093,7 +444,7 @@ var Badge = function Badge(_a) {
|
|
|
2093
444
|
variant = _b === void 0 ? "primary" : _b,
|
|
2094
445
|
icon = _a.icon,
|
|
2095
446
|
className = _a.className,
|
|
2096
|
-
props = __rest(_a, ["children", "variant", "icon", "className"]);
|
|
447
|
+
props = tslib.__rest(_a, ["children", "variant", "icon", "className"]);
|
|
2097
448
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
2098
449
|
className: cn("px-2 py-2 rounded-4xl bg-opacity-20 hover:bg-opacity-40 transition-all flex items-center justify-center text-xs font-semibold", className, (styleMap === null || styleMap === void 0 ? void 0 : styleMap[variant]) || styleMap["primary"])
|
|
2099
450
|
}), icon && /*#__PURE__*/React.createElement("span", {
|
|
@@ -2101,2077 +452,6 @@ var Badge = function Badge(_a) {
|
|
|
2101
452
|
}, icon), children);
|
|
2102
453
|
};
|
|
2103
454
|
|
|
2104
|
-
(function (Prism) {
|
|
2105
|
-
|
|
2106
|
-
var javascript = Prism.util.clone(Prism.languages.javascript);
|
|
2107
|
-
|
|
2108
|
-
var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
|
|
2109
|
-
var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
|
|
2110
|
-
var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
|
|
2111
|
-
|
|
2112
|
-
/**
|
|
2113
|
-
* @param {string} source
|
|
2114
|
-
* @param {string} [flags]
|
|
2115
|
-
*/
|
|
2116
|
-
function re(source, flags) {
|
|
2117
|
-
source = source
|
|
2118
|
-
.replace(/<S>/g, function () { return space; })
|
|
2119
|
-
.replace(/<BRACES>/g, function () { return braces; })
|
|
2120
|
-
.replace(/<SPREAD>/g, function () { return spread; });
|
|
2121
|
-
return RegExp(source, flags);
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
spread = re(spread).source;
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
Prism.languages.jsx = Prism.languages.extend('markup', javascript);
|
|
2128
|
-
Prism.languages.jsx.tag.pattern = re(
|
|
2129
|
-
/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
|
|
2130
|
-
);
|
|
2131
|
-
|
|
2132
|
-
Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/;
|
|
2133
|
-
Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
|
|
2134
|
-
Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
|
|
2135
|
-
Prism.languages.jsx.tag.inside['comment'] = javascript['comment'];
|
|
2136
|
-
|
|
2137
|
-
Prism.languages.insertBefore('inside', 'attr-name', {
|
|
2138
|
-
'spread': {
|
|
2139
|
-
pattern: re(/<SPREAD>/.source),
|
|
2140
|
-
inside: Prism.languages.jsx
|
|
2141
|
-
}
|
|
2142
|
-
}, Prism.languages.jsx.tag);
|
|
2143
|
-
|
|
2144
|
-
Prism.languages.insertBefore('inside', 'special-attr', {
|
|
2145
|
-
'script': {
|
|
2146
|
-
// Allow for two levels of nesting
|
|
2147
|
-
pattern: re(/=<BRACES>/.source),
|
|
2148
|
-
alias: 'language-javascript',
|
|
2149
|
-
inside: {
|
|
2150
|
-
'script-punctuation': {
|
|
2151
|
-
pattern: /^=(?=\{)/,
|
|
2152
|
-
alias: 'punctuation'
|
|
2153
|
-
},
|
|
2154
|
-
rest: Prism.languages.jsx
|
|
2155
|
-
},
|
|
2156
|
-
}
|
|
2157
|
-
}, Prism.languages.jsx.tag);
|
|
2158
|
-
|
|
2159
|
-
// The following will handle plain text inside tags
|
|
2160
|
-
var stringifyToken = function (token) {
|
|
2161
|
-
if (!token) {
|
|
2162
|
-
return '';
|
|
2163
|
-
}
|
|
2164
|
-
if (typeof token === 'string') {
|
|
2165
|
-
return token;
|
|
2166
|
-
}
|
|
2167
|
-
if (typeof token.content === 'string') {
|
|
2168
|
-
return token.content;
|
|
2169
|
-
}
|
|
2170
|
-
return token.content.map(stringifyToken).join('');
|
|
2171
|
-
};
|
|
2172
|
-
|
|
2173
|
-
var walkTokens = function (tokens) {
|
|
2174
|
-
var openedTags = [];
|
|
2175
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
2176
|
-
var token = tokens[i];
|
|
2177
|
-
var notTagNorBrace = false;
|
|
2178
|
-
|
|
2179
|
-
if (typeof token !== 'string') {
|
|
2180
|
-
if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
|
|
2181
|
-
// We found a tag, now find its kind
|
|
2182
|
-
|
|
2183
|
-
if (token.content[0].content[0].content === '</') {
|
|
2184
|
-
// Closing tag
|
|
2185
|
-
if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
|
|
2186
|
-
// Pop matching opening tag
|
|
2187
|
-
openedTags.pop();
|
|
2188
|
-
}
|
|
2189
|
-
} else {
|
|
2190
|
-
if (token.content[token.content.length - 1].content === '/>') ; else {
|
|
2191
|
-
// Opening tag
|
|
2192
|
-
openedTags.push({
|
|
2193
|
-
tagName: stringifyToken(token.content[0].content[1]),
|
|
2194
|
-
openedBraces: 0
|
|
2195
|
-
});
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
} else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
|
|
2199
|
-
|
|
2200
|
-
// Here we might have entered a JSX context inside a tag
|
|
2201
|
-
openedTags[openedTags.length - 1].openedBraces++;
|
|
2202
|
-
|
|
2203
|
-
} else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
|
|
2204
|
-
|
|
2205
|
-
// Here we might have left a JSX context inside a tag
|
|
2206
|
-
openedTags[openedTags.length - 1].openedBraces--;
|
|
2207
|
-
|
|
2208
|
-
} else {
|
|
2209
|
-
notTagNorBrace = true;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
if (notTagNorBrace || typeof token === 'string') {
|
|
2213
|
-
if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
|
|
2214
|
-
// Here we are inside a tag, and not inside a JSX context.
|
|
2215
|
-
// That's plain text: drop any tokens matched.
|
|
2216
|
-
var plainText = stringifyToken(token);
|
|
2217
|
-
|
|
2218
|
-
// And merge text with adjacent text
|
|
2219
|
-
if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
|
|
2220
|
-
plainText += stringifyToken(tokens[i + 1]);
|
|
2221
|
-
tokens.splice(i + 1, 1);
|
|
2222
|
-
}
|
|
2223
|
-
if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
|
|
2224
|
-
plainText = stringifyToken(tokens[i - 1]) + plainText;
|
|
2225
|
-
tokens.splice(i - 1, 1);
|
|
2226
|
-
i--;
|
|
2227
|
-
}
|
|
2228
|
-
|
|
2229
|
-
tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
if (token.content && typeof token.content !== 'string') {
|
|
2234
|
-
walkTokens(token.content);
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
};
|
|
2238
|
-
|
|
2239
|
-
Prism.hooks.add('after-tokenize', function (env) {
|
|
2240
|
-
if (env.language !== 'jsx' && env.language !== 'tsx') {
|
|
2241
|
-
return;
|
|
2242
|
-
}
|
|
2243
|
-
walkTokens(env.tokens);
|
|
2244
|
-
});
|
|
2245
|
-
|
|
2246
|
-
}(Prism));
|
|
2247
|
-
|
|
2248
|
-
var prismTypescript = {};
|
|
2249
|
-
|
|
2250
|
-
var hasRequiredPrismTypescript;
|
|
2251
|
-
|
|
2252
|
-
function requirePrismTypescript () {
|
|
2253
|
-
if (hasRequiredPrismTypescript) return prismTypescript;
|
|
2254
|
-
hasRequiredPrismTypescript = 1;
|
|
2255
|
-
(function (Prism) {
|
|
2256
|
-
|
|
2257
|
-
Prism.languages.typescript = Prism.languages.extend('javascript', {
|
|
2258
|
-
'class-name': {
|
|
2259
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
|
|
2260
|
-
lookbehind: true,
|
|
2261
|
-
greedy: true,
|
|
2262
|
-
inside: null // see below
|
|
2263
|
-
},
|
|
2264
|
-
'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/,
|
|
2265
|
-
});
|
|
2266
|
-
|
|
2267
|
-
// The keywords TypeScript adds to JavaScript
|
|
2268
|
-
Prism.languages.typescript.keyword.push(
|
|
2269
|
-
/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
|
|
2270
|
-
// keywords that have to be followed by an identifier
|
|
2271
|
-
/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
|
|
2272
|
-
// This is for `import type *, {}`
|
|
2273
|
-
/\btype\b(?=\s*(?:[\{*]|$))/
|
|
2274
|
-
);
|
|
2275
|
-
|
|
2276
|
-
// doesn't work with TS because TS is too complex
|
|
2277
|
-
delete Prism.languages.typescript['parameter'];
|
|
2278
|
-
delete Prism.languages.typescript['literal-property'];
|
|
2279
|
-
|
|
2280
|
-
// a version of typescript specifically for highlighting types
|
|
2281
|
-
var typeInside = Prism.languages.extend('typescript', {});
|
|
2282
|
-
delete typeInside['class-name'];
|
|
2283
|
-
|
|
2284
|
-
Prism.languages.typescript['class-name'].inside = typeInside;
|
|
2285
|
-
|
|
2286
|
-
Prism.languages.insertBefore('typescript', 'function', {
|
|
2287
|
-
'decorator': {
|
|
2288
|
-
pattern: /@[$\w\xA0-\uFFFF]+/,
|
|
2289
|
-
inside: {
|
|
2290
|
-
'at': {
|
|
2291
|
-
pattern: /^@/,
|
|
2292
|
-
alias: 'operator'
|
|
2293
|
-
},
|
|
2294
|
-
'function': /^[\s\S]+/
|
|
2295
|
-
}
|
|
2296
|
-
},
|
|
2297
|
-
'generic-function': {
|
|
2298
|
-
// e.g. foo<T extends "bar" | "baz">( ...
|
|
2299
|
-
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
|
|
2300
|
-
greedy: true,
|
|
2301
|
-
inside: {
|
|
2302
|
-
'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
|
|
2303
|
-
'generic': {
|
|
2304
|
-
pattern: /<[\s\S]+/, // everything after the first <
|
|
2305
|
-
alias: 'class-name',
|
|
2306
|
-
inside: typeInside
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
});
|
|
2311
|
-
|
|
2312
|
-
Prism.languages.ts = Prism.languages.typescript;
|
|
2313
|
-
|
|
2314
|
-
}(Prism));
|
|
2315
|
-
return prismTypescript;
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
requirePrismTypescript();
|
|
2319
|
-
|
|
2320
|
-
(function (Prism) {
|
|
2321
|
-
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
|
2322
|
-
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
|
2323
|
-
// + make sure PS1..4 are here as they are not always set,
|
|
2324
|
-
// - some useless things.
|
|
2325
|
-
var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
|
|
2326
|
-
|
|
2327
|
-
var commandAfterHeredoc = {
|
|
2328
|
-
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
2329
|
-
lookbehind: true,
|
|
2330
|
-
alias: 'punctuation', // this looks reasonably well in all themes
|
|
2331
|
-
inside: null // see below
|
|
2332
|
-
};
|
|
2333
|
-
|
|
2334
|
-
var insideString = {
|
|
2335
|
-
'bash': commandAfterHeredoc,
|
|
2336
|
-
'environment': {
|
|
2337
|
-
pattern: RegExp('\\$' + envVars),
|
|
2338
|
-
alias: 'constant'
|
|
2339
|
-
},
|
|
2340
|
-
'variable': [
|
|
2341
|
-
// [0]: Arithmetic Environment
|
|
2342
|
-
{
|
|
2343
|
-
pattern: /\$?\(\([\s\S]+?\)\)/,
|
|
2344
|
-
greedy: true,
|
|
2345
|
-
inside: {
|
|
2346
|
-
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|
2347
|
-
'variable': [
|
|
2348
|
-
{
|
|
2349
|
-
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
2350
|
-
lookbehind: true
|
|
2351
|
-
},
|
|
2352
|
-
/^\$\(\(/
|
|
2353
|
-
],
|
|
2354
|
-
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
2355
|
-
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|
2356
|
-
'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
2357
|
-
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|
2358
|
-
'punctuation': /\(\(?|\)\)?|,|;/
|
|
2359
|
-
}
|
|
2360
|
-
},
|
|
2361
|
-
// [1]: Command Substitution
|
|
2362
|
-
{
|
|
2363
|
-
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
2364
|
-
greedy: true,
|
|
2365
|
-
inside: {
|
|
2366
|
-
'variable': /^\$\(|^`|\)$|`$/
|
|
2367
|
-
}
|
|
2368
|
-
},
|
|
2369
|
-
// [2]: Brace expansion
|
|
2370
|
-
{
|
|
2371
|
-
pattern: /\$\{[^}]+\}/,
|
|
2372
|
-
greedy: true,
|
|
2373
|
-
inside: {
|
|
2374
|
-
'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
2375
|
-
'punctuation': /[\[\]]/,
|
|
2376
|
-
'environment': {
|
|
2377
|
-
pattern: RegExp('(\\{)' + envVars),
|
|
2378
|
-
lookbehind: true,
|
|
2379
|
-
alias: 'constant'
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
},
|
|
2383
|
-
/\$(?:\w+|[#?*!@$])/
|
|
2384
|
-
],
|
|
2385
|
-
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
2386
|
-
'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
2387
|
-
};
|
|
2388
|
-
|
|
2389
|
-
Prism.languages.bash = {
|
|
2390
|
-
'shebang': {
|
|
2391
|
-
pattern: /^#!\s*\/.*/,
|
|
2392
|
-
alias: 'important'
|
|
2393
|
-
},
|
|
2394
|
-
'comment': {
|
|
2395
|
-
pattern: /(^|[^"{\\$])#.*/,
|
|
2396
|
-
lookbehind: true
|
|
2397
|
-
},
|
|
2398
|
-
'function-name': [
|
|
2399
|
-
// a) function foo {
|
|
2400
|
-
// b) foo() {
|
|
2401
|
-
// c) function foo() {
|
|
2402
|
-
// but not “foo {”
|
|
2403
|
-
{
|
|
2404
|
-
// a) and c)
|
|
2405
|
-
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
2406
|
-
lookbehind: true,
|
|
2407
|
-
alias: 'function'
|
|
2408
|
-
},
|
|
2409
|
-
{
|
|
2410
|
-
// b)
|
|
2411
|
-
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
2412
|
-
alias: 'function'
|
|
2413
|
-
}
|
|
2414
|
-
],
|
|
2415
|
-
// Highlight variable names as variables in for and select beginnings.
|
|
2416
|
-
'for-or-select': {
|
|
2417
|
-
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
2418
|
-
alias: 'variable',
|
|
2419
|
-
lookbehind: true
|
|
2420
|
-
},
|
|
2421
|
-
// Highlight variable names as variables in the left-hand part
|
|
2422
|
-
// of assignments (“=” and “+=”).
|
|
2423
|
-
'assign-left': {
|
|
2424
|
-
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
2425
|
-
inside: {
|
|
2426
|
-
'environment': {
|
|
2427
|
-
pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
|
|
2428
|
-
lookbehind: true,
|
|
2429
|
-
alias: 'constant'
|
|
2430
|
-
}
|
|
2431
|
-
},
|
|
2432
|
-
alias: 'variable',
|
|
2433
|
-
lookbehind: true
|
|
2434
|
-
},
|
|
2435
|
-
// Highlight parameter names as variables
|
|
2436
|
-
'parameter': {
|
|
2437
|
-
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
|
2438
|
-
alias: 'variable',
|
|
2439
|
-
lookbehind: true
|
|
2440
|
-
},
|
|
2441
|
-
'string': [
|
|
2442
|
-
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
2443
|
-
{
|
|
2444
|
-
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
2445
|
-
lookbehind: true,
|
|
2446
|
-
greedy: true,
|
|
2447
|
-
inside: insideString
|
|
2448
|
-
},
|
|
2449
|
-
// Here-document with quotes around the tag
|
|
2450
|
-
// → No expansion (so no “inside”).
|
|
2451
|
-
{
|
|
2452
|
-
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
2453
|
-
lookbehind: true,
|
|
2454
|
-
greedy: true,
|
|
2455
|
-
inside: {
|
|
2456
|
-
'bash': commandAfterHeredoc
|
|
2457
|
-
}
|
|
2458
|
-
},
|
|
2459
|
-
// “Normal” string
|
|
2460
|
-
{
|
|
2461
|
-
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
|
|
2462
|
-
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
2463
|
-
lookbehind: true,
|
|
2464
|
-
greedy: true,
|
|
2465
|
-
inside: insideString
|
|
2466
|
-
},
|
|
2467
|
-
{
|
|
2468
|
-
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
2469
|
-
pattern: /(^|[^$\\])'[^']*'/,
|
|
2470
|
-
lookbehind: true,
|
|
2471
|
-
greedy: true
|
|
2472
|
-
},
|
|
2473
|
-
{
|
|
2474
|
-
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
|
|
2475
|
-
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
2476
|
-
greedy: true,
|
|
2477
|
-
inside: {
|
|
2478
|
-
'entity': insideString.entity
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2481
|
-
],
|
|
2482
|
-
'environment': {
|
|
2483
|
-
pattern: RegExp('\\$?' + envVars),
|
|
2484
|
-
alias: 'constant'
|
|
2485
|
-
},
|
|
2486
|
-
'variable': insideString.variable,
|
|
2487
|
-
'function': {
|
|
2488
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
2489
|
-
lookbehind: true
|
|
2490
|
-
},
|
|
2491
|
-
'keyword': {
|
|
2492
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
2493
|
-
lookbehind: true
|
|
2494
|
-
},
|
|
2495
|
-
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
2496
|
-
'builtin': {
|
|
2497
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
|
2498
|
-
lookbehind: true,
|
|
2499
|
-
// Alias added to make those easier to distinguish from strings.
|
|
2500
|
-
alias: 'class-name'
|
|
2501
|
-
},
|
|
2502
|
-
'boolean': {
|
|
2503
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
2504
|
-
lookbehind: true
|
|
2505
|
-
},
|
|
2506
|
-
'file-descriptor': {
|
|
2507
|
-
pattern: /\B&\d\b/,
|
|
2508
|
-
alias: 'important'
|
|
2509
|
-
},
|
|
2510
|
-
'operator': {
|
|
2511
|
-
// Lots of redirections here, but not just that.
|
|
2512
|
-
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
2513
|
-
inside: {
|
|
2514
|
-
'file-descriptor': {
|
|
2515
|
-
pattern: /^\d/,
|
|
2516
|
-
alias: 'important'
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
|
-
},
|
|
2520
|
-
'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
|
2521
|
-
'number': {
|
|
2522
|
-
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
2523
|
-
lookbehind: true
|
|
2524
|
-
}
|
|
2525
|
-
};
|
|
2526
|
-
|
|
2527
|
-
commandAfterHeredoc.inside = Prism.languages.bash;
|
|
2528
|
-
|
|
2529
|
-
/* Patterns in command substitution. */
|
|
2530
|
-
var toBeCopied = [
|
|
2531
|
-
'comment',
|
|
2532
|
-
'function-name',
|
|
2533
|
-
'for-or-select',
|
|
2534
|
-
'assign-left',
|
|
2535
|
-
'parameter',
|
|
2536
|
-
'string',
|
|
2537
|
-
'environment',
|
|
2538
|
-
'function',
|
|
2539
|
-
'keyword',
|
|
2540
|
-
'builtin',
|
|
2541
|
-
'boolean',
|
|
2542
|
-
'file-descriptor',
|
|
2543
|
-
'operator',
|
|
2544
|
-
'punctuation',
|
|
2545
|
-
'number'
|
|
2546
|
-
];
|
|
2547
|
-
var inside = insideString.variable[1].inside;
|
|
2548
|
-
for (var i = 0; i < toBeCopied.length; i++) {
|
|
2549
|
-
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
|
-
Prism.languages.sh = Prism.languages.bash;
|
|
2553
|
-
Prism.languages.shell = Prism.languages.bash;
|
|
2554
|
-
}(Prism));
|
|
2555
|
-
|
|
2556
|
-
(function (Prism) {
|
|
2557
|
-
|
|
2558
|
-
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2559
|
-
|
|
2560
|
-
Prism.languages.css = {
|
|
2561
|
-
'comment': /\/\*[\s\S]*?\*\//,
|
|
2562
|
-
'atrule': {
|
|
2563
|
-
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2564
|
-
inside: {
|
|
2565
|
-
'rule': /^@[\w-]+/,
|
|
2566
|
-
'selector-function-argument': {
|
|
2567
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2568
|
-
lookbehind: true,
|
|
2569
|
-
alias: 'selector'
|
|
2570
|
-
},
|
|
2571
|
-
'keyword': {
|
|
2572
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2573
|
-
lookbehind: true
|
|
2574
|
-
}
|
|
2575
|
-
// See rest below
|
|
2576
|
-
}
|
|
2577
|
-
},
|
|
2578
|
-
'url': {
|
|
2579
|
-
// https://drafts.csswg.org/css-values-3/#urls
|
|
2580
|
-
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2581
|
-
greedy: true,
|
|
2582
|
-
inside: {
|
|
2583
|
-
'function': /^url/i,
|
|
2584
|
-
'punctuation': /^\(|\)$/,
|
|
2585
|
-
'string': {
|
|
2586
|
-
pattern: RegExp('^' + string.source + '$'),
|
|
2587
|
-
alias: 'url'
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
},
|
|
2591
|
-
'selector': {
|
|
2592
|
-
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2593
|
-
lookbehind: true
|
|
2594
|
-
},
|
|
2595
|
-
'string': {
|
|
2596
|
-
pattern: string,
|
|
2597
|
-
greedy: true
|
|
2598
|
-
},
|
|
2599
|
-
'property': {
|
|
2600
|
-
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2601
|
-
lookbehind: true
|
|
2602
|
-
},
|
|
2603
|
-
'important': /!important\b/i,
|
|
2604
|
-
'function': {
|
|
2605
|
-
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2606
|
-
lookbehind: true
|
|
2607
|
-
},
|
|
2608
|
-
'punctuation': /[(){};:,]/
|
|
2609
|
-
};
|
|
2610
|
-
|
|
2611
|
-
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2612
|
-
|
|
2613
|
-
var markup = Prism.languages.markup;
|
|
2614
|
-
if (markup) {
|
|
2615
|
-
markup.tag.addInlined('style', 'css');
|
|
2616
|
-
markup.tag.addAttribute('style', 'css');
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
}(Prism));
|
|
2620
|
-
|
|
2621
|
-
(function (Prism) {
|
|
2622
|
-
|
|
2623
|
-
Prism.languages.diff = {
|
|
2624
|
-
'coord': [
|
|
2625
|
-
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
|
|
2626
|
-
/^(?:\*{3}|-{3}|\+{3}).*$/m,
|
|
2627
|
-
// Match "@@ ... @@" coord lines in unified diff.
|
|
2628
|
-
/^@@.*@@$/m,
|
|
2629
|
-
// Match coord lines in normal diff (starts with a number).
|
|
2630
|
-
/^\d.*$/m
|
|
2631
|
-
]
|
|
2632
|
-
|
|
2633
|
-
// deleted, inserted, unchanged, diff
|
|
2634
|
-
};
|
|
2635
|
-
|
|
2636
|
-
/**
|
|
2637
|
-
* A map from the name of a block to its line prefix.
|
|
2638
|
-
*
|
|
2639
|
-
* @type {Object<string, string>}
|
|
2640
|
-
*/
|
|
2641
|
-
var PREFIXES = {
|
|
2642
|
-
'deleted-sign': '-',
|
|
2643
|
-
'deleted-arrow': '<',
|
|
2644
|
-
'inserted-sign': '+',
|
|
2645
|
-
'inserted-arrow': '>',
|
|
2646
|
-
'unchanged': ' ',
|
|
2647
|
-
'diff': '!',
|
|
2648
|
-
};
|
|
2649
|
-
|
|
2650
|
-
// add a token for each prefix
|
|
2651
|
-
Object.keys(PREFIXES).forEach(function (name) {
|
|
2652
|
-
var prefix = PREFIXES[name];
|
|
2653
|
-
|
|
2654
|
-
var alias = [];
|
|
2655
|
-
if (!/^\w+$/.test(name)) { // "deleted-sign" -> "deleted"
|
|
2656
|
-
alias.push(/\w+/.exec(name)[0]);
|
|
2657
|
-
}
|
|
2658
|
-
if (name === 'diff') {
|
|
2659
|
-
alias.push('bold');
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
Prism.languages.diff[name] = {
|
|
2663
|
-
pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'),
|
|
2664
|
-
alias: alias,
|
|
2665
|
-
inside: {
|
|
2666
|
-
'line': {
|
|
2667
|
-
pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
|
|
2668
|
-
lookbehind: true
|
|
2669
|
-
},
|
|
2670
|
-
'prefix': {
|
|
2671
|
-
pattern: /[\s\S]/,
|
|
2672
|
-
alias: /\w+/.exec(name)[0]
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2676
|
-
|
|
2677
|
-
});
|
|
2678
|
-
|
|
2679
|
-
// make prefixes available to Diff plugin
|
|
2680
|
-
Object.defineProperty(Prism.languages.diff, 'PREFIXES', {
|
|
2681
|
-
value: PREFIXES
|
|
2682
|
-
});
|
|
2683
|
-
|
|
2684
|
-
}(Prism));
|
|
2685
|
-
|
|
2686
|
-
(function (Prism) {
|
|
2687
|
-
|
|
2688
|
-
// Many of the following regexes will contain negated lookaheads like `[ \t]+(?![ \t])`. This is a trick to ensure
|
|
2689
|
-
// that quantifiers behave *atomically*. Atomic quantifiers are necessary to prevent exponential backtracking.
|
|
2690
|
-
|
|
2691
|
-
var spaceAfterBackSlash = /\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source;
|
|
2692
|
-
// At least one space, comment, or line break
|
|
2693
|
-
var space = /(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source
|
|
2694
|
-
.replace(/<SP_BS>/g, function () { return spaceAfterBackSlash; });
|
|
2695
|
-
|
|
2696
|
-
var string = /"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source;
|
|
2697
|
-
var option = /--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g, function () { return string; });
|
|
2698
|
-
|
|
2699
|
-
var stringRule = {
|
|
2700
|
-
pattern: RegExp(string),
|
|
2701
|
-
greedy: true
|
|
2702
|
-
};
|
|
2703
|
-
var commentRule = {
|
|
2704
|
-
pattern: /(^[ \t]*)#.*/m,
|
|
2705
|
-
lookbehind: true,
|
|
2706
|
-
greedy: true
|
|
2707
|
-
};
|
|
2708
|
-
|
|
2709
|
-
/**
|
|
2710
|
-
* @param {string} source
|
|
2711
|
-
* @param {string} flags
|
|
2712
|
-
* @returns {RegExp}
|
|
2713
|
-
*/
|
|
2714
|
-
function re(source, flags) {
|
|
2715
|
-
source = source
|
|
2716
|
-
.replace(/<OPT>/g, function () { return option; })
|
|
2717
|
-
.replace(/<SP>/g, function () { return space; });
|
|
2718
|
-
|
|
2719
|
-
return RegExp(source, flags);
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
Prism.languages.docker = {
|
|
2723
|
-
'instruction': {
|
|
2724
|
-
pattern: /(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,
|
|
2725
|
-
lookbehind: true,
|
|
2726
|
-
greedy: true,
|
|
2727
|
-
inside: {
|
|
2728
|
-
'options': {
|
|
2729
|
-
pattern: re(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source, 'i'),
|
|
2730
|
-
lookbehind: true,
|
|
2731
|
-
greedy: true,
|
|
2732
|
-
inside: {
|
|
2733
|
-
'property': {
|
|
2734
|
-
pattern: /(^|\s)--[\w-]+/,
|
|
2735
|
-
lookbehind: true
|
|
2736
|
-
},
|
|
2737
|
-
'string': [
|
|
2738
|
-
stringRule,
|
|
2739
|
-
{
|
|
2740
|
-
pattern: /(=)(?!["'])(?:[^\s\\]|\\.)+/,
|
|
2741
|
-
lookbehind: true
|
|
2742
|
-
}
|
|
2743
|
-
],
|
|
2744
|
-
'operator': /\\$/m,
|
|
2745
|
-
'punctuation': /=/
|
|
2746
|
-
}
|
|
2747
|
-
},
|
|
2748
|
-
'keyword': [
|
|
2749
|
-
{
|
|
2750
|
-
// https://docs.docker.com/engine/reference/builder/#healthcheck
|
|
2751
|
-
pattern: re(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source, 'i'),
|
|
2752
|
-
lookbehind: true,
|
|
2753
|
-
greedy: true
|
|
2754
|
-
},
|
|
2755
|
-
{
|
|
2756
|
-
// https://docs.docker.com/engine/reference/builder/#from
|
|
2757
|
-
pattern: re(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source, 'i'),
|
|
2758
|
-
lookbehind: true,
|
|
2759
|
-
greedy: true
|
|
2760
|
-
},
|
|
2761
|
-
{
|
|
2762
|
-
// https://docs.docker.com/engine/reference/builder/#onbuild
|
|
2763
|
-
pattern: re(/(^ONBUILD<SP>)\w+/.source, 'i'),
|
|
2764
|
-
lookbehind: true,
|
|
2765
|
-
greedy: true
|
|
2766
|
-
},
|
|
2767
|
-
{
|
|
2768
|
-
pattern: /^\w+/,
|
|
2769
|
-
greedy: true
|
|
2770
|
-
}
|
|
2771
|
-
],
|
|
2772
|
-
'comment': commentRule,
|
|
2773
|
-
'string': stringRule,
|
|
2774
|
-
'variable': /\$(?:\w+|\{[^{}"'\\]*\})/,
|
|
2775
|
-
'operator': /\\$/m
|
|
2776
|
-
}
|
|
2777
|
-
},
|
|
2778
|
-
'comment': commentRule
|
|
2779
|
-
};
|
|
2780
|
-
|
|
2781
|
-
Prism.languages.dockerfile = Prism.languages.docker;
|
|
2782
|
-
|
|
2783
|
-
}(Prism));
|
|
2784
|
-
|
|
2785
|
-
Prism.languages.git = {
|
|
2786
|
-
/*
|
|
2787
|
-
* A simple one line comment like in a git status command
|
|
2788
|
-
* For instance:
|
|
2789
|
-
* $ git status
|
|
2790
|
-
* # On branch infinite-scroll
|
|
2791
|
-
* # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
|
|
2792
|
-
* # and have 1 and 2 different commits each, respectively.
|
|
2793
|
-
* nothing to commit (working directory clean)
|
|
2794
|
-
*/
|
|
2795
|
-
'comment': /^#.*/m,
|
|
2796
|
-
|
|
2797
|
-
/*
|
|
2798
|
-
* Regexp to match the changed lines in a git diff output. Check the example below.
|
|
2799
|
-
*/
|
|
2800
|
-
'deleted': /^[-–].*/m,
|
|
2801
|
-
'inserted': /^\+.*/m,
|
|
2802
|
-
|
|
2803
|
-
/*
|
|
2804
|
-
* a string (double and simple quote)
|
|
2805
|
-
*/
|
|
2806
|
-
'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
|
|
2807
|
-
|
|
2808
|
-
/*
|
|
2809
|
-
* a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
|
|
2810
|
-
* For instance:
|
|
2811
|
-
* $ git add file.txt
|
|
2812
|
-
*/
|
|
2813
|
-
'command': {
|
|
2814
|
-
pattern: /^.*\$ git .*$/m,
|
|
2815
|
-
inside: {
|
|
2816
|
-
/*
|
|
2817
|
-
* A git command can contain a parameter starting by a single or a double dash followed by a string
|
|
2818
|
-
* For instance:
|
|
2819
|
-
* $ git diff --cached
|
|
2820
|
-
* $ git log -p
|
|
2821
|
-
*/
|
|
2822
|
-
'parameter': /\s--?\w+/
|
|
2823
|
-
}
|
|
2824
|
-
},
|
|
2825
|
-
|
|
2826
|
-
/*
|
|
2827
|
-
* Coordinates displayed in a git diff command
|
|
2828
|
-
* For instance:
|
|
2829
|
-
* $ git diff
|
|
2830
|
-
* diff --git file.txt file.txt
|
|
2831
|
-
* index 6214953..1d54a52 100644
|
|
2832
|
-
* --- file.txt
|
|
2833
|
-
* +++ file.txt
|
|
2834
|
-
* @@ -1 +1,2 @@
|
|
2835
|
-
* -Here's my tetx file
|
|
2836
|
-
* +Here's my text file
|
|
2837
|
-
* +And this is the second line
|
|
2838
|
-
*/
|
|
2839
|
-
'coord': /^@@.*@@$/m,
|
|
2840
|
-
|
|
2841
|
-
/*
|
|
2842
|
-
* Match a "commit [SHA1]" line in a git log output.
|
|
2843
|
-
* For instance:
|
|
2844
|
-
* $ git log
|
|
2845
|
-
* commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
|
|
2846
|
-
* Author: lgiraudel
|
|
2847
|
-
* Date: Mon Feb 17 11:18:34 2014 +0100
|
|
2848
|
-
*
|
|
2849
|
-
* Add of a new line
|
|
2850
|
-
*/
|
|
2851
|
-
'commit-sha1': /^commit \w{40}$/m
|
|
2852
|
-
};
|
|
2853
|
-
|
|
2854
|
-
Prism.languages.go = Prism.languages.extend('clike', {
|
|
2855
|
-
'string': {
|
|
2856
|
-
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
|
|
2857
|
-
lookbehind: true,
|
|
2858
|
-
greedy: true
|
|
2859
|
-
},
|
|
2860
|
-
'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
|
2861
|
-
'boolean': /\b(?:_|false|iota|nil|true)\b/,
|
|
2862
|
-
'number': [
|
|
2863
|
-
// binary and octal integers
|
|
2864
|
-
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
|
2865
|
-
// hexadecimal integers and floats
|
|
2866
|
-
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
|
2867
|
-
// decimal integers and floats
|
|
2868
|
-
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
|
2869
|
-
],
|
|
2870
|
-
'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
|
|
2871
|
-
'builtin': /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
|
|
2872
|
-
});
|
|
2873
|
-
|
|
2874
|
-
Prism.languages.insertBefore('go', 'string', {
|
|
2875
|
-
'char': {
|
|
2876
|
-
pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
|
|
2877
|
-
greedy: true
|
|
2878
|
-
}
|
|
2879
|
-
});
|
|
2880
|
-
|
|
2881
|
-
delete Prism.languages.go['class-name'];
|
|
2882
|
-
|
|
2883
|
-
Prism.languages.graphql = {
|
|
2884
|
-
'comment': /#.*/,
|
|
2885
|
-
'description': {
|
|
2886
|
-
pattern: /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
|
|
2887
|
-
greedy: true,
|
|
2888
|
-
alias: 'string',
|
|
2889
|
-
inside: {
|
|
2890
|
-
'language-markdown': {
|
|
2891
|
-
pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
|
|
2892
|
-
lookbehind: true,
|
|
2893
|
-
inside: Prism.languages.markdown
|
|
2894
|
-
}
|
|
2895
|
-
}
|
|
2896
|
-
},
|
|
2897
|
-
'string': {
|
|
2898
|
-
pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
|
|
2899
|
-
greedy: true
|
|
2900
|
-
},
|
|
2901
|
-
'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
2902
|
-
'boolean': /\b(?:false|true)\b/,
|
|
2903
|
-
'variable': /\$[a-z_]\w*/i,
|
|
2904
|
-
'directive': {
|
|
2905
|
-
pattern: /@[a-z_]\w*/i,
|
|
2906
|
-
alias: 'function'
|
|
2907
|
-
},
|
|
2908
|
-
'attr-name': {
|
|
2909
|
-
pattern: /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
|
|
2910
|
-
greedy: true
|
|
2911
|
-
},
|
|
2912
|
-
'atom-input': {
|
|
2913
|
-
pattern: /\b[A-Z]\w*Input\b/,
|
|
2914
|
-
alias: 'class-name'
|
|
2915
|
-
},
|
|
2916
|
-
'scalar': /\b(?:Boolean|Float|ID|Int|String)\b/,
|
|
2917
|
-
'constant': /\b[A-Z][A-Z_\d]*\b/,
|
|
2918
|
-
'class-name': {
|
|
2919
|
-
pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
|
|
2920
|
-
lookbehind: true
|
|
2921
|
-
},
|
|
2922
|
-
'fragment': {
|
|
2923
|
-
pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
|
|
2924
|
-
lookbehind: true,
|
|
2925
|
-
alias: 'function'
|
|
2926
|
-
},
|
|
2927
|
-
'definition-mutation': {
|
|
2928
|
-
pattern: /(\bmutation\s+)[a-zA-Z_]\w*/,
|
|
2929
|
-
lookbehind: true,
|
|
2930
|
-
alias: 'function'
|
|
2931
|
-
},
|
|
2932
|
-
'definition-query': {
|
|
2933
|
-
pattern: /(\bquery\s+)[a-zA-Z_]\w*/,
|
|
2934
|
-
lookbehind: true,
|
|
2935
|
-
alias: 'function'
|
|
2936
|
-
},
|
|
2937
|
-
'keyword': /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
|
|
2938
|
-
'operator': /[!=|&]|\.{3}/,
|
|
2939
|
-
'property-query': /\w+(?=\s*\()/,
|
|
2940
|
-
'object': /\w+(?=\s*\{)/,
|
|
2941
|
-
'punctuation': /[!(){}\[\]:=,]/,
|
|
2942
|
-
'property': /\w+/
|
|
2943
|
-
};
|
|
2944
|
-
|
|
2945
|
-
Prism.hooks.add('after-tokenize', function afterTokenizeGraphql(env) {
|
|
2946
|
-
if (env.language !== 'graphql') {
|
|
2947
|
-
return;
|
|
2948
|
-
}
|
|
2949
|
-
|
|
2950
|
-
/**
|
|
2951
|
-
* get the graphql token stream that we want to customize
|
|
2952
|
-
*
|
|
2953
|
-
* @typedef {InstanceType<import("./prism-core")["Token"]>} Token
|
|
2954
|
-
* @type {Token[]}
|
|
2955
|
-
*/
|
|
2956
|
-
var validTokens = env.tokens.filter(function (token) {
|
|
2957
|
-
return typeof token !== 'string' && token.type !== 'comment' && token.type !== 'scalar';
|
|
2958
|
-
});
|
|
2959
|
-
|
|
2960
|
-
var currentIndex = 0;
|
|
2961
|
-
|
|
2962
|
-
/**
|
|
2963
|
-
* Returns whether the token relative to the current index has the given type.
|
|
2964
|
-
*
|
|
2965
|
-
* @param {number} offset
|
|
2966
|
-
* @returns {Token | undefined}
|
|
2967
|
-
*/
|
|
2968
|
-
function getToken(offset) {
|
|
2969
|
-
return validTokens[currentIndex + offset];
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
/**
|
|
2973
|
-
* Returns whether the token relative to the current index has the given type.
|
|
2974
|
-
*
|
|
2975
|
-
* @param {readonly string[]} types
|
|
2976
|
-
* @param {number} [offset=0]
|
|
2977
|
-
* @returns {boolean}
|
|
2978
|
-
*/
|
|
2979
|
-
function isTokenType(types, offset) {
|
|
2980
|
-
offset = offset || 0;
|
|
2981
|
-
for (var i = 0; i < types.length; i++) {
|
|
2982
|
-
var token = getToken(i + offset);
|
|
2983
|
-
if (!token || token.type !== types[i]) {
|
|
2984
|
-
return false;
|
|
2985
|
-
}
|
|
2986
|
-
}
|
|
2987
|
-
return true;
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
|
-
/**
|
|
2991
|
-
* Returns the index of the closing bracket to an opening bracket.
|
|
2992
|
-
*
|
|
2993
|
-
* It is assumed that `token[currentIndex - 1]` is an opening bracket.
|
|
2994
|
-
*
|
|
2995
|
-
* If no closing bracket could be found, `-1` will be returned.
|
|
2996
|
-
*
|
|
2997
|
-
* @param {RegExp} open
|
|
2998
|
-
* @param {RegExp} close
|
|
2999
|
-
* @returns {number}
|
|
3000
|
-
*/
|
|
3001
|
-
function findClosingBracket(open, close) {
|
|
3002
|
-
var stackHeight = 1;
|
|
3003
|
-
|
|
3004
|
-
for (var i = currentIndex; i < validTokens.length; i++) {
|
|
3005
|
-
var token = validTokens[i];
|
|
3006
|
-
var content = token.content;
|
|
3007
|
-
|
|
3008
|
-
if (token.type === 'punctuation' && typeof content === 'string') {
|
|
3009
|
-
if (open.test(content)) {
|
|
3010
|
-
stackHeight++;
|
|
3011
|
-
} else if (close.test(content)) {
|
|
3012
|
-
stackHeight--;
|
|
3013
|
-
|
|
3014
|
-
if (stackHeight === 0) {
|
|
3015
|
-
return i;
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
|
|
3021
|
-
return -1;
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
/**
|
|
3025
|
-
* Adds an alias to the given token.
|
|
3026
|
-
*
|
|
3027
|
-
* @param {Token} token
|
|
3028
|
-
* @param {string} alias
|
|
3029
|
-
* @returns {void}
|
|
3030
|
-
*/
|
|
3031
|
-
function addAlias(token, alias) {
|
|
3032
|
-
var aliases = token.alias;
|
|
3033
|
-
if (!aliases) {
|
|
3034
|
-
token.alias = aliases = [];
|
|
3035
|
-
} else if (!Array.isArray(aliases)) {
|
|
3036
|
-
token.alias = aliases = [aliases];
|
|
3037
|
-
}
|
|
3038
|
-
aliases.push(alias);
|
|
3039
|
-
}
|
|
3040
|
-
|
|
3041
|
-
for (; currentIndex < validTokens.length;) {
|
|
3042
|
-
var startToken = validTokens[currentIndex++];
|
|
3043
|
-
|
|
3044
|
-
// add special aliases for mutation tokens
|
|
3045
|
-
if (startToken.type === 'keyword' && startToken.content === 'mutation') {
|
|
3046
|
-
// any array of the names of all input variables (if any)
|
|
3047
|
-
var inputVariables = [];
|
|
3048
|
-
|
|
3049
|
-
if (isTokenType(['definition-mutation', 'punctuation']) && getToken(1).content === '(') {
|
|
3050
|
-
// definition
|
|
3051
|
-
|
|
3052
|
-
currentIndex += 2; // skip 'definition-mutation' and 'punctuation'
|
|
3053
|
-
|
|
3054
|
-
var definitionEnd = findClosingBracket(/^\($/, /^\)$/);
|
|
3055
|
-
if (definitionEnd === -1) {
|
|
3056
|
-
continue;
|
|
3057
|
-
}
|
|
3058
|
-
|
|
3059
|
-
// find all input variables
|
|
3060
|
-
for (; currentIndex < definitionEnd; currentIndex++) {
|
|
3061
|
-
var t = getToken(0);
|
|
3062
|
-
if (t.type === 'variable') {
|
|
3063
|
-
addAlias(t, 'variable-input');
|
|
3064
|
-
inputVariables.push(t.content);
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
|
|
3068
|
-
currentIndex = definitionEnd + 1;
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
if (isTokenType(['punctuation', 'property-query']) && getToken(0).content === '{') {
|
|
3072
|
-
currentIndex++; // skip opening bracket
|
|
3073
|
-
|
|
3074
|
-
addAlias(getToken(0), 'property-mutation');
|
|
3075
|
-
|
|
3076
|
-
if (inputVariables.length > 0) {
|
|
3077
|
-
var mutationEnd = findClosingBracket(/^\{$/, /^\}$/);
|
|
3078
|
-
if (mutationEnd === -1) {
|
|
3079
|
-
continue;
|
|
3080
|
-
}
|
|
3081
|
-
|
|
3082
|
-
// give references to input variables a special alias
|
|
3083
|
-
for (var i = currentIndex; i < mutationEnd; i++) {
|
|
3084
|
-
var varToken = validTokens[i];
|
|
3085
|
-
if (varToken.type === 'variable' && inputVariables.indexOf(varToken.content) >= 0) {
|
|
3086
|
-
addAlias(varToken, 'variable-input');
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3089
|
-
}
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
}
|
|
3093
|
-
});
|
|
3094
|
-
|
|
3095
|
-
var prismJava = {};
|
|
3096
|
-
|
|
3097
|
-
var hasRequiredPrismJava;
|
|
3098
|
-
|
|
3099
|
-
function requirePrismJava () {
|
|
3100
|
-
if (hasRequiredPrismJava) return prismJava;
|
|
3101
|
-
hasRequiredPrismJava = 1;
|
|
3102
|
-
(function (Prism) {
|
|
3103
|
-
|
|
3104
|
-
var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
|
|
3105
|
-
|
|
3106
|
-
// full package (optional) + parent classes (optional)
|
|
3107
|
-
var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
|
|
3108
|
-
|
|
3109
|
-
// based on the java naming conventions
|
|
3110
|
-
var className = {
|
|
3111
|
-
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
|
3112
|
-
lookbehind: true,
|
|
3113
|
-
inside: {
|
|
3114
|
-
'namespace': {
|
|
3115
|
-
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
3116
|
-
inside: {
|
|
3117
|
-
'punctuation': /\./
|
|
3118
|
-
}
|
|
3119
|
-
},
|
|
3120
|
-
'punctuation': /\./
|
|
3121
|
-
}
|
|
3122
|
-
};
|
|
3123
|
-
|
|
3124
|
-
Prism.languages.java = Prism.languages.extend('clike', {
|
|
3125
|
-
'string': {
|
|
3126
|
-
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
|
3127
|
-
lookbehind: true,
|
|
3128
|
-
greedy: true
|
|
3129
|
-
},
|
|
3130
|
-
'class-name': [
|
|
3131
|
-
className,
|
|
3132
|
-
{
|
|
3133
|
-
// variables, parameters, and constructor references
|
|
3134
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
3135
|
-
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
|
|
3136
|
-
lookbehind: true,
|
|
3137
|
-
inside: className.inside
|
|
3138
|
-
},
|
|
3139
|
-
{
|
|
3140
|
-
// class names based on keyword
|
|
3141
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
3142
|
-
pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
|
|
3143
|
-
lookbehind: true,
|
|
3144
|
-
inside: className.inside
|
|
3145
|
-
}
|
|
3146
|
-
],
|
|
3147
|
-
'keyword': keywords,
|
|
3148
|
-
'function': [
|
|
3149
|
-
Prism.languages.clike.function,
|
|
3150
|
-
{
|
|
3151
|
-
pattern: /(::\s*)[a-z_]\w*/,
|
|
3152
|
-
lookbehind: true
|
|
3153
|
-
}
|
|
3154
|
-
],
|
|
3155
|
-
'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
|
3156
|
-
'operator': {
|
|
3157
|
-
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
|
3158
|
-
lookbehind: true
|
|
3159
|
-
},
|
|
3160
|
-
'constant': /\b[A-Z][A-Z_\d]+\b/
|
|
3161
|
-
});
|
|
3162
|
-
|
|
3163
|
-
Prism.languages.insertBefore('java', 'string', {
|
|
3164
|
-
'triple-quoted-string': {
|
|
3165
|
-
// http://openjdk.java.net/jeps/355#Description
|
|
3166
|
-
pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
|
3167
|
-
greedy: true,
|
|
3168
|
-
alias: 'string'
|
|
3169
|
-
},
|
|
3170
|
-
'char': {
|
|
3171
|
-
pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
|
3172
|
-
greedy: true
|
|
3173
|
-
}
|
|
3174
|
-
});
|
|
3175
|
-
|
|
3176
|
-
Prism.languages.insertBefore('java', 'class-name', {
|
|
3177
|
-
'annotation': {
|
|
3178
|
-
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
3179
|
-
lookbehind: true,
|
|
3180
|
-
alias: 'punctuation'
|
|
3181
|
-
},
|
|
3182
|
-
'generics': {
|
|
3183
|
-
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
3184
|
-
inside: {
|
|
3185
|
-
'class-name': className,
|
|
3186
|
-
'keyword': keywords,
|
|
3187
|
-
'punctuation': /[<>(),.:]/,
|
|
3188
|
-
'operator': /[?&|]/
|
|
3189
|
-
}
|
|
3190
|
-
},
|
|
3191
|
-
'import': [
|
|
3192
|
-
{
|
|
3193
|
-
pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
|
|
3194
|
-
lookbehind: true,
|
|
3195
|
-
inside: {
|
|
3196
|
-
'namespace': className.inside.namespace,
|
|
3197
|
-
'punctuation': /\./,
|
|
3198
|
-
'operator': /\*/,
|
|
3199
|
-
'class-name': /\w+/
|
|
3200
|
-
}
|
|
3201
|
-
},
|
|
3202
|
-
{
|
|
3203
|
-
pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
|
|
3204
|
-
lookbehind: true,
|
|
3205
|
-
alias: 'static',
|
|
3206
|
-
inside: {
|
|
3207
|
-
'namespace': className.inside.namespace,
|
|
3208
|
-
'static': /\b\w+$/,
|
|
3209
|
-
'punctuation': /\./,
|
|
3210
|
-
'operator': /\*/,
|
|
3211
|
-
'class-name': /\w+/
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
],
|
|
3215
|
-
'namespace': {
|
|
3216
|
-
pattern: RegExp(
|
|
3217
|
-
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
|
|
3218
|
-
.source.replace(/<keyword>/g, function () { return keywords.source; })),
|
|
3219
|
-
lookbehind: true,
|
|
3220
|
-
inside: {
|
|
3221
|
-
'punctuation': /\./,
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
});
|
|
3225
|
-
}(Prism));
|
|
3226
|
-
return prismJava;
|
|
3227
|
-
}
|
|
3228
|
-
|
|
3229
|
-
requirePrismJava();
|
|
3230
|
-
|
|
3231
|
-
// https://www.json.org/json-en.html
|
|
3232
|
-
Prism.languages.json = {
|
|
3233
|
-
'property': {
|
|
3234
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
3235
|
-
lookbehind: true,
|
|
3236
|
-
greedy: true
|
|
3237
|
-
},
|
|
3238
|
-
'string': {
|
|
3239
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
|
3240
|
-
lookbehind: true,
|
|
3241
|
-
greedy: true
|
|
3242
|
-
},
|
|
3243
|
-
'comment': {
|
|
3244
|
-
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
3245
|
-
greedy: true
|
|
3246
|
-
},
|
|
3247
|
-
'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
3248
|
-
'punctuation': /[{}[\],]/,
|
|
3249
|
-
'operator': /:/,
|
|
3250
|
-
'boolean': /\b(?:false|true)\b/,
|
|
3251
|
-
'null': {
|
|
3252
|
-
pattern: /\bnull\b/,
|
|
3253
|
-
alias: 'keyword'
|
|
3254
|
-
}
|
|
3255
|
-
};
|
|
3256
|
-
|
|
3257
|
-
Prism.languages.webmanifest = Prism.languages.json;
|
|
3258
|
-
|
|
3259
|
-
(function (Prism) {
|
|
3260
|
-
Prism.languages.kotlin = Prism.languages.extend('clike', {
|
|
3261
|
-
'keyword': {
|
|
3262
|
-
// The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
|
|
3263
|
-
pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
|
|
3264
|
-
lookbehind: true
|
|
3265
|
-
},
|
|
3266
|
-
'function': [
|
|
3267
|
-
{
|
|
3268
|
-
pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,
|
|
3269
|
-
greedy: true
|
|
3270
|
-
},
|
|
3271
|
-
{
|
|
3272
|
-
pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,
|
|
3273
|
-
lookbehind: true,
|
|
3274
|
-
greedy: true
|
|
3275
|
-
}
|
|
3276
|
-
],
|
|
3277
|
-
'number': /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
|
|
3278
|
-
'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
|
|
3279
|
-
});
|
|
3280
|
-
|
|
3281
|
-
delete Prism.languages.kotlin['class-name'];
|
|
3282
|
-
|
|
3283
|
-
var interpolationInside = {
|
|
3284
|
-
'interpolation-punctuation': {
|
|
3285
|
-
pattern: /^\$\{?|\}$/,
|
|
3286
|
-
alias: 'punctuation'
|
|
3287
|
-
},
|
|
3288
|
-
'expression': {
|
|
3289
|
-
pattern: /[\s\S]+/,
|
|
3290
|
-
inside: Prism.languages.kotlin
|
|
3291
|
-
}
|
|
3292
|
-
};
|
|
3293
|
-
|
|
3294
|
-
Prism.languages.insertBefore('kotlin', 'string', {
|
|
3295
|
-
// https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
|
|
3296
|
-
'string-literal': [
|
|
3297
|
-
{
|
|
3298
|
-
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
|
|
3299
|
-
alias: 'multiline',
|
|
3300
|
-
inside: {
|
|
3301
|
-
'interpolation': {
|
|
3302
|
-
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
3303
|
-
inside: interpolationInside
|
|
3304
|
-
},
|
|
3305
|
-
'string': /[\s\S]+/
|
|
3306
|
-
}
|
|
3307
|
-
},
|
|
3308
|
-
{
|
|
3309
|
-
pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,
|
|
3310
|
-
alias: 'singleline',
|
|
3311
|
-
inside: {
|
|
3312
|
-
'interpolation': {
|
|
3313
|
-
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
3314
|
-
lookbehind: true,
|
|
3315
|
-
inside: interpolationInside
|
|
3316
|
-
},
|
|
3317
|
-
'string': /[\s\S]+/
|
|
3318
|
-
}
|
|
3319
|
-
}
|
|
3320
|
-
],
|
|
3321
|
-
'char': {
|
|
3322
|
-
// https://kotlinlang.org/spec/expressions.html#character-literals
|
|
3323
|
-
pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,
|
|
3324
|
-
greedy: true
|
|
3325
|
-
}
|
|
3326
|
-
});
|
|
3327
|
-
|
|
3328
|
-
delete Prism.languages.kotlin['string'];
|
|
3329
|
-
|
|
3330
|
-
Prism.languages.insertBefore('kotlin', 'keyword', {
|
|
3331
|
-
'annotation': {
|
|
3332
|
-
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
|
|
3333
|
-
alias: 'builtin'
|
|
3334
|
-
}
|
|
3335
|
-
});
|
|
3336
|
-
|
|
3337
|
-
Prism.languages.insertBefore('kotlin', 'function', {
|
|
3338
|
-
'label': {
|
|
3339
|
-
pattern: /\b\w+@|@\w+\b/,
|
|
3340
|
-
alias: 'symbol'
|
|
3341
|
-
}
|
|
3342
|
-
});
|
|
3343
|
-
|
|
3344
|
-
Prism.languages.kt = Prism.languages.kotlin;
|
|
3345
|
-
Prism.languages.kts = Prism.languages.kotlin;
|
|
3346
|
-
}(Prism));
|
|
3347
|
-
|
|
3348
|
-
(function (Prism) {
|
|
3349
|
-
|
|
3350
|
-
// Allow only one line break
|
|
3351
|
-
var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
|
|
3352
|
-
|
|
3353
|
-
/**
|
|
3354
|
-
* This function is intended for the creation of the bold or italic pattern.
|
|
3355
|
-
*
|
|
3356
|
-
* This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
|
|
3357
|
-
*
|
|
3358
|
-
* _Note:_ Keep in mind that this adds a capturing group.
|
|
3359
|
-
*
|
|
3360
|
-
* @param {string} pattern
|
|
3361
|
-
* @returns {RegExp}
|
|
3362
|
-
*/
|
|
3363
|
-
function createInline(pattern) {
|
|
3364
|
-
pattern = pattern.replace(/<inner>/g, function () { return inner; });
|
|
3365
|
-
return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
|
|
3366
|
-
}
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
|
|
3370
|
-
var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () { return tableCell; });
|
|
3371
|
-
var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
Prism.languages.markdown = Prism.languages.extend('markup', {});
|
|
3375
|
-
Prism.languages.insertBefore('markdown', 'prolog', {
|
|
3376
|
-
'front-matter-block': {
|
|
3377
|
-
pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
|
|
3378
|
-
lookbehind: true,
|
|
3379
|
-
greedy: true,
|
|
3380
|
-
inside: {
|
|
3381
|
-
'punctuation': /^---|---$/,
|
|
3382
|
-
'front-matter': {
|
|
3383
|
-
pattern: /\S+(?:\s+\S+)*/,
|
|
3384
|
-
alias: ['yaml', 'language-yaml'],
|
|
3385
|
-
inside: Prism.languages.yaml
|
|
3386
|
-
}
|
|
3387
|
-
}
|
|
3388
|
-
},
|
|
3389
|
-
'blockquote': {
|
|
3390
|
-
// > ...
|
|
3391
|
-
pattern: /^>(?:[\t ]*>)*/m,
|
|
3392
|
-
alias: 'punctuation'
|
|
3393
|
-
},
|
|
3394
|
-
'table': {
|
|
3395
|
-
pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
|
|
3396
|
-
inside: {
|
|
3397
|
-
'table-data-rows': {
|
|
3398
|
-
pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
|
|
3399
|
-
lookbehind: true,
|
|
3400
|
-
inside: {
|
|
3401
|
-
'table-data': {
|
|
3402
|
-
pattern: RegExp(tableCell),
|
|
3403
|
-
inside: Prism.languages.markdown
|
|
3404
|
-
},
|
|
3405
|
-
'punctuation': /\|/
|
|
3406
|
-
}
|
|
3407
|
-
},
|
|
3408
|
-
'table-line': {
|
|
3409
|
-
pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
|
|
3410
|
-
lookbehind: true,
|
|
3411
|
-
inside: {
|
|
3412
|
-
'punctuation': /\||:?-{3,}:?/
|
|
3413
|
-
}
|
|
3414
|
-
},
|
|
3415
|
-
'table-header-row': {
|
|
3416
|
-
pattern: RegExp('^' + tableRow + '$'),
|
|
3417
|
-
inside: {
|
|
3418
|
-
'table-header': {
|
|
3419
|
-
pattern: RegExp(tableCell),
|
|
3420
|
-
alias: 'important',
|
|
3421
|
-
inside: Prism.languages.markdown
|
|
3422
|
-
},
|
|
3423
|
-
'punctuation': /\|/
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
|
-
}
|
|
3427
|
-
},
|
|
3428
|
-
'code': [
|
|
3429
|
-
{
|
|
3430
|
-
// Prefixed by 4 spaces or 1 tab and preceded by an empty line
|
|
3431
|
-
pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
|
|
3432
|
-
lookbehind: true,
|
|
3433
|
-
alias: 'keyword'
|
|
3434
|
-
},
|
|
3435
|
-
{
|
|
3436
|
-
// ```optional language
|
|
3437
|
-
// code block
|
|
3438
|
-
// ```
|
|
3439
|
-
pattern: /^```[\s\S]*?^```$/m,
|
|
3440
|
-
greedy: true,
|
|
3441
|
-
inside: {
|
|
3442
|
-
'code-block': {
|
|
3443
|
-
pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
|
|
3444
|
-
lookbehind: true
|
|
3445
|
-
},
|
|
3446
|
-
'code-language': {
|
|
3447
|
-
pattern: /^(```).+/,
|
|
3448
|
-
lookbehind: true
|
|
3449
|
-
},
|
|
3450
|
-
'punctuation': /```/
|
|
3451
|
-
}
|
|
3452
|
-
}
|
|
3453
|
-
],
|
|
3454
|
-
'title': [
|
|
3455
|
-
{
|
|
3456
|
-
// title 1
|
|
3457
|
-
// =======
|
|
3458
|
-
|
|
3459
|
-
// title 2
|
|
3460
|
-
// -------
|
|
3461
|
-
pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
|
|
3462
|
-
alias: 'important',
|
|
3463
|
-
inside: {
|
|
3464
|
-
punctuation: /==+$|--+$/
|
|
3465
|
-
}
|
|
3466
|
-
},
|
|
3467
|
-
{
|
|
3468
|
-
// # title 1
|
|
3469
|
-
// ###### title 6
|
|
3470
|
-
pattern: /(^\s*)#.+/m,
|
|
3471
|
-
lookbehind: true,
|
|
3472
|
-
alias: 'important',
|
|
3473
|
-
inside: {
|
|
3474
|
-
punctuation: /^#+|#+$/
|
|
3475
|
-
}
|
|
3476
|
-
}
|
|
3477
|
-
],
|
|
3478
|
-
'hr': {
|
|
3479
|
-
// ***
|
|
3480
|
-
// ---
|
|
3481
|
-
// * * *
|
|
3482
|
-
// -----------
|
|
3483
|
-
pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
|
|
3484
|
-
lookbehind: true,
|
|
3485
|
-
alias: 'punctuation'
|
|
3486
|
-
},
|
|
3487
|
-
'list': {
|
|
3488
|
-
// * item
|
|
3489
|
-
// + item
|
|
3490
|
-
// - item
|
|
3491
|
-
// 1. item
|
|
3492
|
-
pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
|
|
3493
|
-
lookbehind: true,
|
|
3494
|
-
alias: 'punctuation'
|
|
3495
|
-
},
|
|
3496
|
-
'url-reference': {
|
|
3497
|
-
// [id]: http://example.com "Optional title"
|
|
3498
|
-
// [id]: http://example.com 'Optional title'
|
|
3499
|
-
// [id]: http://example.com (Optional title)
|
|
3500
|
-
// [id]: <http://example.com> "Optional title"
|
|
3501
|
-
pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
|
|
3502
|
-
inside: {
|
|
3503
|
-
'variable': {
|
|
3504
|
-
pattern: /^(!?\[)[^\]]+/,
|
|
3505
|
-
lookbehind: true
|
|
3506
|
-
},
|
|
3507
|
-
'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
|
|
3508
|
-
'punctuation': /^[\[\]!:]|[<>]/
|
|
3509
|
-
},
|
|
3510
|
-
alias: 'url'
|
|
3511
|
-
},
|
|
3512
|
-
'bold': {
|
|
3513
|
-
// **strong**
|
|
3514
|
-
// __strong__
|
|
3515
|
-
|
|
3516
|
-
// allow one nested instance of italic text using the same delimiter
|
|
3517
|
-
pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
|
|
3518
|
-
lookbehind: true,
|
|
3519
|
-
greedy: true,
|
|
3520
|
-
inside: {
|
|
3521
|
-
'content': {
|
|
3522
|
-
pattern: /(^..)[\s\S]+(?=..$)/,
|
|
3523
|
-
lookbehind: true,
|
|
3524
|
-
inside: {} // see below
|
|
3525
|
-
},
|
|
3526
|
-
'punctuation': /\*\*|__/
|
|
3527
|
-
}
|
|
3528
|
-
},
|
|
3529
|
-
'italic': {
|
|
3530
|
-
// *em*
|
|
3531
|
-
// _em_
|
|
3532
|
-
|
|
3533
|
-
// allow one nested instance of bold text using the same delimiter
|
|
3534
|
-
pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
|
|
3535
|
-
lookbehind: true,
|
|
3536
|
-
greedy: true,
|
|
3537
|
-
inside: {
|
|
3538
|
-
'content': {
|
|
3539
|
-
pattern: /(^.)[\s\S]+(?=.$)/,
|
|
3540
|
-
lookbehind: true,
|
|
3541
|
-
inside: {} // see below
|
|
3542
|
-
},
|
|
3543
|
-
'punctuation': /[*_]/
|
|
3544
|
-
}
|
|
3545
|
-
},
|
|
3546
|
-
'strike': {
|
|
3547
|
-
// ~~strike through~~
|
|
3548
|
-
// ~strike~
|
|
3549
|
-
// eslint-disable-next-line regexp/strict
|
|
3550
|
-
pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
|
|
3551
|
-
lookbehind: true,
|
|
3552
|
-
greedy: true,
|
|
3553
|
-
inside: {
|
|
3554
|
-
'content': {
|
|
3555
|
-
pattern: /(^~~?)[\s\S]+(?=\1$)/,
|
|
3556
|
-
lookbehind: true,
|
|
3557
|
-
inside: {} // see below
|
|
3558
|
-
},
|
|
3559
|
-
'punctuation': /~~?/
|
|
3560
|
-
}
|
|
3561
|
-
},
|
|
3562
|
-
'code-snippet': {
|
|
3563
|
-
// `code`
|
|
3564
|
-
// ``code``
|
|
3565
|
-
pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
|
|
3566
|
-
lookbehind: true,
|
|
3567
|
-
greedy: true,
|
|
3568
|
-
alias: ['code', 'keyword']
|
|
3569
|
-
},
|
|
3570
|
-
'url': {
|
|
3571
|
-
// [example](http://example.com "Optional title")
|
|
3572
|
-
// [example][id]
|
|
3573
|
-
// [example] [id]
|
|
3574
|
-
pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
|
|
3575
|
-
lookbehind: true,
|
|
3576
|
-
greedy: true,
|
|
3577
|
-
inside: {
|
|
3578
|
-
'operator': /^!/,
|
|
3579
|
-
'content': {
|
|
3580
|
-
pattern: /(^\[)[^\]]+(?=\])/,
|
|
3581
|
-
lookbehind: true,
|
|
3582
|
-
inside: {} // see below
|
|
3583
|
-
},
|
|
3584
|
-
'variable': {
|
|
3585
|
-
pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
|
|
3586
|
-
lookbehind: true
|
|
3587
|
-
},
|
|
3588
|
-
'url': {
|
|
3589
|
-
pattern: /(^\]\()[^\s)]+/,
|
|
3590
|
-
lookbehind: true
|
|
3591
|
-
},
|
|
3592
|
-
'string': {
|
|
3593
|
-
pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
|
|
3594
|
-
lookbehind: true
|
|
3595
|
-
}
|
|
3596
|
-
}
|
|
3597
|
-
}
|
|
3598
|
-
});
|
|
3599
|
-
|
|
3600
|
-
['url', 'bold', 'italic', 'strike'].forEach(function (token) {
|
|
3601
|
-
['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (inside) {
|
|
3602
|
-
if (token !== inside) {
|
|
3603
|
-
Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
|
|
3604
|
-
}
|
|
3605
|
-
});
|
|
3606
|
-
});
|
|
3607
|
-
|
|
3608
|
-
Prism.hooks.add('after-tokenize', function (env) {
|
|
3609
|
-
if (env.language !== 'markdown' && env.language !== 'md') {
|
|
3610
|
-
return;
|
|
3611
|
-
}
|
|
3612
|
-
|
|
3613
|
-
function walkTokens(tokens) {
|
|
3614
|
-
if (!tokens || typeof tokens === 'string') {
|
|
3615
|
-
return;
|
|
3616
|
-
}
|
|
3617
|
-
|
|
3618
|
-
for (var i = 0, l = tokens.length; i < l; i++) {
|
|
3619
|
-
var token = tokens[i];
|
|
3620
|
-
|
|
3621
|
-
if (token.type !== 'code') {
|
|
3622
|
-
walkTokens(token.content);
|
|
3623
|
-
continue;
|
|
3624
|
-
}
|
|
3625
|
-
|
|
3626
|
-
/*
|
|
3627
|
-
* Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
|
|
3628
|
-
* is optional. But the grammar is defined so that there is only one case we have to handle:
|
|
3629
|
-
*
|
|
3630
|
-
* token.content = [
|
|
3631
|
-
* <span class="punctuation">```</span>,
|
|
3632
|
-
* <span class="code-language">xxxx</span>,
|
|
3633
|
-
* '\n', // exactly one new lines (\r or \n or \r\n)
|
|
3634
|
-
* <span class="code-block">...</span>,
|
|
3635
|
-
* '\n', // exactly one new lines again
|
|
3636
|
-
* <span class="punctuation">```</span>
|
|
3637
|
-
* ];
|
|
3638
|
-
*/
|
|
3639
|
-
|
|
3640
|
-
var codeLang = token.content[1];
|
|
3641
|
-
var codeBlock = token.content[3];
|
|
3642
|
-
|
|
3643
|
-
if (codeLang && codeBlock &&
|
|
3644
|
-
codeLang.type === 'code-language' && codeBlock.type === 'code-block' &&
|
|
3645
|
-
typeof codeLang.content === 'string') {
|
|
3646
|
-
|
|
3647
|
-
// this might be a language that Prism does not support
|
|
3648
|
-
|
|
3649
|
-
// do some replacements to support C++, C#, and F#
|
|
3650
|
-
var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp');
|
|
3651
|
-
// only use the first word
|
|
3652
|
-
lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
|
|
3653
|
-
var alias = 'language-' + lang;
|
|
3654
|
-
|
|
3655
|
-
// add alias
|
|
3656
|
-
if (!codeBlock.alias) {
|
|
3657
|
-
codeBlock.alias = [alias];
|
|
3658
|
-
} else if (typeof codeBlock.alias === 'string') {
|
|
3659
|
-
codeBlock.alias = [codeBlock.alias, alias];
|
|
3660
|
-
} else {
|
|
3661
|
-
codeBlock.alias.push(alias);
|
|
3662
|
-
}
|
|
3663
|
-
}
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
|
|
3667
|
-
walkTokens(env.tokens);
|
|
3668
|
-
});
|
|
3669
|
-
|
|
3670
|
-
Prism.hooks.add('wrap', function (env) {
|
|
3671
|
-
if (env.type !== 'code-block') {
|
|
3672
|
-
return;
|
|
3673
|
-
}
|
|
3674
|
-
|
|
3675
|
-
var codeLang = '';
|
|
3676
|
-
for (var i = 0, l = env.classes.length; i < l; i++) {
|
|
3677
|
-
var cls = env.classes[i];
|
|
3678
|
-
var match = /language-(.+)/.exec(cls);
|
|
3679
|
-
if (match) {
|
|
3680
|
-
codeLang = match[1];
|
|
3681
|
-
break;
|
|
3682
|
-
}
|
|
3683
|
-
}
|
|
3684
|
-
|
|
3685
|
-
var grammar = Prism.languages[codeLang];
|
|
3686
|
-
|
|
3687
|
-
if (!grammar) {
|
|
3688
|
-
if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
|
|
3689
|
-
var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
|
|
3690
|
-
env.attributes['id'] = id;
|
|
3691
|
-
|
|
3692
|
-
Prism.plugins.autoloader.loadLanguages(codeLang, function () {
|
|
3693
|
-
var ele = document.getElementById(id);
|
|
3694
|
-
if (ele) {
|
|
3695
|
-
ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
|
|
3696
|
-
}
|
|
3697
|
-
});
|
|
3698
|
-
}
|
|
3699
|
-
} else {
|
|
3700
|
-
env.content = Prism.highlight(textContent(env.content), grammar, codeLang);
|
|
3701
|
-
}
|
|
3702
|
-
});
|
|
3703
|
-
|
|
3704
|
-
var tagPattern = RegExp(Prism.languages.markup.tag.pattern.source, 'gi');
|
|
3705
|
-
|
|
3706
|
-
/**
|
|
3707
|
-
* A list of known entity names.
|
|
3708
|
-
*
|
|
3709
|
-
* This will always be incomplete to save space. The current list is the one used by lowdash's unescape function.
|
|
3710
|
-
*
|
|
3711
|
-
* @see {@link https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/unescape.js#L2}
|
|
3712
|
-
*/
|
|
3713
|
-
var KNOWN_ENTITY_NAMES = {
|
|
3714
|
-
'amp': '&',
|
|
3715
|
-
'lt': '<',
|
|
3716
|
-
'gt': '>',
|
|
3717
|
-
'quot': '"',
|
|
3718
|
-
};
|
|
3719
|
-
|
|
3720
|
-
// IE 11 doesn't support `String.fromCodePoint`
|
|
3721
|
-
var fromCodePoint = String.fromCodePoint || String.fromCharCode;
|
|
3722
|
-
|
|
3723
|
-
/**
|
|
3724
|
-
* Returns the text content of a given HTML source code string.
|
|
3725
|
-
*
|
|
3726
|
-
* @param {string} html
|
|
3727
|
-
* @returns {string}
|
|
3728
|
-
*/
|
|
3729
|
-
function textContent(html) {
|
|
3730
|
-
// remove all tags
|
|
3731
|
-
var text = html.replace(tagPattern, '');
|
|
3732
|
-
|
|
3733
|
-
// decode known entities
|
|
3734
|
-
text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function (m, code) {
|
|
3735
|
-
code = code.toLowerCase();
|
|
3736
|
-
|
|
3737
|
-
if (code[0] === '#') {
|
|
3738
|
-
var value;
|
|
3739
|
-
if (code[1] === 'x') {
|
|
3740
|
-
value = parseInt(code.slice(2), 16);
|
|
3741
|
-
} else {
|
|
3742
|
-
value = Number(code.slice(1));
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
return fromCodePoint(value);
|
|
3746
|
-
} else {
|
|
3747
|
-
var known = KNOWN_ENTITY_NAMES[code];
|
|
3748
|
-
if (known) {
|
|
3749
|
-
return known;
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
// unable to decode
|
|
3753
|
-
return m;
|
|
3754
|
-
}
|
|
3755
|
-
});
|
|
3756
|
-
|
|
3757
|
-
return text;
|
|
3758
|
-
}
|
|
3759
|
-
|
|
3760
|
-
Prism.languages.md = Prism.languages.markdown;
|
|
3761
|
-
|
|
3762
|
-
}(Prism));
|
|
3763
|
-
|
|
3764
|
-
Prism.languages.markup = {
|
|
3765
|
-
'comment': {
|
|
3766
|
-
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
3767
|
-
greedy: true
|
|
3768
|
-
},
|
|
3769
|
-
'prolog': {
|
|
3770
|
-
pattern: /<\?[\s\S]+?\?>/,
|
|
3771
|
-
greedy: true
|
|
3772
|
-
},
|
|
3773
|
-
'doctype': {
|
|
3774
|
-
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
3775
|
-
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
3776
|
-
greedy: true,
|
|
3777
|
-
inside: {
|
|
3778
|
-
'internal-subset': {
|
|
3779
|
-
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
3780
|
-
lookbehind: true,
|
|
3781
|
-
greedy: true,
|
|
3782
|
-
inside: null // see below
|
|
3783
|
-
},
|
|
3784
|
-
'string': {
|
|
3785
|
-
pattern: /"[^"]*"|'[^']*'/,
|
|
3786
|
-
greedy: true
|
|
3787
|
-
},
|
|
3788
|
-
'punctuation': /^<!|>$|[[\]]/,
|
|
3789
|
-
'doctype-tag': /^DOCTYPE/i,
|
|
3790
|
-
'name': /[^\s<>'"]+/
|
|
3791
|
-
}
|
|
3792
|
-
},
|
|
3793
|
-
'cdata': {
|
|
3794
|
-
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
3795
|
-
greedy: true
|
|
3796
|
-
},
|
|
3797
|
-
'tag': {
|
|
3798
|
-
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
3799
|
-
greedy: true,
|
|
3800
|
-
inside: {
|
|
3801
|
-
'tag': {
|
|
3802
|
-
pattern: /^<\/?[^\s>\/]+/,
|
|
3803
|
-
inside: {
|
|
3804
|
-
'punctuation': /^<\/?/,
|
|
3805
|
-
'namespace': /^[^\s>\/:]+:/
|
|
3806
|
-
}
|
|
3807
|
-
},
|
|
3808
|
-
'special-attr': [],
|
|
3809
|
-
'attr-value': {
|
|
3810
|
-
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
3811
|
-
inside: {
|
|
3812
|
-
'punctuation': [
|
|
3813
|
-
{
|
|
3814
|
-
pattern: /^=/,
|
|
3815
|
-
alias: 'attr-equals'
|
|
3816
|
-
},
|
|
3817
|
-
{
|
|
3818
|
-
pattern: /^(\s*)["']|["']$/,
|
|
3819
|
-
lookbehind: true
|
|
3820
|
-
}
|
|
3821
|
-
]
|
|
3822
|
-
}
|
|
3823
|
-
},
|
|
3824
|
-
'punctuation': /\/?>/,
|
|
3825
|
-
'attr-name': {
|
|
3826
|
-
pattern: /[^\s>\/]+/,
|
|
3827
|
-
inside: {
|
|
3828
|
-
'namespace': /^[^\s>\/:]+:/
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
|
|
3832
|
-
}
|
|
3833
|
-
},
|
|
3834
|
-
'entity': [
|
|
3835
|
-
{
|
|
3836
|
-
pattern: /&[\da-z]{1,8};/i,
|
|
3837
|
-
alias: 'named-entity'
|
|
3838
|
-
},
|
|
3839
|
-
/&#x?[\da-f]{1,8};/i
|
|
3840
|
-
]
|
|
3841
|
-
};
|
|
3842
|
-
|
|
3843
|
-
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
|
3844
|
-
Prism.languages.markup['entity'];
|
|
3845
|
-
Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
|
|
3846
|
-
|
|
3847
|
-
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
|
3848
|
-
Prism.hooks.add('wrap', function (env) {
|
|
3849
|
-
|
|
3850
|
-
if (env.type === 'entity') {
|
|
3851
|
-
env.attributes['title'] = env.content.replace(/&/, '&');
|
|
3852
|
-
}
|
|
3853
|
-
});
|
|
3854
|
-
|
|
3855
|
-
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
|
|
3856
|
-
/**
|
|
3857
|
-
* Adds an inlined language to markup.
|
|
3858
|
-
*
|
|
3859
|
-
* An example of an inlined language is CSS with `<style>` tags.
|
|
3860
|
-
*
|
|
3861
|
-
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
|
3862
|
-
* case insensitive.
|
|
3863
|
-
* @param {string} lang The language key.
|
|
3864
|
-
* @example
|
|
3865
|
-
* addInlined('style', 'css');
|
|
3866
|
-
*/
|
|
3867
|
-
value: function addInlined(tagName, lang) {
|
|
3868
|
-
var includedCdataInside = {};
|
|
3869
|
-
includedCdataInside['language-' + lang] = {
|
|
3870
|
-
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
3871
|
-
lookbehind: true,
|
|
3872
|
-
inside: Prism.languages[lang]
|
|
3873
|
-
};
|
|
3874
|
-
includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
|
|
3875
|
-
|
|
3876
|
-
var inside = {
|
|
3877
|
-
'included-cdata': {
|
|
3878
|
-
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
3879
|
-
inside: includedCdataInside
|
|
3880
|
-
}
|
|
3881
|
-
};
|
|
3882
|
-
inside['language-' + lang] = {
|
|
3883
|
-
pattern: /[\s\S]+/,
|
|
3884
|
-
inside: Prism.languages[lang]
|
|
3885
|
-
};
|
|
3886
|
-
|
|
3887
|
-
var def = {};
|
|
3888
|
-
def[tagName] = {
|
|
3889
|
-
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
|
|
3890
|
-
lookbehind: true,
|
|
3891
|
-
greedy: true,
|
|
3892
|
-
inside: inside
|
|
3893
|
-
};
|
|
3894
|
-
|
|
3895
|
-
Prism.languages.insertBefore('markup', 'cdata', def);
|
|
3896
|
-
}
|
|
3897
|
-
});
|
|
3898
|
-
Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
|
|
3899
|
-
/**
|
|
3900
|
-
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
3901
|
-
*
|
|
3902
|
-
* An example of an inlined language is CSS with `style` attributes.
|
|
3903
|
-
*
|
|
3904
|
-
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
|
3905
|
-
* case insensitive.
|
|
3906
|
-
* @param {string} lang The language key.
|
|
3907
|
-
* @example
|
|
3908
|
-
* addAttribute('style', 'css');
|
|
3909
|
-
*/
|
|
3910
|
-
value: function (attrName, lang) {
|
|
3911
|
-
Prism.languages.markup.tag.inside['special-attr'].push({
|
|
3912
|
-
pattern: RegExp(
|
|
3913
|
-
/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
3914
|
-
'i'
|
|
3915
|
-
),
|
|
3916
|
-
lookbehind: true,
|
|
3917
|
-
inside: {
|
|
3918
|
-
'attr-name': /^[^\s=]+/,
|
|
3919
|
-
'attr-value': {
|
|
3920
|
-
pattern: /=[\s\S]+/,
|
|
3921
|
-
inside: {
|
|
3922
|
-
'value': {
|
|
3923
|
-
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
3924
|
-
lookbehind: true,
|
|
3925
|
-
alias: [lang, 'language-' + lang],
|
|
3926
|
-
inside: Prism.languages[lang]
|
|
3927
|
-
},
|
|
3928
|
-
'punctuation': [
|
|
3929
|
-
{
|
|
3930
|
-
pattern: /^=/,
|
|
3931
|
-
alias: 'attr-equals'
|
|
3932
|
-
},
|
|
3933
|
-
/"|'/
|
|
3934
|
-
]
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
}
|
|
3938
|
-
});
|
|
3939
|
-
}
|
|
3940
|
-
});
|
|
3941
|
-
|
|
3942
|
-
Prism.languages.html = Prism.languages.markup;
|
|
3943
|
-
Prism.languages.mathml = Prism.languages.markup;
|
|
3944
|
-
Prism.languages.svg = Prism.languages.markup;
|
|
3945
|
-
|
|
3946
|
-
Prism.languages.xml = Prism.languages.extend('markup', {});
|
|
3947
|
-
Prism.languages.ssml = Prism.languages.xml;
|
|
3948
|
-
Prism.languages.atom = Prism.languages.xml;
|
|
3949
|
-
Prism.languages.rss = Prism.languages.xml;
|
|
3950
|
-
|
|
3951
|
-
var prismPython = {};
|
|
3952
|
-
|
|
3953
|
-
var hasRequiredPrismPython;
|
|
3954
|
-
|
|
3955
|
-
function requirePrismPython () {
|
|
3956
|
-
if (hasRequiredPrismPython) return prismPython;
|
|
3957
|
-
hasRequiredPrismPython = 1;
|
|
3958
|
-
Prism.languages.python = {
|
|
3959
|
-
'comment': {
|
|
3960
|
-
pattern: /(^|[^\\])#.*/,
|
|
3961
|
-
lookbehind: true,
|
|
3962
|
-
greedy: true
|
|
3963
|
-
},
|
|
3964
|
-
'string-interpolation': {
|
|
3965
|
-
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
3966
|
-
greedy: true,
|
|
3967
|
-
inside: {
|
|
3968
|
-
'interpolation': {
|
|
3969
|
-
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
3970
|
-
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
3971
|
-
lookbehind: true,
|
|
3972
|
-
inside: {
|
|
3973
|
-
'format-spec': {
|
|
3974
|
-
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
3975
|
-
lookbehind: true
|
|
3976
|
-
},
|
|
3977
|
-
'conversion-option': {
|
|
3978
|
-
pattern: //,
|
|
3979
|
-
alias: 'punctuation'
|
|
3980
|
-
},
|
|
3981
|
-
rest: null
|
|
3982
|
-
}
|
|
3983
|
-
},
|
|
3984
|
-
'string': /[\s\S]+/
|
|
3985
|
-
}
|
|
3986
|
-
},
|
|
3987
|
-
'triple-quoted-string': {
|
|
3988
|
-
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
3989
|
-
greedy: true,
|
|
3990
|
-
alias: 'string'
|
|
3991
|
-
},
|
|
3992
|
-
'string': {
|
|
3993
|
-
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
3994
|
-
greedy: true
|
|
3995
|
-
},
|
|
3996
|
-
'function': {
|
|
3997
|
-
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
3998
|
-
lookbehind: true
|
|
3999
|
-
},
|
|
4000
|
-
'class-name': {
|
|
4001
|
-
pattern: /(\bclass\s+)\w+/i,
|
|
4002
|
-
lookbehind: true
|
|
4003
|
-
},
|
|
4004
|
-
'decorator': {
|
|
4005
|
-
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
4006
|
-
lookbehind: true,
|
|
4007
|
-
alias: ['annotation', 'punctuation'],
|
|
4008
|
-
inside: {
|
|
4009
|
-
'punctuation': /\./
|
|
4010
|
-
}
|
|
4011
|
-
},
|
|
4012
|
-
'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
4013
|
-
'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
4014
|
-
'boolean': /\b(?:False|None|True)\b/,
|
|
4015
|
-
'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
4016
|
-
'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
4017
|
-
'punctuation': /[{}[\];(),.:]/
|
|
4018
|
-
};
|
|
4019
|
-
|
|
4020
|
-
Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
|
|
4021
|
-
|
|
4022
|
-
Prism.languages.py = Prism.languages.python;
|
|
4023
|
-
return prismPython;
|
|
4024
|
-
}
|
|
4025
|
-
|
|
4026
|
-
requirePrismPython();
|
|
4027
|
-
|
|
4028
|
-
Prism.languages.sql = {
|
|
4029
|
-
'comment': {
|
|
4030
|
-
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
|
|
4031
|
-
lookbehind: true
|
|
4032
|
-
},
|
|
4033
|
-
'variable': [
|
|
4034
|
-
{
|
|
4035
|
-
pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
|
|
4036
|
-
greedy: true
|
|
4037
|
-
},
|
|
4038
|
-
/@[\w.$]+/
|
|
4039
|
-
],
|
|
4040
|
-
'string': {
|
|
4041
|
-
pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
|
|
4042
|
-
greedy: true,
|
|
4043
|
-
lookbehind: true
|
|
4044
|
-
},
|
|
4045
|
-
'identifier': {
|
|
4046
|
-
pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
|
|
4047
|
-
greedy: true,
|
|
4048
|
-
lookbehind: true,
|
|
4049
|
-
inside: {
|
|
4050
|
-
'punctuation': /^`|`$/
|
|
4051
|
-
}
|
|
4052
|
-
},
|
|
4053
|
-
'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, // Should we highlight user defined functions too?
|
|
4054
|
-
'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
|
|
4055
|
-
'boolean': /\b(?:FALSE|NULL|TRUE)\b/i,
|
|
4056
|
-
'number': /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
|
|
4057
|
-
'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
|
|
4058
|
-
'punctuation': /[;[\]()`,.]/
|
|
4059
|
-
};
|
|
4060
|
-
|
|
4061
|
-
(function (Prism) {
|
|
4062
|
-
|
|
4063
|
-
// https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
|
4064
|
-
// https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
|
4065
|
-
var anchorOrAlias = /[*&][^\s[\]{},]+/;
|
|
4066
|
-
// https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
|
4067
|
-
var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
|
4068
|
-
// https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
|
4069
|
-
var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
|
|
4070
|
-
+ anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
|
|
4071
|
-
// https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
|
4072
|
-
// This is a simplified version that doesn't support "#" and multiline keys
|
|
4073
|
-
// All these long scarry character classes are simplified versions of YAML's characters
|
|
4074
|
-
var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
|
|
4075
|
-
.replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
|
|
4076
|
-
var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
|
4077
|
-
|
|
4078
|
-
/**
|
|
4079
|
-
*
|
|
4080
|
-
* @param {string} value
|
|
4081
|
-
* @param {string} [flags]
|
|
4082
|
-
* @returns {RegExp}
|
|
4083
|
-
*/
|
|
4084
|
-
function createValuePattern(value, flags) {
|
|
4085
|
-
flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
|
|
4086
|
-
var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
|
|
4087
|
-
.replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
|
|
4088
|
-
return RegExp(pattern, flags);
|
|
4089
|
-
}
|
|
4090
|
-
|
|
4091
|
-
Prism.languages.yaml = {
|
|
4092
|
-
'scalar': {
|
|
4093
|
-
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
|
|
4094
|
-
.replace(/<<prop>>/g, function () { return properties; })),
|
|
4095
|
-
lookbehind: true,
|
|
4096
|
-
alias: 'string'
|
|
4097
|
-
},
|
|
4098
|
-
'comment': /#.*/,
|
|
4099
|
-
'key': {
|
|
4100
|
-
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
|
|
4101
|
-
.replace(/<<prop>>/g, function () { return properties; })
|
|
4102
|
-
.replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
|
|
4103
|
-
lookbehind: true,
|
|
4104
|
-
greedy: true,
|
|
4105
|
-
alias: 'atrule'
|
|
4106
|
-
},
|
|
4107
|
-
'directive': {
|
|
4108
|
-
pattern: /(^[ \t]*)%.+/m,
|
|
4109
|
-
lookbehind: true,
|
|
4110
|
-
alias: 'important'
|
|
4111
|
-
},
|
|
4112
|
-
'datetime': {
|
|
4113
|
-
pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
|
|
4114
|
-
lookbehind: true,
|
|
4115
|
-
alias: 'number'
|
|
4116
|
-
},
|
|
4117
|
-
'boolean': {
|
|
4118
|
-
pattern: createValuePattern(/false|true/.source, 'i'),
|
|
4119
|
-
lookbehind: true,
|
|
4120
|
-
alias: 'important'
|
|
4121
|
-
},
|
|
4122
|
-
'null': {
|
|
4123
|
-
pattern: createValuePattern(/null|~/.source, 'i'),
|
|
4124
|
-
lookbehind: true,
|
|
4125
|
-
alias: 'important'
|
|
4126
|
-
},
|
|
4127
|
-
'string': {
|
|
4128
|
-
pattern: createValuePattern(string),
|
|
4129
|
-
lookbehind: true,
|
|
4130
|
-
greedy: true
|
|
4131
|
-
},
|
|
4132
|
-
'number': {
|
|
4133
|
-
pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
|
|
4134
|
-
lookbehind: true
|
|
4135
|
-
},
|
|
4136
|
-
'tag': tag,
|
|
4137
|
-
'important': anchorOrAlias,
|
|
4138
|
-
'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
|
|
4139
|
-
};
|
|
4140
|
-
|
|
4141
|
-
Prism.languages.yml = Prism.languages.yaml;
|
|
4142
|
-
|
|
4143
|
-
}(Prism));
|
|
4144
|
-
|
|
4145
|
-
function styleInject(css, ref) {
|
|
4146
|
-
if ( ref === void 0 ) ref = {};
|
|
4147
|
-
var insertAt = ref.insertAt;
|
|
4148
|
-
|
|
4149
|
-
if (typeof document === 'undefined') { return; }
|
|
4150
|
-
|
|
4151
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
4152
|
-
var style = document.createElement('style');
|
|
4153
|
-
style.type = 'text/css';
|
|
4154
|
-
|
|
4155
|
-
if (insertAt === 'top') {
|
|
4156
|
-
if (head.firstChild) {
|
|
4157
|
-
head.insertBefore(style, head.firstChild);
|
|
4158
|
-
} else {
|
|
4159
|
-
head.appendChild(style);
|
|
4160
|
-
}
|
|
4161
|
-
} else {
|
|
4162
|
-
head.appendChild(style);
|
|
4163
|
-
}
|
|
4164
|
-
|
|
4165
|
-
if (style.styleSheet) {
|
|
4166
|
-
style.styleSheet.cssText = css;
|
|
4167
|
-
} else {
|
|
4168
|
-
style.appendChild(document.createTextNode(css));
|
|
4169
|
-
}
|
|
4170
|
-
}
|
|
4171
|
-
|
|
4172
|
-
var css_248z = "code[class*=language-],pre[class*=language-]{word-wrap:normal;background:none;color:#ccc;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;text-align:left;white-space:pre;word-break:normal;word-spacing:normal}pre[class*=language-]{margin:.5em 0;overflow:auto;padding:1em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{border-radius:.3em;padding:.1em;white-space:normal}.prism-tomorrow_token__KrW-C.prism-tomorrow_block-comment__fmeiG,.prism-tomorrow_token__KrW-C.prism-tomorrow_cdata__gaM1U,.prism-tomorrow_token__KrW-C.prism-tomorrow_comment__MpEjR,.prism-tomorrow_token__KrW-C.prism-tomorrow_doctype__34yKK,.prism-tomorrow_token__KrW-C.prism-tomorrow_prolog__2XDAA{color:#999}.prism-tomorrow_token__KrW-C.prism-tomorrow_punctuation__GT4Hh{color:#ccc}.prism-tomorrow_token__KrW-C.prism-tomorrow_attr-name__RiyBx,.prism-tomorrow_token__KrW-C.prism-tomorrow_deleted__fbS8t,.prism-tomorrow_token__KrW-C.prism-tomorrow_namespace__LDKlc,.prism-tomorrow_token__KrW-C.prism-tomorrow_tag__wwC6b{color:#e2777a}.prism-tomorrow_token__KrW-C.prism-tomorrow_function-name__rqSQu{color:#6196cc}.prism-tomorrow_token__KrW-C.prism-tomorrow_boolean__6L25S,.prism-tomorrow_token__KrW-C.prism-tomorrow_function__VtlZD,.prism-tomorrow_token__KrW-C.prism-tomorrow_number__Z59SX{color:#f08d49}.prism-tomorrow_token__KrW-C.prism-tomorrow_class-name__QD5Je,.prism-tomorrow_token__KrW-C.prism-tomorrow_constant__UpgQc,.prism-tomorrow_token__KrW-C.prism-tomorrow_property__PI46C,.prism-tomorrow_token__KrW-C.prism-tomorrow_symbol__MsngS{color:#f8c555}.prism-tomorrow_token__KrW-C.prism-tomorrow_atrule__dQpZ0,.prism-tomorrow_token__KrW-C.prism-tomorrow_builtin__PtyR-,.prism-tomorrow_token__KrW-C.prism-tomorrow_important__utoFb,.prism-tomorrow_token__KrW-C.prism-tomorrow_keyword__08y7S,.prism-tomorrow_token__KrW-C.prism-tomorrow_selector__2Nh-h{color:#cc99cd}.prism-tomorrow_token__KrW-C.prism-tomorrow_attr-value__BBClg,.prism-tomorrow_token__KrW-C.prism-tomorrow_char__mbFhI,.prism-tomorrow_token__KrW-C.prism-tomorrow_regex__iN-NT,.prism-tomorrow_token__KrW-C.prism-tomorrow_string__0zO2B,.prism-tomorrow_token__KrW-C.prism-tomorrow_variable__jgQen{color:#7ec699}.prism-tomorrow_token__KrW-C.prism-tomorrow_entity__Mfep8,.prism-tomorrow_token__KrW-C.prism-tomorrow_operator__roMFP,.prism-tomorrow_token__KrW-C.prism-tomorrow_url__Arvav{color:#67cdcc}.prism-tomorrow_token__KrW-C.prism-tomorrow_bold__uoby2,.prism-tomorrow_token__KrW-C.prism-tomorrow_important__utoFb{font-weight:700}.prism-tomorrow_token__KrW-C.prism-tomorrow_italic__OOrET{font-style:italic}.prism-tomorrow_token__KrW-C.prism-tomorrow_entity__Mfep8{cursor:help}.prism-tomorrow_token__KrW-C.prism-tomorrow_inserted__U8Old{color:green}";
|
|
4173
|
-
styleInject(css_248z);
|
|
4174
|
-
|
|
4175
455
|
var theme = {
|
|
4176
456
|
plain: {
|
|
4177
457
|
color: "#e2e8f0",
|
|
@@ -4227,12 +507,11 @@ var theme = {
|
|
|
4227
507
|
};
|
|
4228
508
|
|
|
4229
509
|
var CodeBlock = function CodeBlock(_a) {
|
|
4230
|
-
var inline = _a.inline
|
|
4231
|
-
_a.
|
|
4232
|
-
var language = _a.language,
|
|
510
|
+
var inline = _a.inline,
|
|
511
|
+
language = _a.language,
|
|
4233
512
|
children = _a.children,
|
|
4234
|
-
rest = __rest(_a, ["inline", "className", "language", "children"]);
|
|
4235
|
-
var _b = React
|
|
513
|
+
rest = tslib.__rest(_a, ["inline", "className", "language", "children"]);
|
|
514
|
+
var _b = React.useState(false),
|
|
4236
515
|
copied = _b[0],
|
|
4237
516
|
setCopied = _b[1];
|
|
4238
517
|
var onCopy = function onCopy() {
|
|
@@ -4248,47 +527,47 @@ var CodeBlock = function CodeBlock(_a) {
|
|
|
4248
527
|
return (
|
|
4249
528
|
/*#__PURE__*/
|
|
4250
529
|
// Small inline code block, that should be used in a sentence
|
|
4251
|
-
React
|
|
530
|
+
React.createElement("code", _extends({
|
|
4252
531
|
className: "bg-stone-800 text-white p-1 rounded"
|
|
4253
532
|
}, rest), children)
|
|
4254
533
|
);
|
|
4255
534
|
}
|
|
4256
|
-
return /*#__PURE__*/React
|
|
535
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4257
536
|
className: "group relative mt-4"
|
|
4258
|
-
}, /*#__PURE__*/React
|
|
537
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4259
538
|
className: "absolute right-4 top-4 z-10"
|
|
4260
|
-
}, /*#__PURE__*/React
|
|
539
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
4261
540
|
onClick: onCopy,
|
|
4262
541
|
className: cn("flex items-center space-x-1 rounded-md px-2 py-1 text-xs", "bg-gray-700/50 text-gray-300 transition-colors", "hover:bg-gray-600/50 hover:text-gray-200")
|
|
4263
|
-
}, copied ? /*#__PURE__*/React
|
|
542
|
+
}, copied ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(lucideReact.Check, {
|
|
4264
543
|
className: "h-3 w-3"
|
|
4265
|
-
}), /*#__PURE__*/React
|
|
544
|
+
}), /*#__PURE__*/React.createElement("span", null, "Copied!")) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(lucideReact.Copy, {
|
|
4266
545
|
className: "h-3 w-3"
|
|
4267
|
-
}), /*#__PURE__*/React
|
|
546
|
+
}), /*#__PURE__*/React.createElement("span", null, "Copy")))), /*#__PURE__*/React.createElement(prismReactRenderer.Highlight, {
|
|
4268
547
|
code: children.trim(),
|
|
4269
548
|
language: language === "tsx" ? "jsx" : language,
|
|
4270
549
|
theme: theme,
|
|
4271
|
-
prism: Prism
|
|
550
|
+
prism: Prism
|
|
4272
551
|
}, function (_a) {
|
|
4273
552
|
var className = _a.className,
|
|
4274
553
|
style = _a.style,
|
|
4275
554
|
tokens = _a.tokens,
|
|
4276
555
|
getLineProps = _a.getLineProps,
|
|
4277
556
|
getTokenProps = _a.getTokenProps;
|
|
4278
|
-
return /*#__PURE__*/React
|
|
557
|
+
return /*#__PURE__*/React.createElement("pre", {
|
|
4279
558
|
className: cn("overflow-x-auto rounded-3xl p-4 text-sm leading-6", "bg-gray-800/80 backdrop-blur-xl", "border border-gray-700/50", className),
|
|
4280
559
|
style: style
|
|
4281
|
-
}, /*#__PURE__*/React
|
|
560
|
+
}, /*#__PURE__*/React.createElement("code", {
|
|
4282
561
|
className: "inline-block min-w-full"
|
|
4283
562
|
}, tokens.map(function (line, i) {
|
|
4284
|
-
return /*#__PURE__*/React
|
|
563
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
4285
564
|
key: i
|
|
4286
565
|
}, getLineProps({
|
|
4287
566
|
line: line
|
|
4288
|
-
})), /*#__PURE__*/React
|
|
567
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
4289
568
|
className: "mr-4 inline-block w-4 text-right text-gray-500 select-none"
|
|
4290
569
|
}, i + 1), line.map(function (token, key) {
|
|
4291
|
-
return /*#__PURE__*/React
|
|
570
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
4292
571
|
key: key
|
|
4293
572
|
}, getTokenProps({
|
|
4294
573
|
token: token
|
|
@@ -4303,11 +582,10 @@ var Markdown = function Markdown(_a) {
|
|
|
4303
582
|
return /*#__PURE__*/React.createElement(ReactMarkdown, {
|
|
4304
583
|
components: {
|
|
4305
584
|
code: function code(_a) {
|
|
4306
|
-
_a.
|
|
4307
|
-
var inline = _a.inline,
|
|
585
|
+
var inline = _a.inline,
|
|
4308
586
|
className = _a.className,
|
|
4309
587
|
children = _a.children;
|
|
4310
|
-
__rest(_a, ["node", "inline", "className", "children"]);
|
|
588
|
+
tslib.__rest(_a, ["node", "inline", "className", "children"]);
|
|
4311
589
|
var match = /language-(\w+)/.exec(className || "");
|
|
4312
590
|
return /*#__PURE__*/React.createElement(CodeBlock, {
|
|
4313
591
|
inline: inline,
|
|
@@ -4335,7 +613,7 @@ var Alert = function Alert(_a) {
|
|
|
4335
613
|
className = _a.className,
|
|
4336
614
|
_c = _a.closeable,
|
|
4337
615
|
closeable = _c === void 0 ? false : _c;
|
|
4338
|
-
var _d = React
|
|
616
|
+
var _d = React.useState(true),
|
|
4339
617
|
isVisible = _d[0],
|
|
4340
618
|
setIsVisible = _d[1];
|
|
4341
619
|
var Icon = iconMap === null || iconMap === void 0 ? void 0 : iconMap[variant];
|
|
@@ -4368,7 +646,7 @@ var Card = function Card(_a) {
|
|
|
4368
646
|
|
|
4369
647
|
var Skeleton = function Skeleton(_a) {
|
|
4370
648
|
var className = _a.className,
|
|
4371
|
-
props = __rest(_a, ["className"]);
|
|
649
|
+
props = tslib.__rest(_a, ["className"]);
|
|
4372
650
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
4373
651
|
className: cn("animate-pulse bg-gray-500 bg-opacity-20 rounded-4xl", className)
|
|
4374
652
|
}, props));
|
|
@@ -4399,7 +677,7 @@ var TabGroup = function TabGroup(_a) {
|
|
|
4399
677
|
_d = _a.variant,
|
|
4400
678
|
variant = _d === void 0 ? "primary" : _d,
|
|
4401
679
|
className = _a.className;
|
|
4402
|
-
var _e = React
|
|
680
|
+
var _e = React.useState((_b = tabs[0]) === null || _b === void 0 ? void 0 : _b.id),
|
|
4403
681
|
activeTab = _e[0],
|
|
4404
682
|
setActiveTab = _e[1];
|
|
4405
683
|
var longestTabLabel = Math.max.apply(Math, tabs.map(function (tab) {
|
|
@@ -4483,4 +761,3 @@ exports.TabGroup = TabGroup;
|
|
|
4483
761
|
exports.Table = Table;
|
|
4484
762
|
exports.Textarea = Textarea;
|
|
4485
763
|
exports.Tooltip = Tooltip;
|
|
4486
|
-
//# sourceMappingURL=index.cjs.js.map
|