@jojovms/scripto 0.0.6 → 0.0.7
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/scripto.es.js +1138 -1765
- package/dist/scripto.umd.js +34 -63
- package/package.json +2 -2
package/dist/scripto.es.js
CHANGED
|
@@ -1,827 +1,203 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Vn = Object.defineProperty;
|
|
2
|
+
var Jt = (l) => {
|
|
3
3
|
throw TypeError(l);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @license React
|
|
13
|
-
* react-jsx-runtime.production.min.js
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
var Tn;
|
|
21
|
-
function rr() {
|
|
22
|
-
if (Tn) return lt;
|
|
23
|
-
Tn = 1;
|
|
24
|
-
var l = me, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, r = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
25
|
-
function s(c, u, x) {
|
|
26
|
-
var h, w = {}, g = null, E = null;
|
|
27
|
-
x !== void 0 && (g = "" + x), u.key !== void 0 && (g = "" + u.key), u.ref !== void 0 && (E = u.ref);
|
|
28
|
-
for (h in u) n.call(u, h) && !a.hasOwnProperty(h) && (w[h] = u[h]);
|
|
29
|
-
if (c && c.defaultProps) for (h in u = c.defaultProps, u) w[h] === void 0 && (w[h] = u[h]);
|
|
30
|
-
return { $$typeof: e, type: c, key: g, ref: E, props: w, _owner: r.current };
|
|
31
|
-
}
|
|
32
|
-
return lt.Fragment = t, lt.jsx = s, lt.jsxs = s, lt;
|
|
33
|
-
}
|
|
34
|
-
var ct = {};
|
|
35
|
-
/**
|
|
36
|
-
* @license React
|
|
37
|
-
* react-jsx-runtime.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
var wn;
|
|
45
|
-
function ir() {
|
|
46
|
-
return wn || (wn = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
-
var l = me, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), E = Symbol.for("react.offscreen"), T = Symbol.iterator, m = "@@iterator";
|
|
48
|
-
function O(o) {
|
|
49
|
-
if (o === null || typeof o != "object")
|
|
50
|
-
return null;
|
|
51
|
-
var p = T && o[T] || o[m];
|
|
52
|
-
return typeof p == "function" ? p : null;
|
|
53
|
-
}
|
|
54
|
-
var M = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
55
|
-
function N(o) {
|
|
56
|
-
{
|
|
57
|
-
for (var p = arguments.length, k = new Array(p > 1 ? p - 1 : 0), _ = 1; _ < p; _++)
|
|
58
|
-
k[_ - 1] = arguments[_];
|
|
59
|
-
K("error", o, k);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function K(o, p, k) {
|
|
63
|
-
{
|
|
64
|
-
var _ = M.ReactDebugCurrentFrame, S = _.getStackAddendum();
|
|
65
|
-
S !== "" && (p += "%s", k = k.concat([S]));
|
|
66
|
-
var I = k.map(function(A) {
|
|
67
|
-
return String(A);
|
|
68
|
-
});
|
|
69
|
-
I.unshift("Warning: " + p), Function.prototype.apply.call(console[o], console, I);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
var H = !1, oe = !1, Ve = !1, Bt = !1, Wt = !1, Tt;
|
|
73
|
-
Tt = Symbol.for("react.module.reference");
|
|
74
|
-
function Gt(o) {
|
|
75
|
-
return !!(typeof o == "string" || typeof o == "function" || o === n || o === a || Wt || o === r || o === x || o === h || Bt || o === E || H || oe || Ve || typeof o == "object" && o !== null && (o.$$typeof === g || o.$$typeof === w || o.$$typeof === s || o.$$typeof === c || o.$$typeof === u || // This needs to include all possible module reference object
|
|
76
|
-
// types supported by any Flight configuration anywhere since
|
|
77
|
-
// we don't know which Flight build this will end up being used
|
|
78
|
-
// with.
|
|
79
|
-
o.$$typeof === Tt || o.getModuleId !== void 0));
|
|
80
|
-
}
|
|
81
|
-
function W(o, p, k) {
|
|
82
|
-
var _ = o.displayName;
|
|
83
|
-
if (_)
|
|
84
|
-
return _;
|
|
85
|
-
var S = p.displayName || p.name || "";
|
|
86
|
-
return S !== "" ? k + "(" + S + ")" : k;
|
|
87
|
-
}
|
|
88
|
-
function je(o) {
|
|
89
|
-
return o.displayName || "Context";
|
|
90
|
-
}
|
|
91
|
-
function ee(o) {
|
|
92
|
-
if (o == null)
|
|
93
|
-
return null;
|
|
94
|
-
if (typeof o.tag == "number" && N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof o == "function")
|
|
95
|
-
return o.displayName || o.name || null;
|
|
96
|
-
if (typeof o == "string")
|
|
97
|
-
return o;
|
|
98
|
-
switch (o) {
|
|
99
|
-
case n:
|
|
100
|
-
return "Fragment";
|
|
101
|
-
case t:
|
|
102
|
-
return "Portal";
|
|
103
|
-
case a:
|
|
104
|
-
return "Profiler";
|
|
105
|
-
case r:
|
|
106
|
-
return "StrictMode";
|
|
107
|
-
case x:
|
|
108
|
-
return "Suspense";
|
|
109
|
-
case h:
|
|
110
|
-
return "SuspenseList";
|
|
111
|
-
}
|
|
112
|
-
if (typeof o == "object")
|
|
113
|
-
switch (o.$$typeof) {
|
|
114
|
-
case c:
|
|
115
|
-
var p = o;
|
|
116
|
-
return je(p) + ".Consumer";
|
|
117
|
-
case s:
|
|
118
|
-
var k = o;
|
|
119
|
-
return je(k._context) + ".Provider";
|
|
120
|
-
case u:
|
|
121
|
-
return W(o, o.render, "ForwardRef");
|
|
122
|
-
case w:
|
|
123
|
-
var _ = o.displayName || null;
|
|
124
|
-
return _ !== null ? _ : ee(o.type) || "Memo";
|
|
125
|
-
case g: {
|
|
126
|
-
var S = o, I = S._payload, A = S._init;
|
|
127
|
-
try {
|
|
128
|
-
return ee(A(I));
|
|
129
|
-
} catch {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
var se = Object.assign, Le = 0, wt, _t, qe, yt, Ze, F, Xe;
|
|
137
|
-
function B() {
|
|
138
|
-
}
|
|
139
|
-
B.__reactDisabledLog = !0;
|
|
140
|
-
function Et() {
|
|
141
|
-
{
|
|
142
|
-
if (Le === 0) {
|
|
143
|
-
wt = console.log, _t = console.info, qe = console.warn, yt = console.error, Ze = console.group, F = console.groupCollapsed, Xe = console.groupEnd;
|
|
144
|
-
var o = {
|
|
145
|
-
configurable: !0,
|
|
146
|
-
enumerable: !0,
|
|
147
|
-
value: B,
|
|
148
|
-
writable: !0
|
|
149
|
-
};
|
|
150
|
-
Object.defineProperties(console, {
|
|
151
|
-
info: o,
|
|
152
|
-
log: o,
|
|
153
|
-
warn: o,
|
|
154
|
-
error: o,
|
|
155
|
-
group: o,
|
|
156
|
-
groupCollapsed: o,
|
|
157
|
-
groupEnd: o
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
Le++;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function $() {
|
|
164
|
-
{
|
|
165
|
-
if (Le--, Le === 0) {
|
|
166
|
-
var o = {
|
|
167
|
-
configurable: !0,
|
|
168
|
-
enumerable: !0,
|
|
169
|
-
writable: !0
|
|
170
|
-
};
|
|
171
|
-
Object.defineProperties(console, {
|
|
172
|
-
log: se({}, o, {
|
|
173
|
-
value: wt
|
|
174
|
-
}),
|
|
175
|
-
info: se({}, o, {
|
|
176
|
-
value: _t
|
|
177
|
-
}),
|
|
178
|
-
warn: se({}, o, {
|
|
179
|
-
value: qe
|
|
180
|
-
}),
|
|
181
|
-
error: se({}, o, {
|
|
182
|
-
value: yt
|
|
183
|
-
}),
|
|
184
|
-
group: se({}, o, {
|
|
185
|
-
value: Ze
|
|
186
|
-
}),
|
|
187
|
-
groupCollapsed: se({}, o, {
|
|
188
|
-
value: F
|
|
189
|
-
}),
|
|
190
|
-
groupEnd: se({}, o, {
|
|
191
|
-
value: Xe
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
Le < 0 && N("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
var ge = M.ReactCurrentDispatcher, Ie;
|
|
199
|
-
function ae(o, p, k) {
|
|
200
|
-
{
|
|
201
|
-
if (Ie === void 0)
|
|
202
|
-
try {
|
|
203
|
-
throw Error();
|
|
204
|
-
} catch (S) {
|
|
205
|
-
var _ = S.stack.trim().match(/\n( *(at )?)/);
|
|
206
|
-
Ie = _ && _[1] || "";
|
|
207
|
-
}
|
|
208
|
-
return `
|
|
209
|
-
` + Ie + o;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
var ze = !1, Ee;
|
|
213
|
-
{
|
|
214
|
-
var vt = typeof WeakMap == "function" ? WeakMap : Map;
|
|
215
|
-
Ee = new vt();
|
|
216
|
-
}
|
|
217
|
-
function Ke(o, p) {
|
|
218
|
-
if (!o || ze)
|
|
219
|
-
return "";
|
|
220
|
-
{
|
|
221
|
-
var k = Ee.get(o);
|
|
222
|
-
if (k !== void 0)
|
|
223
|
-
return k;
|
|
224
|
-
}
|
|
225
|
-
var _;
|
|
226
|
-
ze = !0;
|
|
227
|
-
var S = Error.prepareStackTrace;
|
|
228
|
-
Error.prepareStackTrace = void 0;
|
|
229
|
-
var I;
|
|
230
|
-
I = ge.current, ge.current = null, Et();
|
|
231
|
-
try {
|
|
232
|
-
if (p) {
|
|
233
|
-
var A = function() {
|
|
234
|
-
throw Error();
|
|
235
|
-
};
|
|
236
|
-
if (Object.defineProperty(A.prototype, "props", {
|
|
237
|
-
set: function() {
|
|
238
|
-
throw Error();
|
|
239
|
-
}
|
|
240
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
241
|
-
try {
|
|
242
|
-
Reflect.construct(A, []);
|
|
243
|
-
} catch (L) {
|
|
244
|
-
_ = L;
|
|
245
|
-
}
|
|
246
|
-
Reflect.construct(o, [], A);
|
|
247
|
-
} else {
|
|
248
|
-
try {
|
|
249
|
-
A.call();
|
|
250
|
-
} catch (L) {
|
|
251
|
-
_ = L;
|
|
252
|
-
}
|
|
253
|
-
o.call(A.prototype);
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
try {
|
|
257
|
-
throw Error();
|
|
258
|
-
} catch (L) {
|
|
259
|
-
_ = L;
|
|
260
|
-
}
|
|
261
|
-
o();
|
|
262
|
-
}
|
|
263
|
-
} catch (L) {
|
|
264
|
-
if (L && _ && typeof L.stack == "string") {
|
|
265
|
-
for (var v = L.stack.split(`
|
|
266
|
-
`), G = _.stack.split(`
|
|
267
|
-
`), d = v.length - 1, i = G.length - 1; d >= 1 && i >= 0 && v[d] !== G[i]; )
|
|
268
|
-
i--;
|
|
269
|
-
for (; d >= 1 && i >= 0; d--, i--)
|
|
270
|
-
if (v[d] !== G[i]) {
|
|
271
|
-
if (d !== 1 || i !== 1)
|
|
272
|
-
do
|
|
273
|
-
if (d--, i--, i < 0 || v[d] !== G[i]) {
|
|
274
|
-
var f = `
|
|
275
|
-
` + v[d].replace(" at new ", " at ");
|
|
276
|
-
return o.displayName && f.includes("<anonymous>") && (f = f.replace("<anonymous>", o.displayName)), typeof o == "function" && Ee.set(o, f), f;
|
|
277
|
-
}
|
|
278
|
-
while (d >= 1 && i >= 0);
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
} finally {
|
|
283
|
-
ze = !1, ge.current = I, $(), Error.prepareStackTrace = S;
|
|
284
|
-
}
|
|
285
|
-
var b = o ? o.displayName || o.name : "", C = b ? ae(b) : "";
|
|
286
|
-
return typeof o == "function" && Ee.set(o, C), C;
|
|
287
|
-
}
|
|
288
|
-
function ve(o, p, k) {
|
|
289
|
-
return Ke(o, !1);
|
|
290
|
-
}
|
|
291
|
-
function $e(o) {
|
|
292
|
-
var p = o.prototype;
|
|
293
|
-
return !!(p && p.isReactComponent);
|
|
294
|
-
}
|
|
295
|
-
function te(o, p, k) {
|
|
296
|
-
if (o == null)
|
|
297
|
-
return "";
|
|
298
|
-
if (typeof o == "function")
|
|
299
|
-
return Ke(o, $e(o));
|
|
300
|
-
if (typeof o == "string")
|
|
301
|
-
return ae(o);
|
|
302
|
-
switch (o) {
|
|
303
|
-
case x:
|
|
304
|
-
return ae("Suspense");
|
|
305
|
-
case h:
|
|
306
|
-
return ae("SuspenseList");
|
|
307
|
-
}
|
|
308
|
-
if (typeof o == "object")
|
|
309
|
-
switch (o.$$typeof) {
|
|
310
|
-
case u:
|
|
311
|
-
return ve(o.render);
|
|
312
|
-
case w:
|
|
313
|
-
return te(o.type, p, k);
|
|
314
|
-
case g: {
|
|
315
|
-
var _ = o, S = _._payload, I = _._init;
|
|
316
|
-
try {
|
|
317
|
-
return te(I(S), p, k);
|
|
318
|
-
} catch {
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return "";
|
|
323
|
-
}
|
|
324
|
-
var ke = Object.prototype.hasOwnProperty, Fe = {}, be = M.ReactDebugCurrentFrame;
|
|
325
|
-
function xe(o) {
|
|
326
|
-
if (o) {
|
|
327
|
-
var p = o._owner, k = te(o.type, o._source, p ? p.type : null);
|
|
328
|
-
be.setExtraStackFrame(k);
|
|
329
|
-
} else
|
|
330
|
-
be.setExtraStackFrame(null);
|
|
331
|
-
}
|
|
332
|
-
function Ue(o, p, k, _, S) {
|
|
333
|
-
{
|
|
334
|
-
var I = Function.call.bind(ke);
|
|
335
|
-
for (var A in o)
|
|
336
|
-
if (I(o, A)) {
|
|
337
|
-
var v = void 0;
|
|
338
|
-
try {
|
|
339
|
-
if (typeof o[A] != "function") {
|
|
340
|
-
var G = Error((_ || "React class") + ": " + k + " type `" + A + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[A] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
341
|
-
throw G.name = "Invariant Violation", G;
|
|
342
|
-
}
|
|
343
|
-
v = o[A](p, A, _, k, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
344
|
-
} catch (d) {
|
|
345
|
-
v = d;
|
|
346
|
-
}
|
|
347
|
-
v && !(v instanceof Error) && (xe(S), N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", _ || "React class", k, A, typeof v), xe(null)), v instanceof Error && !(v.message in Fe) && (Fe[v.message] = !0, xe(S), N("Failed %s type: %s", k, v.message), xe(null));
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
var Rt = Array.isArray;
|
|
352
|
-
function He(o) {
|
|
353
|
-
return Rt(o);
|
|
354
|
-
}
|
|
355
|
-
function Yt(o) {
|
|
356
|
-
{
|
|
357
|
-
var p = typeof Symbol == "function" && Symbol.toStringTag, k = p && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
358
|
-
return k;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
function Qe(o) {
|
|
362
|
-
try {
|
|
363
|
-
return Re(o), !1;
|
|
364
|
-
} catch {
|
|
365
|
-
return !0;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
function Re(o) {
|
|
369
|
-
return "" + o;
|
|
370
|
-
}
|
|
371
|
-
function Te(o) {
|
|
372
|
-
if (Qe(o))
|
|
373
|
-
return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Yt(o)), Re(o);
|
|
374
|
-
}
|
|
375
|
-
var Q = M.ReactCurrentOwner, Je = {
|
|
376
|
-
key: !0,
|
|
377
|
-
ref: !0,
|
|
378
|
-
__self: !0,
|
|
379
|
-
__source: !0
|
|
380
|
-
}, et, tt;
|
|
381
|
-
function nt(o) {
|
|
382
|
-
if (ke.call(o, "ref")) {
|
|
383
|
-
var p = Object.getOwnPropertyDescriptor(o, "ref").get;
|
|
384
|
-
if (p && p.isReactWarning)
|
|
385
|
-
return !1;
|
|
386
|
-
}
|
|
387
|
-
return o.ref !== void 0;
|
|
388
|
-
}
|
|
389
|
-
function At(o) {
|
|
390
|
-
if (ke.call(o, "key")) {
|
|
391
|
-
var p = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
392
|
-
if (p && p.isReactWarning)
|
|
393
|
-
return !1;
|
|
394
|
-
}
|
|
395
|
-
return o.key !== void 0;
|
|
396
|
-
}
|
|
397
|
-
function Be(o, p) {
|
|
398
|
-
typeof o.ref == "string" && Q.current;
|
|
399
|
-
}
|
|
400
|
-
function We(o, p) {
|
|
401
|
-
{
|
|
402
|
-
var k = function() {
|
|
403
|
-
et || (et = !0, N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
|
|
404
|
-
};
|
|
405
|
-
k.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
406
|
-
get: k,
|
|
407
|
-
configurable: !0
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
function le(o, p) {
|
|
412
|
-
{
|
|
413
|
-
var k = function() {
|
|
414
|
-
tt || (tt = !0, N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
|
|
415
|
-
};
|
|
416
|
-
k.isReactWarning = !0, Object.defineProperty(o, "ref", {
|
|
417
|
-
get: k,
|
|
418
|
-
configurable: !0
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
var Ae = function(o, p, k, _, S, I, A) {
|
|
423
|
-
var v = {
|
|
424
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
425
|
-
$$typeof: e,
|
|
426
|
-
// Built-in properties that belong on the element
|
|
427
|
-
type: o,
|
|
428
|
-
key: p,
|
|
429
|
-
ref: k,
|
|
430
|
-
props: A,
|
|
431
|
-
// Record the component responsible for creating this element.
|
|
432
|
-
_owner: I
|
|
433
|
-
};
|
|
434
|
-
return v._store = {}, Object.defineProperty(v._store, "validated", {
|
|
435
|
-
configurable: !1,
|
|
436
|
-
enumerable: !1,
|
|
437
|
-
writable: !0,
|
|
438
|
-
value: !1
|
|
439
|
-
}), Object.defineProperty(v, "_self", {
|
|
440
|
-
configurable: !1,
|
|
441
|
-
enumerable: !1,
|
|
442
|
-
writable: !1,
|
|
443
|
-
value: _
|
|
444
|
-
}), Object.defineProperty(v, "_source", {
|
|
445
|
-
configurable: !1,
|
|
446
|
-
enumerable: !1,
|
|
447
|
-
writable: !1,
|
|
448
|
-
value: S
|
|
449
|
-
}), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
|
|
450
|
-
};
|
|
451
|
-
function rt(o, p, k, _, S) {
|
|
452
|
-
{
|
|
453
|
-
var I, A = {}, v = null, G = null;
|
|
454
|
-
k !== void 0 && (Te(k), v = "" + k), At(p) && (Te(p.key), v = "" + p.key), nt(p) && (G = p.ref, Be(p, S));
|
|
455
|
-
for (I in p)
|
|
456
|
-
ke.call(p, I) && !Je.hasOwnProperty(I) && (A[I] = p[I]);
|
|
457
|
-
if (o && o.defaultProps) {
|
|
458
|
-
var d = o.defaultProps;
|
|
459
|
-
for (I in d)
|
|
460
|
-
A[I] === void 0 && (A[I] = d[I]);
|
|
461
|
-
}
|
|
462
|
-
if (v || G) {
|
|
463
|
-
var i = typeof o == "function" ? o.displayName || o.name || "Unknown" : o;
|
|
464
|
-
v && We(A, i), G && le(A, i);
|
|
465
|
-
}
|
|
466
|
-
return Ae(o, v, G, S, _, Q.current, A);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
var De = M.ReactCurrentOwner, St = M.ReactDebugCurrentFrame;
|
|
470
|
-
function ce(o) {
|
|
471
|
-
if (o) {
|
|
472
|
-
var p = o._owner, k = te(o.type, o._source, p ? p.type : null);
|
|
473
|
-
St.setExtraStackFrame(k);
|
|
474
|
-
} else
|
|
475
|
-
St.setExtraStackFrame(null);
|
|
476
|
-
}
|
|
477
|
-
var Se;
|
|
478
|
-
Se = !1;
|
|
479
|
-
function it(o) {
|
|
480
|
-
return typeof o == "object" && o !== null && o.$$typeof === e;
|
|
481
|
-
}
|
|
482
|
-
function Oe() {
|
|
483
|
-
{
|
|
484
|
-
if (De.current) {
|
|
485
|
-
var o = ee(De.current.type);
|
|
486
|
-
if (o)
|
|
487
|
-
return `
|
|
488
|
-
|
|
489
|
-
Check the render method of \`` + o + "`.";
|
|
490
|
-
}
|
|
491
|
-
return "";
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
function Vt(o) {
|
|
495
|
-
return "";
|
|
496
|
-
}
|
|
497
|
-
var Ot = {};
|
|
498
|
-
function U(o) {
|
|
499
|
-
{
|
|
500
|
-
var p = Oe();
|
|
501
|
-
if (!p) {
|
|
502
|
-
var k = typeof o == "string" ? o : o.displayName || o.name;
|
|
503
|
-
k && (p = `
|
|
504
|
-
|
|
505
|
-
Check the top-level render call using <` + k + ">.");
|
|
506
|
-
}
|
|
507
|
-
return p;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
function we(o, p) {
|
|
511
|
-
{
|
|
512
|
-
if (!o._store || o._store.validated || o.key != null)
|
|
513
|
-
return;
|
|
514
|
-
o._store.validated = !0;
|
|
515
|
-
var k = U(p);
|
|
516
|
-
if (Ot[k])
|
|
517
|
-
return;
|
|
518
|
-
Ot[k] = !0;
|
|
519
|
-
var _ = "";
|
|
520
|
-
o && o._owner && o._owner !== De.current && (_ = " It was passed a child from " + ee(o._owner.type) + "."), ce(o), N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', k, _), ce(null);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
function Ct(o, p) {
|
|
524
|
-
{
|
|
525
|
-
if (typeof o != "object")
|
|
526
|
-
return;
|
|
527
|
-
if (He(o))
|
|
528
|
-
for (var k = 0; k < o.length; k++) {
|
|
529
|
-
var _ = o[k];
|
|
530
|
-
it(_) && we(_, p);
|
|
531
|
-
}
|
|
532
|
-
else if (it(o))
|
|
533
|
-
o._store && (o._store.validated = !0);
|
|
534
|
-
else if (o) {
|
|
535
|
-
var S = O(o);
|
|
536
|
-
if (typeof S == "function" && S !== o.entries)
|
|
537
|
-
for (var I = S.call(o), A; !(A = I.next()).done; )
|
|
538
|
-
it(A.value) && we(A.value, p);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
function Lt(o) {
|
|
543
|
-
{
|
|
544
|
-
var p = o.type;
|
|
545
|
-
if (p == null || typeof p == "string")
|
|
546
|
-
return;
|
|
547
|
-
var k;
|
|
548
|
-
if (typeof p == "function")
|
|
549
|
-
k = p.propTypes;
|
|
550
|
-
else if (typeof p == "object" && (p.$$typeof === u || // Note: Memo only checks outer props here.
|
|
551
|
-
// Inner props are checked in the reconciler.
|
|
552
|
-
p.$$typeof === w))
|
|
553
|
-
k = p.propTypes;
|
|
554
|
-
else
|
|
555
|
-
return;
|
|
556
|
-
if (k) {
|
|
557
|
-
var _ = ee(p);
|
|
558
|
-
Ue(k, o.props, "prop", _, o);
|
|
559
|
-
} else if (p.PropTypes !== void 0 && !Se) {
|
|
560
|
-
Se = !0;
|
|
561
|
-
var S = ee(p);
|
|
562
|
-
N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
|
|
563
|
-
}
|
|
564
|
-
typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
function ot(o) {
|
|
568
|
-
{
|
|
569
|
-
for (var p = Object.keys(o.props), k = 0; k < p.length; k++) {
|
|
570
|
-
var _ = p[k];
|
|
571
|
-
if (_ !== "children" && _ !== "key") {
|
|
572
|
-
ce(o), N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", _), ce(null);
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
o.ref !== null && (ce(o), N("Invalid attribute `ref` supplied to `React.Fragment`."), ce(null));
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
var st = {};
|
|
580
|
-
function at(o, p, k, _, S, I) {
|
|
581
|
-
{
|
|
582
|
-
var A = Gt(o);
|
|
583
|
-
if (!A) {
|
|
584
|
-
var v = "";
|
|
585
|
-
(o === void 0 || typeof o == "object" && o !== null && Object.keys(o).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
586
|
-
var G = Vt();
|
|
587
|
-
G ? v += G : v += Oe();
|
|
588
|
-
var d;
|
|
589
|
-
o === null ? d = "null" : He(o) ? d = "array" : o !== void 0 && o.$$typeof === e ? (d = "<" + (ee(o.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : d = typeof o, N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, v);
|
|
590
|
-
}
|
|
591
|
-
var i = rt(o, p, k, S, I);
|
|
592
|
-
if (i == null)
|
|
593
|
-
return i;
|
|
594
|
-
if (A) {
|
|
595
|
-
var f = p.children;
|
|
596
|
-
if (f !== void 0)
|
|
597
|
-
if (_)
|
|
598
|
-
if (He(f)) {
|
|
599
|
-
for (var b = 0; b < f.length; b++)
|
|
600
|
-
Ct(f[b], o);
|
|
601
|
-
Object.freeze && Object.freeze(f);
|
|
602
|
-
} else
|
|
603
|
-
N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
604
|
-
else
|
|
605
|
-
Ct(f, o);
|
|
606
|
-
}
|
|
607
|
-
if (ke.call(p, "key")) {
|
|
608
|
-
var C = ee(o), L = Object.keys(p).filter(function(ue) {
|
|
609
|
-
return ue !== "key";
|
|
610
|
-
}), z = L.length > 0 ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
611
|
-
if (!st[C + z]) {
|
|
612
|
-
var V = L.length > 0 ? "{" + L.join(": ..., ") + ": ...}" : "{}";
|
|
613
|
-
N(`A props object containing a "key" prop is being spread into JSX:
|
|
614
|
-
let props = %s;
|
|
615
|
-
<%s {...props} />
|
|
616
|
-
React keys must be passed directly to JSX without using spread:
|
|
617
|
-
let props = %s;
|
|
618
|
-
<%s key={someKey} {...props} />`, z, C, V, C), st[C + z] = !0;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
return o === n ? ot(i) : Lt(i), i;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
function qt(o, p, k) {
|
|
625
|
-
return at(o, p, k, !0);
|
|
626
|
-
}
|
|
627
|
-
function ne(o, p, k) {
|
|
628
|
-
return at(o, p, k, !1);
|
|
629
|
-
}
|
|
630
|
-
var _e = ne, It = qt;
|
|
631
|
-
ct.Fragment = n, ct.jsx = _e, ct.jsxs = It;
|
|
632
|
-
}()), ct;
|
|
633
|
-
}
|
|
634
|
-
process.env.NODE_ENV === "production" ? nn.exports = rr() : nn.exports = ir();
|
|
635
|
-
var y = nn.exports, Mn = {
|
|
5
|
+
var Xn = (l, e, t) => e in l ? Vn(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
6
|
+
var A = (l, e, t) => Xn(l, typeof e != "symbol" ? e + "" : e, t), Qn = (l, e, t) => e.has(l) || Jt("Cannot " + t);
|
|
7
|
+
var en = (l, e, t) => e.has(l) ? Jt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t);
|
|
8
|
+
var Ue = (l, e, t) => (Qn(l, e, "access private method"), t);
|
|
9
|
+
import { jsxs as $, jsx as w } from "react/jsx-runtime";
|
|
10
|
+
import re, { useRef as Kn, useState as ie, useEffect as be } from "react";
|
|
11
|
+
var gn = {
|
|
636
12
|
color: void 0,
|
|
637
13
|
size: void 0,
|
|
638
14
|
className: void 0,
|
|
639
15
|
style: void 0,
|
|
640
16
|
attr: void 0
|
|
641
|
-
},
|
|
642
|
-
return
|
|
17
|
+
}, tn = re.createContext && re.createContext(gn), se = function() {
|
|
18
|
+
return se = Object.assign || function(l) {
|
|
643
19
|
for (var e, t = 1, n = arguments.length; t < n; t++) {
|
|
644
20
|
e = arguments[t];
|
|
645
|
-
for (var
|
|
21
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (l[i] = e[i]);
|
|
646
22
|
}
|
|
647
23
|
return l;
|
|
648
|
-
},
|
|
649
|
-
},
|
|
24
|
+
}, se.apply(this, arguments);
|
|
25
|
+
}, Jn = function(l, e) {
|
|
650
26
|
var t = {};
|
|
651
27
|
for (var n in l) Object.prototype.hasOwnProperty.call(l, n) && e.indexOf(n) < 0 && (t[n] = l[n]);
|
|
652
|
-
if (l != null && typeof Object.getOwnPropertySymbols == "function") for (var
|
|
653
|
-
e.indexOf(n[
|
|
28
|
+
if (l != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, n = Object.getOwnPropertySymbols(l); i < n.length; i++)
|
|
29
|
+
e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(l, n[i]) && (t[n[i]] = l[n[i]]);
|
|
654
30
|
return t;
|
|
655
31
|
};
|
|
656
|
-
function
|
|
32
|
+
function kn(l) {
|
|
657
33
|
return l && l.map(function(e, t) {
|
|
658
|
-
return
|
|
34
|
+
return re.createElement(e.tag, se({
|
|
659
35
|
key: t
|
|
660
|
-
}, e.attr),
|
|
36
|
+
}, e.attr), kn(e.child));
|
|
661
37
|
});
|
|
662
38
|
}
|
|
663
|
-
function
|
|
39
|
+
function G(l) {
|
|
664
40
|
return function(e) {
|
|
665
|
-
return
|
|
666
|
-
attr:
|
|
667
|
-
}, e),
|
|
41
|
+
return re.createElement(ei, se({
|
|
42
|
+
attr: se({}, l.attr)
|
|
43
|
+
}, e), kn(l.child));
|
|
668
44
|
};
|
|
669
45
|
}
|
|
670
|
-
function
|
|
46
|
+
function ei(l) {
|
|
671
47
|
var e = function(t) {
|
|
672
|
-
var n = l.attr,
|
|
673
|
-
return t.className && (
|
|
48
|
+
var n = l.attr, i = l.size, o = l.title, r = Jn(l, ["attr", "size", "title"]), a = i || t.size || "1em", c;
|
|
49
|
+
return t.className && (c = t.className), l.className && (c = (c ? c + " " : "") + l.className), re.createElement("svg", se({
|
|
674
50
|
stroke: "currentColor",
|
|
675
51
|
fill: "currentColor",
|
|
676
52
|
strokeWidth: "0"
|
|
677
|
-
}, t.attr, n,
|
|
678
|
-
className:
|
|
679
|
-
style:
|
|
53
|
+
}, t.attr, n, r, {
|
|
54
|
+
className: c,
|
|
55
|
+
style: se(se({
|
|
680
56
|
color: l.color || t.color
|
|
681
57
|
}, t.style), l.style),
|
|
682
|
-
height:
|
|
683
|
-
width:
|
|
58
|
+
height: a,
|
|
59
|
+
width: a,
|
|
684
60
|
xmlns: "http://www.w3.org/2000/svg"
|
|
685
|
-
}),
|
|
61
|
+
}), o && re.createElement("title", null, o), l.children);
|
|
686
62
|
};
|
|
687
|
-
return
|
|
63
|
+
return tn !== void 0 ? re.createElement(tn.Consumer, null, function(t) {
|
|
688
64
|
return e(t);
|
|
689
|
-
}) : e(
|
|
65
|
+
}) : e(gn);
|
|
690
66
|
}
|
|
691
|
-
function
|
|
692
|
-
return
|
|
67
|
+
function ti(l) {
|
|
68
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "48", d: "M112 244l144-144 144 144M256 120v292" } }] })(l);
|
|
693
69
|
}
|
|
694
|
-
function
|
|
695
|
-
return
|
|
70
|
+
function ni(l) {
|
|
71
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128L192 384l-96-96" } }] })(l);
|
|
696
72
|
}
|
|
697
|
-
function
|
|
698
|
-
return
|
|
73
|
+
function ii(l) {
|
|
74
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M368 368L144 144m224 0L144 368" } }] })(l);
|
|
699
75
|
}
|
|
700
|
-
function
|
|
701
|
-
return
|
|
76
|
+
function ri(l) {
|
|
77
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8-69 0-113.44 45.79-128 91.2-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M320 255.79l-64-64-64 64m64 192.42V207.79" } }] })(l);
|
|
702
78
|
}
|
|
703
|
-
function
|
|
704
|
-
return
|
|
79
|
+
function si(l) {
|
|
80
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "rect", attr: { width: "336", height: "336", x: "128", y: "128", fill: "none", strokeLinejoin: "round", strokeWidth: "32", rx: "57", ry: "57" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M383.5 128l.5-24a56.16 56.16 0 00-56-56H112a64.19 64.19 0 00-64 64v216a56.16 56.16 0 0056 56h24" } }] })(l);
|
|
705
81
|
}
|
|
706
|
-
function
|
|
707
|
-
return
|
|
82
|
+
function oi(l) {
|
|
83
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinejoin: "round", strokeWidth: "32", d: "M416 221.25V416a48 48 0 01-48 48H144a48 48 0 01-48-48V96a48 48 0 0148-48h98.75a32 32 0 0122.62 9.37l141.26 141.26a32 32 0 019.37 22.62z" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M256 56v120a32 32 0 0032 32h120m-232 80h160m-160 80h160" } }] })(l);
|
|
708
84
|
}
|
|
709
|
-
function
|
|
710
|
-
return
|
|
85
|
+
function li(l) {
|
|
86
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M336 176h40a40 40 0 0140 40v208a40 40 0 01-40 40H136a40 40 0 01-40-40V216a40 40 0 0140-40h40" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M176 272l80 80 80-80M256 48v288" } }] })(l);
|
|
711
87
|
}
|
|
712
|
-
function
|
|
713
|
-
return
|
|
88
|
+
function ai(l) {
|
|
89
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z" } }] })(l);
|
|
714
90
|
}
|
|
715
|
-
function
|
|
716
|
-
return
|
|
91
|
+
function ci(l) {
|
|
92
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeMiterlimit: "10", strokeWidth: "32", d: "M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z" } }, { tag: "path", attr: { d: "M310.4 336H201.6a25.62 25.62 0 01-25.6-25.6V201.6a25.62 25.62 0 0125.6-25.6h108.8a25.62 25.62 0 0125.6 25.6v108.8a25.62 25.62 0 01-25.6 25.6z" } }] })(l);
|
|
717
93
|
}
|
|
718
|
-
function
|
|
719
|
-
return
|
|
94
|
+
function ui(l) {
|
|
95
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeMiterlimit: "10", strokeWidth: "32", d: "M256 48v48m0 320v48m147.08-355.08l-33.94 33.94M142.86 369.14l-33.94 33.94M464 256h-48m-320 0H48m355.08 147.08l-33.94-33.94M142.86 142.86l-33.94-33.94" } }, { tag: "circle", attr: { cx: "256", cy: "256", r: "80", fill: "none", strokeLinecap: "round", strokeMiterlimit: "10", strokeWidth: "32" } }] })(l);
|
|
720
96
|
}
|
|
721
|
-
function
|
|
722
|
-
return
|
|
97
|
+
function pi(l) {
|
|
98
|
+
return G({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M126 192H56a8 8 0 00-8 8v112a8 8 0 008 8h69.65a15.93 15.93 0 0110.14 3.54l91.47 74.89A8 8 0 00240 392V120a8 8 0 00-12.74-6.43l-91.47 74.89A15 15 0 01126 192zm194 128c9.74-19.38 16-40.84 16-64 0-23.48-6-44.42-16-64m48 176c19.48-33.92 32-64.06 32-112s-12-77.74-32-112m48 272c30-46 48-91.43 48-160s-18-113-48-160" } }] })(l);
|
|
723
99
|
}
|
|
724
|
-
function
|
|
725
|
-
return
|
|
100
|
+
function hi(l) {
|
|
101
|
+
return G({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M288 288h-32v-64h32v64zm288-128v192H288v32H160v-32H0V160h576zm-416 32H32v128h64v-96h32v96h32V192zm160 0H192v160h64v-32h64V192zm224 0H352v128h64v-96h32v96h32v-96h32v96h32V192z" } }] })(l);
|
|
726
102
|
}
|
|
727
|
-
const
|
|
728
|
-
const e =
|
|
729
|
-
if (
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
}
|
|
733
|
-
},
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
l({ name:
|
|
737
|
-
},
|
|
738
|
-
},
|
|
739
|
-
|
|
740
|
-
},
|
|
741
|
-
|
|
742
|
-
},
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
|
|
103
|
+
const fi = ({ onFileLoaded: l }) => {
|
|
104
|
+
const e = Kn(null), [t, n] = ie(!1), [i, o] = ie(""), [r, a] = ie(!1), c = (p) => {
|
|
105
|
+
if (p.length > 0) {
|
|
106
|
+
const _ = p[0];
|
|
107
|
+
g(_) ? f(_) : alert("Please upload a valid Markdown (.md) file.");
|
|
108
|
+
}
|
|
109
|
+
}, g = (p) => p.name.endsWith(".md") || p.name.endsWith(".markdown") || p.type === "text/markdown", f = (p) => {
|
|
110
|
+
const _ = new FileReader();
|
|
111
|
+
_.onload = (I) => {
|
|
112
|
+
l({ name: p.name, content: I.target.result });
|
|
113
|
+
}, _.readAsText(p);
|
|
114
|
+
}, T = (p) => {
|
|
115
|
+
p.preventDefault(), p.stopPropagation(), p.type === "dragenter" || p.type === "dragover" ? n(!0) : (p.type === "dragleave" || p.type === "drop") && n(!1);
|
|
116
|
+
}, h = (p) => {
|
|
117
|
+
p.preventDefault(), p.stopPropagation(), n(!1), p.dataTransfer.files && p.dataTransfer.files[0] && c(p.dataTransfer.files);
|
|
118
|
+
}, b = async () => {
|
|
119
|
+
const p = i.trim();
|
|
120
|
+
if (p) {
|
|
121
|
+
a(!0);
|
|
746
122
|
try {
|
|
747
|
-
const
|
|
748
|
-
if (!
|
|
749
|
-
throw new Error(`HTTP error! status: ${
|
|
750
|
-
const
|
|
751
|
-
let
|
|
752
|
-
|
|
753
|
-
} catch (
|
|
754
|
-
console.error("Fetch error:",
|
|
123
|
+
const _ = m(p), I = await fetch(_);
|
|
124
|
+
if (!I.ok)
|
|
125
|
+
throw new Error(`HTTP error! status: ${I.status}`);
|
|
126
|
+
const q = await I.text();
|
|
127
|
+
let W = p.substring(p.lastIndexOf("/") + 1) || "remote-file.md";
|
|
128
|
+
W.includes("?") && (W = W.split("?")[0]), l({ name: W, content: q });
|
|
129
|
+
} catch (_) {
|
|
130
|
+
console.error("Fetch error:", _), alert(`Failed to load Markdown from URL.
|
|
755
131
|
|
|
756
132
|
Note: This might be due to CORS restrictions. Try a raw GitHub URL.`);
|
|
757
133
|
} finally {
|
|
758
|
-
|
|
134
|
+
a(!1);
|
|
759
135
|
}
|
|
760
136
|
}
|
|
761
|
-
},
|
|
137
|
+
}, m = (p) => {
|
|
762
138
|
try {
|
|
763
|
-
if (new URL(
|
|
764
|
-
return
|
|
139
|
+
if (new URL(p).hostname === "github.com" && p.includes("/blob/"))
|
|
140
|
+
return p.replace("github.com", "raw.githubusercontent.com").replace("/blob/", "/");
|
|
765
141
|
} catch {
|
|
766
142
|
}
|
|
767
|
-
return
|
|
143
|
+
return p;
|
|
768
144
|
};
|
|
769
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ $(
|
|
770
146
|
"section",
|
|
771
147
|
{
|
|
772
148
|
className: `upload-zone ${t ? "drag-active" : ""}`,
|
|
773
149
|
onClick: () => e.current.click(),
|
|
774
|
-
onDragEnter:
|
|
775
|
-
onDragLeave:
|
|
776
|
-
onDragOver:
|
|
777
|
-
onDrop:
|
|
150
|
+
onDragEnter: T,
|
|
151
|
+
onDragLeave: T,
|
|
152
|
+
onDragOver: T,
|
|
153
|
+
onDrop: h,
|
|
778
154
|
id: "upload-area",
|
|
779
155
|
children: [
|
|
780
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ w(
|
|
781
157
|
"input",
|
|
782
158
|
{
|
|
783
159
|
type: "file",
|
|
784
160
|
ref: e,
|
|
785
161
|
accept: ".md,.markdown",
|
|
786
162
|
hidden: !0,
|
|
787
|
-
onChange: (
|
|
163
|
+
onChange: (p) => c(p.target.files)
|
|
788
164
|
}
|
|
789
165
|
),
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ $("div", { className: "upload-content", children: [
|
|
167
|
+
/* @__PURE__ */ w("div", { className: "icon-wrapper", children: /* @__PURE__ */ w(ri, {}) }),
|
|
168
|
+
/* @__PURE__ */ w("h2", { children: "Drop your Markdown file here" }),
|
|
169
|
+
/* @__PURE__ */ $("p", { children: [
|
|
794
170
|
"or ",
|
|
795
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ w("span", { className: "browse-btn", children: "browse files" })
|
|
796
172
|
] }),
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ w("div", { className: "divider", children: /* @__PURE__ */ w("span", { children: "OR" }) }),
|
|
174
|
+
/* @__PURE__ */ $("div", { className: "url-input-container", onClick: (p) => p.stopPropagation(), children: [
|
|
175
|
+
/* @__PURE__ */ w(
|
|
800
176
|
"input",
|
|
801
177
|
{
|
|
802
178
|
type: "url",
|
|
803
179
|
id: "url-input",
|
|
804
180
|
placeholder: "Paste a raw Markdown URL...",
|
|
805
181
|
spellCheck: "false",
|
|
806
|
-
value:
|
|
807
|
-
onChange: (
|
|
808
|
-
onKeyDown: (
|
|
182
|
+
value: i,
|
|
183
|
+
onChange: (p) => o(p.target.value),
|
|
184
|
+
onKeyDown: (p) => p.key === "Enter" && b()
|
|
809
185
|
}
|
|
810
186
|
),
|
|
811
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ w("button", { id: "url-btn", onClick: b, disabled: r, children: r ? "..." : "Go" })
|
|
812
188
|
] }),
|
|
813
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ $("p", { className: "sub-text", children: [
|
|
814
190
|
"Supports ",
|
|
815
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ w("span", { style: { color: "aqua" }, children: ".md" }),
|
|
816
192
|
" and ",
|
|
817
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ w("span", { style: { color: "aqua" }, children: ".markdown" })
|
|
818
194
|
] })
|
|
819
195
|
] })
|
|
820
196
|
]
|
|
821
197
|
}
|
|
822
198
|
);
|
|
823
199
|
};
|
|
824
|
-
function
|
|
200
|
+
function _t() {
|
|
825
201
|
return {
|
|
826
202
|
async: !1,
|
|
827
203
|
breaks: !1,
|
|
@@ -835,43 +211,43 @@ function cn() {
|
|
|
835
211
|
walkTokens: null
|
|
836
212
|
};
|
|
837
213
|
}
|
|
838
|
-
let
|
|
839
|
-
function
|
|
840
|
-
|
|
214
|
+
let ue = _t();
|
|
215
|
+
function bn(l) {
|
|
216
|
+
ue = l;
|
|
841
217
|
}
|
|
842
|
-
const
|
|
218
|
+
const Tn = /[&<>"']/, di = new RegExp(Tn.source, "g"), wn = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, mi = new RegExp(wn.source, "g"), gi = {
|
|
843
219
|
"&": "&",
|
|
844
220
|
"<": "<",
|
|
845
221
|
">": ">",
|
|
846
222
|
'"': """,
|
|
847
223
|
"'": "'"
|
|
848
|
-
},
|
|
849
|
-
function
|
|
224
|
+
}, nn = (l) => gi[l];
|
|
225
|
+
function B(l, e) {
|
|
850
226
|
if (e) {
|
|
851
|
-
if (
|
|
852
|
-
return l.replace(
|
|
853
|
-
} else if (
|
|
854
|
-
return l.replace(
|
|
227
|
+
if (Tn.test(l))
|
|
228
|
+
return l.replace(di, nn);
|
|
229
|
+
} else if (wn.test(l))
|
|
230
|
+
return l.replace(mi, nn);
|
|
855
231
|
return l;
|
|
856
232
|
}
|
|
857
|
-
const
|
|
858
|
-
function
|
|
859
|
-
return l.replace(
|
|
233
|
+
const ki = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
234
|
+
function bi(l) {
|
|
235
|
+
return l.replace(ki, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
|
|
860
236
|
}
|
|
861
|
-
const
|
|
862
|
-
function
|
|
237
|
+
const Ti = /(^|[^\[])\^/g;
|
|
238
|
+
function E(l, e) {
|
|
863
239
|
let t = typeof l == "string" ? l : l.source;
|
|
864
240
|
e = e || "";
|
|
865
241
|
const n = {
|
|
866
|
-
replace: (
|
|
867
|
-
let
|
|
868
|
-
return
|
|
242
|
+
replace: (i, o) => {
|
|
243
|
+
let r = typeof o == "string" ? o : o.source;
|
|
244
|
+
return r = r.replace(Ti, "$1"), t = t.replace(i, r), n;
|
|
869
245
|
},
|
|
870
246
|
getRegex: () => new RegExp(t, e)
|
|
871
247
|
};
|
|
872
248
|
return n;
|
|
873
249
|
}
|
|
874
|
-
function
|
|
250
|
+
function rn(l) {
|
|
875
251
|
try {
|
|
876
252
|
l = encodeURI(l).replace(/%25/g, "%");
|
|
877
253
|
} catch {
|
|
@@ -879,35 +255,35 @@ function En(l) {
|
|
|
879
255
|
}
|
|
880
256
|
return l;
|
|
881
257
|
}
|
|
882
|
-
const
|
|
883
|
-
function
|
|
884
|
-
const t = l.replace(/\|/g, (
|
|
885
|
-
let
|
|
886
|
-
for (; --
|
|
887
|
-
|
|
888
|
-
return
|
|
258
|
+
const Le = { exec: () => null };
|
|
259
|
+
function sn(l, e) {
|
|
260
|
+
const t = l.replace(/\|/g, (o, r, a) => {
|
|
261
|
+
let c = !1, g = r;
|
|
262
|
+
for (; --g >= 0 && a[g] === "\\"; )
|
|
263
|
+
c = !c;
|
|
264
|
+
return c ? "|" : " |";
|
|
889
265
|
}), n = t.split(/ \|/);
|
|
890
|
-
let
|
|
266
|
+
let i = 0;
|
|
891
267
|
if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
|
|
892
268
|
if (n.length > e)
|
|
893
269
|
n.splice(e);
|
|
894
270
|
else
|
|
895
271
|
for (; n.length < e; )
|
|
896
272
|
n.push("");
|
|
897
|
-
for (;
|
|
898
|
-
n[
|
|
273
|
+
for (; i < n.length; i++)
|
|
274
|
+
n[i] = n[i].trim().replace(/\\\|/g, "|");
|
|
899
275
|
return n;
|
|
900
276
|
}
|
|
901
|
-
function
|
|
277
|
+
function Fe(l, e, t) {
|
|
902
278
|
const n = l.length;
|
|
903
279
|
if (n === 0)
|
|
904
280
|
return "";
|
|
905
|
-
let
|
|
906
|
-
for (;
|
|
907
|
-
|
|
908
|
-
return l.slice(0, n -
|
|
281
|
+
let i = 0;
|
|
282
|
+
for (; i < n && l.charAt(n - i - 1) === e; )
|
|
283
|
+
i++;
|
|
284
|
+
return l.slice(0, n - i);
|
|
909
285
|
}
|
|
910
|
-
function
|
|
286
|
+
function wi(l, e) {
|
|
911
287
|
if (l.indexOf(e[1]) === -1)
|
|
912
288
|
return -1;
|
|
913
289
|
let t = 0;
|
|
@@ -920,51 +296,51 @@ function Rr(l, e) {
|
|
|
920
296
|
return n;
|
|
921
297
|
return -1;
|
|
922
298
|
}
|
|
923
|
-
function
|
|
924
|
-
const
|
|
299
|
+
function on(l, e, t, n) {
|
|
300
|
+
const i = e.href, o = e.title ? B(e.title) : null, r = l[1].replace(/\\([\[\]])/g, "$1");
|
|
925
301
|
if (l[0].charAt(0) !== "!") {
|
|
926
302
|
n.state.inLink = !0;
|
|
927
|
-
const
|
|
303
|
+
const a = {
|
|
928
304
|
type: "link",
|
|
929
305
|
raw: t,
|
|
930
|
-
href:
|
|
931
|
-
title:
|
|
932
|
-
text:
|
|
933
|
-
tokens: n.inlineTokens(
|
|
306
|
+
href: i,
|
|
307
|
+
title: o,
|
|
308
|
+
text: r,
|
|
309
|
+
tokens: n.inlineTokens(r)
|
|
934
310
|
};
|
|
935
|
-
return n.state.inLink = !1,
|
|
311
|
+
return n.state.inLink = !1, a;
|
|
936
312
|
}
|
|
937
313
|
return {
|
|
938
314
|
type: "image",
|
|
939
315
|
raw: t,
|
|
940
|
-
href:
|
|
941
|
-
title:
|
|
942
|
-
text:
|
|
316
|
+
href: i,
|
|
317
|
+
title: o,
|
|
318
|
+
text: B(r)
|
|
943
319
|
};
|
|
944
320
|
}
|
|
945
|
-
function
|
|
321
|
+
function xi(l, e) {
|
|
946
322
|
const t = l.match(/^(\s+)(?:```)/);
|
|
947
323
|
if (t === null)
|
|
948
324
|
return e;
|
|
949
325
|
const n = t[1];
|
|
950
326
|
return e.split(`
|
|
951
|
-
`).map((
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
return
|
|
955
|
-
const [
|
|
956
|
-
return
|
|
327
|
+
`).map((i) => {
|
|
328
|
+
const o = i.match(/^\s+/);
|
|
329
|
+
if (o === null)
|
|
330
|
+
return i;
|
|
331
|
+
const [r] = o;
|
|
332
|
+
return r.length >= n.length ? i.slice(n.length) : i;
|
|
957
333
|
}).join(`
|
|
958
334
|
`);
|
|
959
335
|
}
|
|
960
|
-
class
|
|
336
|
+
class Ge {
|
|
961
337
|
// set by the lexer
|
|
962
338
|
constructor(e) {
|
|
963
|
-
|
|
964
|
-
|
|
339
|
+
A(this, "options");
|
|
340
|
+
A(this, "rules");
|
|
965
341
|
// set by the lexer
|
|
966
|
-
|
|
967
|
-
this.options = e ||
|
|
342
|
+
A(this, "lexer");
|
|
343
|
+
this.options = e || ue;
|
|
968
344
|
}
|
|
969
345
|
space(e) {
|
|
970
346
|
const t = this.rules.block.newline.exec(e);
|
|
@@ -982,7 +358,7 @@ class $t {
|
|
|
982
358
|
type: "code",
|
|
983
359
|
raw: t[0],
|
|
984
360
|
codeBlockStyle: "indented",
|
|
985
|
-
text: this.options.pedantic ? n :
|
|
361
|
+
text: this.options.pedantic ? n : Fe(n, `
|
|
986
362
|
`)
|
|
987
363
|
};
|
|
988
364
|
}
|
|
@@ -990,12 +366,12 @@ class $t {
|
|
|
990
366
|
fences(e) {
|
|
991
367
|
const t = this.rules.block.fences.exec(e);
|
|
992
368
|
if (t) {
|
|
993
|
-
const n = t[0],
|
|
369
|
+
const n = t[0], i = xi(n, t[3] || "");
|
|
994
370
|
return {
|
|
995
371
|
type: "code",
|
|
996
372
|
raw: n,
|
|
997
373
|
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
998
|
-
text:
|
|
374
|
+
text: i
|
|
999
375
|
};
|
|
1000
376
|
}
|
|
1001
377
|
}
|
|
@@ -1004,8 +380,8 @@ class $t {
|
|
|
1004
380
|
if (t) {
|
|
1005
381
|
let n = t[2].trim();
|
|
1006
382
|
if (/#$/.test(n)) {
|
|
1007
|
-
const
|
|
1008
|
-
(this.options.pedantic || !
|
|
383
|
+
const i = Fe(n, "#");
|
|
384
|
+
(this.options.pedantic || !i || / $/.test(i)) && (n = i.trim());
|
|
1009
385
|
}
|
|
1010
386
|
return {
|
|
1011
387
|
type: "heading",
|
|
@@ -1027,14 +403,14 @@ class $t {
|
|
|
1027
403
|
blockquote(e) {
|
|
1028
404
|
const t = this.rules.block.blockquote.exec(e);
|
|
1029
405
|
if (t) {
|
|
1030
|
-
const n =
|
|
1031
|
-
`),
|
|
406
|
+
const n = Fe(t[0].replace(/^ *>[ \t]?/gm, ""), `
|
|
407
|
+
`), i = this.lexer.state.top;
|
|
1032
408
|
this.lexer.state.top = !0;
|
|
1033
|
-
const
|
|
1034
|
-
return this.lexer.state.top =
|
|
409
|
+
const o = this.lexer.blockTokens(n);
|
|
410
|
+
return this.lexer.state.top = i, {
|
|
1035
411
|
type: "blockquote",
|
|
1036
412
|
raw: t[0],
|
|
1037
|
-
tokens:
|
|
413
|
+
tokens: o,
|
|
1038
414
|
text: n
|
|
1039
415
|
};
|
|
1040
416
|
}
|
|
@@ -1043,70 +419,70 @@ class $t {
|
|
|
1043
419
|
let t = this.rules.block.list.exec(e);
|
|
1044
420
|
if (t) {
|
|
1045
421
|
let n = t[1].trim();
|
|
1046
|
-
const
|
|
422
|
+
const i = n.length > 1, o = {
|
|
1047
423
|
type: "list",
|
|
1048
424
|
raw: "",
|
|
1049
|
-
ordered:
|
|
1050
|
-
start:
|
|
425
|
+
ordered: i,
|
|
426
|
+
start: i ? +n.slice(0, -1) : "",
|
|
1051
427
|
loose: !1,
|
|
1052
428
|
items: []
|
|
1053
429
|
};
|
|
1054
|
-
n =
|
|
1055
|
-
const
|
|
1056
|
-
let
|
|
430
|
+
n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
|
|
431
|
+
const r = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
|
|
432
|
+
let a = "", c = "", g = !1;
|
|
1057
433
|
for (; e; ) {
|
|
1058
|
-
let
|
|
1059
|
-
if (!(t =
|
|
434
|
+
let f = !1;
|
|
435
|
+
if (!(t = r.exec(e)) || this.rules.block.hr.test(e))
|
|
1060
436
|
break;
|
|
1061
|
-
|
|
1062
|
-
let
|
|
1063
|
-
`, 1)[0].replace(/^\t+/, (
|
|
1064
|
-
`, 1)[0],
|
|
1065
|
-
this.options.pedantic ? (
|
|
1066
|
-
let
|
|
1067
|
-
if (!
|
|
1068
|
-
`, e = e.substring(
|
|
1069
|
-
const
|
|
437
|
+
a = t[0], e = e.substring(a.length);
|
|
438
|
+
let T = t[2].split(`
|
|
439
|
+
`, 1)[0].replace(/^\t+/, (I) => " ".repeat(3 * I.length)), h = e.split(`
|
|
440
|
+
`, 1)[0], b = 0;
|
|
441
|
+
this.options.pedantic ? (b = 2, c = T.trimStart()) : (b = t[2].search(/[^ ]/), b = b > 4 ? 1 : b, c = T.slice(b), b += t[1].length);
|
|
442
|
+
let m = !1;
|
|
443
|
+
if (!T && /^ *$/.test(h) && (a += h + `
|
|
444
|
+
`, e = e.substring(h.length + 1), f = !0), !f) {
|
|
445
|
+
const I = new RegExp(`^ {0,${Math.min(3, b - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), q = new RegExp(`^ {0,${Math.min(3, b - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), W = new RegExp(`^ {0,${Math.min(3, b - 1)}}(?:\`\`\`|~~~)`), C = new RegExp(`^ {0,${Math.min(3, b - 1)}}#`);
|
|
1070
446
|
for (; e; ) {
|
|
1071
|
-
const
|
|
447
|
+
const J = e.split(`
|
|
1072
448
|
`, 1)[0];
|
|
1073
|
-
if (
|
|
449
|
+
if (h = J, this.options.pedantic && (h = h.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), W.test(h) || C.test(h) || I.test(h) || q.test(e))
|
|
1074
450
|
break;
|
|
1075
|
-
if (
|
|
1076
|
-
|
|
1077
|
-
` +
|
|
451
|
+
if (h.search(/[^ ]/) >= b || !h.trim())
|
|
452
|
+
c += `
|
|
453
|
+
` + h.slice(b);
|
|
1078
454
|
else {
|
|
1079
|
-
if (
|
|
455
|
+
if (m || T.search(/[^ ]/) >= 4 || W.test(T) || C.test(T) || q.test(T))
|
|
1080
456
|
break;
|
|
1081
|
-
|
|
1082
|
-
` +
|
|
457
|
+
c += `
|
|
458
|
+
` + h;
|
|
1083
459
|
}
|
|
1084
|
-
!
|
|
1085
|
-
`, e = e.substring(
|
|
460
|
+
!m && !h.trim() && (m = !0), a += J + `
|
|
461
|
+
`, e = e.substring(J.length + 1), T = h.slice(b);
|
|
1086
462
|
}
|
|
1087
463
|
}
|
|
1088
|
-
|
|
1089
|
-
let
|
|
1090
|
-
this.options.gfm && (
|
|
464
|
+
o.loose || (g ? o.loose = !0 : /\n *\n *$/.test(a) && (g = !0));
|
|
465
|
+
let p = null, _;
|
|
466
|
+
this.options.gfm && (p = /^\[[ xX]\] /.exec(c), p && (_ = p[0] !== "[ ] ", c = c.replace(/^\[[ xX]\] +/, ""))), o.items.push({
|
|
1091
467
|
type: "list_item",
|
|
1092
|
-
raw:
|
|
1093
|
-
task: !!
|
|
1094
|
-
checked:
|
|
468
|
+
raw: a,
|
|
469
|
+
task: !!p,
|
|
470
|
+
checked: _,
|
|
1095
471
|
loose: !1,
|
|
1096
|
-
text:
|
|
472
|
+
text: c,
|
|
1097
473
|
tokens: []
|
|
1098
|
-
}),
|
|
474
|
+
}), o.raw += a;
|
|
1099
475
|
}
|
|
1100
|
-
|
|
1101
|
-
for (let
|
|
1102
|
-
if (this.lexer.state.top = !1,
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
}
|
|
1106
|
-
if (
|
|
1107
|
-
for (let
|
|
1108
|
-
|
|
1109
|
-
return
|
|
476
|
+
o.items[o.items.length - 1].raw = a.trimEnd(), o.items[o.items.length - 1].text = c.trimEnd(), o.raw = o.raw.trimEnd();
|
|
477
|
+
for (let f = 0; f < o.items.length; f++)
|
|
478
|
+
if (this.lexer.state.top = !1, o.items[f].tokens = this.lexer.blockTokens(o.items[f].text, []), !o.loose) {
|
|
479
|
+
const T = o.items[f].tokens.filter((b) => b.type === "space"), h = T.length > 0 && T.some((b) => /\n.*\n/.test(b.raw));
|
|
480
|
+
o.loose = h;
|
|
481
|
+
}
|
|
482
|
+
if (o.loose)
|
|
483
|
+
for (let f = 0; f < o.items.length; f++)
|
|
484
|
+
o.items[f].loose = !0;
|
|
485
|
+
return o;
|
|
1110
486
|
}
|
|
1111
487
|
}
|
|
1112
488
|
html(e) {
|
|
@@ -1123,13 +499,13 @@ class $t {
|
|
|
1123
499
|
def(e) {
|
|
1124
500
|
const t = this.rules.block.def.exec(e);
|
|
1125
501
|
if (t) {
|
|
1126
|
-
const n = t[1].toLowerCase().replace(/\s+/g, " "),
|
|
502
|
+
const n = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", o = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
1127
503
|
return {
|
|
1128
504
|
type: "def",
|
|
1129
505
|
tag: n,
|
|
1130
506
|
raw: t[0],
|
|
1131
|
-
href:
|
|
1132
|
-
title:
|
|
507
|
+
href: i,
|
|
508
|
+
title: o
|
|
1133
509
|
};
|
|
1134
510
|
}
|
|
1135
511
|
}
|
|
@@ -1137,28 +513,28 @@ class $t {
|
|
|
1137
513
|
const t = this.rules.block.table.exec(e);
|
|
1138
514
|
if (!t || !/[:|]/.test(t[2]))
|
|
1139
515
|
return;
|
|
1140
|
-
const n =
|
|
1141
|
-
`) : [],
|
|
516
|
+
const n = sn(t[1]), i = t[2].replace(/^\||\| *$/g, "").split("|"), o = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
|
|
517
|
+
`) : [], r = {
|
|
1142
518
|
type: "table",
|
|
1143
519
|
raw: t[0],
|
|
1144
520
|
header: [],
|
|
1145
521
|
align: [],
|
|
1146
522
|
rows: []
|
|
1147
523
|
};
|
|
1148
|
-
if (n.length ===
|
|
1149
|
-
for (const
|
|
1150
|
-
/^ *-+: *$/.test(
|
|
1151
|
-
for (const
|
|
1152
|
-
|
|
524
|
+
if (n.length === i.length) {
|
|
525
|
+
for (const a of i)
|
|
526
|
+
/^ *-+: *$/.test(a) ? r.align.push("right") : /^ *:-+: *$/.test(a) ? r.align.push("center") : /^ *:-+ *$/.test(a) ? r.align.push("left") : r.align.push(null);
|
|
527
|
+
for (const a of n)
|
|
528
|
+
r.header.push({
|
|
529
|
+
text: a,
|
|
530
|
+
tokens: this.lexer.inline(a)
|
|
531
|
+
});
|
|
532
|
+
for (const a of o)
|
|
533
|
+
r.rows.push(sn(a, r.header.length).map((c) => ({
|
|
1153
534
|
text: c,
|
|
1154
535
|
tokens: this.lexer.inline(c)
|
|
1155
|
-
});
|
|
1156
|
-
for (const c of a)
|
|
1157
|
-
s.rows.push(vn(c, s.header.length).map((u) => ({
|
|
1158
|
-
text: u,
|
|
1159
|
-
tokens: this.lexer.inline(u)
|
|
1160
536
|
})));
|
|
1161
|
-
return
|
|
537
|
+
return r;
|
|
1162
538
|
}
|
|
1163
539
|
}
|
|
1164
540
|
lheading(e) {
|
|
@@ -1201,7 +577,7 @@ class $t {
|
|
|
1201
577
|
return {
|
|
1202
578
|
type: "escape",
|
|
1203
579
|
raw: t[0],
|
|
1204
|
-
text:
|
|
580
|
+
text: B(t[1])
|
|
1205
581
|
};
|
|
1206
582
|
}
|
|
1207
583
|
tag(e) {
|
|
@@ -1223,80 +599,80 @@ class $t {
|
|
|
1223
599
|
if (!this.options.pedantic && /^</.test(n)) {
|
|
1224
600
|
if (!/>$/.test(n))
|
|
1225
601
|
return;
|
|
1226
|
-
const
|
|
1227
|
-
if ((n.length -
|
|
602
|
+
const r = Fe(n.slice(0, -1), "\\");
|
|
603
|
+
if ((n.length - r.length) % 2 === 0)
|
|
1228
604
|
return;
|
|
1229
605
|
} else {
|
|
1230
|
-
const
|
|
1231
|
-
if (
|
|
1232
|
-
const
|
|
1233
|
-
t[2] = t[2].substring(0,
|
|
606
|
+
const r = wi(t[2], "()");
|
|
607
|
+
if (r > -1) {
|
|
608
|
+
const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + r;
|
|
609
|
+
t[2] = t[2].substring(0, r), t[0] = t[0].substring(0, c).trim(), t[3] = "";
|
|
1234
610
|
}
|
|
1235
611
|
}
|
|
1236
|
-
let
|
|
612
|
+
let i = t[2], o = "";
|
|
1237
613
|
if (this.options.pedantic) {
|
|
1238
|
-
const
|
|
1239
|
-
|
|
614
|
+
const r = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
|
|
615
|
+
r && (i = r[1], o = r[3]);
|
|
1240
616
|
} else
|
|
1241
|
-
|
|
1242
|
-
return
|
|
1243
|
-
href:
|
|
1244
|
-
title:
|
|
617
|
+
o = t[3] ? t[3].slice(1, -1) : "";
|
|
618
|
+
return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), on(t, {
|
|
619
|
+
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
620
|
+
title: o && o.replace(this.rules.inline.anyPunctuation, "$1")
|
|
1245
621
|
}, t[0], this.lexer);
|
|
1246
622
|
}
|
|
1247
623
|
}
|
|
1248
624
|
reflink(e, t) {
|
|
1249
625
|
let n;
|
|
1250
626
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
1251
|
-
const
|
|
1252
|
-
if (!
|
|
1253
|
-
const
|
|
627
|
+
const i = (n[2] || n[1]).replace(/\s+/g, " "), o = t[i.toLowerCase()];
|
|
628
|
+
if (!o) {
|
|
629
|
+
const r = n[0].charAt(0);
|
|
1254
630
|
return {
|
|
1255
631
|
type: "text",
|
|
1256
|
-
raw:
|
|
1257
|
-
text:
|
|
632
|
+
raw: r,
|
|
633
|
+
text: r
|
|
1258
634
|
};
|
|
1259
635
|
}
|
|
1260
|
-
return
|
|
636
|
+
return on(n, o, n[0], this.lexer);
|
|
1261
637
|
}
|
|
1262
638
|
}
|
|
1263
639
|
emStrong(e, t, n = "") {
|
|
1264
|
-
let
|
|
1265
|
-
if (!
|
|
640
|
+
let i = this.rules.inline.emStrongLDelim.exec(e);
|
|
641
|
+
if (!i || i[3] && n.match(/[\p{L}\p{N}]/u))
|
|
1266
642
|
return;
|
|
1267
|
-
if (!(
|
|
1268
|
-
const
|
|
1269
|
-
let
|
|
1270
|
-
const
|
|
1271
|
-
for (
|
|
1272
|
-
if (
|
|
643
|
+
if (!(i[1] || i[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
644
|
+
const r = [...i[0]].length - 1;
|
|
645
|
+
let a, c, g = r, f = 0;
|
|
646
|
+
const T = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
647
|
+
for (T.lastIndex = 0, t = t.slice(-1 * e.length + r); (i = T.exec(t)) != null; ) {
|
|
648
|
+
if (a = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !a)
|
|
1273
649
|
continue;
|
|
1274
|
-
if (
|
|
1275
|
-
|
|
650
|
+
if (c = [...a].length, i[3] || i[4]) {
|
|
651
|
+
g += c;
|
|
1276
652
|
continue;
|
|
1277
|
-
} else if ((
|
|
1278
|
-
|
|
653
|
+
} else if ((i[5] || i[6]) && r % 3 && !((r + c) % 3)) {
|
|
654
|
+
f += c;
|
|
1279
655
|
continue;
|
|
1280
656
|
}
|
|
1281
|
-
if (
|
|
657
|
+
if (g -= c, g > 0)
|
|
1282
658
|
continue;
|
|
1283
|
-
|
|
1284
|
-
const
|
|
1285
|
-
if (Math.min(
|
|
1286
|
-
const
|
|
659
|
+
c = Math.min(c, c + g + f);
|
|
660
|
+
const h = [...i[0]][0].length, b = e.slice(0, r + i.index + h + c);
|
|
661
|
+
if (Math.min(r, c) % 2) {
|
|
662
|
+
const p = b.slice(1, -1);
|
|
1287
663
|
return {
|
|
1288
664
|
type: "em",
|
|
1289
|
-
raw:
|
|
1290
|
-
text:
|
|
1291
|
-
tokens: this.lexer.inlineTokens(
|
|
665
|
+
raw: b,
|
|
666
|
+
text: p,
|
|
667
|
+
tokens: this.lexer.inlineTokens(p)
|
|
1292
668
|
};
|
|
1293
669
|
}
|
|
1294
|
-
const
|
|
670
|
+
const m = b.slice(2, -2);
|
|
1295
671
|
return {
|
|
1296
672
|
type: "strong",
|
|
1297
|
-
raw:
|
|
1298
|
-
text:
|
|
1299
|
-
tokens: this.lexer.inlineTokens(
|
|
673
|
+
raw: b,
|
|
674
|
+
text: m,
|
|
675
|
+
tokens: this.lexer.inlineTokens(m)
|
|
1300
676
|
};
|
|
1301
677
|
}
|
|
1302
678
|
}
|
|
@@ -1305,8 +681,8 @@ class $t {
|
|
|
1305
681
|
const t = this.rules.inline.code.exec(e);
|
|
1306
682
|
if (t) {
|
|
1307
683
|
let n = t[2].replace(/\n/g, " ");
|
|
1308
|
-
const
|
|
1309
|
-
return
|
|
684
|
+
const i = /[^ ]/.test(n), o = /^ /.test(n) && / $/.test(n);
|
|
685
|
+
return i && o && (n = n.substring(1, n.length - 1)), n = B(n, !0), {
|
|
1310
686
|
type: "codespan",
|
|
1311
687
|
raw: t[0],
|
|
1312
688
|
text: n
|
|
@@ -1334,12 +710,12 @@ class $t {
|
|
|
1334
710
|
autolink(e) {
|
|
1335
711
|
const t = this.rules.inline.autolink.exec(e);
|
|
1336
712
|
if (t) {
|
|
1337
|
-
let n,
|
|
1338
|
-
return t[2] === "@" ? (n =
|
|
713
|
+
let n, i;
|
|
714
|
+
return t[2] === "@" ? (n = B(t[1]), i = "mailto:" + n) : (n = B(t[1]), i = n), {
|
|
1339
715
|
type: "link",
|
|
1340
716
|
raw: t[0],
|
|
1341
717
|
text: n,
|
|
1342
|
-
href:
|
|
718
|
+
href: i,
|
|
1343
719
|
tokens: [
|
|
1344
720
|
{
|
|
1345
721
|
type: "text",
|
|
@@ -1354,26 +730,26 @@ class $t {
|
|
|
1354
730
|
var n;
|
|
1355
731
|
let t;
|
|
1356
732
|
if (t = this.rules.inline.url.exec(e)) {
|
|
1357
|
-
let
|
|
733
|
+
let i, o;
|
|
1358
734
|
if (t[2] === "@")
|
|
1359
|
-
|
|
735
|
+
i = B(t[0]), o = "mailto:" + i;
|
|
1360
736
|
else {
|
|
1361
|
-
let
|
|
737
|
+
let r;
|
|
1362
738
|
do
|
|
1363
|
-
|
|
1364
|
-
while (
|
|
1365
|
-
|
|
739
|
+
r = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
|
|
740
|
+
while (r !== t[0]);
|
|
741
|
+
i = B(t[0]), t[1] === "www." ? o = "http://" + t[0] : o = t[0];
|
|
1366
742
|
}
|
|
1367
743
|
return {
|
|
1368
744
|
type: "link",
|
|
1369
745
|
raw: t[0],
|
|
1370
|
-
text:
|
|
1371
|
-
href:
|
|
746
|
+
text: i,
|
|
747
|
+
href: o,
|
|
1372
748
|
tokens: [
|
|
1373
749
|
{
|
|
1374
750
|
type: "text",
|
|
1375
|
-
raw:
|
|
1376
|
-
text:
|
|
751
|
+
raw: i,
|
|
752
|
+
text: i
|
|
1377
753
|
}
|
|
1378
754
|
]
|
|
1379
755
|
};
|
|
@@ -1383,7 +759,7 @@ class $t {
|
|
|
1383
759
|
const t = this.rules.inline.text.exec(e);
|
|
1384
760
|
if (t) {
|
|
1385
761
|
let n;
|
|
1386
|
-
return this.lexer.state.inRawBlock ? n = t[0] : n =
|
|
762
|
+
return this.lexer.state.inRawBlock ? n = t[0] : n = B(t[0]), {
|
|
1387
763
|
type: "text",
|
|
1388
764
|
raw: t[0],
|
|
1389
765
|
text: n
|
|
@@ -1391,118 +767,118 @@ class $t {
|
|
|
1391
767
|
}
|
|
1392
768
|
}
|
|
1393
769
|
}
|
|
1394
|
-
const
|
|
1395
|
-
blockquote:
|
|
1396
|
-
code:
|
|
1397
|
-
def:
|
|
1398
|
-
fences:
|
|
1399
|
-
heading:
|
|
1400
|
-
hr:
|
|
1401
|
-
html:
|
|
1402
|
-
lheading:
|
|
1403
|
-
list:
|
|
1404
|
-
newline:
|
|
1405
|
-
paragraph:
|
|
1406
|
-
table:
|
|
1407
|
-
text:
|
|
1408
|
-
},
|
|
1409
|
-
...
|
|
1410
|
-
table:
|
|
1411
|
-
paragraph:
|
|
1412
|
-
},
|
|
1413
|
-
...
|
|
1414
|
-
html:
|
|
770
|
+
const _i = /^(?: *(?:\n|$))+/, yi = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, Ei = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Ie = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ai = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xn = /(?:[*+-]|\d{1,9}[.)])/, _n = E(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, xn).getRegex(), yt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Si = /^[^\n]+/, Et = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ri = E(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", Et).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Li = E(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, xn).getRegex(), Ye = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", At = /<!--(?!-?>)[\s\S]*?(?:-->|$)/, vi = E("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", At).replace("tag", Ye).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), yn = E(yt).replace("hr", Ie).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ye).getRegex(), Ii = E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", yn).getRegex(), St = {
|
|
771
|
+
blockquote: Ii,
|
|
772
|
+
code: yi,
|
|
773
|
+
def: Ri,
|
|
774
|
+
fences: Ei,
|
|
775
|
+
heading: Ai,
|
|
776
|
+
hr: Ie,
|
|
777
|
+
html: vi,
|
|
778
|
+
lheading: _n,
|
|
779
|
+
list: Li,
|
|
780
|
+
newline: _i,
|
|
781
|
+
paragraph: yn,
|
|
782
|
+
table: Le,
|
|
783
|
+
text: Si
|
|
784
|
+
}, ln = E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Ie).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ye).getRegex(), Ci = {
|
|
785
|
+
...St,
|
|
786
|
+
table: ln,
|
|
787
|
+
paragraph: E(yt).replace("hr", Ie).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ln).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ye).getRegex()
|
|
788
|
+
}, Oi = {
|
|
789
|
+
...St,
|
|
790
|
+
html: E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", At).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
1415
791
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1416
792
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1417
|
-
fences:
|
|
793
|
+
fences: Le,
|
|
1418
794
|
// fences not supported
|
|
1419
795
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1420
|
-
paragraph:
|
|
1421
|
-
]`).replace("lheading",
|
|
1422
|
-
},
|
|
1423
|
-
_backpedal:
|
|
796
|
+
paragraph: E(yt).replace("hr", Ie).replace("heading", ` *#{1,6} *[^
|
|
797
|
+
]`).replace("lheading", _n).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
798
|
+
}, En = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Di = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, An = /^( {2,}|\\)\n(?!\s*$)/, Ni = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ce = "\\p{P}$+<=>`^|~", Mi = E(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, Ce).getRegex(), zi = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, Pi = E(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, Ce).getRegex(), $i = E("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, Ce).getRegex(), Ui = E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, Ce).getRegex(), Fi = E(/\\([punct])/, "gu").replace(/punct/g, Ce).getRegex(), Hi = E(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Bi = E(At).replace("(?:-->|$)", "-->").getRegex(), Wi = E("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Bi).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), qe = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, ji = E(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", qe).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Sn = E(/^!?\[(label)\]\[(ref)\]/).replace("label", qe).replace("ref", Et).getRegex(), Rn = E(/^!?\[(ref)\](?:\[\])?/).replace("ref", Et).getRegex(), Gi = E("reflink|nolink(?!\\()", "g").replace("reflink", Sn).replace("nolink", Rn).getRegex(), Rt = {
|
|
799
|
+
_backpedal: Le,
|
|
1424
800
|
// only used for GFM url
|
|
1425
|
-
anyPunctuation:
|
|
1426
|
-
autolink:
|
|
1427
|
-
blockSkip:
|
|
1428
|
-
br:
|
|
1429
|
-
code:
|
|
1430
|
-
del:
|
|
1431
|
-
emStrongLDelim:
|
|
1432
|
-
emStrongRDelimAst:
|
|
1433
|
-
emStrongRDelimUnd:
|
|
1434
|
-
escape:
|
|
1435
|
-
link:
|
|
1436
|
-
nolink:
|
|
1437
|
-
punctuation:
|
|
1438
|
-
reflink:
|
|
1439
|
-
reflinkSearch:
|
|
1440
|
-
tag:
|
|
1441
|
-
text:
|
|
1442
|
-
url:
|
|
1443
|
-
},
|
|
1444
|
-
...
|
|
1445
|
-
link:
|
|
1446
|
-
reflink:
|
|
1447
|
-
},
|
|
1448
|
-
...
|
|
1449
|
-
escape:
|
|
1450
|
-
url:
|
|
801
|
+
anyPunctuation: Fi,
|
|
802
|
+
autolink: Hi,
|
|
803
|
+
blockSkip: zi,
|
|
804
|
+
br: An,
|
|
805
|
+
code: Di,
|
|
806
|
+
del: Le,
|
|
807
|
+
emStrongLDelim: Pi,
|
|
808
|
+
emStrongRDelimAst: $i,
|
|
809
|
+
emStrongRDelimUnd: Ui,
|
|
810
|
+
escape: En,
|
|
811
|
+
link: ji,
|
|
812
|
+
nolink: Rn,
|
|
813
|
+
punctuation: Mi,
|
|
814
|
+
reflink: Sn,
|
|
815
|
+
reflinkSearch: Gi,
|
|
816
|
+
tag: Wi,
|
|
817
|
+
text: Ni,
|
|
818
|
+
url: Le
|
|
819
|
+
}, qi = {
|
|
820
|
+
...Rt,
|
|
821
|
+
link: E(/^!?\[(label)\]\((.*?)\)/).replace("label", qe).getRegex(),
|
|
822
|
+
reflink: E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", qe).getRegex()
|
|
823
|
+
}, kt = {
|
|
824
|
+
...Rt,
|
|
825
|
+
escape: E(En).replace("])", "~|])").getRegex(),
|
|
826
|
+
url: E(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1451
827
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1452
828
|
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
1453
829
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1454
|
-
},
|
|
1455
|
-
...
|
|
1456
|
-
br:
|
|
1457
|
-
text:
|
|
1458
|
-
},
|
|
1459
|
-
normal:
|
|
1460
|
-
gfm:
|
|
1461
|
-
pedantic:
|
|
1462
|
-
},
|
|
1463
|
-
normal:
|
|
1464
|
-
gfm:
|
|
1465
|
-
breaks:
|
|
1466
|
-
pedantic:
|
|
830
|
+
}, Zi = {
|
|
831
|
+
...kt,
|
|
832
|
+
br: E(An).replace("{2,}", "*").getRegex(),
|
|
833
|
+
text: E(kt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
834
|
+
}, He = {
|
|
835
|
+
normal: St,
|
|
836
|
+
gfm: Ci,
|
|
837
|
+
pedantic: Oi
|
|
838
|
+
}, _e = {
|
|
839
|
+
normal: Rt,
|
|
840
|
+
gfm: kt,
|
|
841
|
+
breaks: Zi,
|
|
842
|
+
pedantic: qi
|
|
1467
843
|
};
|
|
1468
|
-
class
|
|
844
|
+
class Q {
|
|
1469
845
|
constructor(e) {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
846
|
+
A(this, "tokens");
|
|
847
|
+
A(this, "options");
|
|
848
|
+
A(this, "state");
|
|
849
|
+
A(this, "tokenizer");
|
|
850
|
+
A(this, "inlineQueue");
|
|
851
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ue, this.options.tokenizer = this.options.tokenizer || new Ge(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
1476
852
|
inLink: !1,
|
|
1477
853
|
inRawBlock: !1,
|
|
1478
854
|
top: !0
|
|
1479
855
|
};
|
|
1480
856
|
const t = {
|
|
1481
|
-
block:
|
|
1482
|
-
inline:
|
|
857
|
+
block: He.normal,
|
|
858
|
+
inline: _e.normal
|
|
1483
859
|
};
|
|
1484
|
-
this.options.pedantic ? (t.block =
|
|
860
|
+
this.options.pedantic ? (t.block = He.pedantic, t.inline = _e.pedantic) : this.options.gfm && (t.block = He.gfm, this.options.breaks ? t.inline = _e.breaks : t.inline = _e.gfm), this.tokenizer.rules = t;
|
|
1485
861
|
}
|
|
1486
862
|
/**
|
|
1487
863
|
* Expose Rules
|
|
1488
864
|
*/
|
|
1489
865
|
static get rules() {
|
|
1490
866
|
return {
|
|
1491
|
-
block:
|
|
1492
|
-
inline:
|
|
867
|
+
block: He,
|
|
868
|
+
inline: _e
|
|
1493
869
|
};
|
|
1494
870
|
}
|
|
1495
871
|
/**
|
|
1496
872
|
* Static Lex Method
|
|
1497
873
|
*/
|
|
1498
874
|
static lex(e, t) {
|
|
1499
|
-
return new
|
|
875
|
+
return new Q(t).lex(e);
|
|
1500
876
|
}
|
|
1501
877
|
/**
|
|
1502
878
|
* Static Lex Inline Method
|
|
1503
879
|
*/
|
|
1504
880
|
static lexInline(e, t) {
|
|
1505
|
-
return new
|
|
881
|
+
return new Q(t).inlineTokens(e);
|
|
1506
882
|
}
|
|
1507
883
|
/**
|
|
1508
884
|
* Preprocessing
|
|
@@ -1517,19 +893,19 @@ class he {
|
|
|
1517
893
|
return this.inlineQueue = [], this.tokens;
|
|
1518
894
|
}
|
|
1519
895
|
blockTokens(e, t = []) {
|
|
1520
|
-
this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (
|
|
1521
|
-
let n,
|
|
896
|
+
this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (a, c, g) => c + " ".repeat(g.length));
|
|
897
|
+
let n, i, o, r;
|
|
1522
898
|
for (; e; )
|
|
1523
|
-
if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((
|
|
899
|
+
if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((a) => (n = a.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
|
|
1524
900
|
if (n = this.tokenizer.space(e)) {
|
|
1525
901
|
e = e.substring(n.raw.length), n.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
|
|
1526
902
|
` : t.push(n);
|
|
1527
903
|
continue;
|
|
1528
904
|
}
|
|
1529
905
|
if (n = this.tokenizer.code(e)) {
|
|
1530
|
-
e = e.substring(n.raw.length),
|
|
1531
|
-
` + n.raw,
|
|
1532
|
-
` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
906
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
|
|
907
|
+
` + n.raw, i.text += `
|
|
908
|
+
` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
|
|
1533
909
|
continue;
|
|
1534
910
|
}
|
|
1535
911
|
if (n = this.tokenizer.fences(e)) {
|
|
@@ -1557,9 +933,9 @@ class he {
|
|
|
1557
933
|
continue;
|
|
1558
934
|
}
|
|
1559
935
|
if (n = this.tokenizer.def(e)) {
|
|
1560
|
-
e = e.substring(n.raw.length),
|
|
1561
|
-
` + n.raw,
|
|
1562
|
-
` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
936
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
|
|
937
|
+
` + n.raw, i.text += `
|
|
938
|
+
` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
|
|
1563
939
|
href: n.href,
|
|
1564
940
|
title: n.title
|
|
1565
941
|
});
|
|
@@ -1573,33 +949,33 @@ class he {
|
|
|
1573
949
|
e = e.substring(n.raw.length), t.push(n);
|
|
1574
950
|
continue;
|
|
1575
951
|
}
|
|
1576
|
-
if (
|
|
1577
|
-
let
|
|
1578
|
-
const
|
|
1579
|
-
let
|
|
1580
|
-
this.options.extensions.startBlock.forEach((
|
|
1581
|
-
|
|
1582
|
-
}),
|
|
1583
|
-
}
|
|
1584
|
-
if (this.state.top && (n = this.tokenizer.paragraph(
|
|
1585
|
-
|
|
1586
|
-
` + n.raw,
|
|
1587
|
-
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
952
|
+
if (o = e, this.options.extensions && this.options.extensions.startBlock) {
|
|
953
|
+
let a = 1 / 0;
|
|
954
|
+
const c = e.slice(1);
|
|
955
|
+
let g;
|
|
956
|
+
this.options.extensions.startBlock.forEach((f) => {
|
|
957
|
+
g = f.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (a = Math.min(a, g));
|
|
958
|
+
}), a < 1 / 0 && a >= 0 && (o = e.substring(0, a + 1));
|
|
959
|
+
}
|
|
960
|
+
if (this.state.top && (n = this.tokenizer.paragraph(o))) {
|
|
961
|
+
i = t[t.length - 1], r && i.type === "paragraph" ? (i.raw += `
|
|
962
|
+
` + n.raw, i.text += `
|
|
963
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n), r = o.length !== e.length, e = e.substring(n.raw.length);
|
|
1588
964
|
continue;
|
|
1589
965
|
}
|
|
1590
966
|
if (n = this.tokenizer.text(e)) {
|
|
1591
|
-
e = e.substring(n.raw.length),
|
|
1592
|
-
` + n.raw,
|
|
1593
|
-
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
967
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
|
|
968
|
+
` + n.raw, i.text += `
|
|
969
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
|
|
1594
970
|
continue;
|
|
1595
971
|
}
|
|
1596
972
|
if (e) {
|
|
1597
|
-
const
|
|
973
|
+
const a = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1598
974
|
if (this.options.silent) {
|
|
1599
|
-
console.error(
|
|
975
|
+
console.error(a);
|
|
1600
976
|
break;
|
|
1601
977
|
} else
|
|
1602
|
-
throw new Error(
|
|
978
|
+
throw new Error(a);
|
|
1603
979
|
}
|
|
1604
980
|
}
|
|
1605
981
|
return this.state.top = !0, t;
|
|
@@ -1611,25 +987,25 @@ class he {
|
|
|
1611
987
|
* Lexing/Compiling
|
|
1612
988
|
*/
|
|
1613
989
|
inlineTokens(e, t = []) {
|
|
1614
|
-
let n,
|
|
990
|
+
let n, i, o, r = e, a, c, g;
|
|
1615
991
|
if (this.tokens.links) {
|
|
1616
|
-
const
|
|
1617
|
-
if (
|
|
1618
|
-
for (; (
|
|
1619
|
-
|
|
1620
|
-
}
|
|
1621
|
-
for (; (
|
|
1622
|
-
|
|
1623
|
-
for (; (
|
|
1624
|
-
|
|
992
|
+
const f = Object.keys(this.tokens.links);
|
|
993
|
+
if (f.length > 0)
|
|
994
|
+
for (; (a = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
|
|
995
|
+
f.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
996
|
+
}
|
|
997
|
+
for (; (a = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
|
|
998
|
+
r = r.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
999
|
+
for (; (a = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; )
|
|
1000
|
+
r = r.slice(0, a.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1625
1001
|
for (; e; )
|
|
1626
|
-
if (
|
|
1002
|
+
if (c || (g = ""), c = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((f) => (n = f.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
|
|
1627
1003
|
if (n = this.tokenizer.escape(e)) {
|
|
1628
1004
|
e = e.substring(n.raw.length), t.push(n);
|
|
1629
1005
|
continue;
|
|
1630
1006
|
}
|
|
1631
1007
|
if (n = this.tokenizer.tag(e)) {
|
|
1632
|
-
e = e.substring(n.raw.length),
|
|
1008
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
|
|
1633
1009
|
continue;
|
|
1634
1010
|
}
|
|
1635
1011
|
if (n = this.tokenizer.link(e)) {
|
|
@@ -1637,10 +1013,10 @@ class he {
|
|
|
1637
1013
|
continue;
|
|
1638
1014
|
}
|
|
1639
1015
|
if (n = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1640
|
-
e = e.substring(n.raw.length),
|
|
1016
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
|
|
1641
1017
|
continue;
|
|
1642
1018
|
}
|
|
1643
|
-
if (n = this.tokenizer.emStrong(e,
|
|
1019
|
+
if (n = this.tokenizer.emStrong(e, r, g)) {
|
|
1644
1020
|
e = e.substring(n.raw.length), t.push(n);
|
|
1645
1021
|
continue;
|
|
1646
1022
|
}
|
|
@@ -1664,41 +1040,41 @@ class he {
|
|
|
1664
1040
|
e = e.substring(n.raw.length), t.push(n);
|
|
1665
1041
|
continue;
|
|
1666
1042
|
}
|
|
1667
|
-
if (
|
|
1668
|
-
let
|
|
1669
|
-
const
|
|
1670
|
-
let
|
|
1671
|
-
this.options.extensions.startInline.forEach((
|
|
1672
|
-
|
|
1673
|
-
}),
|
|
1043
|
+
if (o = e, this.options.extensions && this.options.extensions.startInline) {
|
|
1044
|
+
let f = 1 / 0;
|
|
1045
|
+
const T = e.slice(1);
|
|
1046
|
+
let h;
|
|
1047
|
+
this.options.extensions.startInline.forEach((b) => {
|
|
1048
|
+
h = b.call({ lexer: this }, T), typeof h == "number" && h >= 0 && (f = Math.min(f, h));
|
|
1049
|
+
}), f < 1 / 0 && f >= 0 && (o = e.substring(0, f + 1));
|
|
1674
1050
|
}
|
|
1675
|
-
if (n = this.tokenizer.inlineText(
|
|
1676
|
-
e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (
|
|
1051
|
+
if (n = this.tokenizer.inlineText(o)) {
|
|
1052
|
+
e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (g = n.raw.slice(-1)), c = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
|
|
1677
1053
|
continue;
|
|
1678
1054
|
}
|
|
1679
1055
|
if (e) {
|
|
1680
|
-
const
|
|
1056
|
+
const f = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1681
1057
|
if (this.options.silent) {
|
|
1682
|
-
console.error(
|
|
1058
|
+
console.error(f);
|
|
1683
1059
|
break;
|
|
1684
1060
|
} else
|
|
1685
|
-
throw new Error(
|
|
1061
|
+
throw new Error(f);
|
|
1686
1062
|
}
|
|
1687
1063
|
}
|
|
1688
1064
|
return t;
|
|
1689
1065
|
}
|
|
1690
1066
|
}
|
|
1691
|
-
class
|
|
1067
|
+
class Ze {
|
|
1692
1068
|
constructor(e) {
|
|
1693
|
-
|
|
1694
|
-
this.options = e ||
|
|
1069
|
+
A(this, "options");
|
|
1070
|
+
this.options = e || ue;
|
|
1695
1071
|
}
|
|
1696
1072
|
code(e, t, n) {
|
|
1697
|
-
var
|
|
1698
|
-
const
|
|
1073
|
+
var o;
|
|
1074
|
+
const i = (o = (t || "").match(/^\S*/)) == null ? void 0 : o[0];
|
|
1699
1075
|
return e = e.replace(/\n$/, "") + `
|
|
1700
|
-
`,
|
|
1701
|
-
` : "<pre><code>" + (n ? e :
|
|
1076
|
+
`, i ? '<pre><code class="language-' + B(i) + '">' + (n ? e : B(e, !0)) + `</code></pre>
|
|
1077
|
+
` : "<pre><code>" + (n ? e : B(e, !0)) + `</code></pre>
|
|
1702
1078
|
`;
|
|
1703
1079
|
}
|
|
1704
1080
|
blockquote(e) {
|
|
@@ -1718,9 +1094,9 @@ ${e}</blockquote>
|
|
|
1718
1094
|
`;
|
|
1719
1095
|
}
|
|
1720
1096
|
list(e, t, n) {
|
|
1721
|
-
const
|
|
1722
|
-
return "<" +
|
|
1723
|
-
` + e + "</" +
|
|
1097
|
+
const i = t ? "ol" : "ul", o = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
1098
|
+
return "<" + i + o + `>
|
|
1099
|
+
` + e + "</" + i + `>
|
|
1724
1100
|
`;
|
|
1725
1101
|
}
|
|
1726
1102
|
listitem(e, t, n) {
|
|
@@ -1770,26 +1146,26 @@ ${e}</tr>
|
|
|
1770
1146
|
return `<del>${e}</del>`;
|
|
1771
1147
|
}
|
|
1772
1148
|
link(e, t, n) {
|
|
1773
|
-
const
|
|
1774
|
-
if (
|
|
1149
|
+
const i = rn(e);
|
|
1150
|
+
if (i === null)
|
|
1775
1151
|
return n;
|
|
1776
|
-
e =
|
|
1777
|
-
let
|
|
1778
|
-
return t && (
|
|
1152
|
+
e = i;
|
|
1153
|
+
let o = '<a href="' + e + '"';
|
|
1154
|
+
return t && (o += ' title="' + t + '"'), o += ">" + n + "</a>", o;
|
|
1779
1155
|
}
|
|
1780
1156
|
image(e, t, n) {
|
|
1781
|
-
const
|
|
1782
|
-
if (
|
|
1157
|
+
const i = rn(e);
|
|
1158
|
+
if (i === null)
|
|
1783
1159
|
return n;
|
|
1784
|
-
e =
|
|
1785
|
-
let
|
|
1786
|
-
return t && (
|
|
1160
|
+
e = i;
|
|
1161
|
+
let o = `<img src="${e}" alt="${n}"`;
|
|
1162
|
+
return t && (o += ` title="${t}"`), o += ">", o;
|
|
1787
1163
|
}
|
|
1788
1164
|
text(e) {
|
|
1789
1165
|
return e;
|
|
1790
1166
|
}
|
|
1791
1167
|
}
|
|
1792
|
-
class
|
|
1168
|
+
class Lt {
|
|
1793
1169
|
// no need for block level renderers
|
|
1794
1170
|
strong(e) {
|
|
1795
1171
|
return e;
|
|
@@ -1819,40 +1195,40 @@ class mn {
|
|
|
1819
1195
|
return "";
|
|
1820
1196
|
}
|
|
1821
1197
|
}
|
|
1822
|
-
class
|
|
1198
|
+
class K {
|
|
1823
1199
|
constructor(e) {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
this.options = e ||
|
|
1200
|
+
A(this, "options");
|
|
1201
|
+
A(this, "renderer");
|
|
1202
|
+
A(this, "textRenderer");
|
|
1203
|
+
this.options = e || ue, this.options.renderer = this.options.renderer || new Ze(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new Lt();
|
|
1828
1204
|
}
|
|
1829
1205
|
/**
|
|
1830
1206
|
* Static Parse Method
|
|
1831
1207
|
*/
|
|
1832
1208
|
static parse(e, t) {
|
|
1833
|
-
return new
|
|
1209
|
+
return new K(t).parse(e);
|
|
1834
1210
|
}
|
|
1835
1211
|
/**
|
|
1836
1212
|
* Static Parse Inline Method
|
|
1837
1213
|
*/
|
|
1838
1214
|
static parseInline(e, t) {
|
|
1839
|
-
return new
|
|
1215
|
+
return new K(t).parseInline(e);
|
|
1840
1216
|
}
|
|
1841
1217
|
/**
|
|
1842
1218
|
* Parse Loop
|
|
1843
1219
|
*/
|
|
1844
1220
|
parse(e, t = !0) {
|
|
1845
1221
|
let n = "";
|
|
1846
|
-
for (let
|
|
1847
|
-
const
|
|
1848
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1851
|
-
n +=
|
|
1222
|
+
for (let i = 0; i < e.length; i++) {
|
|
1223
|
+
const o = e[i];
|
|
1224
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[o.type]) {
|
|
1225
|
+
const r = o, a = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
1226
|
+
if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(r.type)) {
|
|
1227
|
+
n += a || "";
|
|
1852
1228
|
continue;
|
|
1853
1229
|
}
|
|
1854
1230
|
}
|
|
1855
|
-
switch (
|
|
1231
|
+
switch (o.type) {
|
|
1856
1232
|
case "space":
|
|
1857
1233
|
continue;
|
|
1858
1234
|
case "hr": {
|
|
@@ -1860,78 +1236,78 @@ class de {
|
|
|
1860
1236
|
continue;
|
|
1861
1237
|
}
|
|
1862
1238
|
case "heading": {
|
|
1863
|
-
const
|
|
1864
|
-
n += this.renderer.heading(this.parseInline(
|
|
1239
|
+
const r = o;
|
|
1240
|
+
n += this.renderer.heading(this.parseInline(r.tokens), r.depth, bi(this.parseInline(r.tokens, this.textRenderer)));
|
|
1865
1241
|
continue;
|
|
1866
1242
|
}
|
|
1867
1243
|
case "code": {
|
|
1868
|
-
const
|
|
1869
|
-
n += this.renderer.code(
|
|
1244
|
+
const r = o;
|
|
1245
|
+
n += this.renderer.code(r.text, r.lang, !!r.escaped);
|
|
1870
1246
|
continue;
|
|
1871
1247
|
}
|
|
1872
1248
|
case "table": {
|
|
1873
|
-
const
|
|
1874
|
-
let
|
|
1875
|
-
for (let
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
let
|
|
1879
|
-
for (let
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1882
|
-
for (let
|
|
1883
|
-
|
|
1884
|
-
|
|
1249
|
+
const r = o;
|
|
1250
|
+
let a = "", c = "";
|
|
1251
|
+
for (let f = 0; f < r.header.length; f++)
|
|
1252
|
+
c += this.renderer.tablecell(this.parseInline(r.header[f].tokens), { header: !0, align: r.align[f] });
|
|
1253
|
+
a += this.renderer.tablerow(c);
|
|
1254
|
+
let g = "";
|
|
1255
|
+
for (let f = 0; f < r.rows.length; f++) {
|
|
1256
|
+
const T = r.rows[f];
|
|
1257
|
+
c = "";
|
|
1258
|
+
for (let h = 0; h < T.length; h++)
|
|
1259
|
+
c += this.renderer.tablecell(this.parseInline(T[h].tokens), { header: !1, align: r.align[h] });
|
|
1260
|
+
g += this.renderer.tablerow(c);
|
|
1885
1261
|
}
|
|
1886
|
-
n += this.renderer.table(
|
|
1262
|
+
n += this.renderer.table(a, g);
|
|
1887
1263
|
continue;
|
|
1888
1264
|
}
|
|
1889
1265
|
case "blockquote": {
|
|
1890
|
-
const
|
|
1891
|
-
n += this.renderer.blockquote(
|
|
1266
|
+
const r = o, a = this.parse(r.tokens);
|
|
1267
|
+
n += this.renderer.blockquote(a);
|
|
1892
1268
|
continue;
|
|
1893
1269
|
}
|
|
1894
1270
|
case "list": {
|
|
1895
|
-
const
|
|
1896
|
-
let
|
|
1897
|
-
for (let
|
|
1898
|
-
const
|
|
1899
|
-
let
|
|
1900
|
-
if (
|
|
1901
|
-
const
|
|
1902
|
-
|
|
1271
|
+
const r = o, a = r.ordered, c = r.start, g = r.loose;
|
|
1272
|
+
let f = "";
|
|
1273
|
+
for (let T = 0; T < r.items.length; T++) {
|
|
1274
|
+
const h = r.items[T], b = h.checked, m = h.task;
|
|
1275
|
+
let p = "";
|
|
1276
|
+
if (h.task) {
|
|
1277
|
+
const _ = this.renderer.checkbox(!!b);
|
|
1278
|
+
g ? h.tokens.length > 0 && h.tokens[0].type === "paragraph" ? (h.tokens[0].text = _ + " " + h.tokens[0].text, h.tokens[0].tokens && h.tokens[0].tokens.length > 0 && h.tokens[0].tokens[0].type === "text" && (h.tokens[0].tokens[0].text = _ + " " + h.tokens[0].tokens[0].text)) : h.tokens.unshift({
|
|
1903
1279
|
type: "text",
|
|
1904
|
-
text:
|
|
1905
|
-
}) :
|
|
1280
|
+
text: _ + " "
|
|
1281
|
+
}) : p += _ + " ";
|
|
1906
1282
|
}
|
|
1907
|
-
|
|
1283
|
+
p += this.parse(h.tokens, g), f += this.renderer.listitem(p, m, !!b);
|
|
1908
1284
|
}
|
|
1909
|
-
n += this.renderer.list(
|
|
1285
|
+
n += this.renderer.list(f, a, c);
|
|
1910
1286
|
continue;
|
|
1911
1287
|
}
|
|
1912
1288
|
case "html": {
|
|
1913
|
-
const
|
|
1914
|
-
n += this.renderer.html(
|
|
1289
|
+
const r = o;
|
|
1290
|
+
n += this.renderer.html(r.text, r.block);
|
|
1915
1291
|
continue;
|
|
1916
1292
|
}
|
|
1917
1293
|
case "paragraph": {
|
|
1918
|
-
const
|
|
1919
|
-
n += this.renderer.paragraph(this.parseInline(
|
|
1294
|
+
const r = o;
|
|
1295
|
+
n += this.renderer.paragraph(this.parseInline(r.tokens));
|
|
1920
1296
|
continue;
|
|
1921
1297
|
}
|
|
1922
1298
|
case "text": {
|
|
1923
|
-
let
|
|
1924
|
-
for (;
|
|
1925
|
-
|
|
1926
|
-
` + (
|
|
1927
|
-
n += t ? this.renderer.paragraph(
|
|
1299
|
+
let r = o, a = r.tokens ? this.parseInline(r.tokens) : r.text;
|
|
1300
|
+
for (; i + 1 < e.length && e[i + 1].type === "text"; )
|
|
1301
|
+
r = e[++i], a += `
|
|
1302
|
+
` + (r.tokens ? this.parseInline(r.tokens) : r.text);
|
|
1303
|
+
n += t ? this.renderer.paragraph(a) : a;
|
|
1928
1304
|
continue;
|
|
1929
1305
|
}
|
|
1930
1306
|
default: {
|
|
1931
|
-
const
|
|
1307
|
+
const r = 'Token with "' + o.type + '" type was not found.';
|
|
1932
1308
|
if (this.options.silent)
|
|
1933
|
-
return console.error(
|
|
1934
|
-
throw new Error(
|
|
1309
|
+
return console.error(r), "";
|
|
1310
|
+
throw new Error(r);
|
|
1935
1311
|
}
|
|
1936
1312
|
}
|
|
1937
1313
|
}
|
|
@@ -1943,49 +1319,49 @@ class de {
|
|
|
1943
1319
|
parseInline(e, t) {
|
|
1944
1320
|
t = t || this.renderer;
|
|
1945
1321
|
let n = "";
|
|
1946
|
-
for (let
|
|
1947
|
-
const
|
|
1948
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[
|
|
1949
|
-
const
|
|
1950
|
-
if (
|
|
1951
|
-
n +=
|
|
1322
|
+
for (let i = 0; i < e.length; i++) {
|
|
1323
|
+
const o = e[i];
|
|
1324
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[o.type]) {
|
|
1325
|
+
const r = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
1326
|
+
if (r !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(o.type)) {
|
|
1327
|
+
n += r || "";
|
|
1952
1328
|
continue;
|
|
1953
1329
|
}
|
|
1954
1330
|
}
|
|
1955
|
-
switch (
|
|
1331
|
+
switch (o.type) {
|
|
1956
1332
|
case "escape": {
|
|
1957
|
-
const
|
|
1958
|
-
n += t.text(
|
|
1333
|
+
const r = o;
|
|
1334
|
+
n += t.text(r.text);
|
|
1959
1335
|
break;
|
|
1960
1336
|
}
|
|
1961
1337
|
case "html": {
|
|
1962
|
-
const
|
|
1963
|
-
n += t.html(
|
|
1338
|
+
const r = o;
|
|
1339
|
+
n += t.html(r.text);
|
|
1964
1340
|
break;
|
|
1965
1341
|
}
|
|
1966
1342
|
case "link": {
|
|
1967
|
-
const
|
|
1968
|
-
n += t.link(
|
|
1343
|
+
const r = o;
|
|
1344
|
+
n += t.link(r.href, r.title, this.parseInline(r.tokens, t));
|
|
1969
1345
|
break;
|
|
1970
1346
|
}
|
|
1971
1347
|
case "image": {
|
|
1972
|
-
const
|
|
1973
|
-
n += t.image(
|
|
1348
|
+
const r = o;
|
|
1349
|
+
n += t.image(r.href, r.title, r.text);
|
|
1974
1350
|
break;
|
|
1975
1351
|
}
|
|
1976
1352
|
case "strong": {
|
|
1977
|
-
const
|
|
1978
|
-
n += t.strong(this.parseInline(
|
|
1353
|
+
const r = o;
|
|
1354
|
+
n += t.strong(this.parseInline(r.tokens, t));
|
|
1979
1355
|
break;
|
|
1980
1356
|
}
|
|
1981
1357
|
case "em": {
|
|
1982
|
-
const
|
|
1983
|
-
n += t.em(this.parseInline(
|
|
1358
|
+
const r = o;
|
|
1359
|
+
n += t.em(this.parseInline(r.tokens, t));
|
|
1984
1360
|
break;
|
|
1985
1361
|
}
|
|
1986
1362
|
case "codespan": {
|
|
1987
|
-
const
|
|
1988
|
-
n += t.codespan(
|
|
1363
|
+
const r = o;
|
|
1364
|
+
n += t.codespan(r.text);
|
|
1989
1365
|
break;
|
|
1990
1366
|
}
|
|
1991
1367
|
case "br": {
|
|
@@ -1993,30 +1369,30 @@ class de {
|
|
|
1993
1369
|
break;
|
|
1994
1370
|
}
|
|
1995
1371
|
case "del": {
|
|
1996
|
-
const
|
|
1997
|
-
n += t.del(this.parseInline(
|
|
1372
|
+
const r = o;
|
|
1373
|
+
n += t.del(this.parseInline(r.tokens, t));
|
|
1998
1374
|
break;
|
|
1999
1375
|
}
|
|
2000
1376
|
case "text": {
|
|
2001
|
-
const
|
|
2002
|
-
n += t.text(
|
|
1377
|
+
const r = o;
|
|
1378
|
+
n += t.text(r.text);
|
|
2003
1379
|
break;
|
|
2004
1380
|
}
|
|
2005
1381
|
default: {
|
|
2006
|
-
const
|
|
1382
|
+
const r = 'Token with "' + o.type + '" type was not found.';
|
|
2007
1383
|
if (this.options.silent)
|
|
2008
|
-
return console.error(
|
|
2009
|
-
throw new Error(
|
|
1384
|
+
return console.error(r), "";
|
|
1385
|
+
throw new Error(r);
|
|
2010
1386
|
}
|
|
2011
1387
|
}
|
|
2012
1388
|
}
|
|
2013
1389
|
return n;
|
|
2014
1390
|
}
|
|
2015
1391
|
}
|
|
2016
|
-
class
|
|
1392
|
+
class ve {
|
|
2017
1393
|
constructor(e) {
|
|
2018
|
-
|
|
2019
|
-
this.options = e ||
|
|
1394
|
+
A(this, "options");
|
|
1395
|
+
this.options = e || ue;
|
|
2020
1396
|
}
|
|
2021
1397
|
/**
|
|
2022
1398
|
* Process markdown before marked
|
|
@@ -2037,55 +1413,55 @@ class kt {
|
|
|
2037
1413
|
return e;
|
|
2038
1414
|
}
|
|
2039
1415
|
}
|
|
2040
|
-
|
|
1416
|
+
A(ve, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
2041
1417
|
"preprocess",
|
|
2042
1418
|
"postprocess",
|
|
2043
1419
|
"processAllTokens"
|
|
2044
1420
|
]));
|
|
2045
|
-
var
|
|
2046
|
-
class
|
|
1421
|
+
var ce, bt, Ln;
|
|
1422
|
+
class Yi {
|
|
2047
1423
|
constructor(...e) {
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
1424
|
+
en(this, ce);
|
|
1425
|
+
A(this, "defaults", _t());
|
|
1426
|
+
A(this, "options", this.setOptions);
|
|
1427
|
+
A(this, "parse", Ue(this, ce, bt).call(this, Q.lex, K.parse));
|
|
1428
|
+
A(this, "parseInline", Ue(this, ce, bt).call(this, Q.lexInline, K.parseInline));
|
|
1429
|
+
A(this, "Parser", K);
|
|
1430
|
+
A(this, "Renderer", Ze);
|
|
1431
|
+
A(this, "TextRenderer", Lt);
|
|
1432
|
+
A(this, "Lexer", Q);
|
|
1433
|
+
A(this, "Tokenizer", Ge);
|
|
1434
|
+
A(this, "Hooks", ve);
|
|
2059
1435
|
this.use(...e);
|
|
2060
1436
|
}
|
|
2061
1437
|
/**
|
|
2062
1438
|
* Run callback for every token
|
|
2063
1439
|
*/
|
|
2064
1440
|
walkTokens(e, t) {
|
|
2065
|
-
var
|
|
1441
|
+
var i, o;
|
|
2066
1442
|
let n = [];
|
|
2067
|
-
for (const
|
|
2068
|
-
switch (n = n.concat(t.call(this,
|
|
1443
|
+
for (const r of e)
|
|
1444
|
+
switch (n = n.concat(t.call(this, r)), r.type) {
|
|
2069
1445
|
case "table": {
|
|
2070
|
-
const
|
|
2071
|
-
for (const
|
|
2072
|
-
n = n.concat(this.walkTokens(
|
|
2073
|
-
for (const
|
|
2074
|
-
for (const
|
|
2075
|
-
n = n.concat(this.walkTokens(
|
|
1446
|
+
const a = r;
|
|
1447
|
+
for (const c of a.header)
|
|
1448
|
+
n = n.concat(this.walkTokens(c.tokens, t));
|
|
1449
|
+
for (const c of a.rows)
|
|
1450
|
+
for (const g of c)
|
|
1451
|
+
n = n.concat(this.walkTokens(g.tokens, t));
|
|
2076
1452
|
break;
|
|
2077
1453
|
}
|
|
2078
1454
|
case "list": {
|
|
2079
|
-
const
|
|
2080
|
-
n = n.concat(this.walkTokens(
|
|
1455
|
+
const a = r;
|
|
1456
|
+
n = n.concat(this.walkTokens(a.items, t));
|
|
2081
1457
|
break;
|
|
2082
1458
|
}
|
|
2083
1459
|
default: {
|
|
2084
|
-
const
|
|
2085
|
-
(
|
|
2086
|
-
const
|
|
2087
|
-
n = n.concat(this.walkTokens(
|
|
2088
|
-
}) :
|
|
1460
|
+
const a = r;
|
|
1461
|
+
(o = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && o[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((c) => {
|
|
1462
|
+
const g = a[c].flat(1 / 0);
|
|
1463
|
+
n = n.concat(this.walkTokens(g, t));
|
|
1464
|
+
}) : a.tokens && (n = n.concat(this.walkTokens(a.tokens, t)));
|
|
2089
1465
|
}
|
|
2090
1466
|
}
|
|
2091
1467
|
return n;
|
|
@@ -2093,297 +1469,297 @@ class ei {
|
|
|
2093
1469
|
use(...e) {
|
|
2094
1470
|
const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
2095
1471
|
return e.forEach((n) => {
|
|
2096
|
-
const
|
|
2097
|
-
if (
|
|
2098
|
-
if (!
|
|
1472
|
+
const i = { ...n };
|
|
1473
|
+
if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((o) => {
|
|
1474
|
+
if (!o.name)
|
|
2099
1475
|
throw new Error("extension name required");
|
|
2100
|
-
if ("renderer" in
|
|
2101
|
-
const
|
|
2102
|
-
|
|
2103
|
-
let
|
|
2104
|
-
return
|
|
2105
|
-
} : t.renderers[
|
|
2106
|
-
}
|
|
2107
|
-
if ("tokenizer" in
|
|
2108
|
-
if (!
|
|
1476
|
+
if ("renderer" in o) {
|
|
1477
|
+
const r = t.renderers[o.name];
|
|
1478
|
+
r ? t.renderers[o.name] = function(...a) {
|
|
1479
|
+
let c = o.renderer.apply(this, a);
|
|
1480
|
+
return c === !1 && (c = r.apply(this, a)), c;
|
|
1481
|
+
} : t.renderers[o.name] = o.renderer;
|
|
1482
|
+
}
|
|
1483
|
+
if ("tokenizer" in o) {
|
|
1484
|
+
if (!o.level || o.level !== "block" && o.level !== "inline")
|
|
2109
1485
|
throw new Error("extension level must be 'block' or 'inline'");
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
}
|
|
2113
|
-
"childTokens" in
|
|
2114
|
-
}),
|
|
2115
|
-
const
|
|
2116
|
-
for (const
|
|
2117
|
-
if (!(
|
|
2118
|
-
throw new Error(`renderer '${
|
|
2119
|
-
if (
|
|
1486
|
+
const r = t[o.level];
|
|
1487
|
+
r ? r.unshift(o.tokenizer) : t[o.level] = [o.tokenizer], o.start && (o.level === "block" ? t.startBlock ? t.startBlock.push(o.start) : t.startBlock = [o.start] : o.level === "inline" && (t.startInline ? t.startInline.push(o.start) : t.startInline = [o.start]));
|
|
1488
|
+
}
|
|
1489
|
+
"childTokens" in o && o.childTokens && (t.childTokens[o.name] = o.childTokens);
|
|
1490
|
+
}), i.extensions = t), n.renderer) {
|
|
1491
|
+
const o = this.defaults.renderer || new Ze(this.defaults);
|
|
1492
|
+
for (const r in n.renderer) {
|
|
1493
|
+
if (!(r in o))
|
|
1494
|
+
throw new Error(`renderer '${r}' does not exist`);
|
|
1495
|
+
if (r === "options")
|
|
2120
1496
|
continue;
|
|
2121
|
-
const
|
|
2122
|
-
a
|
|
2123
|
-
let
|
|
2124
|
-
return
|
|
1497
|
+
const a = r, c = n.renderer[a], g = o[a];
|
|
1498
|
+
o[a] = (...f) => {
|
|
1499
|
+
let T = c.apply(o, f);
|
|
1500
|
+
return T === !1 && (T = g.apply(o, f)), T || "";
|
|
2125
1501
|
};
|
|
2126
1502
|
}
|
|
2127
|
-
|
|
1503
|
+
i.renderer = o;
|
|
2128
1504
|
}
|
|
2129
1505
|
if (n.tokenizer) {
|
|
2130
|
-
const
|
|
2131
|
-
for (const
|
|
2132
|
-
if (!(
|
|
2133
|
-
throw new Error(`tokenizer '${
|
|
2134
|
-
if (["options", "rules", "lexer"].includes(
|
|
1506
|
+
const o = this.defaults.tokenizer || new Ge(this.defaults);
|
|
1507
|
+
for (const r in n.tokenizer) {
|
|
1508
|
+
if (!(r in o))
|
|
1509
|
+
throw new Error(`tokenizer '${r}' does not exist`);
|
|
1510
|
+
if (["options", "rules", "lexer"].includes(r))
|
|
2135
1511
|
continue;
|
|
2136
|
-
const
|
|
2137
|
-
a
|
|
2138
|
-
let
|
|
2139
|
-
return
|
|
1512
|
+
const a = r, c = n.tokenizer[a], g = o[a];
|
|
1513
|
+
o[a] = (...f) => {
|
|
1514
|
+
let T = c.apply(o, f);
|
|
1515
|
+
return T === !1 && (T = g.apply(o, f)), T;
|
|
2140
1516
|
};
|
|
2141
1517
|
}
|
|
2142
|
-
|
|
1518
|
+
i.tokenizer = o;
|
|
2143
1519
|
}
|
|
2144
1520
|
if (n.hooks) {
|
|
2145
|
-
const
|
|
2146
|
-
for (const
|
|
2147
|
-
if (!(
|
|
2148
|
-
throw new Error(`hook '${
|
|
2149
|
-
if (
|
|
1521
|
+
const o = this.defaults.hooks || new ve();
|
|
1522
|
+
for (const r in n.hooks) {
|
|
1523
|
+
if (!(r in o))
|
|
1524
|
+
throw new Error(`hook '${r}' does not exist`);
|
|
1525
|
+
if (r === "options")
|
|
2150
1526
|
continue;
|
|
2151
|
-
const
|
|
2152
|
-
|
|
1527
|
+
const a = r, c = n.hooks[a], g = o[a];
|
|
1528
|
+
ve.passThroughHooks.has(r) ? o[a] = (f) => {
|
|
2153
1529
|
if (this.defaults.async)
|
|
2154
|
-
return Promise.resolve(
|
|
2155
|
-
const
|
|
2156
|
-
return
|
|
2157
|
-
} : a
|
|
2158
|
-
let
|
|
2159
|
-
return
|
|
1530
|
+
return Promise.resolve(c.call(o, f)).then((h) => g.call(o, h));
|
|
1531
|
+
const T = c.call(o, f);
|
|
1532
|
+
return g.call(o, T);
|
|
1533
|
+
} : o[a] = (...f) => {
|
|
1534
|
+
let T = c.apply(o, f);
|
|
1535
|
+
return T === !1 && (T = g.apply(o, f)), T;
|
|
2160
1536
|
};
|
|
2161
1537
|
}
|
|
2162
|
-
|
|
1538
|
+
i.hooks = o;
|
|
2163
1539
|
}
|
|
2164
1540
|
if (n.walkTokens) {
|
|
2165
|
-
const
|
|
2166
|
-
|
|
2167
|
-
let
|
|
2168
|
-
return
|
|
1541
|
+
const o = this.defaults.walkTokens, r = n.walkTokens;
|
|
1542
|
+
i.walkTokens = function(a) {
|
|
1543
|
+
let c = [];
|
|
1544
|
+
return c.push(r.call(this, a)), o && (c = c.concat(o.call(this, a))), c;
|
|
2169
1545
|
};
|
|
2170
1546
|
}
|
|
2171
|
-
this.defaults = { ...this.defaults, ...
|
|
1547
|
+
this.defaults = { ...this.defaults, ...i };
|
|
2172
1548
|
}), this;
|
|
2173
1549
|
}
|
|
2174
1550
|
setOptions(e) {
|
|
2175
1551
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
2176
1552
|
}
|
|
2177
1553
|
lexer(e, t) {
|
|
2178
|
-
return
|
|
1554
|
+
return Q.lex(e, t ?? this.defaults);
|
|
2179
1555
|
}
|
|
2180
1556
|
parser(e, t) {
|
|
2181
|
-
return
|
|
1557
|
+
return K.parse(e, t ?? this.defaults);
|
|
2182
1558
|
}
|
|
2183
1559
|
}
|
|
2184
|
-
|
|
2185
|
-
return (n,
|
|
2186
|
-
const
|
|
2187
|
-
this.defaults.async === !0 &&
|
|
2188
|
-
const
|
|
1560
|
+
ce = new WeakSet(), bt = function(e, t) {
|
|
1561
|
+
return (n, i) => {
|
|
1562
|
+
const o = { ...i }, r = { ...this.defaults, ...o };
|
|
1563
|
+
this.defaults.async === !0 && o.async === !1 && (r.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), r.async = !0);
|
|
1564
|
+
const a = Ue(this, ce, Ln).call(this, !!r.silent, !!r.async);
|
|
2189
1565
|
if (typeof n > "u" || n === null)
|
|
2190
|
-
return
|
|
1566
|
+
return a(new Error("marked(): input parameter is undefined or null"));
|
|
2191
1567
|
if (typeof n != "string")
|
|
2192
|
-
return
|
|
2193
|
-
if (
|
|
2194
|
-
return Promise.resolve(
|
|
1568
|
+
return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1569
|
+
if (r.hooks && (r.hooks.options = r), r.async)
|
|
1570
|
+
return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((c) => e(c, r)).then((c) => r.hooks ? r.hooks.processAllTokens(c) : c).then((c) => r.walkTokens ? Promise.all(this.walkTokens(c, r.walkTokens)).then(() => c) : c).then((c) => t(c, r)).then((c) => r.hooks ? r.hooks.postprocess(c) : c).catch(a);
|
|
2195
1571
|
try {
|
|
2196
|
-
|
|
2197
|
-
let
|
|
2198
|
-
|
|
2199
|
-
let
|
|
2200
|
-
return
|
|
2201
|
-
} catch (
|
|
2202
|
-
return c
|
|
1572
|
+
r.hooks && (n = r.hooks.preprocess(n));
|
|
1573
|
+
let c = e(n, r);
|
|
1574
|
+
r.hooks && (c = r.hooks.processAllTokens(c)), r.walkTokens && this.walkTokens(c, r.walkTokens);
|
|
1575
|
+
let g = t(c, r);
|
|
1576
|
+
return r.hooks && (g = r.hooks.postprocess(g)), g;
|
|
1577
|
+
} catch (c) {
|
|
1578
|
+
return a(c);
|
|
2203
1579
|
}
|
|
2204
1580
|
};
|
|
2205
|
-
},
|
|
1581
|
+
}, Ln = function(e, t) {
|
|
2206
1582
|
return (n) => {
|
|
2207
1583
|
if (n.message += `
|
|
2208
1584
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
2209
|
-
const
|
|
2210
|
-
return t ? Promise.resolve(
|
|
1585
|
+
const i = "<p>An error occurred:</p><pre>" + B(n.message + "", !0) + "</pre>";
|
|
1586
|
+
return t ? Promise.resolve(i) : i;
|
|
2211
1587
|
}
|
|
2212
1588
|
if (t)
|
|
2213
1589
|
return Promise.reject(n);
|
|
2214
1590
|
throw n;
|
|
2215
1591
|
};
|
|
2216
1592
|
};
|
|
2217
|
-
const
|
|
2218
|
-
function
|
|
2219
|
-
return
|
|
1593
|
+
const ae = new Yi();
|
|
1594
|
+
function y(l, e) {
|
|
1595
|
+
return ae.parse(l, e);
|
|
2220
1596
|
}
|
|
2221
|
-
|
|
2222
|
-
return
|
|
1597
|
+
y.options = y.setOptions = function(l) {
|
|
1598
|
+
return ae.setOptions(l), y.defaults = ae.defaults, bn(y.defaults), y;
|
|
2223
1599
|
};
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
return
|
|
1600
|
+
y.getDefaults = _t;
|
|
1601
|
+
y.defaults = ue;
|
|
1602
|
+
y.use = function(...l) {
|
|
1603
|
+
return ae.use(...l), y.defaults = ae.defaults, bn(y.defaults), y;
|
|
2228
1604
|
};
|
|
2229
|
-
|
|
2230
|
-
return
|
|
1605
|
+
y.walkTokens = function(l, e) {
|
|
1606
|
+
return ae.walkTokens(l, e);
|
|
2231
1607
|
};
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
1608
|
+
y.parseInline = ae.parseInline;
|
|
1609
|
+
y.Parser = K;
|
|
1610
|
+
y.parser = K.parse;
|
|
1611
|
+
y.Renderer = Ze;
|
|
1612
|
+
y.TextRenderer = Lt;
|
|
1613
|
+
y.Lexer = Q;
|
|
1614
|
+
y.lexer = Q.lex;
|
|
1615
|
+
y.Tokenizer = Ge;
|
|
1616
|
+
y.Hooks = ve;
|
|
1617
|
+
y.parse = y;
|
|
1618
|
+
y.options;
|
|
1619
|
+
y.setOptions;
|
|
1620
|
+
y.use;
|
|
1621
|
+
y.walkTokens;
|
|
1622
|
+
y.parseInline;
|
|
1623
|
+
K.parse;
|
|
1624
|
+
Q.lex;
|
|
2249
1625
|
/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
|
|
2250
1626
|
const {
|
|
2251
|
-
entries:
|
|
2252
|
-
setPrototypeOf:
|
|
2253
|
-
isFrozen:
|
|
2254
|
-
getPrototypeOf:
|
|
2255
|
-
getOwnPropertyDescriptor:
|
|
1627
|
+
entries: vn,
|
|
1628
|
+
setPrototypeOf: an,
|
|
1629
|
+
isFrozen: Vi,
|
|
1630
|
+
getPrototypeOf: Xi,
|
|
1631
|
+
getOwnPropertyDescriptor: Qi
|
|
2256
1632
|
} = Object;
|
|
2257
1633
|
let {
|
|
2258
|
-
freeze:
|
|
2259
|
-
seal:
|
|
2260
|
-
create:
|
|
1634
|
+
freeze: U,
|
|
1635
|
+
seal: j,
|
|
1636
|
+
create: Tt
|
|
2261
1637
|
} = Object, {
|
|
2262
|
-
apply:
|
|
2263
|
-
construct:
|
|
1638
|
+
apply: wt,
|
|
1639
|
+
construct: xt
|
|
2264
1640
|
} = typeof Reflect < "u" && Reflect;
|
|
2265
|
-
|
|
1641
|
+
U || (U = function(e) {
|
|
2266
1642
|
return e;
|
|
2267
1643
|
});
|
|
2268
|
-
|
|
1644
|
+
j || (j = function(e) {
|
|
2269
1645
|
return e;
|
|
2270
1646
|
});
|
|
2271
|
-
|
|
2272
|
-
for (var n = arguments.length,
|
|
2273
|
-
|
|
2274
|
-
return e.apply(t,
|
|
1647
|
+
wt || (wt = function(e, t) {
|
|
1648
|
+
for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), o = 2; o < n; o++)
|
|
1649
|
+
i[o - 2] = arguments[o];
|
|
1650
|
+
return e.apply(t, i);
|
|
2275
1651
|
});
|
|
2276
|
-
|
|
2277
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
2278
|
-
n[
|
|
1652
|
+
xt || (xt = function(e) {
|
|
1653
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
1654
|
+
n[i - 1] = arguments[i];
|
|
2279
1655
|
return new e(...n);
|
|
2280
1656
|
});
|
|
2281
|
-
const
|
|
2282
|
-
function
|
|
1657
|
+
const Be = F(Array.prototype.forEach), Ki = F(Array.prototype.lastIndexOf), cn = F(Array.prototype.pop), ye = F(Array.prototype.push), Ji = F(Array.prototype.splice), je = F(String.prototype.toLowerCase), pt = F(String.prototype.toString), ht = F(String.prototype.match), Ee = F(String.prototype.replace), er = F(String.prototype.indexOf), tr = F(String.prototype.trim), Z = F(Object.prototype.hasOwnProperty), P = F(RegExp.prototype.test), Ae = nr(TypeError);
|
|
1658
|
+
function F(l) {
|
|
2283
1659
|
return function(e) {
|
|
2284
1660
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
2285
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
2286
|
-
n[
|
|
2287
|
-
return
|
|
1661
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
1662
|
+
n[i - 1] = arguments[i];
|
|
1663
|
+
return wt(l, e, n);
|
|
2288
1664
|
};
|
|
2289
1665
|
}
|
|
2290
|
-
function
|
|
1666
|
+
function nr(l) {
|
|
2291
1667
|
return function() {
|
|
2292
1668
|
for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
|
|
2293
1669
|
t[n] = arguments[n];
|
|
2294
|
-
return
|
|
1670
|
+
return xt(l, t);
|
|
2295
1671
|
};
|
|
2296
1672
|
}
|
|
2297
|
-
function
|
|
2298
|
-
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
2299
|
-
|
|
1673
|
+
function x(l, e) {
|
|
1674
|
+
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : je;
|
|
1675
|
+
an && an(l, null);
|
|
2300
1676
|
let n = e.length;
|
|
2301
1677
|
for (; n--; ) {
|
|
2302
|
-
let
|
|
2303
|
-
if (typeof
|
|
2304
|
-
const
|
|
2305
|
-
|
|
1678
|
+
let i = e[n];
|
|
1679
|
+
if (typeof i == "string") {
|
|
1680
|
+
const o = t(i);
|
|
1681
|
+
o !== i && (Vi(e) || (e[n] = o), i = o);
|
|
2306
1682
|
}
|
|
2307
|
-
l[
|
|
1683
|
+
l[i] = !0;
|
|
2308
1684
|
}
|
|
2309
1685
|
return l;
|
|
2310
1686
|
}
|
|
2311
|
-
function
|
|
1687
|
+
function ir(l) {
|
|
2312
1688
|
for (let e = 0; e < l.length; e++)
|
|
2313
|
-
|
|
1689
|
+
Z(l, e) || (l[e] = null);
|
|
2314
1690
|
return l;
|
|
2315
1691
|
}
|
|
2316
|
-
function
|
|
2317
|
-
const e =
|
|
2318
|
-
for (const [t, n] of
|
|
2319
|
-
|
|
1692
|
+
function X(l) {
|
|
1693
|
+
const e = Tt(null);
|
|
1694
|
+
for (const [t, n] of vn(l))
|
|
1695
|
+
Z(l, t) && (Array.isArray(n) ? e[t] = ir(n) : n && typeof n == "object" && n.constructor === Object ? e[t] = X(n) : e[t] = n);
|
|
2320
1696
|
return e;
|
|
2321
1697
|
}
|
|
2322
|
-
function
|
|
1698
|
+
function Se(l, e) {
|
|
2323
1699
|
for (; l !== null; ) {
|
|
2324
|
-
const n =
|
|
1700
|
+
const n = Qi(l, e);
|
|
2325
1701
|
if (n) {
|
|
2326
1702
|
if (n.get)
|
|
2327
|
-
return
|
|
1703
|
+
return F(n.get);
|
|
2328
1704
|
if (typeof n.value == "function")
|
|
2329
|
-
return
|
|
1705
|
+
return F(n.value);
|
|
2330
1706
|
}
|
|
2331
|
-
l =
|
|
1707
|
+
l = Xi(l);
|
|
2332
1708
|
}
|
|
2333
1709
|
function t() {
|
|
2334
1710
|
return null;
|
|
2335
1711
|
}
|
|
2336
1712
|
return t;
|
|
2337
1713
|
}
|
|
2338
|
-
const
|
|
1714
|
+
const un = U(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), ft = U(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), dt = U(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), rr = U(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), mt = U(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), sr = U(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), pn = U(["#text"]), hn = U(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), gt = U(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), fn = U(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), We = U(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), or = j(/\{\{[\w\W]*|[\w\W]*\}\}/gm), lr = j(/<%[\w\W]*|[\w\W]*%>/gm), ar = j(/\$\{[\w\W]*/gm), cr = j(/^data-[\-\w.\u00B7-\uFFFF]+$/), ur = j(/^aria-[\-\w]+$/), In = j(
|
|
2339
1715
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
2340
1716
|
// eslint-disable-line no-useless-escape
|
|
2341
|
-
),
|
|
1717
|
+
), pr = j(/^(?:\w+script|data):/i), hr = j(
|
|
2342
1718
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
2343
1719
|
// eslint-disable-line no-control-regex
|
|
2344
|
-
),
|
|
2345
|
-
var
|
|
1720
|
+
), Cn = j(/^html$/i), fr = j(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
1721
|
+
var dn = /* @__PURE__ */ Object.freeze({
|
|
2346
1722
|
__proto__: null,
|
|
2347
|
-
ARIA_ATTR:
|
|
2348
|
-
ATTR_WHITESPACE:
|
|
2349
|
-
CUSTOM_ELEMENT:
|
|
2350
|
-
DATA_ATTR:
|
|
2351
|
-
DOCTYPE_NAME:
|
|
2352
|
-
ERB_EXPR:
|
|
2353
|
-
IS_ALLOWED_URI:
|
|
2354
|
-
IS_SCRIPT_OR_DATA:
|
|
2355
|
-
MUSTACHE_EXPR:
|
|
2356
|
-
TMPLIT_EXPR:
|
|
1723
|
+
ARIA_ATTR: ur,
|
|
1724
|
+
ATTR_WHITESPACE: hr,
|
|
1725
|
+
CUSTOM_ELEMENT: fr,
|
|
1726
|
+
DATA_ATTR: cr,
|
|
1727
|
+
DOCTYPE_NAME: Cn,
|
|
1728
|
+
ERB_EXPR: lr,
|
|
1729
|
+
IS_ALLOWED_URI: In,
|
|
1730
|
+
IS_SCRIPT_OR_DATA: pr,
|
|
1731
|
+
MUSTACHE_EXPR: or,
|
|
1732
|
+
TMPLIT_EXPR: ar
|
|
2357
1733
|
});
|
|
2358
|
-
const
|
|
1734
|
+
const Re = {
|
|
2359
1735
|
element: 1,
|
|
2360
1736
|
text: 3,
|
|
2361
1737
|
// Deprecated
|
|
2362
1738
|
progressingInstruction: 7,
|
|
2363
1739
|
comment: 8,
|
|
2364
1740
|
document: 9
|
|
2365
|
-
},
|
|
1741
|
+
}, dr = function() {
|
|
2366
1742
|
return typeof window > "u" ? null : window;
|
|
2367
|
-
},
|
|
1743
|
+
}, mr = function(e, t) {
|
|
2368
1744
|
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
2369
1745
|
return null;
|
|
2370
1746
|
let n = null;
|
|
2371
|
-
const
|
|
2372
|
-
t && t.hasAttribute(
|
|
2373
|
-
const
|
|
1747
|
+
const i = "data-tt-policy-suffix";
|
|
1748
|
+
t && t.hasAttribute(i) && (n = t.getAttribute(i));
|
|
1749
|
+
const o = "dompurify" + (n ? "#" + n : "");
|
|
2374
1750
|
try {
|
|
2375
|
-
return e.createPolicy(
|
|
2376
|
-
createHTML(
|
|
2377
|
-
return
|
|
1751
|
+
return e.createPolicy(o, {
|
|
1752
|
+
createHTML(r) {
|
|
1753
|
+
return r;
|
|
2378
1754
|
},
|
|
2379
|
-
createScriptURL(
|
|
2380
|
-
return
|
|
1755
|
+
createScriptURL(r) {
|
|
1756
|
+
return r;
|
|
2381
1757
|
}
|
|
2382
1758
|
});
|
|
2383
1759
|
} catch {
|
|
2384
|
-
return console.warn("TrustedTypes policy " +
|
|
1760
|
+
return console.warn("TrustedTypes policy " + o + " could not be created."), null;
|
|
2385
1761
|
}
|
|
2386
|
-
},
|
|
1762
|
+
}, mn = function() {
|
|
2387
1763
|
return {
|
|
2388
1764
|
afterSanitizeAttributes: [],
|
|
2389
1765
|
afterSanitizeElements: [],
|
|
@@ -2396,57 +1772,57 @@ const mt = {
|
|
|
2396
1772
|
uponSanitizeShadowNode: []
|
|
2397
1773
|
};
|
|
2398
1774
|
};
|
|
2399
|
-
function
|
|
2400
|
-
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
2401
|
-
const e = (
|
|
2402
|
-
if (e.version = "3.3.1", e.removed = [], !l || !l.document || l.document.nodeType !==
|
|
1775
|
+
function On() {
|
|
1776
|
+
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : dr();
|
|
1777
|
+
const e = (k) => On(k);
|
|
1778
|
+
if (e.version = "3.3.1", e.removed = [], !l || !l.document || l.document.nodeType !== Re.document || !l.Element)
|
|
2403
1779
|
return e.isSupported = !1, e;
|
|
2404
1780
|
let {
|
|
2405
1781
|
document: t
|
|
2406
1782
|
} = l;
|
|
2407
|
-
const n = t,
|
|
2408
|
-
DocumentFragment:
|
|
2409
|
-
HTMLTemplateElement:
|
|
2410
|
-
Node:
|
|
2411
|
-
Element:
|
|
2412
|
-
NodeFilter:
|
|
2413
|
-
NamedNodeMap:
|
|
2414
|
-
HTMLFormElement:
|
|
2415
|
-
DOMParser:
|
|
2416
|
-
trustedTypes:
|
|
2417
|
-
} = l,
|
|
2418
|
-
if (typeof
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2421
|
-
}
|
|
2422
|
-
let
|
|
1783
|
+
const n = t, i = n.currentScript, {
|
|
1784
|
+
DocumentFragment: o,
|
|
1785
|
+
HTMLTemplateElement: r,
|
|
1786
|
+
Node: a,
|
|
1787
|
+
Element: c,
|
|
1788
|
+
NodeFilter: g,
|
|
1789
|
+
NamedNodeMap: f = l.NamedNodeMap || l.MozNamedAttrMap,
|
|
1790
|
+
HTMLFormElement: T,
|
|
1791
|
+
DOMParser: h,
|
|
1792
|
+
trustedTypes: b
|
|
1793
|
+
} = l, m = c.prototype, p = Se(m, "cloneNode"), _ = Se(m, "remove"), I = Se(m, "nextSibling"), q = Se(m, "childNodes"), W = Se(m, "parentNode");
|
|
1794
|
+
if (typeof r == "function") {
|
|
1795
|
+
const k = t.createElement("template");
|
|
1796
|
+
k.content && k.content.ownerDocument && (t = k.content.ownerDocument);
|
|
1797
|
+
}
|
|
1798
|
+
let C, J = "";
|
|
2423
1799
|
const {
|
|
2424
1800
|
implementation: Ve,
|
|
2425
|
-
createNodeIterator:
|
|
2426
|
-
createDocumentFragment:
|
|
2427
|
-
getElementsByTagName:
|
|
1801
|
+
createNodeIterator: Dn,
|
|
1802
|
+
createDocumentFragment: Nn,
|
|
1803
|
+
getElementsByTagName: Mn
|
|
2428
1804
|
} = t, {
|
|
2429
|
-
importNode:
|
|
1805
|
+
importNode: zn
|
|
2430
1806
|
} = n;
|
|
2431
|
-
let
|
|
2432
|
-
e.isSupported = typeof
|
|
1807
|
+
let z = mn();
|
|
1808
|
+
e.isSupported = typeof vn == "function" && typeof W == "function" && Ve && Ve.createHTMLDocument !== void 0;
|
|
2433
1809
|
const {
|
|
2434
|
-
MUSTACHE_EXPR:
|
|
2435
|
-
ERB_EXPR:
|
|
2436
|
-
TMPLIT_EXPR:
|
|
2437
|
-
DATA_ATTR:
|
|
2438
|
-
ARIA_ATTR:
|
|
2439
|
-
IS_SCRIPT_OR_DATA:
|
|
2440
|
-
ATTR_WHITESPACE:
|
|
2441
|
-
CUSTOM_ELEMENT:
|
|
2442
|
-
} =
|
|
1810
|
+
MUSTACHE_EXPR: Xe,
|
|
1811
|
+
ERB_EXPR: Qe,
|
|
1812
|
+
TMPLIT_EXPR: Ke,
|
|
1813
|
+
DATA_ATTR: Pn,
|
|
1814
|
+
ARIA_ATTR: $n,
|
|
1815
|
+
IS_SCRIPT_OR_DATA: Un,
|
|
1816
|
+
ATTR_WHITESPACE: vt,
|
|
1817
|
+
CUSTOM_ELEMENT: Fn
|
|
1818
|
+
} = dn;
|
|
2443
1819
|
let {
|
|
2444
|
-
IS_ALLOWED_URI:
|
|
2445
|
-
} =
|
|
2446
|
-
const
|
|
2447
|
-
let
|
|
2448
|
-
const
|
|
2449
|
-
let
|
|
1820
|
+
IS_ALLOWED_URI: It
|
|
1821
|
+
} = dn, O = null;
|
|
1822
|
+
const Ct = x({}, [...un, ...ft, ...dt, ...mt, ...pn]);
|
|
1823
|
+
let D = null;
|
|
1824
|
+
const Ot = x({}, [...hn, ...gt, ...fn, ...We]);
|
|
1825
|
+
let R = Object.seal(Tt(null, {
|
|
2450
1826
|
tagNameCheck: {
|
|
2451
1827
|
writable: !0,
|
|
2452
1828
|
configurable: !1,
|
|
@@ -2465,8 +1841,8 @@ function Qn() {
|
|
|
2465
1841
|
enumerable: !0,
|
|
2466
1842
|
value: !1
|
|
2467
1843
|
}
|
|
2468
|
-
})),
|
|
2469
|
-
const
|
|
1844
|
+
})), Te = null, Je = null;
|
|
1845
|
+
const pe = Object.seal(Tt(null, {
|
|
2470
1846
|
tagCheck: {
|
|
2471
1847
|
writable: !0,
|
|
2472
1848
|
configurable: !1,
|
|
@@ -2480,169 +1856,169 @@ function Qn() {
|
|
|
2480
1856
|
value: null
|
|
2481
1857
|
}
|
|
2482
1858
|
}));
|
|
2483
|
-
let
|
|
2484
|
-
const
|
|
2485
|
-
let
|
|
2486
|
-
const
|
|
2487
|
-
let
|
|
2488
|
-
const
|
|
2489
|
-
let
|
|
2490
|
-
const
|
|
2491
|
-
let
|
|
2492
|
-
const
|
|
2493
|
-
let
|
|
2494
|
-
const
|
|
2495
|
-
let
|
|
2496
|
-
const
|
|
2497
|
-
let
|
|
2498
|
-
const
|
|
2499
|
-
return
|
|
2500
|
-
},
|
|
2501
|
-
let
|
|
2502
|
-
if (!(
|
|
2503
|
-
if ((!
|
|
2504
|
-
|
|
2505
|
-
if (typeof
|
|
2506
|
-
throw
|
|
2507
|
-
if (typeof
|
|
2508
|
-
throw
|
|
2509
|
-
|
|
1859
|
+
let Dt = !0, et = !0, Nt = !1, Mt = !0, he = !1, Oe = !0, oe = !1, tt = !1, nt = !1, fe = !1, De = !1, Ne = !1, zt = !0, Pt = !1;
|
|
1860
|
+
const Hn = "user-content-";
|
|
1861
|
+
let it = !0, we = !1, de = {}, Y = null;
|
|
1862
|
+
const rt = x({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
1863
|
+
let $t = null;
|
|
1864
|
+
const Ut = x({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
1865
|
+
let st = null;
|
|
1866
|
+
const Ft = x({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Me = "http://www.w3.org/1998/Math/MathML", ze = "http://www.w3.org/2000/svg", ee = "http://www.w3.org/1999/xhtml";
|
|
1867
|
+
let me = ee, ot = !1, lt = null;
|
|
1868
|
+
const Bn = x({}, [Me, ze, ee], pt);
|
|
1869
|
+
let Pe = x({}, ["mi", "mo", "mn", "ms", "mtext"]), $e = x({}, ["annotation-xml"]);
|
|
1870
|
+
const Wn = x({}, ["title", "style", "font", "a", "script"]);
|
|
1871
|
+
let xe = null;
|
|
1872
|
+
const jn = ["application/xhtml+xml", "text/html"], Gn = "text/html";
|
|
1873
|
+
let v = null, ge = null;
|
|
1874
|
+
const qn = t.createElement("form"), Ht = function(s) {
|
|
1875
|
+
return s instanceof RegExp || s instanceof Function;
|
|
1876
|
+
}, at = function() {
|
|
1877
|
+
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1878
|
+
if (!(ge && ge === s)) {
|
|
1879
|
+
if ((!s || typeof s != "object") && (s = {}), s = X(s), xe = // eslint-disable-next-line unicorn/prefer-includes
|
|
1880
|
+
jn.indexOf(s.PARSER_MEDIA_TYPE) === -1 ? Gn : s.PARSER_MEDIA_TYPE, v = xe === "application/xhtml+xml" ? pt : je, O = Z(s, "ALLOWED_TAGS") ? x({}, s.ALLOWED_TAGS, v) : Ct, D = Z(s, "ALLOWED_ATTR") ? x({}, s.ALLOWED_ATTR, v) : Ot, lt = Z(s, "ALLOWED_NAMESPACES") ? x({}, s.ALLOWED_NAMESPACES, pt) : Bn, st = Z(s, "ADD_URI_SAFE_ATTR") ? x(X(Ft), s.ADD_URI_SAFE_ATTR, v) : Ft, $t = Z(s, "ADD_DATA_URI_TAGS") ? x(X(Ut), s.ADD_DATA_URI_TAGS, v) : Ut, Y = Z(s, "FORBID_CONTENTS") ? x({}, s.FORBID_CONTENTS, v) : rt, Te = Z(s, "FORBID_TAGS") ? x({}, s.FORBID_TAGS, v) : X({}), Je = Z(s, "FORBID_ATTR") ? x({}, s.FORBID_ATTR, v) : X({}), de = Z(s, "USE_PROFILES") ? s.USE_PROFILES : !1, Dt = s.ALLOW_ARIA_ATTR !== !1, et = s.ALLOW_DATA_ATTR !== !1, Nt = s.ALLOW_UNKNOWN_PROTOCOLS || !1, Mt = s.ALLOW_SELF_CLOSE_IN_ATTR !== !1, he = s.SAFE_FOR_TEMPLATES || !1, Oe = s.SAFE_FOR_XML !== !1, oe = s.WHOLE_DOCUMENT || !1, fe = s.RETURN_DOM || !1, De = s.RETURN_DOM_FRAGMENT || !1, Ne = s.RETURN_TRUSTED_TYPE || !1, nt = s.FORCE_BODY || !1, zt = s.SANITIZE_DOM !== !1, Pt = s.SANITIZE_NAMED_PROPS || !1, it = s.KEEP_CONTENT !== !1, we = s.IN_PLACE || !1, It = s.ALLOWED_URI_REGEXP || In, me = s.NAMESPACE || ee, Pe = s.MATHML_TEXT_INTEGRATION_POINTS || Pe, $e = s.HTML_INTEGRATION_POINTS || $e, R = s.CUSTOM_ELEMENT_HANDLING || {}, s.CUSTOM_ELEMENT_HANDLING && Ht(s.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (R.tagNameCheck = s.CUSTOM_ELEMENT_HANDLING.tagNameCheck), s.CUSTOM_ELEMENT_HANDLING && Ht(s.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (R.attributeNameCheck = s.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), s.CUSTOM_ELEMENT_HANDLING && typeof s.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (R.allowCustomizedBuiltInElements = s.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), he && (et = !1), De && (fe = !0), de && (O = x({}, pn), D = [], de.html === !0 && (x(O, un), x(D, hn)), de.svg === !0 && (x(O, ft), x(D, gt), x(D, We)), de.svgFilters === !0 && (x(O, dt), x(D, gt), x(D, We)), de.mathMl === !0 && (x(O, mt), x(D, fn), x(D, We))), s.ADD_TAGS && (typeof s.ADD_TAGS == "function" ? pe.tagCheck = s.ADD_TAGS : (O === Ct && (O = X(O)), x(O, s.ADD_TAGS, v))), s.ADD_ATTR && (typeof s.ADD_ATTR == "function" ? pe.attributeCheck = s.ADD_ATTR : (D === Ot && (D = X(D)), x(D, s.ADD_ATTR, v))), s.ADD_URI_SAFE_ATTR && x(st, s.ADD_URI_SAFE_ATTR, v), s.FORBID_CONTENTS && (Y === rt && (Y = X(Y)), x(Y, s.FORBID_CONTENTS, v)), s.ADD_FORBID_CONTENTS && (Y === rt && (Y = X(Y)), x(Y, s.ADD_FORBID_CONTENTS, v)), it && (O["#text"] = !0), oe && x(O, ["html", "head", "body"]), O.table && (x(O, ["tbody"]), delete Te.tbody), s.TRUSTED_TYPES_POLICY) {
|
|
1881
|
+
if (typeof s.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
1882
|
+
throw Ae('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
1883
|
+
if (typeof s.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
1884
|
+
throw Ae('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
1885
|
+
C = s.TRUSTED_TYPES_POLICY, J = C.createHTML("");
|
|
2510
1886
|
} else
|
|
2511
|
-
|
|
2512
|
-
|
|
1887
|
+
C === void 0 && (C = mr(b, i)), C !== null && typeof J == "string" && (J = C.createHTML(""));
|
|
1888
|
+
U && U(s), ge = s;
|
|
2513
1889
|
}
|
|
2514
|
-
},
|
|
2515
|
-
let
|
|
2516
|
-
(!
|
|
2517
|
-
namespaceURI:
|
|
1890
|
+
}, Bt = x({}, [...ft, ...dt, ...rr]), Wt = x({}, [...mt, ...sr]), Zn = function(s) {
|
|
1891
|
+
let u = W(s);
|
|
1892
|
+
(!u || !u.tagName) && (u = {
|
|
1893
|
+
namespaceURI: me,
|
|
2518
1894
|
tagName: "template"
|
|
2519
1895
|
});
|
|
2520
|
-
const
|
|
2521
|
-
return
|
|
2522
|
-
},
|
|
2523
|
-
|
|
2524
|
-
element:
|
|
1896
|
+
const d = je(s.tagName), S = je(u.tagName);
|
|
1897
|
+
return lt[s.namespaceURI] ? s.namespaceURI === ze ? u.namespaceURI === ee ? d === "svg" : u.namespaceURI === Me ? d === "svg" && (S === "annotation-xml" || Pe[S]) : !!Bt[d] : s.namespaceURI === Me ? u.namespaceURI === ee ? d === "math" : u.namespaceURI === ze ? d === "math" && $e[S] : !!Wt[d] : s.namespaceURI === ee ? u.namespaceURI === ze && !$e[S] || u.namespaceURI === Me && !Pe[S] ? !1 : !Wt[d] && (Wn[d] || !Bt[d]) : !!(xe === "application/xhtml+xml" && lt[s.namespaceURI]) : !1;
|
|
1898
|
+
}, V = function(s) {
|
|
1899
|
+
ye(e.removed, {
|
|
1900
|
+
element: s
|
|
2525
1901
|
});
|
|
2526
1902
|
try {
|
|
2527
|
-
|
|
1903
|
+
W(s).removeChild(s);
|
|
2528
1904
|
} catch {
|
|
2529
|
-
|
|
1905
|
+
_(s);
|
|
2530
1906
|
}
|
|
2531
|
-
},
|
|
1907
|
+
}, le = function(s, u) {
|
|
2532
1908
|
try {
|
|
2533
|
-
|
|
2534
|
-
attribute:
|
|
2535
|
-
from:
|
|
1909
|
+
ye(e.removed, {
|
|
1910
|
+
attribute: u.getAttributeNode(s),
|
|
1911
|
+
from: u
|
|
2536
1912
|
});
|
|
2537
1913
|
} catch {
|
|
2538
|
-
|
|
1914
|
+
ye(e.removed, {
|
|
2539
1915
|
attribute: null,
|
|
2540
|
-
from:
|
|
1916
|
+
from: u
|
|
2541
1917
|
});
|
|
2542
1918
|
}
|
|
2543
|
-
if (
|
|
2544
|
-
if (
|
|
1919
|
+
if (u.removeAttribute(s), s === "is")
|
|
1920
|
+
if (fe || De)
|
|
2545
1921
|
try {
|
|
2546
|
-
|
|
1922
|
+
V(u);
|
|
2547
1923
|
} catch {
|
|
2548
1924
|
}
|
|
2549
1925
|
else
|
|
2550
1926
|
try {
|
|
2551
|
-
|
|
1927
|
+
u.setAttribute(s, "");
|
|
2552
1928
|
} catch {
|
|
2553
1929
|
}
|
|
2554
|
-
},
|
|
2555
|
-
let
|
|
2556
|
-
if (
|
|
2557
|
-
|
|
1930
|
+
}, jt = function(s) {
|
|
1931
|
+
let u = null, d = null;
|
|
1932
|
+
if (nt)
|
|
1933
|
+
s = "<remove></remove>" + s;
|
|
2558
1934
|
else {
|
|
2559
|
-
const
|
|
2560
|
-
|
|
1935
|
+
const L = ht(s, /^[\r\n\t ]+/);
|
|
1936
|
+
d = L && L[0];
|
|
2561
1937
|
}
|
|
2562
|
-
|
|
2563
|
-
const
|
|
2564
|
-
if (
|
|
1938
|
+
xe === "application/xhtml+xml" && me === ee && (s = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + s + "</body></html>");
|
|
1939
|
+
const S = C ? C.createHTML(s) : s;
|
|
1940
|
+
if (me === ee)
|
|
2565
1941
|
try {
|
|
2566
|
-
|
|
1942
|
+
u = new h().parseFromString(S, xe);
|
|
2567
1943
|
} catch {
|
|
2568
1944
|
}
|
|
2569
|
-
if (!
|
|
2570
|
-
|
|
1945
|
+
if (!u || !u.documentElement) {
|
|
1946
|
+
u = Ve.createDocument(me, "template", null);
|
|
2571
1947
|
try {
|
|
2572
|
-
|
|
1948
|
+
u.documentElement.innerHTML = ot ? J : S;
|
|
2573
1949
|
} catch {
|
|
2574
1950
|
}
|
|
2575
1951
|
}
|
|
2576
|
-
const
|
|
2577
|
-
return
|
|
2578
|
-
},
|
|
2579
|
-
return
|
|
2580
|
-
|
|
2581
|
-
|
|
1952
|
+
const M = u.body || u.documentElement;
|
|
1953
|
+
return s && d && M.insertBefore(t.createTextNode(d), M.childNodes[0] || null), me === ee ? Mn.call(u, oe ? "html" : "body")[0] : oe ? u.documentElement : M;
|
|
1954
|
+
}, Gt = function(s) {
|
|
1955
|
+
return Dn.call(
|
|
1956
|
+
s.ownerDocument || s,
|
|
1957
|
+
s,
|
|
2582
1958
|
// eslint-disable-next-line no-bitwise
|
|
2583
|
-
|
|
1959
|
+
g.SHOW_ELEMENT | g.SHOW_COMMENT | g.SHOW_TEXT | g.SHOW_PROCESSING_INSTRUCTION | g.SHOW_CDATA_SECTION,
|
|
2584
1960
|
null
|
|
2585
1961
|
);
|
|
2586
|
-
},
|
|
2587
|
-
return
|
|
2588
|
-
},
|
|
2589
|
-
return typeof
|
|
1962
|
+
}, ct = function(s) {
|
|
1963
|
+
return s instanceof T && (typeof s.nodeName != "string" || typeof s.textContent != "string" || typeof s.removeChild != "function" || !(s.attributes instanceof f) || typeof s.removeAttribute != "function" || typeof s.setAttribute != "function" || typeof s.namespaceURI != "string" || typeof s.insertBefore != "function" || typeof s.hasChildNodes != "function");
|
|
1964
|
+
}, qt = function(s) {
|
|
1965
|
+
return typeof a == "function" && s instanceof a;
|
|
2590
1966
|
};
|
|
2591
|
-
function
|
|
2592
|
-
|
|
2593
|
-
|
|
1967
|
+
function te(k, s, u) {
|
|
1968
|
+
Be(k, (d) => {
|
|
1969
|
+
d.call(e, s, u, ge);
|
|
2594
1970
|
});
|
|
2595
1971
|
}
|
|
2596
|
-
const
|
|
2597
|
-
let
|
|
2598
|
-
if (
|
|
2599
|
-
return
|
|
2600
|
-
const
|
|
2601
|
-
if (
|
|
2602
|
-
tagName:
|
|
2603
|
-
allowedTags:
|
|
2604
|
-
}),
|
|
2605
|
-
return
|
|
2606
|
-
if (!(
|
|
2607
|
-
if (!
|
|
1972
|
+
const Zt = function(s) {
|
|
1973
|
+
let u = null;
|
|
1974
|
+
if (te(z.beforeSanitizeElements, s, null), ct(s))
|
|
1975
|
+
return V(s), !0;
|
|
1976
|
+
const d = v(s.nodeName);
|
|
1977
|
+
if (te(z.uponSanitizeElement, s, {
|
|
1978
|
+
tagName: d,
|
|
1979
|
+
allowedTags: O
|
|
1980
|
+
}), Oe && s.hasChildNodes() && !qt(s.firstElementChild) && P(/<[/\w!]/g, s.innerHTML) && P(/<[/\w!]/g, s.textContent) || s.nodeType === Re.progressingInstruction || Oe && s.nodeType === Re.comment && P(/<[/\w]/g, s.data))
|
|
1981
|
+
return V(s), !0;
|
|
1982
|
+
if (!(pe.tagCheck instanceof Function && pe.tagCheck(d)) && (!O[d] || Te[d])) {
|
|
1983
|
+
if (!Te[d] && Vt(d) && (R.tagNameCheck instanceof RegExp && P(R.tagNameCheck, d) || R.tagNameCheck instanceof Function && R.tagNameCheck(d)))
|
|
2608
1984
|
return !1;
|
|
2609
|
-
if (
|
|
2610
|
-
const
|
|
2611
|
-
if (
|
|
2612
|
-
const
|
|
2613
|
-
for (let
|
|
2614
|
-
const
|
|
2615
|
-
|
|
1985
|
+
if (it && !Y[d]) {
|
|
1986
|
+
const S = W(s) || s.parentNode, M = q(s) || s.childNodes;
|
|
1987
|
+
if (M && S) {
|
|
1988
|
+
const L = M.length;
|
|
1989
|
+
for (let H = L - 1; H >= 0; --H) {
|
|
1990
|
+
const ne = p(M[H], !0);
|
|
1991
|
+
ne.__removalCount = (s.__removalCount || 0) + 1, S.insertBefore(ne, I(s));
|
|
2616
1992
|
}
|
|
2617
1993
|
}
|
|
2618
1994
|
}
|
|
2619
|
-
return
|
|
2620
|
-
}
|
|
2621
|
-
return
|
|
2622
|
-
|
|
2623
|
-
}),
|
|
2624
|
-
element:
|
|
2625
|
-
}),
|
|
2626
|
-
},
|
|
2627
|
-
if (
|
|
1995
|
+
return V(s), !0;
|
|
1996
|
+
}
|
|
1997
|
+
return s instanceof c && !Zn(s) || (d === "noscript" || d === "noembed" || d === "noframes") && P(/<\/no(script|embed|frames)/i, s.innerHTML) ? (V(s), !0) : (he && s.nodeType === Re.text && (u = s.textContent, Be([Xe, Qe, Ke], (S) => {
|
|
1998
|
+
u = Ee(u, S, " ");
|
|
1999
|
+
}), s.textContent !== u && (ye(e.removed, {
|
|
2000
|
+
element: s.cloneNode()
|
|
2001
|
+
}), s.textContent = u)), te(z.afterSanitizeElements, s, null), !1);
|
|
2002
|
+
}, Yt = function(s, u, d) {
|
|
2003
|
+
if (zt && (u === "id" || u === "name") && (d in t || d in qn))
|
|
2628
2004
|
return !1;
|
|
2629
|
-
if (!(
|
|
2630
|
-
if (!(
|
|
2631
|
-
if (!(
|
|
2632
|
-
if (!
|
|
2005
|
+
if (!(et && !Je[u] && P(Pn, u))) {
|
|
2006
|
+
if (!(Dt && P($n, u))) {
|
|
2007
|
+
if (!(pe.attributeCheck instanceof Function && pe.attributeCheck(u, s))) {
|
|
2008
|
+
if (!D[u] || Je[u]) {
|
|
2633
2009
|
if (
|
|
2634
2010
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
2635
2011
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2636
2012
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
2637
|
-
!(
|
|
2013
|
+
!(Vt(s) && (R.tagNameCheck instanceof RegExp && P(R.tagNameCheck, s) || R.tagNameCheck instanceof Function && R.tagNameCheck(s)) && (R.attributeNameCheck instanceof RegExp && P(R.attributeNameCheck, u) || R.attributeNameCheck instanceof Function && R.attributeNameCheck(u, s)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
2638
2014
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2639
|
-
|
|
2015
|
+
u === "is" && R.allowCustomizedBuiltInElements && (R.tagNameCheck instanceof RegExp && P(R.tagNameCheck, d) || R.tagNameCheck instanceof Function && R.tagNameCheck(d)))
|
|
2640
2016
|
) return !1;
|
|
2641
|
-
} else if (!
|
|
2642
|
-
if (!
|
|
2643
|
-
if (!((
|
|
2644
|
-
if (!(
|
|
2645
|
-
if (
|
|
2017
|
+
} else if (!st[u]) {
|
|
2018
|
+
if (!P(It, Ee(d, vt, ""))) {
|
|
2019
|
+
if (!((u === "src" || u === "xlink:href" || u === "href") && s !== "script" && er(d, "data:") === 0 && $t[s])) {
|
|
2020
|
+
if (!(Nt && !P(Un, Ee(d, vt, "")))) {
|
|
2021
|
+
if (d)
|
|
2646
2022
|
return !1;
|
|
2647
2023
|
}
|
|
2648
2024
|
}
|
|
@@ -2652,244 +2028,242 @@ function Qn() {
|
|
|
2652
2028
|
}
|
|
2653
2029
|
}
|
|
2654
2030
|
return !0;
|
|
2655
|
-
},
|
|
2656
|
-
return
|
|
2657
|
-
},
|
|
2658
|
-
|
|
2031
|
+
}, Vt = function(s) {
|
|
2032
|
+
return s !== "annotation-xml" && ht(s, Fn);
|
|
2033
|
+
}, Xt = function(s) {
|
|
2034
|
+
te(z.beforeSanitizeAttributes, s, null);
|
|
2659
2035
|
const {
|
|
2660
|
-
attributes:
|
|
2661
|
-
} =
|
|
2662
|
-
if (!
|
|
2036
|
+
attributes: u
|
|
2037
|
+
} = s;
|
|
2038
|
+
if (!u || ct(s))
|
|
2663
2039
|
return;
|
|
2664
|
-
const
|
|
2040
|
+
const d = {
|
|
2665
2041
|
attrName: "",
|
|
2666
2042
|
attrValue: "",
|
|
2667
2043
|
keepAttr: !0,
|
|
2668
|
-
allowedAttributes:
|
|
2044
|
+
allowedAttributes: D,
|
|
2669
2045
|
forceKeepAttr: void 0
|
|
2670
2046
|
};
|
|
2671
|
-
let
|
|
2672
|
-
for (;
|
|
2673
|
-
const
|
|
2674
|
-
name:
|
|
2675
|
-
namespaceURI:
|
|
2676
|
-
value:
|
|
2677
|
-
} =
|
|
2678
|
-
let
|
|
2679
|
-
if (
|
|
2680
|
-
|
|
2047
|
+
let S = u.length;
|
|
2048
|
+
for (; S--; ) {
|
|
2049
|
+
const M = u[S], {
|
|
2050
|
+
name: L,
|
|
2051
|
+
namespaceURI: H,
|
|
2052
|
+
value: ne
|
|
2053
|
+
} = M, ke = v(L), ut = ne;
|
|
2054
|
+
let N = L === "value" ? ut : tr(ut);
|
|
2055
|
+
if (d.attrName = ke, d.attrValue = N, d.keepAttr = !0, d.forceKeepAttr = void 0, te(z.uponSanitizeAttribute, s, d), N = d.attrValue, Pt && (ke === "id" || ke === "name") && (le(L, s), N = Hn + N), Oe && P(/((--!?|])>)|<\/(style|title|textarea)/i, N)) {
|
|
2056
|
+
le(L, s);
|
|
2681
2057
|
continue;
|
|
2682
2058
|
}
|
|
2683
|
-
if (
|
|
2684
|
-
|
|
2059
|
+
if (ke === "attributename" && ht(N, "href")) {
|
|
2060
|
+
le(L, s);
|
|
2685
2061
|
continue;
|
|
2686
2062
|
}
|
|
2687
|
-
if (
|
|
2063
|
+
if (d.forceKeepAttr)
|
|
2688
2064
|
continue;
|
|
2689
|
-
if (!
|
|
2690
|
-
|
|
2065
|
+
if (!d.keepAttr) {
|
|
2066
|
+
le(L, s);
|
|
2691
2067
|
continue;
|
|
2692
2068
|
}
|
|
2693
|
-
if (!
|
|
2694
|
-
|
|
2069
|
+
if (!Mt && P(/\/>/i, N)) {
|
|
2070
|
+
le(L, s);
|
|
2695
2071
|
continue;
|
|
2696
2072
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2073
|
+
he && Be([Xe, Qe, Ke], (Kt) => {
|
|
2074
|
+
N = Ee(N, Kt, " ");
|
|
2699
2075
|
});
|
|
2700
|
-
const
|
|
2701
|
-
if (!
|
|
2702
|
-
|
|
2076
|
+
const Qt = v(s.nodeName);
|
|
2077
|
+
if (!Yt(Qt, ke, N)) {
|
|
2078
|
+
le(L, s);
|
|
2703
2079
|
continue;
|
|
2704
2080
|
}
|
|
2705
|
-
if (
|
|
2706
|
-
switch (
|
|
2081
|
+
if (C && typeof b == "object" && typeof b.getAttributeType == "function" && !H)
|
|
2082
|
+
switch (b.getAttributeType(Qt, ke)) {
|
|
2707
2083
|
case "TrustedHTML": {
|
|
2708
|
-
|
|
2084
|
+
N = C.createHTML(N);
|
|
2709
2085
|
break;
|
|
2710
2086
|
}
|
|
2711
2087
|
case "TrustedScriptURL": {
|
|
2712
|
-
|
|
2088
|
+
N = C.createScriptURL(N);
|
|
2713
2089
|
break;
|
|
2714
2090
|
}
|
|
2715
2091
|
}
|
|
2716
|
-
if (
|
|
2092
|
+
if (N !== ut)
|
|
2717
2093
|
try {
|
|
2718
|
-
|
|
2094
|
+
H ? s.setAttributeNS(H, L, N) : s.setAttribute(L, N), ct(s) ? V(s) : cn(e.removed);
|
|
2719
2095
|
} catch {
|
|
2720
|
-
|
|
2096
|
+
le(L, s);
|
|
2721
2097
|
}
|
|
2722
2098
|
}
|
|
2723
|
-
|
|
2724
|
-
},
|
|
2725
|
-
let
|
|
2726
|
-
const
|
|
2727
|
-
for (
|
|
2728
|
-
|
|
2729
|
-
|
|
2099
|
+
te(z.afterSanitizeAttributes, s, null);
|
|
2100
|
+
}, Yn = function k(s) {
|
|
2101
|
+
let u = null;
|
|
2102
|
+
const d = Gt(s);
|
|
2103
|
+
for (te(z.beforeSanitizeShadowDOM, s, null); u = d.nextNode(); )
|
|
2104
|
+
te(z.uponSanitizeShadowNode, u, null), Zt(u), Xt(u), u.content instanceof o && k(u.content);
|
|
2105
|
+
te(z.afterSanitizeShadowDOM, s, null);
|
|
2730
2106
|
};
|
|
2731
|
-
return e.sanitize = function(
|
|
2732
|
-
let
|
|
2733
|
-
if (
|
|
2734
|
-
if (typeof
|
|
2735
|
-
if (
|
|
2736
|
-
throw
|
|
2107
|
+
return e.sanitize = function(k) {
|
|
2108
|
+
let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, d = null, S = null, M = null;
|
|
2109
|
+
if (ot = !k, ot && (k = "<!-->"), typeof k != "string" && !qt(k))
|
|
2110
|
+
if (typeof k.toString == "function") {
|
|
2111
|
+
if (k = k.toString(), typeof k != "string")
|
|
2112
|
+
throw Ae("dirty is not a string, aborting");
|
|
2737
2113
|
} else
|
|
2738
|
-
throw
|
|
2114
|
+
throw Ae("toString is not a function");
|
|
2739
2115
|
if (!e.isSupported)
|
|
2740
|
-
return
|
|
2741
|
-
if (
|
|
2742
|
-
if (
|
|
2743
|
-
const
|
|
2744
|
-
if (!
|
|
2745
|
-
throw
|
|
2116
|
+
return k;
|
|
2117
|
+
if (tt || at(s), e.removed = [], typeof k == "string" && (we = !1), we) {
|
|
2118
|
+
if (k.nodeName) {
|
|
2119
|
+
const ne = v(k.nodeName);
|
|
2120
|
+
if (!O[ne] || Te[ne])
|
|
2121
|
+
throw Ae("root node is forbidden and cannot be sanitized in-place");
|
|
2746
2122
|
}
|
|
2747
|
-
} else if (
|
|
2748
|
-
|
|
2123
|
+
} else if (k instanceof a)
|
|
2124
|
+
u = jt("<!---->"), d = u.ownerDocument.importNode(k, !0), d.nodeType === Re.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? u = d : u.appendChild(d);
|
|
2749
2125
|
else {
|
|
2750
|
-
if (!
|
|
2751
|
-
|
|
2752
|
-
return
|
|
2753
|
-
if (
|
|
2754
|
-
return
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
const
|
|
2758
|
-
for (;
|
|
2759
|
-
S
|
|
2760
|
-
if (
|
|
2761
|
-
return
|
|
2762
|
-
if (
|
|
2763
|
-
if (
|
|
2764
|
-
for (
|
|
2765
|
-
|
|
2126
|
+
if (!fe && !he && !oe && // eslint-disable-next-line unicorn/prefer-includes
|
|
2127
|
+
k.indexOf("<") === -1)
|
|
2128
|
+
return C && Ne ? C.createHTML(k) : k;
|
|
2129
|
+
if (u = jt(k), !u)
|
|
2130
|
+
return fe ? null : Ne ? J : "";
|
|
2131
|
+
}
|
|
2132
|
+
u && nt && V(u.firstChild);
|
|
2133
|
+
const L = Gt(we ? k : u);
|
|
2134
|
+
for (; S = L.nextNode(); )
|
|
2135
|
+
Zt(S), Xt(S), S.content instanceof o && Yn(S.content);
|
|
2136
|
+
if (we)
|
|
2137
|
+
return k;
|
|
2138
|
+
if (fe) {
|
|
2139
|
+
if (De)
|
|
2140
|
+
for (M = Nn.call(u.ownerDocument); u.firstChild; )
|
|
2141
|
+
M.appendChild(u.firstChild);
|
|
2766
2142
|
else
|
|
2767
|
-
|
|
2768
|
-
return (
|
|
2769
|
-
}
|
|
2770
|
-
let
|
|
2771
|
-
return
|
|
2772
|
-
` +
|
|
2773
|
-
|
|
2774
|
-
}),
|
|
2143
|
+
M = u;
|
|
2144
|
+
return (D.shadowroot || D.shadowrootmode) && (M = zn.call(n, M, !0)), M;
|
|
2145
|
+
}
|
|
2146
|
+
let H = oe ? u.outerHTML : u.innerHTML;
|
|
2147
|
+
return oe && O["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && P(Cn, u.ownerDocument.doctype.name) && (H = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
2148
|
+
` + H), he && Be([Xe, Qe, Ke], (ne) => {
|
|
2149
|
+
H = Ee(H, ne, " ");
|
|
2150
|
+
}), C && Ne ? C.createHTML(H) : H;
|
|
2775
2151
|
}, e.setConfig = function() {
|
|
2776
|
-
let
|
|
2777
|
-
|
|
2152
|
+
let k = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2153
|
+
at(k), tt = !0;
|
|
2778
2154
|
}, e.clearConfig = function() {
|
|
2779
|
-
|
|
2780
|
-
}, e.isValidAttribute = function(
|
|
2781
|
-
|
|
2782
|
-
const
|
|
2783
|
-
return
|
|
2784
|
-
}, e.addHook = function(
|
|
2785
|
-
typeof
|
|
2786
|
-
}, e.removeHook = function(
|
|
2787
|
-
if (
|
|
2788
|
-
const
|
|
2789
|
-
return
|
|
2790
|
-
}
|
|
2791
|
-
return
|
|
2792
|
-
}, e.removeHooks = function(
|
|
2793
|
-
|
|
2155
|
+
ge = null, tt = !1;
|
|
2156
|
+
}, e.isValidAttribute = function(k, s, u) {
|
|
2157
|
+
ge || at({});
|
|
2158
|
+
const d = v(k), S = v(s);
|
|
2159
|
+
return Yt(d, S, u);
|
|
2160
|
+
}, e.addHook = function(k, s) {
|
|
2161
|
+
typeof s == "function" && ye(z[k], s);
|
|
2162
|
+
}, e.removeHook = function(k, s) {
|
|
2163
|
+
if (s !== void 0) {
|
|
2164
|
+
const u = Ki(z[k], s);
|
|
2165
|
+
return u === -1 ? void 0 : Ji(z[k], u, 1)[0];
|
|
2166
|
+
}
|
|
2167
|
+
return cn(z[k]);
|
|
2168
|
+
}, e.removeHooks = function(k) {
|
|
2169
|
+
z[k] = [];
|
|
2794
2170
|
}, e.removeAllHooks = function() {
|
|
2795
|
-
|
|
2171
|
+
z = mn();
|
|
2796
2172
|
}, e;
|
|
2797
2173
|
}
|
|
2798
|
-
var
|
|
2799
|
-
const
|
|
2174
|
+
var gr = On();
|
|
2175
|
+
const kr = {
|
|
2800
2176
|
heading(l, e, t) {
|
|
2801
2177
|
typeof l == "object" && l !== null && (t = l.raw || t, e = l.depth || l.level || e, l = l.text || "");
|
|
2802
|
-
const
|
|
2803
|
-
return `<h${e} id="${
|
|
2178
|
+
const i = (t || String(l)).toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2179
|
+
return `<h${e} id="${i}">${l}</h${e}>`;
|
|
2804
2180
|
}
|
|
2805
2181
|
};
|
|
2806
|
-
|
|
2807
|
-
function
|
|
2808
|
-
const e =
|
|
2809
|
-
return
|
|
2182
|
+
y.use({ renderer: kr });
|
|
2183
|
+
function br(l) {
|
|
2184
|
+
const e = y.parse(l);
|
|
2185
|
+
return gr.sanitize(e, {
|
|
2810
2186
|
ADD_ATTR: ["id", "name"],
|
|
2811
2187
|
// 'name' sometimes used for anchors too
|
|
2812
2188
|
ADD_TAGS: ["h1", "h2", "h3", "h4", "h5", "h6"]
|
|
2813
2189
|
// Ensure headers aren't stripped (redundant but safe)
|
|
2814
2190
|
});
|
|
2815
2191
|
}
|
|
2816
|
-
const
|
|
2817
|
-
const [n,
|
|
2818
|
-
|
|
2192
|
+
const Tr = ({ content: l, filename: e, onClose: t }) => {
|
|
2193
|
+
const [n, i] = ie(""), [o, r] = ie(!1), [a, c] = ie(!1);
|
|
2194
|
+
be(() => {
|
|
2819
2195
|
if (l) {
|
|
2820
|
-
const
|
|
2821
|
-
|
|
2196
|
+
const h = br(l);
|
|
2197
|
+
i(h);
|
|
2822
2198
|
}
|
|
2823
|
-
}, [l]),
|
|
2824
|
-
const
|
|
2825
|
-
var
|
|
2826
|
-
const
|
|
2827
|
-
if (
|
|
2828
|
-
const
|
|
2829
|
-
|
|
2199
|
+
}, [l]), be(() => {
|
|
2200
|
+
const h = (m) => {
|
|
2201
|
+
var _;
|
|
2202
|
+
const p = (_ = m.target.getAttribute("href")) == null ? void 0 : _.substring(1);
|
|
2203
|
+
if (p) {
|
|
2204
|
+
const I = document.getElementById(p);
|
|
2205
|
+
I && (m.preventDefault(), I.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
2830
2206
|
}
|
|
2831
|
-
},
|
|
2832
|
-
return
|
|
2833
|
-
|
|
2207
|
+
}, b = document.querySelectorAll('.markdown-body a[href^="#"]');
|
|
2208
|
+
return b.forEach((m) => m.addEventListener("click", h)), () => {
|
|
2209
|
+
b.forEach((m) => m.removeEventListener("click", h));
|
|
2834
2210
|
};
|
|
2835
2211
|
}, [n]);
|
|
2836
|
-
const
|
|
2837
|
-
var
|
|
2838
|
-
if (
|
|
2839
|
-
window.speechSynthesis.cancel(),
|
|
2212
|
+
const g = () => {
|
|
2213
|
+
var h;
|
|
2214
|
+
if (o)
|
|
2215
|
+
window.speechSynthesis.cancel(), r(!1);
|
|
2840
2216
|
else {
|
|
2841
|
-
const
|
|
2842
|
-
if (!
|
|
2843
|
-
const
|
|
2844
|
-
|
|
2217
|
+
const b = (h = document.getElementById("markdown-content")) == null ? void 0 : h.innerText;
|
|
2218
|
+
if (!b) return;
|
|
2219
|
+
const m = new SpeechSynthesisUtterance(b);
|
|
2220
|
+
m.rate = 1, m.onend = () => r(!1), m.onerror = () => r(!1), window.speechSynthesis.speak(m), r(!0);
|
|
2845
2221
|
}
|
|
2846
2222
|
};
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
"text/html": m,
|
|
2853
|
-
"text/plain": O
|
|
2854
|
-
})];
|
|
2855
|
-
navigator.clipboard.write(M).then(() => {
|
|
2856
|
-
u(!0), setTimeout(() => u(!1), 2e3);
|
|
2857
|
-
}).catch(() => {
|
|
2858
|
-
navigator.clipboard.writeText(E).then(() => {
|
|
2859
|
-
u(!0), setTimeout(() => u(!1), 2e3);
|
|
2860
|
-
});
|
|
2861
|
-
});
|
|
2862
|
-
}, w = () => {
|
|
2863
|
-
alert("💡 Tip: To preserve the visual theme in your PDF, make sure to check 'Background graphics' in the print settings window."), window.print();
|
|
2864
|
-
};
|
|
2865
|
-
return /* @__PURE__ */ y.jsxs("section", { className: "preview-zone", children: [
|
|
2866
|
-
/* @__PURE__ */ y.jsxs("div", { className: "preview-header", children: [
|
|
2867
|
-
/* @__PURE__ */ y.jsx("span", { id: "filename-display", children: e || "filename.md" }),
|
|
2868
|
-
/* @__PURE__ */ y.jsxs("div", { className: "header-actions", children: [
|
|
2869
|
-
/* @__PURE__ */ y.jsx(
|
|
2223
|
+
return be(() => () => window.speechSynthesis.cancel(), []), /* @__PURE__ */ $("section", { className: "preview-zone", children: [
|
|
2224
|
+
/* @__PURE__ */ $("div", { className: "preview-header", children: [
|
|
2225
|
+
/* @__PURE__ */ w("span", { id: "filename-display", children: e || "filename.md" }),
|
|
2226
|
+
/* @__PURE__ */ $("div", { className: "header-actions", children: [
|
|
2227
|
+
/* @__PURE__ */ w(
|
|
2870
2228
|
"button",
|
|
2871
2229
|
{
|
|
2872
|
-
className: `icon-btn ${
|
|
2873
|
-
onClick:
|
|
2874
|
-
title:
|
|
2875
|
-
children:
|
|
2230
|
+
className: `icon-btn ${o ? "speaking" : ""}`,
|
|
2231
|
+
onClick: g,
|
|
2232
|
+
title: o ? "Stop Reading" : "Read Aloud",
|
|
2233
|
+
children: o ? /* @__PURE__ */ w(ci, {}) : /* @__PURE__ */ w(pi, {})
|
|
2876
2234
|
}
|
|
2877
2235
|
),
|
|
2878
|
-
/* @__PURE__ */
|
|
2236
|
+
/* @__PURE__ */ w(
|
|
2879
2237
|
"button",
|
|
2880
2238
|
{
|
|
2881
2239
|
className: "icon-btn",
|
|
2882
|
-
onClick:
|
|
2240
|
+
onClick: () => {
|
|
2241
|
+
const h = document.getElementById("markdown-content");
|
|
2242
|
+
if (!h) return;
|
|
2243
|
+
const b = h.innerText, m = h.innerHTML, p = new Blob([m], { type: "text/html" }), _ = new Blob([b], { type: "text/plain" }), I = [new ClipboardItem({
|
|
2244
|
+
"text/html": p,
|
|
2245
|
+
"text/plain": _
|
|
2246
|
+
})];
|
|
2247
|
+
navigator.clipboard.write(I).then(() => {
|
|
2248
|
+
c(!0), setTimeout(() => c(!1), 2e3);
|
|
2249
|
+
}).catch(() => {
|
|
2250
|
+
navigator.clipboard.writeText(b).then(() => {
|
|
2251
|
+
c(!0), setTimeout(() => c(!1), 2e3);
|
|
2252
|
+
});
|
|
2253
|
+
});
|
|
2254
|
+
},
|
|
2883
2255
|
title: "Copy to Clipboard",
|
|
2884
|
-
style: { color:
|
|
2885
|
-
children:
|
|
2256
|
+
style: { color: a ? "var(--accent-color)" : "" },
|
|
2257
|
+
children: a ? /* @__PURE__ */ w(ni, {}) : /* @__PURE__ */ w(si, {})
|
|
2886
2258
|
}
|
|
2887
2259
|
),
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
|
|
2260
|
+
/* @__PURE__ */ w("button", { className: "icon-btn", onClick: () => {
|
|
2261
|
+
alert("💡 Tip: To preserve the visual theme in your PDF, make sure to check 'Background graphics' in the print settings window."), window.print();
|
|
2262
|
+
}, title: "Save as PDF", children: /* @__PURE__ */ w(li, {}) }),
|
|
2263
|
+
/* @__PURE__ */ w("button", { className: "icon-btn", onClick: t, title: "Close File", id: "close-btn", children: /* @__PURE__ */ w(ii, {}) })
|
|
2890
2264
|
] })
|
|
2891
2265
|
] }),
|
|
2892
|
-
/* @__PURE__ */
|
|
2266
|
+
/* @__PURE__ */ w(
|
|
2893
2267
|
"div",
|
|
2894
2268
|
{
|
|
2895
2269
|
id: "markdown-content",
|
|
@@ -2898,101 +2272,100 @@ const vi = ({ content: l, filename: e, onClose: t }) => {
|
|
|
2898
2272
|
}
|
|
2899
2273
|
)
|
|
2900
2274
|
] });
|
|
2901
|
-
},
|
|
2902
|
-
const [e, t] =
|
|
2903
|
-
|
|
2904
|
-
const
|
|
2905
|
-
t(
|
|
2275
|
+
}, yr = ({ url: l }) => {
|
|
2276
|
+
const [e, t] = ie("light"), [n, i] = ie(null), [o, r] = ie(!1), a = re.useRef(null);
|
|
2277
|
+
be(() => {
|
|
2278
|
+
const m = localStorage.getItem("theme"), p = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2279
|
+
t(m || (p ? "dark" : "light"));
|
|
2906
2280
|
}, []);
|
|
2907
|
-
const
|
|
2908
|
-
const
|
|
2909
|
-
t(
|
|
2910
|
-
},
|
|
2281
|
+
const c = () => {
|
|
2282
|
+
const m = e === "light" ? "dark" : "light";
|
|
2283
|
+
t(m), localStorage.setItem("theme", m);
|
|
2284
|
+
}, g = (m) => {
|
|
2911
2285
|
try {
|
|
2912
|
-
if (new URL(
|
|
2913
|
-
return
|
|
2286
|
+
if (new URL(m).hostname === "github.com" && m.includes("/blob/"))
|
|
2287
|
+
return m.replace("github.com", "raw.githubusercontent.com").replace("/blob/", "/");
|
|
2914
2288
|
} catch {
|
|
2915
2289
|
}
|
|
2916
|
-
return
|
|
2917
|
-
},
|
|
2918
|
-
if (
|
|
2290
|
+
return m;
|
|
2291
|
+
}, f = async (m) => {
|
|
2292
|
+
if (m)
|
|
2919
2293
|
try {
|
|
2920
|
-
const
|
|
2921
|
-
if (!
|
|
2922
|
-
const
|
|
2923
|
-
let
|
|
2924
|
-
|
|
2925
|
-
} catch (
|
|
2926
|
-
console.error("Scripto Load Error:",
|
|
2294
|
+
const p = g(m), _ = await fetch(p);
|
|
2295
|
+
if (!_.ok) throw new Error("Failed to fetch");
|
|
2296
|
+
const I = await _.text();
|
|
2297
|
+
let q = m.substring(m.lastIndexOf("/") + 1) || "remote-file.md";
|
|
2298
|
+
q.includes("?") && (q = q.split("?")[0]), i({ name: q, content: I });
|
|
2299
|
+
} catch (p) {
|
|
2300
|
+
console.error("Scripto Load Error:", p);
|
|
2927
2301
|
}
|
|
2928
2302
|
};
|
|
2929
|
-
|
|
2930
|
-
const
|
|
2931
|
-
if (!
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2303
|
+
be(() => {
|
|
2304
|
+
const m = a.current;
|
|
2305
|
+
if (!m) return;
|
|
2306
|
+
const p = () => {
|
|
2307
|
+
m.scrollTop > 300 ? r(!0) : r(!1);
|
|
2934
2308
|
};
|
|
2935
|
-
return
|
|
2309
|
+
return m.addEventListener("scroll", p), () => m.removeEventListener("scroll", p);
|
|
2936
2310
|
}, []);
|
|
2937
|
-
const
|
|
2938
|
-
|
|
2939
|
-
},
|
|
2940
|
-
|
|
2941
|
-
},
|
|
2942
|
-
|
|
2943
|
-
const
|
|
2944
|
-
|
|
2311
|
+
const T = () => {
|
|
2312
|
+
a.current && a.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
2313
|
+
}, h = (m) => {
|
|
2314
|
+
i(m), a.current && (a.current.scrollTop = 0);
|
|
2315
|
+
}, b = () => {
|
|
2316
|
+
i(null);
|
|
2317
|
+
const m = new URL(window.location);
|
|
2318
|
+
m.searchParams.delete("url"), window.history.pushState({}, "", m);
|
|
2945
2319
|
};
|
|
2946
|
-
return
|
|
2947
|
-
const
|
|
2948
|
-
|
|
2949
|
-
}, [l]), /* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2320
|
+
return be(() => {
|
|
2321
|
+
const m = new URLSearchParams(window.location.search), p = l || m.get("url");
|
|
2322
|
+
p && f(p);
|
|
2323
|
+
}, [l]), /* @__PURE__ */ $("div", { className: "scripto-wrapper", "data-theme": e, children: [
|
|
2324
|
+
/* @__PURE__ */ $("div", { className: "background-blobs", children: [
|
|
2325
|
+
/* @__PURE__ */ w("div", { className: "blob blob-1" }),
|
|
2326
|
+
/* @__PURE__ */ w("div", { className: "blob blob-2" }),
|
|
2327
|
+
/* @__PURE__ */ w("div", { className: "blob blob-3" })
|
|
2954
2328
|
] }),
|
|
2955
|
-
/* @__PURE__ */
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
2329
|
+
/* @__PURE__ */ w("button", { id: "theme-toggle", "aria-label": "Toggle Theme", onClick: c, children: e === "light" ? /* @__PURE__ */ w(ui, {}) : /* @__PURE__ */ w(ai, {}) }),
|
|
2330
|
+
/* @__PURE__ */ $("main", { className: "app-container", ref: a, children: [
|
|
2331
|
+
/* @__PURE__ */ $("header", { className: "glass-header", children: [
|
|
2332
|
+
/* @__PURE__ */ $("div", { className: "logo", children: [
|
|
2333
|
+
/* @__PURE__ */ w(oi, {}),
|
|
2334
|
+
/* @__PURE__ */ $("h1", { children: [
|
|
2961
2335
|
"Scr!p",
|
|
2962
|
-
/* @__PURE__ */
|
|
2336
|
+
/* @__PURE__ */ w("span", { children: "tō" })
|
|
2963
2337
|
] })
|
|
2964
2338
|
] }),
|
|
2965
|
-
/* @__PURE__ */
|
|
2339
|
+
/* @__PURE__ */ w("p", { children: "“Simple, elegant visualization — where every mark becomes meaning.”" })
|
|
2966
2340
|
] }),
|
|
2967
|
-
n ? /* @__PURE__ */
|
|
2968
|
-
|
|
2341
|
+
n ? /* @__PURE__ */ w(
|
|
2342
|
+
Tr,
|
|
2969
2343
|
{
|
|
2970
2344
|
content: n.content,
|
|
2971
2345
|
filename: n.name,
|
|
2972
|
-
onClose:
|
|
2346
|
+
onClose: b
|
|
2973
2347
|
}
|
|
2974
|
-
) : /* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2348
|
+
) : /* @__PURE__ */ w(fi, { onFileLoaded: h }),
|
|
2349
|
+
/* @__PURE__ */ w("footer", { className: "app-footer", children: /* @__PURE__ */ $("p", { children: [
|
|
2976
2350
|
" Try it out on ",
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ w("a", { href: "https://www.npmjs.com/package/@jojovms/scripto", target: "_blank", rel: "noopener noreferrer", className: "npm-link", title: "View on NPM", children: /* @__PURE__ */ w(hi, { style: { fontSize: "2.5em", verticalAlign: "middle", marginRight: "5px" } }) }),
|
|
2352
|
+
/* @__PURE__ */ w("span", { style: { margin: "0 10px", opacity: 0.5 }, children: "|" }),
|
|
2979
2353
|
"🎯 App created by ",
|
|
2980
|
-
/* @__PURE__ */
|
|
2354
|
+
/* @__PURE__ */ w("a", { href: "https://bio.link/shijoshaji", target: "_blank", rel: "noopener noreferrer", children: "Shijo Shaji" })
|
|
2981
2355
|
] }) })
|
|
2982
2356
|
] }),
|
|
2983
|
-
/* @__PURE__ */
|
|
2357
|
+
/* @__PURE__ */ w(
|
|
2984
2358
|
"button",
|
|
2985
2359
|
{
|
|
2986
2360
|
id: "scroll-top-btn",
|
|
2987
2361
|
"aria-label": "Scroll to Top",
|
|
2988
|
-
className:
|
|
2989
|
-
onClick:
|
|
2990
|
-
children: /* @__PURE__ */
|
|
2362
|
+
className: o ? "visible" : "",
|
|
2363
|
+
onClick: T,
|
|
2364
|
+
children: /* @__PURE__ */ w(ti, {})
|
|
2991
2365
|
}
|
|
2992
2366
|
)
|
|
2993
2367
|
] });
|
|
2994
2368
|
};
|
|
2995
2369
|
export {
|
|
2996
|
-
|
|
2997
|
-
Si as default
|
|
2370
|
+
yr as Scripto
|
|
2998
2371
|
};
|