jcc-express-mvc 1.5.5 → 1.5.6
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/lib/Application/ApplicationBuilder.d.ts +2 -2
- package/lib/Application/ApplicationBuilder.d.ts.map +1 -1
- package/lib/Application/ApplicationBuilder.js +2 -2
- package/lib/Error/public/css/app-error-prism-line.css +71 -0
- package/lib/Error/public/css/app-error-prism.css +99 -0
- package/lib/Error/public/css/app-error.css +64 -0
- package/lib/Error/public/error.html +130 -0
- package/lib/Error/public/js/app-error-prism-line.js +377 -0
- package/lib/Error/public/js/app-error-prism.js +7 -0
- package/lib/Error/public/pageNotFound.html +28 -0
- package/package.json +1 -1
|
@@ -4,13 +4,13 @@ import { RouteConfig } from "../Interface";
|
|
|
4
4
|
export declare class ApplicationBuilder {
|
|
5
5
|
app: Application;
|
|
6
6
|
constructor(app: Application);
|
|
7
|
-
|
|
7
|
+
withKernel(Kernel: any): this;
|
|
8
8
|
withRouting(routeConfig: RouteConfig[]): this;
|
|
9
9
|
withProviders(providers: Array<new (app: Application) => ServiceProvider>): this;
|
|
10
10
|
private withEvents;
|
|
11
11
|
private withBroadcasting;
|
|
12
12
|
withConsole(): this;
|
|
13
|
-
|
|
13
|
+
withMiddleware(): this;
|
|
14
14
|
create(): Application;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=ApplicationBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationBuilder.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/ApplicationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,qBAAa,kBAAkB;IACtB,GAAG,EAAE,WAAW,CAAC;gBAEZ,GAAG,EAAE,WAAW;IAIrB,
|
|
1
|
+
{"version":3,"file":"ApplicationBuilder.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/ApplicationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,qBAAa,kBAAkB;IACtB,GAAG,EAAE,WAAW,CAAC;gBAEZ,GAAG,EAAE,WAAW;IAIrB,UAAU,CAAC,MAAM,EAAE,GAAG;IAKtB,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE;IAOtC,aAAa,CAClB,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAAC;IAM7D,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,gBAAgB;IAIjB,WAAW;IAKX,cAAc;IAWd,MAAM;CAGd"}
|
|
@@ -7,7 +7,7 @@ class ApplicationBuilder {
|
|
|
7
7
|
constructor(app) {
|
|
8
8
|
this.app = app;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
withKernel(Kernel) {
|
|
11
11
|
this.app.bind("HttpKernel", Kernel);
|
|
12
12
|
return this;
|
|
13
13
|
}
|
|
@@ -32,7 +32,7 @@ class ApplicationBuilder {
|
|
|
32
32
|
this.app.bind("ConsoleKernel", NodeArtisanCommand_1.ConsoleKernel);
|
|
33
33
|
return this;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
withMiddleware() {
|
|
36
36
|
//
|
|
37
37
|
const kernel = this.app.resolve("HttpKernel");
|
|
38
38
|
const middleware = new Middleware_1.Middleware(this.app);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
pre[data-line] {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.line-highlight {
|
|
6
|
+
position: absolute;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
padding: inherit 0;
|
|
10
|
+
margin-top: 0.8rem;
|
|
11
|
+
/* Same as .prism’s padding-top */
|
|
12
|
+
|
|
13
|
+
background: hsla(2, 93%, 47%, 0.329);
|
|
14
|
+
background: linear-gradient(
|
|
15
|
+
to right,
|
|
16
|
+
hsla(2, 93%, 47%, 0.329) 70%,
|
|
17
|
+
hsla(2, 93%, 47%, 0.329)
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/* border-bottom: 2px dashed rgb(221, 24, 24); */
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
|
|
23
|
+
line-height: inherit;
|
|
24
|
+
white-space: pre;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media print {
|
|
28
|
+
.line-highlight {
|
|
29
|
+
-webkit-print-color-adjust: exact;
|
|
30
|
+
color-adjust: exact;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.line-highlight:before,
|
|
35
|
+
.line-highlight[data-end]:after {
|
|
36
|
+
content: attr(data-start);
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0.4em;
|
|
39
|
+
left: 0.6em;
|
|
40
|
+
min-width: 1em;
|
|
41
|
+
padding: 0 0.5em;
|
|
42
|
+
background-color: hsla(24, 20%, 50%, 0.4);
|
|
43
|
+
color: hsl(24, 20%, 95%);
|
|
44
|
+
font: bold 65%/1.5 sans-serif;
|
|
45
|
+
text-align: center;
|
|
46
|
+
vertical-align: 0.3em;
|
|
47
|
+
border-radius: 999px;
|
|
48
|
+
text-shadow: none;
|
|
49
|
+
box-shadow: 0 1px white;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.line-highlight[data-end]:after {
|
|
53
|
+
content: attr(data-end);
|
|
54
|
+
top: auto;
|
|
55
|
+
bottom: 0.4em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.line-numbers .line-highlight:before,
|
|
59
|
+
.line-numbers .line-highlight:after {
|
|
60
|
+
content: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
pre[id].linkable-line-numbers span.line-numbers-rows {
|
|
64
|
+
pointer-events: all;
|
|
65
|
+
}
|
|
66
|
+
pre[id].linkable-line-numbers span.line-numbers-rows > span:before {
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
pre[id].linkable-line-numbers span.line-numbers-rows > span:hover:before {
|
|
70
|
+
background-color: rgba(128, 128, 128, 0.2);
|
|
71
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* PrismJS 1.29.0
|
|
2
|
+
https://prismjs.com/download.html#themes=prism-okaidia&languages=clike+javascript */
|
|
3
|
+
code[class*="language-"],
|
|
4
|
+
pre[class*="language-"] {
|
|
5
|
+
color: #f8f8f2;
|
|
6
|
+
background: 0 0;
|
|
7
|
+
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
|
|
8
|
+
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
|
|
9
|
+
font-size: 1em;
|
|
10
|
+
text-align: left;
|
|
11
|
+
white-space: pre;
|
|
12
|
+
word-spacing: normal;
|
|
13
|
+
word-break: normal;
|
|
14
|
+
word-wrap: normal;
|
|
15
|
+
line-height: 1.5;
|
|
16
|
+
-moz-tab-size: 4;
|
|
17
|
+
-o-tab-size: 4;
|
|
18
|
+
tab-size: 4;
|
|
19
|
+
-webkit-hyphens: none;
|
|
20
|
+
-moz-hyphens: none;
|
|
21
|
+
-ms-hyphens: none;
|
|
22
|
+
hyphens: none;
|
|
23
|
+
}
|
|
24
|
+
pre[class*="language-"] {
|
|
25
|
+
padding: 1em;
|
|
26
|
+
overflow: auto;
|
|
27
|
+
border-radius: 0.3em;
|
|
28
|
+
}
|
|
29
|
+
:not(pre) > code[class*="language-"],
|
|
30
|
+
pre[class*="language-"] {
|
|
31
|
+
background: #10151bd0;
|
|
32
|
+
}
|
|
33
|
+
:not(pre) > code[class*="language-"] {
|
|
34
|
+
padding: 0.1em;
|
|
35
|
+
border-radius: 0.3em;
|
|
36
|
+
white-space: normal;
|
|
37
|
+
}
|
|
38
|
+
.token.cdata,
|
|
39
|
+
.token.comment,
|
|
40
|
+
.token.doctype,
|
|
41
|
+
.token.prolog {
|
|
42
|
+
color: #8292a2;
|
|
43
|
+
}
|
|
44
|
+
.token.punctuation {
|
|
45
|
+
color: #cc872d;
|
|
46
|
+
}
|
|
47
|
+
.token.namespace {
|
|
48
|
+
opacity: 0.7;
|
|
49
|
+
}
|
|
50
|
+
.token.constant,
|
|
51
|
+
.token.deleted,
|
|
52
|
+
.token.property,
|
|
53
|
+
.token.symbol,
|
|
54
|
+
.token.tag {
|
|
55
|
+
color: #0786fd;
|
|
56
|
+
}
|
|
57
|
+
.token.boolean,
|
|
58
|
+
.token.number {
|
|
59
|
+
color: #767c83;
|
|
60
|
+
}
|
|
61
|
+
.token.attr-name,
|
|
62
|
+
.token.builtin,
|
|
63
|
+
.token.char,
|
|
64
|
+
.token.inserted,
|
|
65
|
+
.token.selector,
|
|
66
|
+
.token.string {
|
|
67
|
+
color: #07db43e1;
|
|
68
|
+
}
|
|
69
|
+
.language-css .token.string,
|
|
70
|
+
.style .token.string,
|
|
71
|
+
.token.entity,
|
|
72
|
+
.token.operator,
|
|
73
|
+
.token.url,
|
|
74
|
+
.token.variable {
|
|
75
|
+
color: #f8f8f2;
|
|
76
|
+
}
|
|
77
|
+
.token.atrule,
|
|
78
|
+
.token.attr-value,
|
|
79
|
+
.token.class-name,
|
|
80
|
+
.token.function {
|
|
81
|
+
color: #cf74e6;
|
|
82
|
+
}
|
|
83
|
+
.token.keyword {
|
|
84
|
+
color: #e22d2d;
|
|
85
|
+
}
|
|
86
|
+
.token.important,
|
|
87
|
+
.token.regex {
|
|
88
|
+
color: #fd971f;
|
|
89
|
+
}
|
|
90
|
+
.token.bold,
|
|
91
|
+
.token.important {
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
}
|
|
94
|
+
.token.italic {
|
|
95
|
+
font-style: italic;
|
|
96
|
+
}
|
|
97
|
+
.token.entity {
|
|
98
|
+
cursor: help;
|
|
99
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
* {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
body {
|
|
7
|
+
background: #0e0f1d;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
}
|
|
13
|
+
.code-container {
|
|
14
|
+
background: #151b23;
|
|
15
|
+
padding: 10px 0;
|
|
16
|
+
min-height: 60vh;
|
|
17
|
+
max-height: 90vh;
|
|
18
|
+
/* min-width: 800px;
|
|
19
|
+
max-width: 70%; */
|
|
20
|
+
}
|
|
21
|
+
.code-container::-webkit-scrollbar {
|
|
22
|
+
width: 1px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.code-container::-webkit-scrollbar-track {
|
|
26
|
+
background: #f1f1f1; /* Track color */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.code-container::-webkit-scrollbar-thumb {
|
|
30
|
+
background-color: #888; /* Handle color */
|
|
31
|
+
border-radius: 10px; /* Rounded corners for handle */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.code-container::-webkit-scrollbar-thumb:hover {
|
|
35
|
+
background-color: #555; /* Color when hovered */
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.error-message {
|
|
39
|
+
color: #fff; /*rgba(245, 43, 43, 0.897);*/
|
|
40
|
+
padding: 20px;
|
|
41
|
+
width: 100%;
|
|
42
|
+
font-size: 1.3rem;
|
|
43
|
+
border-bottom: 1px solid #ddd;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@media (min-width: 640px) {
|
|
47
|
+
.code-container {
|
|
48
|
+
min-width: 50%;
|
|
49
|
+
max-width: 80%;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (min-width: 768px) {
|
|
54
|
+
.code-container {
|
|
55
|
+
min-width: 50%;
|
|
56
|
+
max-width: 80%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
@media (min-width: 1024px) {
|
|
60
|
+
.code-container {
|
|
61
|
+
min-width: 50%;
|
|
62
|
+
max-width: 60%;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<link rel="stylesheet" href="/css/app-error-prism.css" />
|
|
8
|
+
<link rel="stylesheet" href="/css/app-error-prism-line.css" />
|
|
9
|
+
<link rel="stylesheet" href="/css/app-error.css" />
|
|
10
|
+
<title>Error</title>
|
|
11
|
+
<style>
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body class="">
|
|
15
|
+
<div class="code-container">
|
|
16
|
+
<div class="error-message">
|
|
17
|
+
this.req.validated is not a function. (In 'this.req.validated()', 'this.req.validated' is undefined) <p> /home/abdou/Documents/GAMBTECH/FRAMEWORK/PROJECTS/EXPRESS/express-version2.0/Framework/lib/Request/FormRequest.ts 98:21 </p>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="container">
|
|
20
|
+
<pre
|
|
21
|
+
data-line="98"
|
|
22
|
+
class="line-numbers"
|
|
23
|
+
><code class="language-javascript">1. import { ObjectType } from "../Type";
|
|
24
|
+
2. import { AppRequest } from "../Interface";
|
|
25
|
+
3. import { cloudinaryUpload, saveImage } from "../util";
|
|
26
|
+
4.
|
|
27
|
+
5. export abstract class FormRequest {
|
|
28
|
+
6. protected req: AppRequest;
|
|
29
|
+
7. private requestFile: any;
|
|
30
|
+
8. constructor(req: AppRequest) {
|
|
31
|
+
9. this.req = req;
|
|
32
|
+
10. }
|
|
33
|
+
11.
|
|
34
|
+
12. /**
|
|
35
|
+
13. * Retrieves a query parameter from the request.
|
|
36
|
+
14. * @param {string} name - Name of the query parameter.
|
|
37
|
+
15. * @returns {string} - Value of the query parameter.
|
|
38
|
+
16. */
|
|
39
|
+
17. protected query(name: string): any {
|
|
40
|
+
18. return this.req.query[name];
|
|
41
|
+
19. }
|
|
42
|
+
20.
|
|
43
|
+
21. /**
|
|
44
|
+
22. * Retrieves a route parameter from the request.
|
|
45
|
+
23. * @param {string} name - Name of the route parameter.
|
|
46
|
+
24. * @returns {string} - Value of the route parameter.
|
|
47
|
+
25. */
|
|
48
|
+
26. protected route(name: string): string {
|
|
49
|
+
27. return this.req.params[name];
|
|
50
|
+
28. }
|
|
51
|
+
29.
|
|
52
|
+
30. /**
|
|
53
|
+
31. * Check if request has a file.
|
|
54
|
+
32. * @param {string} name - Name of the file .
|
|
55
|
+
33. * @returns {boolean}.
|
|
56
|
+
34. */
|
|
57
|
+
35. protected hasFile(name: string): boolean {
|
|
58
|
+
36. return this.req.files && this.req.files[name] ? true : false;
|
|
59
|
+
37. }
|
|
60
|
+
38.
|
|
61
|
+
39. /**
|
|
62
|
+
40. * Retrieves the request body.
|
|
63
|
+
41. * @returns {Object} - Request body object.
|
|
64
|
+
42. */
|
|
65
|
+
43. protected request(): ObjectType {
|
|
66
|
+
44. return this.req.body;
|
|
67
|
+
45. }
|
|
68
|
+
46.
|
|
69
|
+
47. /**
|
|
70
|
+
48. * Validates form data using the validation method provided by the request object.
|
|
71
|
+
49. * @param {Object} formData - Data to be validated.
|
|
72
|
+
50. * @returns {Promise} - Promise resolving with validation result.
|
|
73
|
+
51. */
|
|
74
|
+
52. protected async validate(
|
|
75
|
+
53. formData: ObjectType
|
|
76
|
+
54. ): Promise<Record<any, ObjectType>> {
|
|
77
|
+
55. return this.req.validate(formData);
|
|
78
|
+
56. }
|
|
79
|
+
57.
|
|
80
|
+
58. /**
|
|
81
|
+
59. * Sets the request file based on the provided file name.
|
|
82
|
+
60. *
|
|
83
|
+
61. * @param {string} fileName - The name of the file to retrieve from the request.
|
|
84
|
+
62. * @returns {this} The current instance for method chaining.
|
|
85
|
+
63. */
|
|
86
|
+
64. protected file(fileName: string): this {
|
|
87
|
+
65. this.requestFile = fileName;
|
|
88
|
+
66. return this;
|
|
89
|
+
67. }
|
|
90
|
+
68.
|
|
91
|
+
69. /**
|
|
92
|
+
70. * Stores the uploaded file in the specified directory.
|
|
93
|
+
71. *
|
|
94
|
+
72. * @param {string} directory - The directory where the file should be stored.
|
|
95
|
+
73. * @returns {string} A promise that resolves when the file is saved.
|
|
96
|
+
74. */
|
|
97
|
+
75. protected store(directory: string): string {
|
|
98
|
+
76. const file = this.requestFile;
|
|
99
|
+
77. this.requestFile = "";
|
|
100
|
+
78. return saveImage(this.req, file, directory);
|
|
101
|
+
79. }
|
|
102
|
+
80.
|
|
103
|
+
81. /**
|
|
104
|
+
82. * Uploads a file to Cloudinary.
|
|
105
|
+
83. *
|
|
106
|
+
84. * @param {string} path - The path of the file to upload.
|
|
107
|
+
85. * @returns {Promise<any>} A promise that resolves with the Cloudinary upload response.
|
|
108
|
+
86. */
|
|
109
|
+
87. async cloudinaryFileUpload(): Promise<any> {
|
|
110
|
+
88. return this.req.files
|
|
111
|
+
89. ? cloudinaryUpload(this.req.files[this.requestFile])
|
|
112
|
+
90. : console.log("Please Select an image");
|
|
113
|
+
91. }
|
|
114
|
+
92.
|
|
115
|
+
93. protected all() {
|
|
116
|
+
94. return { ...this.req.body, ...this.req.query };
|
|
117
|
+
95. }
|
|
118
|
+
96.
|
|
119
|
+
97. protected async validated() {
|
|
120
|
+
98. return this.req.validated() || {};
|
|
121
|
+
99. }
|
|
122
|
+
100. }
|
|
123
|
+
101. </code></pre>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<script src="/js/app-error-prism.js"> </script>
|
|
127
|
+
<script src="/js/app-error-prism-line.js"> </script>
|
|
128
|
+
</body>
|
|
129
|
+
</html>
|
|
130
|
+
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
const d = () => {
|
|
2
|
+
if (
|
|
3
|
+
typeof Prism === "undefined" ||
|
|
4
|
+
typeof document === "undefined" ||
|
|
5
|
+
!document.querySelector
|
|
6
|
+
) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
var LINE_NUMBERS_CLASS = "line-numbers";
|
|
11
|
+
var LINKABLE_LINE_NUMBERS_CLASS = "linkable-line-numbers";
|
|
12
|
+
var NEW_LINE_EXP = /\n(?!$)/g;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} selector
|
|
16
|
+
* @param {ParentNode} [container]
|
|
17
|
+
* @returns {HTMLElement[]}
|
|
18
|
+
*/
|
|
19
|
+
function $$(selector, container) {
|
|
20
|
+
return Array.prototype.slice.call(
|
|
21
|
+
(container || document).querySelectorAll(selector),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns whether the given element has the given class.
|
|
27
|
+
*
|
|
28
|
+
* @param {Element} element
|
|
29
|
+
* @param {string} className
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
function hasClass(element, className) {
|
|
33
|
+
return element.classList.contains(className);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Calls the given function.
|
|
38
|
+
*
|
|
39
|
+
* @param {() => any} func
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
function callFunction(func) {
|
|
43
|
+
func();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Some browsers round the line-height, others don't.
|
|
47
|
+
// We need to test for it to position the elements properly.
|
|
48
|
+
var isLineHeightRounded = (function () {
|
|
49
|
+
var res;
|
|
50
|
+
return function () {
|
|
51
|
+
if (typeof res === "undefined") {
|
|
52
|
+
var d = document.createElement("div");
|
|
53
|
+
d.style.fontSize = "13px";
|
|
54
|
+
d.style.lineHeight = "1.5";
|
|
55
|
+
d.style.padding = "0";
|
|
56
|
+
d.style.border = "0";
|
|
57
|
+
d.innerHTML = " <br /> ";
|
|
58
|
+
document.body.appendChild(d);
|
|
59
|
+
// Browsers that round the line-height should have offsetHeight === 38
|
|
60
|
+
// The others should have 39.
|
|
61
|
+
res = d.offsetHeight === 38;
|
|
62
|
+
document.body.removeChild(d);
|
|
63
|
+
}
|
|
64
|
+
return res;
|
|
65
|
+
};
|
|
66
|
+
})();
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns the top offset of the content box of the given parent and the content box of one of its children.
|
|
70
|
+
*
|
|
71
|
+
* @param {HTMLElement} parent
|
|
72
|
+
* @param {HTMLElement} child
|
|
73
|
+
*/
|
|
74
|
+
function getContentBoxTopOffset(parent, child) {
|
|
75
|
+
var parentStyle = getComputedStyle(parent);
|
|
76
|
+
var childStyle = getComputedStyle(child);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns the numeric value of the given pixel value.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} px
|
|
82
|
+
*/
|
|
83
|
+
function pxToNumber(px) {
|
|
84
|
+
return +px.substr(0, px.length - 2);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
child.offsetTop +
|
|
89
|
+
pxToNumber(childStyle.borderTopWidth) +
|
|
90
|
+
pxToNumber(childStyle.paddingTop) -
|
|
91
|
+
pxToNumber(parentStyle.paddingTop)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns whether the Line Highlight plugin is active for the given element.
|
|
97
|
+
*
|
|
98
|
+
* If this function returns `false`, do not call `highlightLines` for the given element.
|
|
99
|
+
*
|
|
100
|
+
* @param {HTMLElement | null | undefined} pre
|
|
101
|
+
* @returns {boolean}
|
|
102
|
+
*/
|
|
103
|
+
function isActiveFor(pre) {
|
|
104
|
+
if (!pre || !/pre/i.test(pre.nodeName)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (pre.hasAttribute("data-line")) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (pre.id && Prism.util.isActive(pre, LINKABLE_LINE_NUMBERS_CLASS)) {
|
|
113
|
+
// Technically, the line numbers plugin is also necessary but this plugin doesn't control the classes of
|
|
114
|
+
// the line numbers plugin, so we can't assume that they are present.
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var scrollIntoView = true;
|
|
122
|
+
|
|
123
|
+
Prism.plugins.lineHighlight = {
|
|
124
|
+
/**
|
|
125
|
+
* Highlights the lines of the given pre.
|
|
126
|
+
*
|
|
127
|
+
* This function is split into a DOM measuring and mutate phase to improve performance.
|
|
128
|
+
* The returned function mutates the DOM when called.
|
|
129
|
+
*
|
|
130
|
+
* @param {HTMLElement} pre
|
|
131
|
+
* @param {string | null} [lines]
|
|
132
|
+
* @param {string} [classes='']
|
|
133
|
+
* @returns {() => void}
|
|
134
|
+
*/
|
|
135
|
+
highlightLines: function highlightLines(pre, lines, classes) {
|
|
136
|
+
lines =
|
|
137
|
+
typeof lines === "string" ? lines : pre.getAttribute("data-line") || "";
|
|
138
|
+
|
|
139
|
+
var ranges = lines.replace(/\s+/g, "").split(",").filter(Boolean);
|
|
140
|
+
var offset = +pre.getAttribute("data-line-offset") || 0;
|
|
141
|
+
|
|
142
|
+
var parseMethod = isLineHeightRounded() ? parseInt : parseFloat;
|
|
143
|
+
var lineHeight = parseMethod(getComputedStyle(pre).lineHeight);
|
|
144
|
+
var hasLineNumbers = Prism.util.isActive(pre, LINE_NUMBERS_CLASS);
|
|
145
|
+
var codeElement = pre.querySelector("code");
|
|
146
|
+
var parentElement = hasLineNumbers ? pre : codeElement || pre;
|
|
147
|
+
var mutateActions = /** @type {(() => void)[]} */ ([]);
|
|
148
|
+
var lineBreakMatch = codeElement.textContent.match(NEW_LINE_EXP);
|
|
149
|
+
var numberOfLines = lineBreakMatch ? lineBreakMatch.length + 1 : 1;
|
|
150
|
+
/**
|
|
151
|
+
* The top offset between the content box of the <code> element and the content box of the parent element of
|
|
152
|
+
* the line highlight element (either `<pre>` or `<code>`).
|
|
153
|
+
*
|
|
154
|
+
* This offset might not be zero for some themes where the <code> element has a top margin. Some plugins
|
|
155
|
+
* (or users) might also add element above the <code> element. Because the line highlight is aligned relative
|
|
156
|
+
* to the <pre> element, we have to take this into account.
|
|
157
|
+
*
|
|
158
|
+
* This offset will be 0 if the parent element of the line highlight element is the `<code>` element.
|
|
159
|
+
*/
|
|
160
|
+
var codePreOffset =
|
|
161
|
+
!codeElement || parentElement == codeElement
|
|
162
|
+
? 0
|
|
163
|
+
: getContentBoxTopOffset(pre, codeElement);
|
|
164
|
+
|
|
165
|
+
ranges.forEach(function (currentRange) {
|
|
166
|
+
var range = currentRange.split("-");
|
|
167
|
+
|
|
168
|
+
var start = +range[0];
|
|
169
|
+
var end = +range[1] || start;
|
|
170
|
+
end = Math.min(numberOfLines + offset, end);
|
|
171
|
+
|
|
172
|
+
if (end < start) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @type {HTMLElement} */
|
|
177
|
+
var line =
|
|
178
|
+
pre.querySelector(
|
|
179
|
+
'.line-highlight[data-range="' + currentRange + '"]',
|
|
180
|
+
) || document.createElement("div");
|
|
181
|
+
|
|
182
|
+
mutateActions.push(function () {
|
|
183
|
+
line.setAttribute("aria-hidden", "true");
|
|
184
|
+
line.setAttribute("data-range", currentRange);
|
|
185
|
+
line.className = (classes || "") + " line-highlight";
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
|
|
189
|
+
if (hasLineNumbers && Prism.plugins.lineNumbers) {
|
|
190
|
+
var startNode = Prism.plugins.lineNumbers.getLine(pre, start);
|
|
191
|
+
var endNode = Prism.plugins.lineNumbers.getLine(pre, end);
|
|
192
|
+
|
|
193
|
+
if (startNode) {
|
|
194
|
+
var top = startNode.offsetTop + codePreOffset + "px";
|
|
195
|
+
mutateActions.push(function () {
|
|
196
|
+
line.style.top = top;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (endNode) {
|
|
201
|
+
var height =
|
|
202
|
+
endNode.offsetTop -
|
|
203
|
+
startNode.offsetTop +
|
|
204
|
+
endNode.offsetHeight +
|
|
205
|
+
"px";
|
|
206
|
+
mutateActions.push(function () {
|
|
207
|
+
line.style.height = height;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
mutateActions.push(function () {
|
|
212
|
+
line.setAttribute("data-start", String(start));
|
|
213
|
+
|
|
214
|
+
if (end > start) {
|
|
215
|
+
line.setAttribute("data-end", String(end));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
line.style.top =
|
|
219
|
+
(start - offset - 1) * lineHeight + codePreOffset + "px";
|
|
220
|
+
|
|
221
|
+
line.textContent = new Array(end - start + 2).join(" \n");
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
mutateActions.push(function () {
|
|
226
|
+
line.style.width = pre.scrollWidth + "px";
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
mutateActions.push(function () {
|
|
230
|
+
// allow this to play nicely with the line-numbers plugin
|
|
231
|
+
// need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
|
|
232
|
+
parentElement.appendChild(line);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
var id = pre.id;
|
|
237
|
+
if (
|
|
238
|
+
hasLineNumbers &&
|
|
239
|
+
Prism.util.isActive(pre, LINKABLE_LINE_NUMBERS_CLASS) &&
|
|
240
|
+
id
|
|
241
|
+
) {
|
|
242
|
+
// This implements linkable line numbers. Linkable line numbers use Line Highlight to create a link to a
|
|
243
|
+
// specific line. For this to work, the pre element has to:
|
|
244
|
+
// 1) have line numbers,
|
|
245
|
+
// 2) have the `linkable-line-numbers` class or an ascendant that has that class, and
|
|
246
|
+
// 3) have an id.
|
|
247
|
+
|
|
248
|
+
if (!hasClass(pre, LINKABLE_LINE_NUMBERS_CLASS)) {
|
|
249
|
+
// add class to pre
|
|
250
|
+
mutateActions.push(function () {
|
|
251
|
+
pre.classList.add(LINKABLE_LINE_NUMBERS_CLASS);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var start = parseInt(pre.getAttribute("data-start") || "1");
|
|
256
|
+
|
|
257
|
+
// iterate all line number spans
|
|
258
|
+
$$(".line-numbers-rows > span", pre).forEach(function (lineSpan, i) {
|
|
259
|
+
var lineNumber = i + start;
|
|
260
|
+
lineSpan.onclick = function () {
|
|
261
|
+
var hash = id + "." + lineNumber;
|
|
262
|
+
|
|
263
|
+
// this will prevent scrolling since the span is obviously in view
|
|
264
|
+
scrollIntoView = false;
|
|
265
|
+
location.hash = hash;
|
|
266
|
+
setTimeout(function () {
|
|
267
|
+
scrollIntoView = true;
|
|
268
|
+
}, 1);
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return function () {
|
|
274
|
+
mutateActions.forEach(callFunction);
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
function applyHash() {
|
|
280
|
+
var hash = location.hash.slice(1);
|
|
281
|
+
|
|
282
|
+
// Remove pre-existing temporary lines
|
|
283
|
+
$$(".temporary.line-highlight").forEach(function (line) {
|
|
284
|
+
line.parentNode.removeChild(line);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
var range = (hash.match(/\.([\d,-]+)$/) || [, ""])[1];
|
|
288
|
+
|
|
289
|
+
if (!range || document.getElementById(hash)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
var id = hash.slice(0, hash.lastIndexOf("."));
|
|
294
|
+
var pre = document.getElementById(id);
|
|
295
|
+
|
|
296
|
+
if (!pre) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (!pre.hasAttribute("data-line")) {
|
|
301
|
+
pre.setAttribute("data-line", "");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
var mutateDom = Prism.plugins.lineHighlight.highlightLines(
|
|
305
|
+
pre,
|
|
306
|
+
range,
|
|
307
|
+
"temporary ",
|
|
308
|
+
);
|
|
309
|
+
mutateDom();
|
|
310
|
+
|
|
311
|
+
if (scrollIntoView) {
|
|
312
|
+
document.querySelector(".temporary.line-highlight").scrollIntoView();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
var fakeTimer = 0; // Hack to limit the number of times applyHash() runs
|
|
317
|
+
|
|
318
|
+
Prism.hooks.add("before-sanity-check", function (env) {
|
|
319
|
+
var pre = env.element.parentElement;
|
|
320
|
+
if (!isActiveFor(pre)) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/*
|
|
325
|
+
* Cleanup for other plugins (e.g. autoloader).
|
|
326
|
+
*
|
|
327
|
+
* Sometimes <code> blocks are highlighted multiple times. It is necessary
|
|
328
|
+
* to cleanup any left-over tags, because the whitespace inside of the <div>
|
|
329
|
+
* tags change the content of the <code> tag.
|
|
330
|
+
*/
|
|
331
|
+
var num = 0;
|
|
332
|
+
$$(".line-highlight", pre).forEach(function (line) {
|
|
333
|
+
num += line.textContent.length;
|
|
334
|
+
line.parentNode.removeChild(line);
|
|
335
|
+
});
|
|
336
|
+
// Remove extra whitespace
|
|
337
|
+
if (num && /^(?: \n)+$/.test(env.code.slice(-num))) {
|
|
338
|
+
env.code = env.code.slice(0, -num);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
Prism.hooks.add("complete", function completeHook(env) {
|
|
343
|
+
var pre = env.element.parentElement;
|
|
344
|
+
if (!isActiveFor(pre)) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
clearTimeout(fakeTimer);
|
|
349
|
+
|
|
350
|
+
var hasLineNumbers = Prism.plugins.lineNumbers;
|
|
351
|
+
var isLineNumbersLoaded = env.plugins && env.plugins.lineNumbers;
|
|
352
|
+
|
|
353
|
+
if (
|
|
354
|
+
hasClass(pre, LINE_NUMBERS_CLASS) &&
|
|
355
|
+
hasLineNumbers &&
|
|
356
|
+
!isLineNumbersLoaded
|
|
357
|
+
) {
|
|
358
|
+
Prism.hooks.add("line-numbers", completeHook);
|
|
359
|
+
} else {
|
|
360
|
+
var mutateDom = Prism.plugins.lineHighlight.highlightLines(pre);
|
|
361
|
+
mutateDom();
|
|
362
|
+
fakeTimer = setTimeout(applyHash, 1);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
window.addEventListener("hashchange", applyHash);
|
|
367
|
+
window.addEventListener("resize", function () {
|
|
368
|
+
var actions = $$("pre")
|
|
369
|
+
.filter(isActiveFor)
|
|
370
|
+
.map(function (pre) {
|
|
371
|
+
return Prism.plugins.lineHighlight.highlightLines(pre);
|
|
372
|
+
});
|
|
373
|
+
actions.forEach(callFunction);
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
d();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* PrismJS 1.29.0
|
|
2
|
+
https://prismjs.com/download.html#themes=prism-okaidia&languages=clike+javascript */
|
|
3
|
+
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(e){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof i?new i(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(n,t){var r,i;switch(t=t||{},a.util.type(n)){case"Object":if(i=a.util.objId(n),t[i])return t[i];for(var l in r={},t[i]=r,n)n.hasOwnProperty(l)&&(r[l]=e(n[l],t));return r;case"Array":return i=a.util.objId(n),t[i]?t[i]:(r=[],t[i]=r,n.forEach((function(n,a){r[a]=e(n,t)})),r);default:return n}},getLanguage:function(e){for(;e;){var t=n.exec(e.className);if(t)return t[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,t){e.className=e.className.replace(RegExp(n,"gi"),""),e.classList.add("language-"+t)},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var n=document.getElementsByTagName("script");for(var t in n)if(n[t].src==e)return n[t]}return null}},isActive:function(e,n,t){for(var r="no-"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,n){var t=a.util.clone(a.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(e,n,t,r){var i=(r=r||a.languages)[e],l={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var s in t)t.hasOwnProperty(s)&&(l[s]=t[s]);t.hasOwnProperty(o)||(l[o]=i[o])}var u=r[e];return r[e]=l,a.languages.DFS(a.languages,(function(n,t){t===u&&n!=e&&(this[n]=l)})),l},DFS:function e(n,t,r,i){i=i||{};var l=a.util.objId;for(var o in n)if(n.hasOwnProperty(o)){t.call(n,o,n[o],r||o);var s=n[o],u=a.util.type(s);"Object"!==u||i[l(s)]?"Array"!==u||i[l(s)]||(i[l(s)]=!0,e(s,t,o,i)):(i[l(s)]=!0,e(s,t,null,i))}}},plugins:{},highlightAll:function(e,n){a.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run("before-all-elements-highlight",r);for(var i,l=0;i=r.elements[l++];)a.highlightElement(i,!0===n,r.callback)},highlightElement:function(n,t,r){var i=a.util.getLanguage(n),l=a.languages[i];a.util.setLanguage(n,i);var o=n.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&a.util.setLanguage(o,i);var s={element:n,language:i,grammar:l,code:n.textContent};function u(e){s.highlightedCode=e,a.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,a.hooks.run("after-highlight",s),a.hooks.run("complete",s),r&&r.call(s.element)}if(a.hooks.run("before-sanity-check",s),(o=s.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!s.code)return a.hooks.run("complete",s),void(r&&r.call(s.element));if(a.hooks.run("before-highlight",s),s.grammar)if(t&&e.Worker){var c=new Worker(a.filename);c.onmessage=function(e){u(e.data)},c.postMessage(JSON.stringify({language:s.language,code:s.code,immediateClose:!0}))}else u(a.highlight(s.code,s.grammar,s.language));else u(a.util.encode(s.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};if(a.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run("after-tokenize",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new s;return u(a,a.head,e),o(e,a,n,a.head,0),function(e){for(var n=[],t=e.head.next;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=a.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=a.hooks.all[e];if(t&&t.length)for(var r,i=0;r=t[i++];)r(n)}},Token:i};function i(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function l(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function o(e,n,t,r,s,g){for(var f in t)if(t.hasOwnProperty(f)&&t[f]){var h=t[f];h=Array.isArray(h)?h:[h];for(var d=0;d<h.length;++d){if(g&&g.cause==f+","+d)return;var v=h[d],p=v.inside,m=!!v.lookbehind,y=!!v.greedy,k=v.alias;if(y&&!v.pattern.global){var x=v.pattern.toString().match(/[imsuy]*$/)[0];v.pattern=RegExp(v.pattern.source,x+"g")}for(var b=v.pattern||v,w=r.next,A=s;w!==n.tail&&!(g&&A>=g.reach);A+=w.value.length,w=w.next){var E=w.value;if(n.length>e.length)return;if(!(E instanceof i)){var P,L=1;if(y){if(!(P=l(b,A,e,m))||P.index>=e.length)break;var S=P.index,O=P.index+P[0].length,j=A;for(j+=w.value.length;S>=j;)j+=(w=w.next).value.length;if(A=j-=w.value.length,w.value instanceof i)continue;for(var C=w;C!==n.tail&&(j<O||"string"==typeof C.value);C=C.next)L++,j+=C.value.length;L--,E=e.slice(A,j),P.index-=A}else if(!(P=l(b,0,E,m)))continue;S=P.index;var N=P[0],_=E.slice(0,S),M=E.slice(S+N.length),W=A+E.length;g&&W>g.reach&&(g.reach=W);var z=w.prev;if(_&&(z=u(n,z,_),A+=_.length),c(n,z,L),w=u(n,z,new i(f,p?a.tokenize(N,p):N,k,N)),M&&u(n,w,M),L>1){var I={cause:f+","+d,reach:W};o(e,n,t,w.prev,A,I),g&&I.reach>g.reach&&(g.reach=I.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function u(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function c(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;n.next=r,r.prev=n,e.length-=a}if(e.Prism=a,i.stringify=function e(n,t){if("string"==typeof n)return n;if(Array.isArray(n)){var r="";return n.forEach((function(n){r+=e(n,t)})),r}var i={type:n.type,content:e(n.content,t),tag:"span",classes:["token",n.type],attributes:{},language:t},l=n.alias;l&&(Array.isArray(l)?Array.prototype.push.apply(i.classes,l):i.classes.push(l)),a.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=" "+s+'="'+(i.attributes[s]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+o+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(n){var t=JSON.parse(n.data),r=t.language,i=t.code,l=t.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),l&&e.close()}),!1),a):a;var g=a.util.currentScript();function f(){a.manual||a.highlightAll()}if(g&&(a.filename=g.src,g.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var h=document.readyState;"loading"===h||"interactive"===h&&g&&g.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return a}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
|
4
|
+
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
|
|
5
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript;
|
|
6
|
+
|
|
7
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Not Found</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
body {
|
|
14
|
+
background: #eee;
|
|
15
|
+
height: 100vh;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
h1 {
|
|
21
|
+
color: rgba(0, 0, 0, 0.893);
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<h1>404 Page Not Found</h1>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|