hanbiro-react16-sdk 1.0.2 → 1.0.4

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.
@@ -0,0 +1,3060 @@
1
+ var At = Object.defineProperty;
2
+ var It = (t, e, n) => e in t ? At(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var S = (t, e, n) => It(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import * as b from "react";
5
+ import Q, { forwardRef as Ne } from "react";
6
+ let ue;
7
+ const zt = new Uint8Array(16);
8
+ function Lt() {
9
+ if (!ue && (ue = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ue))
10
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
11
+ return ue(zt);
12
+ }
13
+ const q = [];
14
+ for (let t = 0; t < 256; ++t)
15
+ q.push((t + 256).toString(16).slice(1));
16
+ function jt(t, e = 0) {
17
+ return q[t[e + 0]] + q[t[e + 1]] + q[t[e + 2]] + q[t[e + 3]] + "-" + q[t[e + 4]] + q[t[e + 5]] + "-" + q[t[e + 6]] + q[t[e + 7]] + "-" + q[t[e + 8]] + q[t[e + 9]] + "-" + q[t[e + 10]] + q[t[e + 11]] + q[t[e + 12]] + q[t[e + 13]] + q[t[e + 14]] + q[t[e + 15]];
18
+ }
19
+ const Dt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), nt = {
20
+ randomUUID: Dt
21
+ };
22
+ function Mt(t, e, n) {
23
+ if (nt.randomUUID && !t)
24
+ return nt.randomUUID();
25
+ t = t || {};
26
+ const r = t.random || (t.rng || Lt)();
27
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, jt(r);
28
+ }
29
+ function qt(t) {
30
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
31
+ }
32
+ var Ie = { exports: {} }, pe = { exports: {} }, A = {};
33
+ /** @license React v16.13.1
34
+ * react-is.production.min.js
35
+ *
36
+ * Copyright (c) Facebook, Inc. and its affiliates.
37
+ *
38
+ * This source code is licensed under the MIT license found in the
39
+ * LICENSE file in the root directory of this source tree.
40
+ */
41
+ var rt;
42
+ function Bt() {
43
+ if (rt) return A;
44
+ rt = 1;
45
+ var t = typeof Symbol == "function" && Symbol.for, e = t ? Symbol.for("react.element") : 60103, n = t ? Symbol.for("react.portal") : 60106, r = t ? Symbol.for("react.fragment") : 60107, i = t ? Symbol.for("react.strict_mode") : 60108, s = t ? Symbol.for("react.profiler") : 60114, c = t ? Symbol.for("react.provider") : 60109, o = t ? Symbol.for("react.context") : 60110, u = t ? Symbol.for("react.async_mode") : 60111, a = t ? Symbol.for("react.concurrent_mode") : 60111, l = t ? Symbol.for("react.forward_ref") : 60112, g = t ? Symbol.for("react.suspense") : 60113, p = t ? Symbol.for("react.suspense_list") : 60120, k = t ? Symbol.for("react.memo") : 60115, y = t ? Symbol.for("react.lazy") : 60116, x = t ? Symbol.for("react.block") : 60121, P = t ? Symbol.for("react.fundamental") : 60117, D = t ? Symbol.for("react.responder") : 60118, H = t ? Symbol.for("react.scope") : 60119;
46
+ function O(f) {
47
+ if (typeof f == "object" && f !== null) {
48
+ var U = f.$$typeof;
49
+ switch (U) {
50
+ case e:
51
+ switch (f = f.type, f) {
52
+ case u:
53
+ case a:
54
+ case r:
55
+ case s:
56
+ case i:
57
+ case g:
58
+ return f;
59
+ default:
60
+ switch (f = f && f.$$typeof, f) {
61
+ case o:
62
+ case l:
63
+ case y:
64
+ case k:
65
+ case c:
66
+ return f;
67
+ default:
68
+ return U;
69
+ }
70
+ }
71
+ case n:
72
+ return U;
73
+ }
74
+ }
75
+ }
76
+ function M(f) {
77
+ return O(f) === a;
78
+ }
79
+ return A.AsyncMode = u, A.ConcurrentMode = a, A.ContextConsumer = o, A.ContextProvider = c, A.Element = e, A.ForwardRef = l, A.Fragment = r, A.Lazy = y, A.Memo = k, A.Portal = n, A.Profiler = s, A.StrictMode = i, A.Suspense = g, A.isAsyncMode = function(f) {
80
+ return M(f) || O(f) === u;
81
+ }, A.isConcurrentMode = M, A.isContextConsumer = function(f) {
82
+ return O(f) === o;
83
+ }, A.isContextProvider = function(f) {
84
+ return O(f) === c;
85
+ }, A.isElement = function(f) {
86
+ return typeof f == "object" && f !== null && f.$$typeof === e;
87
+ }, A.isForwardRef = function(f) {
88
+ return O(f) === l;
89
+ }, A.isFragment = function(f) {
90
+ return O(f) === r;
91
+ }, A.isLazy = function(f) {
92
+ return O(f) === y;
93
+ }, A.isMemo = function(f) {
94
+ return O(f) === k;
95
+ }, A.isPortal = function(f) {
96
+ return O(f) === n;
97
+ }, A.isProfiler = function(f) {
98
+ return O(f) === s;
99
+ }, A.isStrictMode = function(f) {
100
+ return O(f) === i;
101
+ }, A.isSuspense = function(f) {
102
+ return O(f) === g;
103
+ }, A.isValidElementType = function(f) {
104
+ return typeof f == "string" || typeof f == "function" || f === r || f === a || f === s || f === i || f === g || f === p || typeof f == "object" && f !== null && (f.$$typeof === y || f.$$typeof === k || f.$$typeof === c || f.$$typeof === o || f.$$typeof === l || f.$$typeof === P || f.$$typeof === D || f.$$typeof === H || f.$$typeof === x);
105
+ }, A.typeOf = O, A;
106
+ }
107
+ var I = {};
108
+ /** @license React v16.13.1
109
+ * react-is.development.js
110
+ *
111
+ * Copyright (c) Facebook, Inc. and its affiliates.
112
+ *
113
+ * This source code is licensed under the MIT license found in the
114
+ * LICENSE file in the root directory of this source tree.
115
+ */
116
+ var it;
117
+ function Wt() {
118
+ return it || (it = 1, process.env.NODE_ENV !== "production" && function() {
119
+ var t = typeof Symbol == "function" && Symbol.for, e = t ? Symbol.for("react.element") : 60103, n = t ? Symbol.for("react.portal") : 60106, r = t ? Symbol.for("react.fragment") : 60107, i = t ? Symbol.for("react.strict_mode") : 60108, s = t ? Symbol.for("react.profiler") : 60114, c = t ? Symbol.for("react.provider") : 60109, o = t ? Symbol.for("react.context") : 60110, u = t ? Symbol.for("react.async_mode") : 60111, a = t ? Symbol.for("react.concurrent_mode") : 60111, l = t ? Symbol.for("react.forward_ref") : 60112, g = t ? Symbol.for("react.suspense") : 60113, p = t ? Symbol.for("react.suspense_list") : 60120, k = t ? Symbol.for("react.memo") : 60115, y = t ? Symbol.for("react.lazy") : 60116, x = t ? Symbol.for("react.block") : 60121, P = t ? Symbol.for("react.fundamental") : 60117, D = t ? Symbol.for("react.responder") : 60118, H = t ? Symbol.for("react.scope") : 60119;
120
+ function O(d) {
121
+ return typeof d == "string" || typeof d == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
122
+ d === r || d === a || d === s || d === i || d === g || d === p || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === k || d.$$typeof === c || d.$$typeof === o || d.$$typeof === l || d.$$typeof === P || d.$$typeof === D || d.$$typeof === H || d.$$typeof === x);
123
+ }
124
+ function M(d) {
125
+ if (typeof d == "object" && d !== null) {
126
+ var F = d.$$typeof;
127
+ switch (F) {
128
+ case e:
129
+ var ce = d.type;
130
+ switch (ce) {
131
+ case u:
132
+ case a:
133
+ case r:
134
+ case s:
135
+ case i:
136
+ case g:
137
+ return ce;
138
+ default:
139
+ var tt = ce && ce.$$typeof;
140
+ switch (tt) {
141
+ case o:
142
+ case l:
143
+ case y:
144
+ case k:
145
+ case c:
146
+ return tt;
147
+ default:
148
+ return F;
149
+ }
150
+ }
151
+ case n:
152
+ return F;
153
+ }
154
+ }
155
+ }
156
+ var f = u, U = a, B = o, ne = c, ve = e, ke = l, ae = r, we = y, Se = k, te = n, Ee = s, Z = i, J = g, le = !1;
157
+ function Te(d) {
158
+ return le || (le = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), h(d) || M(d) === u;
159
+ }
160
+ function h(d) {
161
+ return M(d) === a;
162
+ }
163
+ function m(d) {
164
+ return M(d) === o;
165
+ }
166
+ function R(d) {
167
+ return M(d) === c;
168
+ }
169
+ function E(d) {
170
+ return typeof d == "object" && d !== null && d.$$typeof === e;
171
+ }
172
+ function v(d) {
173
+ return M(d) === l;
174
+ }
175
+ function _(d) {
176
+ return M(d) === r;
177
+ }
178
+ function w(d) {
179
+ return M(d) === y;
180
+ }
181
+ function T(d) {
182
+ return M(d) === k;
183
+ }
184
+ function C(d) {
185
+ return M(d) === n;
186
+ }
187
+ function j(d) {
188
+ return M(d) === s;
189
+ }
190
+ function $(d) {
191
+ return M(d) === i;
192
+ }
193
+ function N(d) {
194
+ return M(d) === g;
195
+ }
196
+ I.AsyncMode = f, I.ConcurrentMode = U, I.ContextConsumer = B, I.ContextProvider = ne, I.Element = ve, I.ForwardRef = ke, I.Fragment = ae, I.Lazy = we, I.Memo = Se, I.Portal = te, I.Profiler = Ee, I.StrictMode = Z, I.Suspense = J, I.isAsyncMode = Te, I.isConcurrentMode = h, I.isContextConsumer = m, I.isContextProvider = R, I.isElement = E, I.isForwardRef = v, I.isFragment = _, I.isLazy = w, I.isMemo = T, I.isPortal = C, I.isProfiler = j, I.isStrictMode = $, I.isSuspense = N, I.isValidElementType = O, I.typeOf = M;
197
+ }()), I;
198
+ }
199
+ var st;
200
+ function yt() {
201
+ return st || (st = 1, process.env.NODE_ENV === "production" ? pe.exports = Bt() : pe.exports = Wt()), pe.exports;
202
+ }
203
+ /*
204
+ object-assign
205
+ (c) Sindre Sorhus
206
+ @license MIT
207
+ */
208
+ var Re, ot;
209
+ function Nt() {
210
+ if (ot) return Re;
211
+ ot = 1;
212
+ var t = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
213
+ function r(s) {
214
+ if (s == null)
215
+ throw new TypeError("Object.assign cannot be called with null or undefined");
216
+ return Object(s);
217
+ }
218
+ function i() {
219
+ try {
220
+ if (!Object.assign)
221
+ return !1;
222
+ var s = new String("abc");
223
+ if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
224
+ return !1;
225
+ for (var c = {}, o = 0; o < 10; o++)
226
+ c["_" + String.fromCharCode(o)] = o;
227
+ var u = Object.getOwnPropertyNames(c).map(function(l) {
228
+ return c[l];
229
+ });
230
+ if (u.join("") !== "0123456789")
231
+ return !1;
232
+ var a = {};
233
+ return "abcdefghijklmnopqrst".split("").forEach(function(l) {
234
+ a[l] = l;
235
+ }), Object.keys(Object.assign({}, a)).join("") === "abcdefghijklmnopqrst";
236
+ } catch {
237
+ return !1;
238
+ }
239
+ }
240
+ return Re = i() ? Object.assign : function(s, c) {
241
+ for (var o, u = r(s), a, l = 1; l < arguments.length; l++) {
242
+ o = Object(arguments[l]);
243
+ for (var g in o)
244
+ e.call(o, g) && (u[g] = o[g]);
245
+ if (t) {
246
+ a = t(o);
247
+ for (var p = 0; p < a.length; p++)
248
+ n.call(o, a[p]) && (u[a[p]] = o[a[p]]);
249
+ }
250
+ }
251
+ return u;
252
+ }, Re;
253
+ }
254
+ var _e, at;
255
+ function Ue() {
256
+ if (at) return _e;
257
+ at = 1;
258
+ var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
259
+ return _e = t, _e;
260
+ }
261
+ var Ce, lt;
262
+ function xt() {
263
+ return lt || (lt = 1, Ce = Function.call.bind(Object.prototype.hasOwnProperty)), Ce;
264
+ }
265
+ var $e, ct;
266
+ function Ut() {
267
+ if (ct) return $e;
268
+ ct = 1;
269
+ var t = function() {
270
+ };
271
+ if (process.env.NODE_ENV !== "production") {
272
+ var e = Ue(), n = {}, r = xt();
273
+ t = function(s) {
274
+ var c = "Warning: " + s;
275
+ typeof console < "u" && console.error(c);
276
+ try {
277
+ throw new Error(c);
278
+ } catch {
279
+ }
280
+ };
281
+ }
282
+ function i(s, c, o, u, a) {
283
+ if (process.env.NODE_ENV !== "production") {
284
+ for (var l in s)
285
+ if (r(s, l)) {
286
+ var g;
287
+ try {
288
+ if (typeof s[l] != "function") {
289
+ var p = Error(
290
+ (u || "React class") + ": " + o + " type `" + l + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[l] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
291
+ );
292
+ throw p.name = "Invariant Violation", p;
293
+ }
294
+ g = s[l](c, l, u, o, null, e);
295
+ } catch (y) {
296
+ g = y;
297
+ }
298
+ if (g && !(g instanceof Error) && t(
299
+ (u || "React class") + ": type specification of " + o + " `" + l + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof g + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
300
+ ), g instanceof Error && !(g.message in n)) {
301
+ n[g.message] = !0;
302
+ var k = a ? a() : "";
303
+ t(
304
+ "Failed " + o + " type: " + g.message + (k ?? "")
305
+ );
306
+ }
307
+ }
308
+ }
309
+ }
310
+ return i.resetWarningCache = function() {
311
+ process.env.NODE_ENV !== "production" && (n = {});
312
+ }, $e = i, $e;
313
+ }
314
+ var Pe, ut;
315
+ function Ht() {
316
+ if (ut) return Pe;
317
+ ut = 1;
318
+ var t = yt(), e = Nt(), n = Ue(), r = xt(), i = Ut(), s = function() {
319
+ };
320
+ process.env.NODE_ENV !== "production" && (s = function(o) {
321
+ var u = "Warning: " + o;
322
+ typeof console < "u" && console.error(u);
323
+ try {
324
+ throw new Error(u);
325
+ } catch {
326
+ }
327
+ });
328
+ function c() {
329
+ return null;
330
+ }
331
+ return Pe = function(o, u) {
332
+ var a = typeof Symbol == "function" && Symbol.iterator, l = "@@iterator";
333
+ function g(h) {
334
+ var m = h && (a && h[a] || h[l]);
335
+ if (typeof m == "function")
336
+ return m;
337
+ }
338
+ var p = "<<anonymous>>", k = {
339
+ array: D("array"),
340
+ bigint: D("bigint"),
341
+ bool: D("boolean"),
342
+ func: D("function"),
343
+ number: D("number"),
344
+ object: D("object"),
345
+ string: D("string"),
346
+ symbol: D("symbol"),
347
+ any: H(),
348
+ arrayOf: O,
349
+ element: M(),
350
+ elementType: f(),
351
+ instanceOf: U,
352
+ node: ke(),
353
+ objectOf: ne,
354
+ oneOf: B,
355
+ oneOfType: ve,
356
+ shape: we,
357
+ exact: Se
358
+ };
359
+ function y(h, m) {
360
+ return h === m ? h !== 0 || 1 / h === 1 / m : h !== h && m !== m;
361
+ }
362
+ function x(h, m) {
363
+ this.message = h, this.data = m && typeof m == "object" ? m : {}, this.stack = "";
364
+ }
365
+ x.prototype = Error.prototype;
366
+ function P(h) {
367
+ if (process.env.NODE_ENV !== "production")
368
+ var m = {}, R = 0;
369
+ function E(_, w, T, C, j, $, N) {
370
+ if (C = C || p, $ = $ || T, N !== n) {
371
+ if (u) {
372
+ var d = new Error(
373
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
374
+ );
375
+ throw d.name = "Invariant Violation", d;
376
+ } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
377
+ var F = C + ":" + T;
378
+ !m[F] && // Avoid spamming the console because they are often not actionable except for lib authors
379
+ R < 3 && (s(
380
+ "You are manually calling a React.PropTypes validation function for the `" + $ + "` prop on `" + C + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
381
+ ), m[F] = !0, R++);
382
+ }
383
+ }
384
+ return w[T] == null ? _ ? w[T] === null ? new x("The " + j + " `" + $ + "` is marked as required " + ("in `" + C + "`, but its value is `null`.")) : new x("The " + j + " `" + $ + "` is marked as required in " + ("`" + C + "`, but its value is `undefined`.")) : null : h(w, T, C, j, $);
385
+ }
386
+ var v = E.bind(null, !1);
387
+ return v.isRequired = E.bind(null, !0), v;
388
+ }
389
+ function D(h) {
390
+ function m(R, E, v, _, w, T) {
391
+ var C = R[E], j = Z(C);
392
+ if (j !== h) {
393
+ var $ = J(C);
394
+ return new x(
395
+ "Invalid " + _ + " `" + w + "` of type " + ("`" + $ + "` supplied to `" + v + "`, expected ") + ("`" + h + "`."),
396
+ { expectedType: h }
397
+ );
398
+ }
399
+ return null;
400
+ }
401
+ return P(m);
402
+ }
403
+ function H() {
404
+ return P(c);
405
+ }
406
+ function O(h) {
407
+ function m(R, E, v, _, w) {
408
+ if (typeof h != "function")
409
+ return new x("Property `" + w + "` of component `" + v + "` has invalid PropType notation inside arrayOf.");
410
+ var T = R[E];
411
+ if (!Array.isArray(T)) {
412
+ var C = Z(T);
413
+ return new x("Invalid " + _ + " `" + w + "` of type " + ("`" + C + "` supplied to `" + v + "`, expected an array."));
414
+ }
415
+ for (var j = 0; j < T.length; j++) {
416
+ var $ = h(T, j, v, _, w + "[" + j + "]", n);
417
+ if ($ instanceof Error)
418
+ return $;
419
+ }
420
+ return null;
421
+ }
422
+ return P(m);
423
+ }
424
+ function M() {
425
+ function h(m, R, E, v, _) {
426
+ var w = m[R];
427
+ if (!o(w)) {
428
+ var T = Z(w);
429
+ return new x("Invalid " + v + " `" + _ + "` of type " + ("`" + T + "` supplied to `" + E + "`, expected a single ReactElement."));
430
+ }
431
+ return null;
432
+ }
433
+ return P(h);
434
+ }
435
+ function f() {
436
+ function h(m, R, E, v, _) {
437
+ var w = m[R];
438
+ if (!t.isValidElementType(w)) {
439
+ var T = Z(w);
440
+ return new x("Invalid " + v + " `" + _ + "` of type " + ("`" + T + "` supplied to `" + E + "`, expected a single ReactElement type."));
441
+ }
442
+ return null;
443
+ }
444
+ return P(h);
445
+ }
446
+ function U(h) {
447
+ function m(R, E, v, _, w) {
448
+ if (!(R[E] instanceof h)) {
449
+ var T = h.name || p, C = Te(R[E]);
450
+ return new x("Invalid " + _ + " `" + w + "` of type " + ("`" + C + "` supplied to `" + v + "`, expected ") + ("instance of `" + T + "`."));
451
+ }
452
+ return null;
453
+ }
454
+ return P(m);
455
+ }
456
+ function B(h) {
457
+ if (!Array.isArray(h))
458
+ return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? s(
459
+ "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
460
+ ) : s("Invalid argument supplied to oneOf, expected an array.")), c;
461
+ function m(R, E, v, _, w) {
462
+ for (var T = R[E], C = 0; C < h.length; C++)
463
+ if (y(T, h[C]))
464
+ return null;
465
+ var j = JSON.stringify(h, function(N, d) {
466
+ var F = J(d);
467
+ return F === "symbol" ? String(d) : d;
468
+ });
469
+ return new x("Invalid " + _ + " `" + w + "` of value `" + String(T) + "` " + ("supplied to `" + v + "`, expected one of " + j + "."));
470
+ }
471
+ return P(m);
472
+ }
473
+ function ne(h) {
474
+ function m(R, E, v, _, w) {
475
+ if (typeof h != "function")
476
+ return new x("Property `" + w + "` of component `" + v + "` has invalid PropType notation inside objectOf.");
477
+ var T = R[E], C = Z(T);
478
+ if (C !== "object")
479
+ return new x("Invalid " + _ + " `" + w + "` of type " + ("`" + C + "` supplied to `" + v + "`, expected an object."));
480
+ for (var j in T)
481
+ if (r(T, j)) {
482
+ var $ = h(T, j, v, _, w + "." + j, n);
483
+ if ($ instanceof Error)
484
+ return $;
485
+ }
486
+ return null;
487
+ }
488
+ return P(m);
489
+ }
490
+ function ve(h) {
491
+ if (!Array.isArray(h))
492
+ return process.env.NODE_ENV !== "production" && s("Invalid argument supplied to oneOfType, expected an instance of array."), c;
493
+ for (var m = 0; m < h.length; m++) {
494
+ var R = h[m];
495
+ if (typeof R != "function")
496
+ return s(
497
+ "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + le(R) + " at index " + m + "."
498
+ ), c;
499
+ }
500
+ function E(v, _, w, T, C) {
501
+ for (var j = [], $ = 0; $ < h.length; $++) {
502
+ var N = h[$], d = N(v, _, w, T, C, n);
503
+ if (d == null)
504
+ return null;
505
+ d.data && r(d.data, "expectedType") && j.push(d.data.expectedType);
506
+ }
507
+ var F = j.length > 0 ? ", expected one of type [" + j.join(", ") + "]" : "";
508
+ return new x("Invalid " + T + " `" + C + "` supplied to " + ("`" + w + "`" + F + "."));
509
+ }
510
+ return P(E);
511
+ }
512
+ function ke() {
513
+ function h(m, R, E, v, _) {
514
+ return te(m[R]) ? null : new x("Invalid " + v + " `" + _ + "` supplied to " + ("`" + E + "`, expected a ReactNode."));
515
+ }
516
+ return P(h);
517
+ }
518
+ function ae(h, m, R, E, v) {
519
+ return new x(
520
+ (h || "React class") + ": " + m + " type `" + R + "." + E + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + v + "`."
521
+ );
522
+ }
523
+ function we(h) {
524
+ function m(R, E, v, _, w) {
525
+ var T = R[E], C = Z(T);
526
+ if (C !== "object")
527
+ return new x("Invalid " + _ + " `" + w + "` of type `" + C + "` " + ("supplied to `" + v + "`, expected `object`."));
528
+ for (var j in h) {
529
+ var $ = h[j];
530
+ if (typeof $ != "function")
531
+ return ae(v, _, w, j, J($));
532
+ var N = $(T, j, v, _, w + "." + j, n);
533
+ if (N)
534
+ return N;
535
+ }
536
+ return null;
537
+ }
538
+ return P(m);
539
+ }
540
+ function Se(h) {
541
+ function m(R, E, v, _, w) {
542
+ var T = R[E], C = Z(T);
543
+ if (C !== "object")
544
+ return new x("Invalid " + _ + " `" + w + "` of type `" + C + "` " + ("supplied to `" + v + "`, expected `object`."));
545
+ var j = e({}, R[E], h);
546
+ for (var $ in j) {
547
+ var N = h[$];
548
+ if (r(h, $) && typeof N != "function")
549
+ return ae(v, _, w, $, J(N));
550
+ if (!N)
551
+ return new x(
552
+ "Invalid " + _ + " `" + w + "` key `" + $ + "` supplied to `" + v + "`.\nBad object: " + JSON.stringify(R[E], null, " ") + `
553
+ Valid keys: ` + JSON.stringify(Object.keys(h), null, " ")
554
+ );
555
+ var d = N(T, $, v, _, w + "." + $, n);
556
+ if (d)
557
+ return d;
558
+ }
559
+ return null;
560
+ }
561
+ return P(m);
562
+ }
563
+ function te(h) {
564
+ switch (typeof h) {
565
+ case "number":
566
+ case "string":
567
+ case "undefined":
568
+ return !0;
569
+ case "boolean":
570
+ return !h;
571
+ case "object":
572
+ if (Array.isArray(h))
573
+ return h.every(te);
574
+ if (h === null || o(h))
575
+ return !0;
576
+ var m = g(h);
577
+ if (m) {
578
+ var R = m.call(h), E;
579
+ if (m !== h.entries) {
580
+ for (; !(E = R.next()).done; )
581
+ if (!te(E.value))
582
+ return !1;
583
+ } else
584
+ for (; !(E = R.next()).done; ) {
585
+ var v = E.value;
586
+ if (v && !te(v[1]))
587
+ return !1;
588
+ }
589
+ } else
590
+ return !1;
591
+ return !0;
592
+ default:
593
+ return !1;
594
+ }
595
+ }
596
+ function Ee(h, m) {
597
+ return h === "symbol" ? !0 : m ? m["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && m instanceof Symbol : !1;
598
+ }
599
+ function Z(h) {
600
+ var m = typeof h;
601
+ return Array.isArray(h) ? "array" : h instanceof RegExp ? "object" : Ee(m, h) ? "symbol" : m;
602
+ }
603
+ function J(h) {
604
+ if (typeof h > "u" || h === null)
605
+ return "" + h;
606
+ var m = Z(h);
607
+ if (m === "object") {
608
+ if (h instanceof Date)
609
+ return "date";
610
+ if (h instanceof RegExp)
611
+ return "regexp";
612
+ }
613
+ return m;
614
+ }
615
+ function le(h) {
616
+ var m = J(h);
617
+ switch (m) {
618
+ case "array":
619
+ case "object":
620
+ return "an " + m;
621
+ case "boolean":
622
+ case "date":
623
+ case "regexp":
624
+ return "a " + m;
625
+ default:
626
+ return m;
627
+ }
628
+ }
629
+ function Te(h) {
630
+ return !h.constructor || !h.constructor.name ? p : h.constructor.name;
631
+ }
632
+ return k.checkPropTypes = i, k.resetWarningCache = i.resetWarningCache, k.PropTypes = k, k;
633
+ }, Pe;
634
+ }
635
+ var Oe, pt;
636
+ function Yt() {
637
+ if (pt) return Oe;
638
+ pt = 1;
639
+ var t = Ue();
640
+ function e() {
641
+ }
642
+ function n() {
643
+ }
644
+ return n.resetWarningCache = e, Oe = function() {
645
+ function r(c, o, u, a, l, g) {
646
+ if (g !== t) {
647
+ var p = new Error(
648
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
649
+ );
650
+ throw p.name = "Invariant Violation", p;
651
+ }
652
+ }
653
+ r.isRequired = r;
654
+ function i() {
655
+ return r;
656
+ }
657
+ var s = {
658
+ array: r,
659
+ bigint: r,
660
+ bool: r,
661
+ func: r,
662
+ number: r,
663
+ object: r,
664
+ string: r,
665
+ symbol: r,
666
+ any: r,
667
+ arrayOf: i,
668
+ element: r,
669
+ elementType: r,
670
+ instanceOf: i,
671
+ node: r,
672
+ objectOf: i,
673
+ oneOf: i,
674
+ oneOfType: i,
675
+ shape: i,
676
+ exact: i,
677
+ checkPropTypes: n,
678
+ resetWarningCache: e
679
+ };
680
+ return s.PropTypes = s, s;
681
+ }, Oe;
682
+ }
683
+ if (process.env.NODE_ENV !== "production") {
684
+ var Zt = yt(), Ft = !0;
685
+ Ie.exports = Ht()(Zt.isElement, Ft);
686
+ } else
687
+ Ie.exports = Yt()();
688
+ var Gt = Ie.exports;
689
+ const Y = /* @__PURE__ */ qt(Gt);
690
+ function ze() {
691
+ return ze = Object.assign || function(t) {
692
+ for (var e = 1; e < arguments.length; e++) {
693
+ var n = arguments[e];
694
+ for (var r in n)
695
+ Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
696
+ }
697
+ return t;
698
+ }, ze.apply(this, arguments);
699
+ }
700
+ function Vt(t, e) {
701
+ if (t == null) return {};
702
+ var n = Kt(t, e), r, i;
703
+ if (Object.getOwnPropertySymbols) {
704
+ var s = Object.getOwnPropertySymbols(t);
705
+ for (i = 0; i < s.length; i++)
706
+ r = s[i], !(e.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(t, r) && (n[r] = t[r]);
707
+ }
708
+ return n;
709
+ }
710
+ function Kt(t, e) {
711
+ if (t == null) return {};
712
+ var n = {}, r = Object.keys(t), i, s;
713
+ for (s = 0; s < r.length; s++)
714
+ i = r[s], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
715
+ return n;
716
+ }
717
+ var be = Ne(function(t, e) {
718
+ var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size, s = i === void 0 ? 24 : i, c = Vt(t, ["color", "size"]);
719
+ return /* @__PURE__ */ Q.createElement("svg", ze({
720
+ ref: e,
721
+ xmlns: "http://www.w3.org/2000/svg",
722
+ width: s,
723
+ height: s,
724
+ viewBox: "0 0 24 24",
725
+ fill: "none",
726
+ stroke: r,
727
+ strokeWidth: "2",
728
+ strokeLinecap: "round",
729
+ strokeLinejoin: "round"
730
+ }, c), /* @__PURE__ */ Q.createElement("rect", {
731
+ x: "9",
732
+ y: "9",
733
+ width: "13",
734
+ height: "13",
735
+ rx: "2",
736
+ ry: "2"
737
+ }), /* @__PURE__ */ Q.createElement("path", {
738
+ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
739
+ }));
740
+ });
741
+ be.propTypes = {
742
+ color: Y.string,
743
+ size: Y.oneOfType([Y.string, Y.number])
744
+ };
745
+ be.displayName = "Copy";
746
+ function Le() {
747
+ return Le = Object.assign || function(t) {
748
+ for (var e = 1; e < arguments.length; e++) {
749
+ var n = arguments[e];
750
+ for (var r in n)
751
+ Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
752
+ }
753
+ return t;
754
+ }, Le.apply(this, arguments);
755
+ }
756
+ function Qt(t, e) {
757
+ if (t == null) return {};
758
+ var n = Jt(t, e), r, i;
759
+ if (Object.getOwnPropertySymbols) {
760
+ var s = Object.getOwnPropertySymbols(t);
761
+ for (i = 0; i < s.length; i++)
762
+ r = s[i], !(e.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(t, r) && (n[r] = t[r]);
763
+ }
764
+ return n;
765
+ }
766
+ function Jt(t, e) {
767
+ if (t == null) return {};
768
+ var n = {}, r = Object.keys(t), i, s;
769
+ for (s = 0; s < r.length; s++)
770
+ i = r[s], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
771
+ return n;
772
+ }
773
+ var He = Ne(function(t, e) {
774
+ var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size, s = i === void 0 ? 24 : i, c = Qt(t, ["color", "size"]);
775
+ return /* @__PURE__ */ Q.createElement("svg", Le({
776
+ ref: e,
777
+ xmlns: "http://www.w3.org/2000/svg",
778
+ width: s,
779
+ height: s,
780
+ viewBox: "0 0 24 24",
781
+ fill: "none",
782
+ stroke: r,
783
+ strokeWidth: "2",
784
+ strokeLinecap: "round",
785
+ strokeLinejoin: "round"
786
+ }, c), /* @__PURE__ */ Q.createElement("line", {
787
+ x1: "22",
788
+ y1: "2",
789
+ x2: "11",
790
+ y2: "13"
791
+ }), /* @__PURE__ */ Q.createElement("polygon", {
792
+ points: "22 2 15 22 11 13 2 9 22 2"
793
+ }));
794
+ });
795
+ He.propTypes = {
796
+ color: Y.string,
797
+ size: Y.oneOfType([Y.string, Y.number])
798
+ };
799
+ He.displayName = "Send";
800
+ function je() {
801
+ return je = Object.assign || function(t) {
802
+ for (var e = 1; e < arguments.length; e++) {
803
+ var n = arguments[e];
804
+ for (var r in n)
805
+ Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
806
+ }
807
+ return t;
808
+ }, je.apply(this, arguments);
809
+ }
810
+ function Xt(t, e) {
811
+ if (t == null) return {};
812
+ var n = en(t, e), r, i;
813
+ if (Object.getOwnPropertySymbols) {
814
+ var s = Object.getOwnPropertySymbols(t);
815
+ for (i = 0; i < s.length; i++)
816
+ r = s[i], !(e.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(t, r) && (n[r] = t[r]);
817
+ }
818
+ return n;
819
+ }
820
+ function en(t, e) {
821
+ if (t == null) return {};
822
+ var n = {}, r = Object.keys(t), i, s;
823
+ for (s = 0; s < r.length; s++)
824
+ i = r[s], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
825
+ return n;
826
+ }
827
+ var Ye = Ne(function(t, e) {
828
+ var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size, s = i === void 0 ? 24 : i, c = Xt(t, ["color", "size"]);
829
+ return /* @__PURE__ */ Q.createElement("svg", je({
830
+ ref: e,
831
+ xmlns: "http://www.w3.org/2000/svg",
832
+ width: s,
833
+ height: s,
834
+ viewBox: "0 0 24 24",
835
+ fill: "none",
836
+ stroke: r,
837
+ strokeWidth: "2",
838
+ strokeLinecap: "round",
839
+ strokeLinejoin: "round"
840
+ }, c), /* @__PURE__ */ Q.createElement("circle", {
841
+ cx: "12",
842
+ cy: "12",
843
+ r: "3"
844
+ }), /* @__PURE__ */ Q.createElement("path", {
845
+ d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
846
+ }));
847
+ });
848
+ Ye.propTypes = {
849
+ color: Y.string,
850
+ size: Y.oneOfType([Y.string, Y.number])
851
+ };
852
+ Ye.displayName = "Settings";
853
+ const De = [
854
+ { label: "Korean", value: "KR", extra: "ko" },
855
+ { label: "English", value: "US", extra: "en" },
856
+ { label: "Japanese", value: "JP" },
857
+ { label: "Simplified Chinese", value: "zh-CN", extra: "zh-chs" },
858
+ { label: "Traditional Chinese (Taiwan)", value: "zh-TW" },
859
+ { label: "Traditional Chinese (Hong Kong)", value: "zh-HK", extra: "zh-cht" },
860
+ { label: "Vietnamese", value: "VN", extra: "vi" },
861
+ { label: "Indonesian", value: "ID", extra: "id" }
862
+ ], tn = ({ isGradient: t = !1, stroke: e = 1.5, size: n = 40 }) => {
863
+ const r = "ai-gradient-" + Math.random().toString(36).substr(2, 9);
864
+ return /* @__PURE__ */ b.createElement(
865
+ "svg",
866
+ {
867
+ xmlns: "http://www.w3.org/2000/svg",
868
+ width: n,
869
+ height: n,
870
+ viewBox: "0 0 24 24",
871
+ style: { flexShrink: 0 }
872
+ },
873
+ t && /* @__PURE__ */ b.createElement("defs", null, /* @__PURE__ */ b.createElement("linearGradient", { id: r, x1: "0%", y1: "0%", x2: "0%", y2: "100%" }, /* @__PURE__ */ b.createElement("stop", { offset: "0%", stopColor: "#9D50BB" }, /* @__PURE__ */ b.createElement(
874
+ "animate",
875
+ {
876
+ attributeName: "offset",
877
+ values: "0%;0.4;0%",
878
+ dur: "1s",
879
+ repeatCount: "indefinite"
880
+ }
881
+ )), /* @__PURE__ */ b.createElement("stop", { offset: "30%", stopColor: "#6E48AA" }, /* @__PURE__ */ b.createElement(
882
+ "animate",
883
+ {
884
+ attributeName: "offset",
885
+ values: "0.4;0.7;0.4",
886
+ dur: "1s",
887
+ repeatCount: "indefinite"
888
+ }
889
+ )), /* @__PURE__ */ b.createElement("stop", { offset: "50%", stopColor: "#4776E6" }, /* @__PURE__ */ b.createElement(
890
+ "animate",
891
+ {
892
+ attributeName: "offset",
893
+ values: "0.5;0.7;0.5",
894
+ dur: "1s",
895
+ repeatCount: "indefinite"
896
+ }
897
+ )), /* @__PURE__ */ b.createElement(
898
+ "animateTransform",
899
+ {
900
+ attributeName: "gradientTransform",
901
+ type: "translate",
902
+ from: "0,0",
903
+ to: "100,0",
904
+ dur: "1s",
905
+ repeatCount: "indefinite"
906
+ }
907
+ ))),
908
+ /* @__PURE__ */ b.createElement(
909
+ "path",
910
+ {
911
+ fill: "none",
912
+ stroke: t ? `url(#${r})` : "currentColor",
913
+ strokeLinecap: "round",
914
+ strokeLinejoin: "round",
915
+ strokeWidth: e,
916
+ d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"
917
+ }
918
+ )
919
+ );
920
+ };
921
+ async function nn(t, { setContent: e, setIsLoading: n, setConversationId: r, signer: i, baseUrl: s }) {
922
+ let c = "";
923
+ try {
924
+ n(!0);
925
+ const o = {
926
+ method: "POST",
927
+ baseURL: s,
928
+ url: "/nmail/chatdraft",
929
+ params: t
930
+ };
931
+ let u = {};
932
+ i && typeof i.generateHeaders == "function" && (u = await i.generateHeaders(o));
933
+ const a = await fetch(`${s}/nmail/chatdraft`, {
934
+ method: "POST",
935
+ body: JSON.stringify(t),
936
+ headers: {
937
+ "Content-Type": "application/json",
938
+ "Access-Control-Allow-Origin": "*",
939
+ ...u
940
+ }
941
+ });
942
+ if (n(!1), !a.body)
943
+ throw new Error("Response body is not available for streaming.");
944
+ const l = a.body.getReader();
945
+ let g = "", p = 0;
946
+ for (; ; ) {
947
+ const { done: k, value: y } = await l.read();
948
+ if (k)
949
+ break;
950
+ let x = "", P = "";
951
+ try {
952
+ const D = new TextDecoder().decode(y);
953
+ g += D;
954
+ const H = /"answer":".*?"/g, O = /"conversation_id"\s*:\s*"([^"]+)"/, M = [...g.matchAll(H)], f = g.match(O);
955
+ for (f && f[1] && r(f[1]); p < M.length; ) {
956
+ const U = M[p];
957
+ try {
958
+ x = U[0];
959
+ const B = x.slice(10, x.length - 1);
960
+ P = `"${B}"`, B.endsWith("\\") && (P = `"${B}\\"`);
961
+ const ne = JSON.parse(P);
962
+ c += ne, e(c);
963
+ } catch (B) {
964
+ console.error("Parse error: ", B, x, P);
965
+ }
966
+ p++;
967
+ }
968
+ } catch (D) {
969
+ console.error("TextDecoder error: ", D, x);
970
+ }
971
+ }
972
+ return c;
973
+ } catch (o) {
974
+ console.error("Summary error:", o), e("");
975
+ } finally {
976
+ n(!1);
977
+ }
978
+ return "";
979
+ }
980
+ function Ze() {
981
+ return {
982
+ async: !1,
983
+ breaks: !1,
984
+ extensions: null,
985
+ gfm: !0,
986
+ hooks: null,
987
+ pedantic: !1,
988
+ renderer: null,
989
+ silent: !1,
990
+ tokenizer: null,
991
+ walkTokens: null
992
+ };
993
+ }
994
+ var ee = Ze();
995
+ function vt(t) {
996
+ ee = t;
997
+ }
998
+ var se = { exec: () => null };
999
+ function L(t, e = "") {
1000
+ let n = typeof t == "string" ? t : t.source;
1001
+ const r = {
1002
+ replace: (i, s) => {
1003
+ let c = typeof s == "string" ? s : s.source;
1004
+ return c = c.replace(W.caret, "$1"), n = n.replace(i, c), r;
1005
+ },
1006
+ getRegex: () => new RegExp(n, e)
1007
+ };
1008
+ return r;
1009
+ }
1010
+ var W = {
1011
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
1012
+ outputLinkReplace: /\\([\[\]])/g,
1013
+ indentCodeCompensation: /^(\s+)(?:```)/,
1014
+ beginningSpace: /^\s+/,
1015
+ endingHash: /#$/,
1016
+ startingSpaceChar: /^ /,
1017
+ endingSpaceChar: / $/,
1018
+ nonSpaceChar: /[^ ]/,
1019
+ newLineCharGlobal: /\n/g,
1020
+ tabCharGlobal: /\t/g,
1021
+ multipleSpaceGlobal: /\s+/g,
1022
+ blankLine: /^[ \t]*$/,
1023
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
1024
+ blockquoteStart: /^ {0,3}>/,
1025
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
1026
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
1027
+ listReplaceTabs: /^\t+/,
1028
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
1029
+ listIsTask: /^\[[ xX]\] /,
1030
+ listReplaceTask: /^\[[ xX]\] +/,
1031
+ anyLine: /\n.*\n/,
1032
+ hrefBrackets: /^<(.*)>$/,
1033
+ tableDelimiter: /[:|]/,
1034
+ tableAlignChars: /^\||\| *$/g,
1035
+ tableRowBlankLine: /\n[ \t]*$/,
1036
+ tableAlignRight: /^ *-+: *$/,
1037
+ tableAlignCenter: /^ *:-+: *$/,
1038
+ tableAlignLeft: /^ *:-+ *$/,
1039
+ startATag: /^<a /i,
1040
+ endATag: /^<\/a>/i,
1041
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
1042
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
1043
+ startAngleBracket: /^</,
1044
+ endAngleBracket: />$/,
1045
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
1046
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
1047
+ escapeTest: /[&<>"']/,
1048
+ escapeReplace: /[&<>"']/g,
1049
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
1050
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
1051
+ unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
1052
+ caret: /(^|[^\[])\^/g,
1053
+ percentDecode: /%25/g,
1054
+ findPipe: /\|/g,
1055
+ splitPipe: / \|/,
1056
+ slashPipe: /\\\|/g,
1057
+ carriageReturn: /\r\n|\r/g,
1058
+ spaceLine: /^ +$/gm,
1059
+ notSpaceStart: /^\S*/,
1060
+ endingNewline: /\n$/,
1061
+ listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),
1062
+ nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
1063
+ hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
1064
+ fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`),
1065
+ headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`),
1066
+ htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i")
1067
+ }, rn = /^(?:[ \t]*(?:\n|$))+/, sn = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, on = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, oe = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, an = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Fe = /(?:[*+-]|\d{1,9}[.)])/, kt = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, wt = L(kt).replace(/bull/g, Fe).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ln = L(kt).replace(/bull/g, Fe).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Ge = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, cn = /^[^\n]+/, Ve = /(?!\s*\])(?:\\.|[^\[\]\\])+/, un = L(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ve).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), pn = L(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Fe).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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", Ke = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, hn = L(
1068
+ "^ {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|$))",
1069
+ "i"
1070
+ ).replace("comment", Ke).replace("tag", ye).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), St = L(Ge).replace("hr", oe).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(), fn = L(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", St).getRegex(), Qe = {
1071
+ blockquote: fn,
1072
+ code: sn,
1073
+ def: un,
1074
+ fences: on,
1075
+ heading: an,
1076
+ hr: oe,
1077
+ html: hn,
1078
+ lheading: wt,
1079
+ list: pn,
1080
+ newline: rn,
1081
+ paragraph: St,
1082
+ table: se,
1083
+ text: cn
1084
+ }, ht = L(
1085
+ "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
1086
+ ).replace("hr", oe).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\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(), dn = {
1087
+ ...Qe,
1088
+ lheading: ln,
1089
+ table: ht,
1090
+ paragraph: L(Ge).replace("hr", oe).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ht).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()
1091
+ }, gn = {
1092
+ ...Qe,
1093
+ html: L(
1094
+ `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
1095
+ ).replace("comment", Ke).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(),
1096
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1097
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
1098
+ fences: se,
1099
+ // fences not supported
1100
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
1101
+ paragraph: L(Ge).replace("hr", oe).replace("heading", ` *#{1,6} *[^
1102
+ ]`).replace("lheading", wt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
1103
+ }, mn = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, bn = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Et = /^( {2,}|\\)\n(?!\s*$)/, yn = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, xe = /[\p{P}\p{S}]/u, Je = /[\s\p{P}\p{S}]/u, Tt = /[^\s\p{P}\p{S}]/u, xn = L(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Je).getRegex(), Rt = /(?!~)[\p{P}\p{S}]/u, vn = /(?!~)[\s\p{P}\p{S}]/u, kn = /(?:[^\s\p{P}\p{S}]|~)/u, wn = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, _t = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Sn = L(_t, "u").replace(/punct/g, xe).getRegex(), En = L(_t, "u").replace(/punct/g, Rt).getRegex(), Ct = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Tn = L(Ct, "gu").replace(/notPunctSpace/g, Tt).replace(/punctSpace/g, Je).replace(/punct/g, xe).getRegex(), Rn = L(Ct, "gu").replace(/notPunctSpace/g, kn).replace(/punctSpace/g, vn).replace(/punct/g, Rt).getRegex(), _n = L(
1104
+ "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
1105
+ "gu"
1106
+ ).replace(/notPunctSpace/g, Tt).replace(/punctSpace/g, Je).replace(/punct/g, xe).getRegex(), Cn = L(/\\(punct)/, "gu").replace(/punct/g, xe).getRegex(), $n = L(/^<(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(), Pn = L(Ke).replace("(?:-->|$)", "-->").getRegex(), On = L(
1107
+ "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
1108
+ ).replace("comment", Pn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), de = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, An = L(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", de).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), $t = L(/^!?\[(label)\]\[(ref)\]/).replace("label", de).replace("ref", Ve).getRegex(), Pt = L(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ve).getRegex(), In = L("reflink|nolink(?!\\()", "g").replace("reflink", $t).replace("nolink", Pt).getRegex(), Xe = {
1109
+ _backpedal: se,
1110
+ // only used for GFM url
1111
+ anyPunctuation: Cn,
1112
+ autolink: $n,
1113
+ blockSkip: wn,
1114
+ br: Et,
1115
+ code: bn,
1116
+ del: se,
1117
+ emStrongLDelim: Sn,
1118
+ emStrongRDelimAst: Tn,
1119
+ emStrongRDelimUnd: _n,
1120
+ escape: mn,
1121
+ link: An,
1122
+ nolink: Pt,
1123
+ punctuation: xn,
1124
+ reflink: $t,
1125
+ reflinkSearch: In,
1126
+ tag: On,
1127
+ text: yn,
1128
+ url: se
1129
+ }, zn = {
1130
+ ...Xe,
1131
+ link: L(/^!?\[(label)\]\((.*?)\)/).replace("label", de).getRegex(),
1132
+ reflink: L(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", de).getRegex()
1133
+ }, Me = {
1134
+ ...Xe,
1135
+ emStrongRDelimAst: Rn,
1136
+ emStrongLDelim: En,
1137
+ url: L(/^((?: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(),
1138
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1139
+ del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
1140
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1141
+ }, Ln = {
1142
+ ...Me,
1143
+ br: L(Et).replace("{2,}", "*").getRegex(),
1144
+ text: L(Me.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
1145
+ }, he = {
1146
+ normal: Qe,
1147
+ gfm: dn,
1148
+ pedantic: gn
1149
+ }, re = {
1150
+ normal: Xe,
1151
+ gfm: Me,
1152
+ breaks: Ln,
1153
+ pedantic: zn
1154
+ }, jn = {
1155
+ "&": "&amp;",
1156
+ "<": "&lt;",
1157
+ ">": "&gt;",
1158
+ '"': "&quot;",
1159
+ "'": "&#39;"
1160
+ }, ft = (t) => jn[t];
1161
+ function G(t, e) {
1162
+ if (e) {
1163
+ if (W.escapeTest.test(t))
1164
+ return t.replace(W.escapeReplace, ft);
1165
+ } else if (W.escapeTestNoEncode.test(t))
1166
+ return t.replace(W.escapeReplaceNoEncode, ft);
1167
+ return t;
1168
+ }
1169
+ function dt(t) {
1170
+ try {
1171
+ t = encodeURI(t).replace(W.percentDecode, "%");
1172
+ } catch {
1173
+ return null;
1174
+ }
1175
+ return t;
1176
+ }
1177
+ function gt(t, e) {
1178
+ var s;
1179
+ const n = t.replace(W.findPipe, (c, o, u) => {
1180
+ let a = !1, l = o;
1181
+ for (; --l >= 0 && u[l] === "\\"; ) a = !a;
1182
+ return a ? "|" : " |";
1183
+ }), r = n.split(W.splitPipe);
1184
+ let i = 0;
1185
+ if (r[0].trim() || r.shift(), r.length > 0 && !((s = r.at(-1)) != null && s.trim()) && r.pop(), e)
1186
+ if (r.length > e)
1187
+ r.splice(e);
1188
+ else
1189
+ for (; r.length < e; ) r.push("");
1190
+ for (; i < r.length; i++)
1191
+ r[i] = r[i].trim().replace(W.slashPipe, "|");
1192
+ return r;
1193
+ }
1194
+ function ie(t, e, n) {
1195
+ const r = t.length;
1196
+ if (r === 0)
1197
+ return "";
1198
+ let i = 0;
1199
+ for (; i < r && t.charAt(r - i - 1) === e; )
1200
+ i++;
1201
+ return t.slice(0, r - i);
1202
+ }
1203
+ function Dn(t, e) {
1204
+ if (t.indexOf(e[1]) === -1)
1205
+ return -1;
1206
+ let n = 0;
1207
+ for (let r = 0; r < t.length; r++)
1208
+ if (t[r] === "\\")
1209
+ r++;
1210
+ else if (t[r] === e[0])
1211
+ n++;
1212
+ else if (t[r] === e[1] && (n--, n < 0))
1213
+ return r;
1214
+ return n > 0 ? -2 : -1;
1215
+ }
1216
+ function mt(t, e, n, r, i) {
1217
+ const s = e.href, c = e.title || null, o = t[1].replace(i.other.outputLinkReplace, "$1");
1218
+ r.state.inLink = !0;
1219
+ const u = {
1220
+ type: t[0].charAt(0) === "!" ? "image" : "link",
1221
+ raw: n,
1222
+ href: s,
1223
+ title: c,
1224
+ text: o,
1225
+ tokens: r.inlineTokens(o)
1226
+ };
1227
+ return r.state.inLink = !1, u;
1228
+ }
1229
+ function Mn(t, e, n) {
1230
+ const r = t.match(n.other.indentCodeCompensation);
1231
+ if (r === null)
1232
+ return e;
1233
+ const i = r[1];
1234
+ return e.split(`
1235
+ `).map((s) => {
1236
+ const c = s.match(n.other.beginningSpace);
1237
+ if (c === null)
1238
+ return s;
1239
+ const [o] = c;
1240
+ return o.length >= i.length ? s.slice(i.length) : s;
1241
+ }).join(`
1242
+ `);
1243
+ }
1244
+ var ge = class {
1245
+ // set by the lexer
1246
+ constructor(t) {
1247
+ S(this, "options");
1248
+ S(this, "rules");
1249
+ // set by the lexer
1250
+ S(this, "lexer");
1251
+ this.options = t || ee;
1252
+ }
1253
+ space(t) {
1254
+ const e = this.rules.block.newline.exec(t);
1255
+ if (e && e[0].length > 0)
1256
+ return {
1257
+ type: "space",
1258
+ raw: e[0]
1259
+ };
1260
+ }
1261
+ code(t) {
1262
+ const e = this.rules.block.code.exec(t);
1263
+ if (e) {
1264
+ const n = e[0].replace(this.rules.other.codeRemoveIndent, "");
1265
+ return {
1266
+ type: "code",
1267
+ raw: e[0],
1268
+ codeBlockStyle: "indented",
1269
+ text: this.options.pedantic ? n : ie(n, `
1270
+ `)
1271
+ };
1272
+ }
1273
+ }
1274
+ fences(t) {
1275
+ const e = this.rules.block.fences.exec(t);
1276
+ if (e) {
1277
+ const n = e[0], r = Mn(n, e[3] || "", this.rules);
1278
+ return {
1279
+ type: "code",
1280
+ raw: n,
1281
+ lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2],
1282
+ text: r
1283
+ };
1284
+ }
1285
+ }
1286
+ heading(t) {
1287
+ const e = this.rules.block.heading.exec(t);
1288
+ if (e) {
1289
+ let n = e[2].trim();
1290
+ if (this.rules.other.endingHash.test(n)) {
1291
+ const r = ie(n, "#");
1292
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
1293
+ }
1294
+ return {
1295
+ type: "heading",
1296
+ raw: e[0],
1297
+ depth: e[1].length,
1298
+ text: n,
1299
+ tokens: this.lexer.inline(n)
1300
+ };
1301
+ }
1302
+ }
1303
+ hr(t) {
1304
+ const e = this.rules.block.hr.exec(t);
1305
+ if (e)
1306
+ return {
1307
+ type: "hr",
1308
+ raw: ie(e[0], `
1309
+ `)
1310
+ };
1311
+ }
1312
+ blockquote(t) {
1313
+ const e = this.rules.block.blockquote.exec(t);
1314
+ if (e) {
1315
+ let n = ie(e[0], `
1316
+ `).split(`
1317
+ `), r = "", i = "";
1318
+ const s = [];
1319
+ for (; n.length > 0; ) {
1320
+ let c = !1;
1321
+ const o = [];
1322
+ let u;
1323
+ for (u = 0; u < n.length; u++)
1324
+ if (this.rules.other.blockquoteStart.test(n[u]))
1325
+ o.push(n[u]), c = !0;
1326
+ else if (!c)
1327
+ o.push(n[u]);
1328
+ else
1329
+ break;
1330
+ n = n.slice(u);
1331
+ const a = o.join(`
1332
+ `), l = a.replace(this.rules.other.blockquoteSetextReplace, `
1333
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
1334
+ r = r ? `${r}
1335
+ ${a}` : a, i = i ? `${i}
1336
+ ${l}` : l;
1337
+ const g = this.lexer.state.top;
1338
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(l, s, !0), this.lexer.state.top = g, n.length === 0)
1339
+ break;
1340
+ const p = s.at(-1);
1341
+ if ((p == null ? void 0 : p.type) === "code")
1342
+ break;
1343
+ if ((p == null ? void 0 : p.type) === "blockquote") {
1344
+ const k = p, y = k.raw + `
1345
+ ` + n.join(`
1346
+ `), x = this.blockquote(y);
1347
+ s[s.length - 1] = x, r = r.substring(0, r.length - k.raw.length) + x.raw, i = i.substring(0, i.length - k.text.length) + x.text;
1348
+ break;
1349
+ } else if ((p == null ? void 0 : p.type) === "list") {
1350
+ const k = p, y = k.raw + `
1351
+ ` + n.join(`
1352
+ `), x = this.list(y);
1353
+ s[s.length - 1] = x, r = r.substring(0, r.length - p.raw.length) + x.raw, i = i.substring(0, i.length - k.raw.length) + x.raw, n = y.substring(s.at(-1).raw.length).split(`
1354
+ `);
1355
+ continue;
1356
+ }
1357
+ }
1358
+ return {
1359
+ type: "blockquote",
1360
+ raw: r,
1361
+ tokens: s,
1362
+ text: i
1363
+ };
1364
+ }
1365
+ }
1366
+ list(t) {
1367
+ let e = this.rules.block.list.exec(t);
1368
+ if (e) {
1369
+ let n = e[1].trim();
1370
+ const r = n.length > 1, i = {
1371
+ type: "list",
1372
+ raw: "",
1373
+ ordered: r,
1374
+ start: r ? +n.slice(0, -1) : "",
1375
+ loose: !1,
1376
+ items: []
1377
+ };
1378
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
1379
+ const s = this.rules.other.listItemRegex(n);
1380
+ let c = !1;
1381
+ for (; t; ) {
1382
+ let u = !1, a = "", l = "";
1383
+ if (!(e = s.exec(t)) || this.rules.block.hr.test(t))
1384
+ break;
1385
+ a = e[0], t = t.substring(a.length);
1386
+ let g = e[2].split(`
1387
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (D) => " ".repeat(3 * D.length)), p = t.split(`
1388
+ `, 1)[0], k = !g.trim(), y = 0;
1389
+ if (this.options.pedantic ? (y = 2, l = g.trimStart()) : k ? y = e[1].length + 1 : (y = e[2].search(this.rules.other.nonSpaceChar), y = y > 4 ? 1 : y, l = g.slice(y), y += e[1].length), k && this.rules.other.blankLine.test(p) && (a += p + `
1390
+ `, t = t.substring(p.length + 1), u = !0), !u) {
1391
+ const D = this.rules.other.nextBulletRegex(y), H = this.rules.other.hrRegex(y), O = this.rules.other.fencesBeginRegex(y), M = this.rules.other.headingBeginRegex(y), f = this.rules.other.htmlBeginRegex(y);
1392
+ for (; t; ) {
1393
+ const U = t.split(`
1394
+ `, 1)[0];
1395
+ let B;
1396
+ if (p = U, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), B = p) : B = p.replace(this.rules.other.tabCharGlobal, " "), O.test(p) || M.test(p) || f.test(p) || D.test(p) || H.test(p))
1397
+ break;
1398
+ if (B.search(this.rules.other.nonSpaceChar) >= y || !p.trim())
1399
+ l += `
1400
+ ` + B.slice(y);
1401
+ else {
1402
+ if (k || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || O.test(g) || M.test(g) || H.test(g))
1403
+ break;
1404
+ l += `
1405
+ ` + p;
1406
+ }
1407
+ !k && !p.trim() && (k = !0), a += U + `
1408
+ `, t = t.substring(U.length + 1), g = B.slice(y);
1409
+ }
1410
+ }
1411
+ i.loose || (c ? i.loose = !0 : this.rules.other.doubleBlankLine.test(a) && (c = !0));
1412
+ let x = null, P;
1413
+ this.options.gfm && (x = this.rules.other.listIsTask.exec(l), x && (P = x[0] !== "[ ] ", l = l.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
1414
+ type: "list_item",
1415
+ raw: a,
1416
+ task: !!x,
1417
+ checked: P,
1418
+ loose: !1,
1419
+ text: l,
1420
+ tokens: []
1421
+ }), i.raw += a;
1422
+ }
1423
+ const o = i.items.at(-1);
1424
+ if (o)
1425
+ o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
1426
+ else
1427
+ return;
1428
+ i.raw = i.raw.trimEnd();
1429
+ for (let u = 0; u < i.items.length; u++)
1430
+ if (this.lexer.state.top = !1, i.items[u].tokens = this.lexer.blockTokens(i.items[u].text, []), !i.loose) {
1431
+ const a = i.items[u].tokens.filter((g) => g.type === "space"), l = a.length > 0 && a.some((g) => this.rules.other.anyLine.test(g.raw));
1432
+ i.loose = l;
1433
+ }
1434
+ if (i.loose)
1435
+ for (let u = 0; u < i.items.length; u++)
1436
+ i.items[u].loose = !0;
1437
+ return i;
1438
+ }
1439
+ }
1440
+ html(t) {
1441
+ const e = this.rules.block.html.exec(t);
1442
+ if (e)
1443
+ return {
1444
+ type: "html",
1445
+ block: !0,
1446
+ raw: e[0],
1447
+ pre: e[1] === "pre" || e[1] === "script" || e[1] === "style",
1448
+ text: e[0]
1449
+ };
1450
+ }
1451
+ def(t) {
1452
+ const e = this.rules.block.def.exec(t);
1453
+ if (e) {
1454
+ const n = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
1455
+ return {
1456
+ type: "def",
1457
+ tag: n,
1458
+ raw: e[0],
1459
+ href: r,
1460
+ title: i
1461
+ };
1462
+ }
1463
+ }
1464
+ table(t) {
1465
+ var c;
1466
+ const e = this.rules.block.table.exec(t);
1467
+ if (!e || !this.rules.other.tableDelimiter.test(e[2]))
1468
+ return;
1469
+ const n = gt(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = (c = e[3]) != null && c.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
1470
+ `) : [], s = {
1471
+ type: "table",
1472
+ raw: e[0],
1473
+ header: [],
1474
+ align: [],
1475
+ rows: []
1476
+ };
1477
+ if (n.length === r.length) {
1478
+ for (const o of r)
1479
+ this.rules.other.tableAlignRight.test(o) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? s.align.push("left") : s.align.push(null);
1480
+ for (let o = 0; o < n.length; o++)
1481
+ s.header.push({
1482
+ text: n[o],
1483
+ tokens: this.lexer.inline(n[o]),
1484
+ header: !0,
1485
+ align: s.align[o]
1486
+ });
1487
+ for (const o of i)
1488
+ s.rows.push(gt(o, s.header.length).map((u, a) => ({
1489
+ text: u,
1490
+ tokens: this.lexer.inline(u),
1491
+ header: !1,
1492
+ align: s.align[a]
1493
+ })));
1494
+ return s;
1495
+ }
1496
+ }
1497
+ lheading(t) {
1498
+ const e = this.rules.block.lheading.exec(t);
1499
+ if (e)
1500
+ return {
1501
+ type: "heading",
1502
+ raw: e[0],
1503
+ depth: e[2].charAt(0) === "=" ? 1 : 2,
1504
+ text: e[1],
1505
+ tokens: this.lexer.inline(e[1])
1506
+ };
1507
+ }
1508
+ paragraph(t) {
1509
+ const e = this.rules.block.paragraph.exec(t);
1510
+ if (e) {
1511
+ const n = e[1].charAt(e[1].length - 1) === `
1512
+ ` ? e[1].slice(0, -1) : e[1];
1513
+ return {
1514
+ type: "paragraph",
1515
+ raw: e[0],
1516
+ text: n,
1517
+ tokens: this.lexer.inline(n)
1518
+ };
1519
+ }
1520
+ }
1521
+ text(t) {
1522
+ const e = this.rules.block.text.exec(t);
1523
+ if (e)
1524
+ return {
1525
+ type: "text",
1526
+ raw: e[0],
1527
+ text: e[0],
1528
+ tokens: this.lexer.inline(e[0])
1529
+ };
1530
+ }
1531
+ escape(t) {
1532
+ const e = this.rules.inline.escape.exec(t);
1533
+ if (e)
1534
+ return {
1535
+ type: "escape",
1536
+ raw: e[0],
1537
+ text: e[1]
1538
+ };
1539
+ }
1540
+ tag(t) {
1541
+ const e = this.rules.inline.tag.exec(t);
1542
+ if (e)
1543
+ return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), {
1544
+ type: "html",
1545
+ raw: e[0],
1546
+ inLink: this.lexer.state.inLink,
1547
+ inRawBlock: this.lexer.state.inRawBlock,
1548
+ block: !1,
1549
+ text: e[0]
1550
+ };
1551
+ }
1552
+ link(t) {
1553
+ const e = this.rules.inline.link.exec(t);
1554
+ if (e) {
1555
+ const n = e[2].trim();
1556
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
1557
+ if (!this.rules.other.endAngleBracket.test(n))
1558
+ return;
1559
+ const s = ie(n.slice(0, -1), "\\");
1560
+ if ((n.length - s.length) % 2 === 0)
1561
+ return;
1562
+ } else {
1563
+ const s = Dn(e[2], "()");
1564
+ if (s === -2)
1565
+ return;
1566
+ if (s > -1) {
1567
+ const o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + s;
1568
+ e[2] = e[2].substring(0, s), e[0] = e[0].substring(0, o).trim(), e[3] = "";
1569
+ }
1570
+ }
1571
+ let r = e[2], i = "";
1572
+ if (this.options.pedantic) {
1573
+ const s = this.rules.other.pedanticHrefTitle.exec(r);
1574
+ s && (r = s[1], i = s[3]);
1575
+ } else
1576
+ i = e[3] ? e[3].slice(1, -1) : "";
1577
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), mt(e, {
1578
+ href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
1579
+ title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
1580
+ }, e[0], this.lexer, this.rules);
1581
+ }
1582
+ }
1583
+ reflink(t, e) {
1584
+ let n;
1585
+ if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
1586
+ const r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = e[r.toLowerCase()];
1587
+ if (!i) {
1588
+ const s = n[0].charAt(0);
1589
+ return {
1590
+ type: "text",
1591
+ raw: s,
1592
+ text: s
1593
+ };
1594
+ }
1595
+ return mt(n, i, n[0], this.lexer, this.rules);
1596
+ }
1597
+ }
1598
+ emStrong(t, e, n = "") {
1599
+ let r = this.rules.inline.emStrongLDelim.exec(t);
1600
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
1601
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1602
+ const s = [...r[0]].length - 1;
1603
+ let c, o, u = s, a = 0;
1604
+ const l = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1605
+ for (l.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = l.exec(e)) != null; ) {
1606
+ if (c = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !c) continue;
1607
+ if (o = [...c].length, r[3] || r[4]) {
1608
+ u += o;
1609
+ continue;
1610
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
1611
+ a += o;
1612
+ continue;
1613
+ }
1614
+ if (u -= o, u > 0) continue;
1615
+ o = Math.min(o, o + u + a);
1616
+ const g = [...r[0]][0].length, p = t.slice(0, s + r.index + g + o);
1617
+ if (Math.min(s, o) % 2) {
1618
+ const y = p.slice(1, -1);
1619
+ return {
1620
+ type: "em",
1621
+ raw: p,
1622
+ text: y,
1623
+ tokens: this.lexer.inlineTokens(y)
1624
+ };
1625
+ }
1626
+ const k = p.slice(2, -2);
1627
+ return {
1628
+ type: "strong",
1629
+ raw: p,
1630
+ text: k,
1631
+ tokens: this.lexer.inlineTokens(k)
1632
+ };
1633
+ }
1634
+ }
1635
+ }
1636
+ codespan(t) {
1637
+ const e = this.rules.inline.code.exec(t);
1638
+ if (e) {
1639
+ let n = e[2].replace(this.rules.other.newLineCharGlobal, " ");
1640
+ const r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
1641
+ return r && i && (n = n.substring(1, n.length - 1)), {
1642
+ type: "codespan",
1643
+ raw: e[0],
1644
+ text: n
1645
+ };
1646
+ }
1647
+ }
1648
+ br(t) {
1649
+ const e = this.rules.inline.br.exec(t);
1650
+ if (e)
1651
+ return {
1652
+ type: "br",
1653
+ raw: e[0]
1654
+ };
1655
+ }
1656
+ del(t) {
1657
+ const e = this.rules.inline.del.exec(t);
1658
+ if (e)
1659
+ return {
1660
+ type: "del",
1661
+ raw: e[0],
1662
+ text: e[2],
1663
+ tokens: this.lexer.inlineTokens(e[2])
1664
+ };
1665
+ }
1666
+ autolink(t) {
1667
+ const e = this.rules.inline.autolink.exec(t);
1668
+ if (e) {
1669
+ let n, r;
1670
+ return e[2] === "@" ? (n = e[1], r = "mailto:" + n) : (n = e[1], r = n), {
1671
+ type: "link",
1672
+ raw: e[0],
1673
+ text: n,
1674
+ href: r,
1675
+ tokens: [
1676
+ {
1677
+ type: "text",
1678
+ raw: n,
1679
+ text: n
1680
+ }
1681
+ ]
1682
+ };
1683
+ }
1684
+ }
1685
+ url(t) {
1686
+ var n;
1687
+ let e;
1688
+ if (e = this.rules.inline.url.exec(t)) {
1689
+ let r, i;
1690
+ if (e[2] === "@")
1691
+ r = e[0], i = "mailto:" + r;
1692
+ else {
1693
+ let s;
1694
+ do
1695
+ s = e[0], e[0] = ((n = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : n[0]) ?? "";
1696
+ while (s !== e[0]);
1697
+ r = e[0], e[1] === "www." ? i = "http://" + e[0] : i = e[0];
1698
+ }
1699
+ return {
1700
+ type: "link",
1701
+ raw: e[0],
1702
+ text: r,
1703
+ href: i,
1704
+ tokens: [
1705
+ {
1706
+ type: "text",
1707
+ raw: r,
1708
+ text: r
1709
+ }
1710
+ ]
1711
+ };
1712
+ }
1713
+ }
1714
+ inlineText(t) {
1715
+ const e = this.rules.inline.text.exec(t);
1716
+ if (e) {
1717
+ const n = this.lexer.state.inRawBlock;
1718
+ return {
1719
+ type: "text",
1720
+ raw: e[0],
1721
+ text: e[0],
1722
+ escaped: n
1723
+ };
1724
+ }
1725
+ }
1726
+ }, V = class qe {
1727
+ constructor(e) {
1728
+ S(this, "tokens");
1729
+ S(this, "options");
1730
+ S(this, "state");
1731
+ S(this, "tokenizer");
1732
+ S(this, "inlineQueue");
1733
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ee, 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 = {
1734
+ inLink: !1,
1735
+ inRawBlock: !1,
1736
+ top: !0
1737
+ };
1738
+ const n = {
1739
+ other: W,
1740
+ block: he.normal,
1741
+ inline: re.normal
1742
+ };
1743
+ this.options.pedantic ? (n.block = he.pedantic, n.inline = re.pedantic) : this.options.gfm && (n.block = he.gfm, this.options.breaks ? n.inline = re.breaks : n.inline = re.gfm), this.tokenizer.rules = n;
1744
+ }
1745
+ /**
1746
+ * Expose Rules
1747
+ */
1748
+ static get rules() {
1749
+ return {
1750
+ block: he,
1751
+ inline: re
1752
+ };
1753
+ }
1754
+ /**
1755
+ * Static Lex Method
1756
+ */
1757
+ static lex(e, n) {
1758
+ return new qe(n).lex(e);
1759
+ }
1760
+ /**
1761
+ * Static Lex Inline Method
1762
+ */
1763
+ static lexInline(e, n) {
1764
+ return new qe(n).inlineTokens(e);
1765
+ }
1766
+ /**
1767
+ * Preprocessing
1768
+ */
1769
+ lex(e) {
1770
+ e = e.replace(W.carriageReturn, `
1771
+ `), this.blockTokens(e, this.tokens);
1772
+ for (let n = 0; n < this.inlineQueue.length; n++) {
1773
+ const r = this.inlineQueue[n];
1774
+ this.inlineTokens(r.src, r.tokens);
1775
+ }
1776
+ return this.inlineQueue = [], this.tokens;
1777
+ }
1778
+ blockTokens(e, n = [], r = !1) {
1779
+ var i, s, c;
1780
+ for (this.options.pedantic && (e = e.replace(W.tabCharGlobal, " ").replace(W.spaceLine, "")); e; ) {
1781
+ let o;
1782
+ if ((s = (i = this.options.extensions) == null ? void 0 : i.block) != null && s.some((a) => (o = a.call({ lexer: this }, e, n)) ? (e = e.substring(o.raw.length), n.push(o), !0) : !1))
1783
+ continue;
1784
+ if (o = this.tokenizer.space(e)) {
1785
+ e = e.substring(o.raw.length);
1786
+ const a = n.at(-1);
1787
+ o.raw.length === 1 && a !== void 0 ? a.raw += `
1788
+ ` : n.push(o);
1789
+ continue;
1790
+ }
1791
+ if (o = this.tokenizer.code(e)) {
1792
+ e = e.substring(o.raw.length);
1793
+ const a = n.at(-1);
1794
+ (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
1795
+ ` + o.raw, a.text += `
1796
+ ` + o.text, this.inlineQueue.at(-1).src = a.text) : n.push(o);
1797
+ continue;
1798
+ }
1799
+ if (o = this.tokenizer.fences(e)) {
1800
+ e = e.substring(o.raw.length), n.push(o);
1801
+ continue;
1802
+ }
1803
+ if (o = this.tokenizer.heading(e)) {
1804
+ e = e.substring(o.raw.length), n.push(o);
1805
+ continue;
1806
+ }
1807
+ if (o = this.tokenizer.hr(e)) {
1808
+ e = e.substring(o.raw.length), n.push(o);
1809
+ continue;
1810
+ }
1811
+ if (o = this.tokenizer.blockquote(e)) {
1812
+ e = e.substring(o.raw.length), n.push(o);
1813
+ continue;
1814
+ }
1815
+ if (o = this.tokenizer.list(e)) {
1816
+ e = e.substring(o.raw.length), n.push(o);
1817
+ continue;
1818
+ }
1819
+ if (o = this.tokenizer.html(e)) {
1820
+ e = e.substring(o.raw.length), n.push(o);
1821
+ continue;
1822
+ }
1823
+ if (o = this.tokenizer.def(e)) {
1824
+ e = e.substring(o.raw.length);
1825
+ const a = n.at(-1);
1826
+ (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
1827
+ ` + o.raw, a.text += `
1828
+ ` + o.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[o.tag] || (this.tokens.links[o.tag] = {
1829
+ href: o.href,
1830
+ title: o.title
1831
+ });
1832
+ continue;
1833
+ }
1834
+ if (o = this.tokenizer.table(e)) {
1835
+ e = e.substring(o.raw.length), n.push(o);
1836
+ continue;
1837
+ }
1838
+ if (o = this.tokenizer.lheading(e)) {
1839
+ e = e.substring(o.raw.length), n.push(o);
1840
+ continue;
1841
+ }
1842
+ let u = e;
1843
+ if ((c = this.options.extensions) != null && c.startBlock) {
1844
+ let a = 1 / 0;
1845
+ const l = e.slice(1);
1846
+ let g;
1847
+ this.options.extensions.startBlock.forEach((p) => {
1848
+ g = p.call({ lexer: this }, l), typeof g == "number" && g >= 0 && (a = Math.min(a, g));
1849
+ }), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
1850
+ }
1851
+ if (this.state.top && (o = this.tokenizer.paragraph(u))) {
1852
+ const a = n.at(-1);
1853
+ r && (a == null ? void 0 : a.type) === "paragraph" ? (a.raw += `
1854
+ ` + o.raw, a.text += `
1855
+ ` + o.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : n.push(o), r = u.length !== e.length, e = e.substring(o.raw.length);
1856
+ continue;
1857
+ }
1858
+ if (o = this.tokenizer.text(e)) {
1859
+ e = e.substring(o.raw.length);
1860
+ const a = n.at(-1);
1861
+ (a == null ? void 0 : a.type) === "text" ? (a.raw += `
1862
+ ` + o.raw, a.text += `
1863
+ ` + o.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : n.push(o);
1864
+ continue;
1865
+ }
1866
+ if (e) {
1867
+ const a = "Infinite loop on byte: " + e.charCodeAt(0);
1868
+ if (this.options.silent) {
1869
+ console.error(a);
1870
+ break;
1871
+ } else
1872
+ throw new Error(a);
1873
+ }
1874
+ }
1875
+ return this.state.top = !0, n;
1876
+ }
1877
+ inline(e, n = []) {
1878
+ return this.inlineQueue.push({ src: e, tokens: n }), n;
1879
+ }
1880
+ /**
1881
+ * Lexing/Compiling
1882
+ */
1883
+ inlineTokens(e, n = []) {
1884
+ var o, u, a;
1885
+ let r = e, i = null;
1886
+ if (this.tokens.links) {
1887
+ const l = Object.keys(this.tokens.links);
1888
+ if (l.length > 0)
1889
+ for (; (i = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
1890
+ l.includes(i[0].slice(i[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1891
+ }
1892
+ for (; (i = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; )
1893
+ r = r.slice(0, i.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1894
+ for (; (i = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
1895
+ r = r.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1896
+ let s = !1, c = "";
1897
+ for (; e; ) {
1898
+ s || (c = ""), s = !1;
1899
+ let l;
1900
+ if ((u = (o = this.options.extensions) == null ? void 0 : o.inline) != null && u.some((p) => (l = p.call({ lexer: this }, e, n)) ? (e = e.substring(l.raw.length), n.push(l), !0) : !1))
1901
+ continue;
1902
+ if (l = this.tokenizer.escape(e)) {
1903
+ e = e.substring(l.raw.length), n.push(l);
1904
+ continue;
1905
+ }
1906
+ if (l = this.tokenizer.tag(e)) {
1907
+ e = e.substring(l.raw.length), n.push(l);
1908
+ continue;
1909
+ }
1910
+ if (l = this.tokenizer.link(e)) {
1911
+ e = e.substring(l.raw.length), n.push(l);
1912
+ continue;
1913
+ }
1914
+ if (l = this.tokenizer.reflink(e, this.tokens.links)) {
1915
+ e = e.substring(l.raw.length);
1916
+ const p = n.at(-1);
1917
+ l.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += l.raw, p.text += l.text) : n.push(l);
1918
+ continue;
1919
+ }
1920
+ if (l = this.tokenizer.emStrong(e, r, c)) {
1921
+ e = e.substring(l.raw.length), n.push(l);
1922
+ continue;
1923
+ }
1924
+ if (l = this.tokenizer.codespan(e)) {
1925
+ e = e.substring(l.raw.length), n.push(l);
1926
+ continue;
1927
+ }
1928
+ if (l = this.tokenizer.br(e)) {
1929
+ e = e.substring(l.raw.length), n.push(l);
1930
+ continue;
1931
+ }
1932
+ if (l = this.tokenizer.del(e)) {
1933
+ e = e.substring(l.raw.length), n.push(l);
1934
+ continue;
1935
+ }
1936
+ if (l = this.tokenizer.autolink(e)) {
1937
+ e = e.substring(l.raw.length), n.push(l);
1938
+ continue;
1939
+ }
1940
+ if (!this.state.inLink && (l = this.tokenizer.url(e))) {
1941
+ e = e.substring(l.raw.length), n.push(l);
1942
+ continue;
1943
+ }
1944
+ let g = e;
1945
+ if ((a = this.options.extensions) != null && a.startInline) {
1946
+ let p = 1 / 0;
1947
+ const k = e.slice(1);
1948
+ let y;
1949
+ this.options.extensions.startInline.forEach((x) => {
1950
+ y = x.call({ lexer: this }, k), typeof y == "number" && y >= 0 && (p = Math.min(p, y));
1951
+ }), p < 1 / 0 && p >= 0 && (g = e.substring(0, p + 1));
1952
+ }
1953
+ if (l = this.tokenizer.inlineText(g)) {
1954
+ e = e.substring(l.raw.length), l.raw.slice(-1) !== "_" && (c = l.raw.slice(-1)), s = !0;
1955
+ const p = n.at(-1);
1956
+ (p == null ? void 0 : p.type) === "text" ? (p.raw += l.raw, p.text += l.text) : n.push(l);
1957
+ continue;
1958
+ }
1959
+ if (e) {
1960
+ const p = "Infinite loop on byte: " + e.charCodeAt(0);
1961
+ if (this.options.silent) {
1962
+ console.error(p);
1963
+ break;
1964
+ } else
1965
+ throw new Error(p);
1966
+ }
1967
+ }
1968
+ return n;
1969
+ }
1970
+ }, me = class {
1971
+ // set by the parser
1972
+ constructor(t) {
1973
+ S(this, "options");
1974
+ S(this, "parser");
1975
+ this.options = t || ee;
1976
+ }
1977
+ space(t) {
1978
+ return "";
1979
+ }
1980
+ code({ text: t, lang: e, escaped: n }) {
1981
+ var s;
1982
+ const r = (s = (e || "").match(W.notSpaceStart)) == null ? void 0 : s[0], i = t.replace(W.endingNewline, "") + `
1983
+ `;
1984
+ return r ? '<pre><code class="language-' + G(r) + '">' + (n ? i : G(i, !0)) + `</code></pre>
1985
+ ` : "<pre><code>" + (n ? i : G(i, !0)) + `</code></pre>
1986
+ `;
1987
+ }
1988
+ blockquote({ tokens: t }) {
1989
+ return `<blockquote>
1990
+ ${this.parser.parse(t)}</blockquote>
1991
+ `;
1992
+ }
1993
+ html({ text: t }) {
1994
+ return t;
1995
+ }
1996
+ heading({ tokens: t, depth: e }) {
1997
+ return `<h${e}>${this.parser.parseInline(t)}</h${e}>
1998
+ `;
1999
+ }
2000
+ hr(t) {
2001
+ return `<hr>
2002
+ `;
2003
+ }
2004
+ list(t) {
2005
+ const e = t.ordered, n = t.start;
2006
+ let r = "";
2007
+ for (let c = 0; c < t.items.length; c++) {
2008
+ const o = t.items[c];
2009
+ r += this.listitem(o);
2010
+ }
2011
+ const i = e ? "ol" : "ul", s = e && n !== 1 ? ' start="' + n + '"' : "";
2012
+ return "<" + i + s + `>
2013
+ ` + r + "</" + i + `>
2014
+ `;
2015
+ }
2016
+ listitem(t) {
2017
+ var n;
2018
+ let e = "";
2019
+ if (t.task) {
2020
+ const r = this.checkbox({ checked: !!t.checked });
2021
+ t.loose ? ((n = t.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (t.tokens[0].text = r + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = r + " " + G(t.tokens[0].tokens[0].text), t.tokens[0].tokens[0].escaped = !0)) : t.tokens.unshift({
2022
+ type: "text",
2023
+ raw: r + " ",
2024
+ text: r + " ",
2025
+ escaped: !0
2026
+ }) : e += r + " ";
2027
+ }
2028
+ return e += this.parser.parse(t.tokens, !!t.loose), `<li>${e}</li>
2029
+ `;
2030
+ }
2031
+ checkbox({ checked: t }) {
2032
+ return "<input " + (t ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
2033
+ }
2034
+ paragraph({ tokens: t }) {
2035
+ return `<p>${this.parser.parseInline(t)}</p>
2036
+ `;
2037
+ }
2038
+ table(t) {
2039
+ let e = "", n = "";
2040
+ for (let i = 0; i < t.header.length; i++)
2041
+ n += this.tablecell(t.header[i]);
2042
+ e += this.tablerow({ text: n });
2043
+ let r = "";
2044
+ for (let i = 0; i < t.rows.length; i++) {
2045
+ const s = t.rows[i];
2046
+ n = "";
2047
+ for (let c = 0; c < s.length; c++)
2048
+ n += this.tablecell(s[c]);
2049
+ r += this.tablerow({ text: n });
2050
+ }
2051
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
2052
+ <thead>
2053
+ ` + e + `</thead>
2054
+ ` + r + `</table>
2055
+ `;
2056
+ }
2057
+ tablerow({ text: t }) {
2058
+ return `<tr>
2059
+ ${t}</tr>
2060
+ `;
2061
+ }
2062
+ tablecell(t) {
2063
+ const e = this.parser.parseInline(t.tokens), n = t.header ? "th" : "td";
2064
+ return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
2065
+ `;
2066
+ }
2067
+ /**
2068
+ * span level renderer
2069
+ */
2070
+ strong({ tokens: t }) {
2071
+ return `<strong>${this.parser.parseInline(t)}</strong>`;
2072
+ }
2073
+ em({ tokens: t }) {
2074
+ return `<em>${this.parser.parseInline(t)}</em>`;
2075
+ }
2076
+ codespan({ text: t }) {
2077
+ return `<code>${G(t, !0)}</code>`;
2078
+ }
2079
+ br(t) {
2080
+ return "<br>";
2081
+ }
2082
+ del({ tokens: t }) {
2083
+ return `<del>${this.parser.parseInline(t)}</del>`;
2084
+ }
2085
+ link({ href: t, title: e, tokens: n }) {
2086
+ const r = this.parser.parseInline(n), i = dt(t);
2087
+ if (i === null)
2088
+ return r;
2089
+ t = i;
2090
+ let s = '<a href="' + t + '"';
2091
+ return e && (s += ' title="' + G(e) + '"'), s += ">" + r + "</a>", s;
2092
+ }
2093
+ image({ href: t, title: e, text: n, tokens: r }) {
2094
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
2095
+ const i = dt(t);
2096
+ if (i === null)
2097
+ return G(n);
2098
+ t = i;
2099
+ let s = `<img src="${t}" alt="${n}"`;
2100
+ return e && (s += ` title="${G(e)}"`), s += ">", s;
2101
+ }
2102
+ text(t) {
2103
+ return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : G(t.text);
2104
+ }
2105
+ }, et = class {
2106
+ // no need for block level renderers
2107
+ strong({ text: t }) {
2108
+ return t;
2109
+ }
2110
+ em({ text: t }) {
2111
+ return t;
2112
+ }
2113
+ codespan({ text: t }) {
2114
+ return t;
2115
+ }
2116
+ del({ text: t }) {
2117
+ return t;
2118
+ }
2119
+ html({ text: t }) {
2120
+ return t;
2121
+ }
2122
+ text({ text: t }) {
2123
+ return t;
2124
+ }
2125
+ link({ text: t }) {
2126
+ return "" + t;
2127
+ }
2128
+ image({ text: t }) {
2129
+ return "" + t;
2130
+ }
2131
+ br() {
2132
+ return "";
2133
+ }
2134
+ }, K = class Be {
2135
+ constructor(e) {
2136
+ S(this, "options");
2137
+ S(this, "renderer");
2138
+ S(this, "textRenderer");
2139
+ this.options = e || ee, this.options.renderer = this.options.renderer || new me(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new et();
2140
+ }
2141
+ /**
2142
+ * Static Parse Method
2143
+ */
2144
+ static parse(e, n) {
2145
+ return new Be(n).parse(e);
2146
+ }
2147
+ /**
2148
+ * Static Parse Inline Method
2149
+ */
2150
+ static parseInline(e, n) {
2151
+ return new Be(n).parseInline(e);
2152
+ }
2153
+ /**
2154
+ * Parse Loop
2155
+ */
2156
+ parse(e, n = !0) {
2157
+ var i, s;
2158
+ let r = "";
2159
+ for (let c = 0; c < e.length; c++) {
2160
+ const o = e[c];
2161
+ if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[o.type]) {
2162
+ const a = o, l = this.options.extensions.renderers[a.type].call({ parser: this }, a);
2163
+ if (l !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
2164
+ r += l || "";
2165
+ continue;
2166
+ }
2167
+ }
2168
+ const u = o;
2169
+ switch (u.type) {
2170
+ case "space": {
2171
+ r += this.renderer.space(u);
2172
+ continue;
2173
+ }
2174
+ case "hr": {
2175
+ r += this.renderer.hr(u);
2176
+ continue;
2177
+ }
2178
+ case "heading": {
2179
+ r += this.renderer.heading(u);
2180
+ continue;
2181
+ }
2182
+ case "code": {
2183
+ r += this.renderer.code(u);
2184
+ continue;
2185
+ }
2186
+ case "table": {
2187
+ r += this.renderer.table(u);
2188
+ continue;
2189
+ }
2190
+ case "blockquote": {
2191
+ r += this.renderer.blockquote(u);
2192
+ continue;
2193
+ }
2194
+ case "list": {
2195
+ r += this.renderer.list(u);
2196
+ continue;
2197
+ }
2198
+ case "html": {
2199
+ r += this.renderer.html(u);
2200
+ continue;
2201
+ }
2202
+ case "paragraph": {
2203
+ r += this.renderer.paragraph(u);
2204
+ continue;
2205
+ }
2206
+ case "text": {
2207
+ let a = u, l = this.renderer.text(a);
2208
+ for (; c + 1 < e.length && e[c + 1].type === "text"; )
2209
+ a = e[++c], l += `
2210
+ ` + this.renderer.text(a);
2211
+ n ? r += this.renderer.paragraph({
2212
+ type: "paragraph",
2213
+ raw: l,
2214
+ text: l,
2215
+ tokens: [{ type: "text", raw: l, text: l, escaped: !0 }]
2216
+ }) : r += l;
2217
+ continue;
2218
+ }
2219
+ default: {
2220
+ const a = 'Token with "' + u.type + '" type was not found.';
2221
+ if (this.options.silent)
2222
+ return console.error(a), "";
2223
+ throw new Error(a);
2224
+ }
2225
+ }
2226
+ }
2227
+ return r;
2228
+ }
2229
+ /**
2230
+ * Parse Inline Tokens
2231
+ */
2232
+ parseInline(e, n = this.renderer) {
2233
+ var i, s;
2234
+ let r = "";
2235
+ for (let c = 0; c < e.length; c++) {
2236
+ const o = e[c];
2237
+ if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[o.type]) {
2238
+ const a = this.options.extensions.renderers[o.type].call({ parser: this }, o);
2239
+ if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(o.type)) {
2240
+ r += a || "";
2241
+ continue;
2242
+ }
2243
+ }
2244
+ const u = o;
2245
+ switch (u.type) {
2246
+ case "escape": {
2247
+ r += n.text(u);
2248
+ break;
2249
+ }
2250
+ case "html": {
2251
+ r += n.html(u);
2252
+ break;
2253
+ }
2254
+ case "link": {
2255
+ r += n.link(u);
2256
+ break;
2257
+ }
2258
+ case "image": {
2259
+ r += n.image(u);
2260
+ break;
2261
+ }
2262
+ case "strong": {
2263
+ r += n.strong(u);
2264
+ break;
2265
+ }
2266
+ case "em": {
2267
+ r += n.em(u);
2268
+ break;
2269
+ }
2270
+ case "codespan": {
2271
+ r += n.codespan(u);
2272
+ break;
2273
+ }
2274
+ case "br": {
2275
+ r += n.br(u);
2276
+ break;
2277
+ }
2278
+ case "del": {
2279
+ r += n.del(u);
2280
+ break;
2281
+ }
2282
+ case "text": {
2283
+ r += n.text(u);
2284
+ break;
2285
+ }
2286
+ default: {
2287
+ const a = 'Token with "' + u.type + '" type was not found.';
2288
+ if (this.options.silent)
2289
+ return console.error(a), "";
2290
+ throw new Error(a);
2291
+ }
2292
+ }
2293
+ }
2294
+ return r;
2295
+ }
2296
+ }, Ae, fe = (Ae = class {
2297
+ constructor(t) {
2298
+ S(this, "options");
2299
+ S(this, "block");
2300
+ this.options = t || ee;
2301
+ }
2302
+ /**
2303
+ * Process markdown before marked
2304
+ */
2305
+ preprocess(t) {
2306
+ return t;
2307
+ }
2308
+ /**
2309
+ * Process HTML after marked is finished
2310
+ */
2311
+ postprocess(t) {
2312
+ return t;
2313
+ }
2314
+ /**
2315
+ * Process all tokens before walk tokens
2316
+ */
2317
+ processAllTokens(t) {
2318
+ return t;
2319
+ }
2320
+ /**
2321
+ * Provide function to tokenize markdown
2322
+ */
2323
+ provideLexer() {
2324
+ return this.block ? V.lex : V.lexInline;
2325
+ }
2326
+ /**
2327
+ * Provide function to parse tokens
2328
+ */
2329
+ provideParser() {
2330
+ return this.block ? K.parse : K.parseInline;
2331
+ }
2332
+ }, S(Ae, "passThroughHooks", /* @__PURE__ */ new Set([
2333
+ "preprocess",
2334
+ "postprocess",
2335
+ "processAllTokens"
2336
+ ])), Ae), qn = class {
2337
+ constructor(...t) {
2338
+ S(this, "defaults", Ze());
2339
+ S(this, "options", this.setOptions);
2340
+ S(this, "parse", this.parseMarkdown(!0));
2341
+ S(this, "parseInline", this.parseMarkdown(!1));
2342
+ S(this, "Parser", K);
2343
+ S(this, "Renderer", me);
2344
+ S(this, "TextRenderer", et);
2345
+ S(this, "Lexer", V);
2346
+ S(this, "Tokenizer", ge);
2347
+ S(this, "Hooks", fe);
2348
+ this.use(...t);
2349
+ }
2350
+ /**
2351
+ * Run callback for every token
2352
+ */
2353
+ walkTokens(t, e) {
2354
+ var r, i;
2355
+ let n = [];
2356
+ for (const s of t)
2357
+ switch (n = n.concat(e.call(this, s)), s.type) {
2358
+ case "table": {
2359
+ const c = s;
2360
+ for (const o of c.header)
2361
+ n = n.concat(this.walkTokens(o.tokens, e));
2362
+ for (const o of c.rows)
2363
+ for (const u of o)
2364
+ n = n.concat(this.walkTokens(u.tokens, e));
2365
+ break;
2366
+ }
2367
+ case "list": {
2368
+ const c = s;
2369
+ n = n.concat(this.walkTokens(c.items, e));
2370
+ break;
2371
+ }
2372
+ default: {
2373
+ const c = s;
2374
+ (i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[c.type] ? this.defaults.extensions.childTokens[c.type].forEach((o) => {
2375
+ const u = c[o].flat(1 / 0);
2376
+ n = n.concat(this.walkTokens(u, e));
2377
+ }) : c.tokens && (n = n.concat(this.walkTokens(c.tokens, e)));
2378
+ }
2379
+ }
2380
+ return n;
2381
+ }
2382
+ use(...t) {
2383
+ const e = this.defaults.extensions || { renderers: {}, childTokens: {} };
2384
+ return t.forEach((n) => {
2385
+ const r = { ...n };
2386
+ if (r.async = this.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((i) => {
2387
+ if (!i.name)
2388
+ throw new Error("extension name required");
2389
+ if ("renderer" in i) {
2390
+ const s = e.renderers[i.name];
2391
+ s ? e.renderers[i.name] = function(...c) {
2392
+ let o = i.renderer.apply(this, c);
2393
+ return o === !1 && (o = s.apply(this, c)), o;
2394
+ } : e.renderers[i.name] = i.renderer;
2395
+ }
2396
+ if ("tokenizer" in i) {
2397
+ if (!i.level || i.level !== "block" && i.level !== "inline")
2398
+ throw new Error("extension level must be 'block' or 'inline'");
2399
+ const s = e[i.level];
2400
+ s ? s.unshift(i.tokenizer) : e[i.level] = [i.tokenizer], i.start && (i.level === "block" ? e.startBlock ? e.startBlock.push(i.start) : e.startBlock = [i.start] : i.level === "inline" && (e.startInline ? e.startInline.push(i.start) : e.startInline = [i.start]));
2401
+ }
2402
+ "childTokens" in i && i.childTokens && (e.childTokens[i.name] = i.childTokens);
2403
+ }), r.extensions = e), n.renderer) {
2404
+ const i = this.defaults.renderer || new me(this.defaults);
2405
+ for (const s in n.renderer) {
2406
+ if (!(s in i))
2407
+ throw new Error(`renderer '${s}' does not exist`);
2408
+ if (["options", "parser"].includes(s))
2409
+ continue;
2410
+ const c = s, o = n.renderer[c], u = i[c];
2411
+ i[c] = (...a) => {
2412
+ let l = o.apply(i, a);
2413
+ return l === !1 && (l = u.apply(i, a)), l || "";
2414
+ };
2415
+ }
2416
+ r.renderer = i;
2417
+ }
2418
+ if (n.tokenizer) {
2419
+ const i = this.defaults.tokenizer || new ge(this.defaults);
2420
+ for (const s in n.tokenizer) {
2421
+ if (!(s in i))
2422
+ throw new Error(`tokenizer '${s}' does not exist`);
2423
+ if (["options", "rules", "lexer"].includes(s))
2424
+ continue;
2425
+ const c = s, o = n.tokenizer[c], u = i[c];
2426
+ i[c] = (...a) => {
2427
+ let l = o.apply(i, a);
2428
+ return l === !1 && (l = u.apply(i, a)), l;
2429
+ };
2430
+ }
2431
+ r.tokenizer = i;
2432
+ }
2433
+ if (n.hooks) {
2434
+ const i = this.defaults.hooks || new fe();
2435
+ for (const s in n.hooks) {
2436
+ if (!(s in i))
2437
+ throw new Error(`hook '${s}' does not exist`);
2438
+ if (["options", "block"].includes(s))
2439
+ continue;
2440
+ const c = s, o = n.hooks[c], u = i[c];
2441
+ fe.passThroughHooks.has(s) ? i[c] = (a) => {
2442
+ if (this.defaults.async)
2443
+ return Promise.resolve(o.call(i, a)).then((g) => u.call(i, g));
2444
+ const l = o.call(i, a);
2445
+ return u.call(i, l);
2446
+ } : i[c] = (...a) => {
2447
+ let l = o.apply(i, a);
2448
+ return l === !1 && (l = u.apply(i, a)), l;
2449
+ };
2450
+ }
2451
+ r.hooks = i;
2452
+ }
2453
+ if (n.walkTokens) {
2454
+ const i = this.defaults.walkTokens, s = n.walkTokens;
2455
+ r.walkTokens = function(c) {
2456
+ let o = [];
2457
+ return o.push(s.call(this, c)), i && (o = o.concat(i.call(this, c))), o;
2458
+ };
2459
+ }
2460
+ this.defaults = { ...this.defaults, ...r };
2461
+ }), this;
2462
+ }
2463
+ setOptions(t) {
2464
+ return this.defaults = { ...this.defaults, ...t }, this;
2465
+ }
2466
+ lexer(t, e) {
2467
+ return V.lex(t, e ?? this.defaults);
2468
+ }
2469
+ parser(t, e) {
2470
+ return K.parse(t, e ?? this.defaults);
2471
+ }
2472
+ parseMarkdown(t) {
2473
+ return (n, r) => {
2474
+ const i = { ...r }, s = { ...this.defaults, ...i }, c = this.onError(!!s.silent, !!s.async);
2475
+ if (this.defaults.async === !0 && i.async === !1)
2476
+ return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
2477
+ if (typeof n > "u" || n === null)
2478
+ return c(new Error("marked(): input parameter is undefined or null"));
2479
+ if (typeof n != "string")
2480
+ return c(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
2481
+ s.hooks && (s.hooks.options = s, s.hooks.block = t);
2482
+ const o = s.hooks ? s.hooks.provideLexer() : t ? V.lex : V.lexInline, u = s.hooks ? s.hooks.provideParser() : t ? K.parse : K.parseInline;
2483
+ if (s.async)
2484
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((a) => o(a, s)).then((a) => s.hooks ? s.hooks.processAllTokens(a) : a).then((a) => s.walkTokens ? Promise.all(this.walkTokens(a, s.walkTokens)).then(() => a) : a).then((a) => u(a, s)).then((a) => s.hooks ? s.hooks.postprocess(a) : a).catch(c);
2485
+ try {
2486
+ s.hooks && (n = s.hooks.preprocess(n));
2487
+ let a = o(n, s);
2488
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
2489
+ let l = u(a, s);
2490
+ return s.hooks && (l = s.hooks.postprocess(l)), l;
2491
+ } catch (a) {
2492
+ return c(a);
2493
+ }
2494
+ };
2495
+ }
2496
+ onError(t, e) {
2497
+ return (n) => {
2498
+ if (n.message += `
2499
+ Please report this to https://github.com/markedjs/marked.`, t) {
2500
+ const r = "<p>An error occurred:</p><pre>" + G(n.message + "", !0) + "</pre>";
2501
+ return e ? Promise.resolve(r) : r;
2502
+ }
2503
+ if (e)
2504
+ return Promise.reject(n);
2505
+ throw n;
2506
+ };
2507
+ }
2508
+ }, X = new qn();
2509
+ function z(t, e) {
2510
+ return X.parse(t, e);
2511
+ }
2512
+ z.options = z.setOptions = function(t) {
2513
+ return X.setOptions(t), z.defaults = X.defaults, vt(z.defaults), z;
2514
+ };
2515
+ z.getDefaults = Ze;
2516
+ z.defaults = ee;
2517
+ z.use = function(...t) {
2518
+ return X.use(...t), z.defaults = X.defaults, vt(z.defaults), z;
2519
+ };
2520
+ z.walkTokens = function(t, e) {
2521
+ return X.walkTokens(t, e);
2522
+ };
2523
+ z.parseInline = X.parseInline;
2524
+ z.Parser = K;
2525
+ z.parser = K.parse;
2526
+ z.Renderer = me;
2527
+ z.TextRenderer = et;
2528
+ z.Lexer = V;
2529
+ z.lexer = V.lex;
2530
+ z.Tokenizer = ge;
2531
+ z.Hooks = fe;
2532
+ z.parse = z;
2533
+ z.options;
2534
+ z.setOptions;
2535
+ z.use;
2536
+ z.walkTokens;
2537
+ z.parseInline;
2538
+ K.parse;
2539
+ V.lex;
2540
+ const bt = ({ data: t, style: e }) => /* @__PURE__ */ b.createElement(
2541
+ "div",
2542
+ {
2543
+ style: {
2544
+ maxWidth: "80%",
2545
+ ...e
2546
+ }
2547
+ },
2548
+ t && t.subject ? /* @__PURE__ */ b.createElement(
2549
+ "div",
2550
+ {
2551
+ dangerouslySetInnerHTML: {
2552
+ __html: z.parse(t.body, { async: !1 })
2553
+ }
2554
+ }
2555
+ ) : /* @__PURE__ */ b.createElement("p", { style: { margin: 0, whiteSpace: "pre-wrap" } }, t ? t.question : "")
2556
+ ), Bn = ({
2557
+ items: t,
2558
+ onApply: e,
2559
+ getEditorContent: n
2560
+ }) => {
2561
+ const r = async (i) => {
2562
+ const s = /제목:[^\n]*/g;
2563
+ ((s.exec(i) || [])[0] || "").replace("제목: ", "").replace(`
2564
+ `, "");
2565
+ const o = i.replace(s, "").replace("본문: ", "");
2566
+ let u = await z.parse(o);
2567
+ const a = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g, l = n ? n() : "", g = a.exec(l) || [];
2568
+ g[0] && (u = u + "<br>" + g[0]), e({ html: u });
2569
+ };
2570
+ return /* @__PURE__ */ b.createElement(
2571
+ "div",
2572
+ {
2573
+ style: {
2574
+ flex: 1,
2575
+ minHeight: 0,
2576
+ position: "relative",
2577
+ overflowY: "auto",
2578
+ paddingRight: 16,
2579
+ marginRight: -16,
2580
+ marginBottom: 8,
2581
+ display: "flex",
2582
+ flexDirection: "column"
2583
+ }
2584
+ },
2585
+ t && t.map((i) => /* @__PURE__ */ b.createElement(
2586
+ "div",
2587
+ {
2588
+ key: i.id,
2589
+ style: {
2590
+ display: "flex",
2591
+ flexDirection: "column",
2592
+ marginBottom: 16
2593
+ }
2594
+ },
2595
+ /* @__PURE__ */ b.createElement(
2596
+ "div",
2597
+ {
2598
+ style: {
2599
+ width: "100%",
2600
+ display: "flex",
2601
+ alignItems: "flex-end",
2602
+ flexDirection: "column",
2603
+ position: "relative",
2604
+ marginTop: 8
2605
+ }
2606
+ },
2607
+ /* @__PURE__ */ b.createElement(
2608
+ bt,
2609
+ {
2610
+ data: { question: i.question },
2611
+ style: {
2612
+ borderRadius: 8,
2613
+ borderTopRightRadius: 0,
2614
+ padding: "8px 12px",
2615
+ background: "var(--background-softGrey)"
2616
+ }
2617
+ }
2618
+ )
2619
+ ),
2620
+ /* @__PURE__ */ b.createElement(
2621
+ "div",
2622
+ {
2623
+ style: {
2624
+ width: "100%",
2625
+ display: "flex",
2626
+ alignItems: "flex-start",
2627
+ flexDirection: "column",
2628
+ position: "relative",
2629
+ marginTop: 8
2630
+ }
2631
+ },
2632
+ i.isLoading ? /* @__PURE__ */ b.createElement(
2633
+ "div",
2634
+ {
2635
+ style: {
2636
+ marginTop: 8,
2637
+ fontStyle: "italic",
2638
+ color: "var(--text-secondary)"
2639
+ }
2640
+ },
2641
+ "Loading..."
2642
+ ) : /* @__PURE__ */ b.createElement(
2643
+ "div",
2644
+ {
2645
+ style: {
2646
+ display: "flex",
2647
+ flexDirection: "row",
2648
+ alignItems: "flex-end",
2649
+ width: "100%"
2650
+ }
2651
+ },
2652
+ /* @__PURE__ */ b.createElement(
2653
+ bt,
2654
+ {
2655
+ data: { subject: i.subject, body: i.body },
2656
+ style: {
2657
+ background: "var(--background-softGrey)",
2658
+ borderRadius: 8,
2659
+ borderTopLeftRadius: 0,
2660
+ padding: "8px 12px",
2661
+ flexShrink: 0
2662
+ }
2663
+ }
2664
+ ),
2665
+ /* @__PURE__ */ b.createElement(
2666
+ "button",
2667
+ {
2668
+ type: "button",
2669
+ title: "Apply content",
2670
+ onClick: () => r(i.body),
2671
+ style: {
2672
+ marginLeft: 4,
2673
+ background: "none",
2674
+ border: "none",
2675
+ cursor: "pointer",
2676
+ display: "flex",
2677
+ alignItems: "center",
2678
+ justifyContent: "center",
2679
+ padding: 8,
2680
+ borderRadius: 4
2681
+ }
2682
+ },
2683
+ /* @__PURE__ */ b.createElement(be, { size: 16, color: "#666" })
2684
+ )
2685
+ )
2686
+ )
2687
+ ))
2688
+ );
2689
+ };
2690
+ class Wn extends b.Component {
2691
+ constructor(n) {
2692
+ super(n);
2693
+ S(this, "containerRef");
2694
+ S(this, "handleClickOutside", (n) => {
2695
+ this.containerRef.current && !this.containerRef.current.contains(n.target) && this.setState({ open: !1 });
2696
+ });
2697
+ S(this, "togglePopper", () => {
2698
+ this.setState((n) => ({ open: !n.open }));
2699
+ });
2700
+ S(this, "handleLangChange", (n) => {
2701
+ const r = De.find((i) => i.value === n.target.value);
2702
+ this.props.setLang(r || null);
2703
+ });
2704
+ this.state = { open: !1 }, this.containerRef = b.createRef();
2705
+ }
2706
+ componentDidMount() {
2707
+ document.addEventListener("mousedown", this.handleClickOutside);
2708
+ }
2709
+ componentWillUnmount() {
2710
+ document.removeEventListener("mousedown", this.handleClickOutside);
2711
+ }
2712
+ render() {
2713
+ const { lang: n, originalEmail: r, setOriginalEmail: i, getEditorContent: s } = this.props, { open: c } = this.state;
2714
+ return /* @__PURE__ */ b.createElement(
2715
+ "div",
2716
+ {
2717
+ ref: this.containerRef,
2718
+ style: { position: "relative", display: "inline-block" }
2719
+ },
2720
+ /* @__PURE__ */ b.createElement(
2721
+ "button",
2722
+ {
2723
+ type: "button",
2724
+ onClick: this.togglePopper,
2725
+ className: "icon-button small"
2726
+ },
2727
+ /* @__PURE__ */ b.createElement(Ye, { size: 16 })
2728
+ ),
2729
+ c && /* @__PURE__ */ b.createElement(
2730
+ "div",
2731
+ {
2732
+ style: {
2733
+ position: "absolute",
2734
+ bottom: "100%",
2735
+ left: 0,
2736
+ zIndex: 1051,
2737
+ background: "#fff",
2738
+ border: "1px solid #ddd",
2739
+ boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
2740
+ borderRadius: 8,
2741
+ padding: 16,
2742
+ width: 320,
2743
+ marginBottom: 8
2744
+ }
2745
+ },
2746
+ /* @__PURE__ */ b.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ b.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ b.createElement(
2747
+ "span",
2748
+ {
2749
+ style: {
2750
+ fontSize: 12,
2751
+ fontWeight: 500,
2752
+ color: "var(--text-secondary)"
2753
+ }
2754
+ },
2755
+ "Language"
2756
+ ), /* @__PURE__ */ b.createElement(
2757
+ "select",
2758
+ {
2759
+ value: n ? n.value : "",
2760
+ onChange: this.handleLangChange,
2761
+ style: {
2762
+ padding: "6px 8px",
2763
+ borderRadius: 4,
2764
+ border: "1px solid #ccc",
2765
+ fontSize: 14
2766
+ }
2767
+ },
2768
+ /* @__PURE__ */ b.createElement("option", { value: "", disabled: !0 }, "Select Language"),
2769
+ De.map((o) => /* @__PURE__ */ b.createElement("option", { key: o.value, value: o.value }, o.label))
2770
+ )), /* @__PURE__ */ b.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ b.createElement(
2771
+ "div",
2772
+ {
2773
+ style: {
2774
+ display: "flex",
2775
+ alignItems: "center",
2776
+ justifyContent: "space-between"
2777
+ }
2778
+ },
2779
+ /* @__PURE__ */ b.createElement(
2780
+ "span",
2781
+ {
2782
+ style: {
2783
+ fontSize: 12,
2784
+ fontWeight: 500,
2785
+ color: "var(--text-secondary)"
2786
+ }
2787
+ },
2788
+ "AI Context"
2789
+ ),
2790
+ s && /* @__PURE__ */ b.createElement(
2791
+ "button",
2792
+ {
2793
+ type: "button",
2794
+ title: "Copy from origin email",
2795
+ onClick: () => {
2796
+ const o = s();
2797
+ i(o);
2798
+ },
2799
+ className: "icon-button"
2800
+ },
2801
+ /* @__PURE__ */ b.createElement(be, null)
2802
+ )
2803
+ ), /* @__PURE__ */ b.createElement(
2804
+ "textarea",
2805
+ {
2806
+ value: r,
2807
+ onChange: (o) => i(o.target.value),
2808
+ style: {
2809
+ width: "100%",
2810
+ height: 120,
2811
+ resize: "vertical",
2812
+ padding: 8,
2813
+ border: "1px solid #ccc",
2814
+ borderRadius: 4,
2815
+ fontSize: 13,
2816
+ fontFamily: "inherit",
2817
+ boxSizing: "border-box"
2818
+ }
2819
+ }
2820
+ )))
2821
+ )
2822
+ );
2823
+ }
2824
+ }
2825
+ class Zn extends b.Component {
2826
+ constructor(n) {
2827
+ super(n);
2828
+ // Equivalent to useImperativeHandle
2829
+ S(this, "setAiContext", (n) => {
2830
+ this.setState({ originalEmail: n });
2831
+ });
2832
+ S(this, "handleMessageChange", (n) => {
2833
+ this.setState({ message: n.target.value });
2834
+ });
2835
+ S(this, "handleSubmit", async () => {
2836
+ const { message: n, messages: r, lang: i, originalEmail: s, conversationId: c } = this.state, { signer: o, baseUrl: u = "" } = this.props;
2837
+ if (!n.trim()) return;
2838
+ const a = Mt();
2839
+ let l = {
2840
+ id: a,
2841
+ question: n,
2842
+ subject: "",
2843
+ body: "",
2844
+ created_at: (/* @__PURE__ */ new Date()).getTime(),
2845
+ isLoading: !0
2846
+ };
2847
+ const g = [...r, l];
2848
+ this.setState({
2849
+ messages: g,
2850
+ message: "",
2851
+ isSending: !0
2852
+ });
2853
+ const p = {
2854
+ query: n,
2855
+ default_language: i ? i.value : "KR",
2856
+ original_email: s,
2857
+ debug_grpc: !0
2858
+ };
2859
+ c && (p.conversation_id = c), await nn(p, {
2860
+ setContent: (P) => {
2861
+ this.setState((D) => ({ messages: D.messages.map(
2862
+ (O) => O.id === a ? {
2863
+ ...O,
2864
+ subject: "Some thing not used",
2865
+ body: P,
2866
+ isLoading: !1,
2867
+ created_at: (/* @__PURE__ */ new Date()).getTime()
2868
+ } : O
2869
+ ) }));
2870
+ },
2871
+ setIsLoading: (P) => {
2872
+ this.setState((D) => ({ messages: D.messages.map(
2873
+ (O) => O.id === a ? { ...O, isLoading: P } : O
2874
+ ) }));
2875
+ },
2876
+ setConversationId: (P) => {
2877
+ this.setState({ conversationId: P });
2878
+ },
2879
+ signer: o,
2880
+ baseUrl: u
2881
+ }), this.setState({ isSending: !1 });
2882
+ });
2883
+ S(this, "handleKeyDown", (n) => {
2884
+ !n.shiftKey && n.key === "Enter" && !this.state.isSending && (n.preventDefault(), this.handleSubmit());
2885
+ });
2886
+ S(this, "setLang", (n) => {
2887
+ this.setState({ lang: n });
2888
+ });
2889
+ S(this, "setOriginalEmail", (n) => {
2890
+ this.setState({ originalEmail: n });
2891
+ });
2892
+ this.state = {
2893
+ message: "",
2894
+ messages: [],
2895
+ isSending: !1,
2896
+ lang: De[0],
2897
+ conversationId: "",
2898
+ originalEmail: ""
2899
+ };
2900
+ }
2901
+ render() {
2902
+ const { onApply: n, getEditorContent: r } = this.props, { message: i, messages: s, isSending: c, lang: o, originalEmail: u } = this.state;
2903
+ return /* @__PURE__ */ b.createElement(
2904
+ "div",
2905
+ {
2906
+ style: {
2907
+ display: "flex",
2908
+ height: "100%",
2909
+ padding: 16,
2910
+ flexDirection: "column",
2911
+ background: "#fff",
2912
+ fontFamily: "inherit",
2913
+ boxSizing: "border-box"
2914
+ }
2915
+ },
2916
+ s.length > 0 ? /* @__PURE__ */ b.createElement(
2917
+ Bn,
2918
+ {
2919
+ items: s,
2920
+ onApply: n,
2921
+ getEditorContent: r
2922
+ }
2923
+ ) : /* @__PURE__ */ b.createElement(
2924
+ "div",
2925
+ {
2926
+ style: {
2927
+ flex: 1,
2928
+ minHeight: 0,
2929
+ display: "flex",
2930
+ flexDirection: "column",
2931
+ alignItems: "center",
2932
+ justifyContent: "center",
2933
+ color: "var(--grey-light)"
2934
+ }
2935
+ },
2936
+ /* @__PURE__ */ b.createElement(tn, { size: 46 }),
2937
+ /* @__PURE__ */ b.createElement(
2938
+ "h2",
2939
+ {
2940
+ style: {
2941
+ marginTop: 16,
2942
+ fontWeight: 600,
2943
+ color: "inherit",
2944
+ fontSize: 18
2945
+ }
2946
+ },
2947
+ "Build with Agent"
2948
+ )
2949
+ ),
2950
+ /* @__PURE__ */ b.createElement(
2951
+ "div",
2952
+ {
2953
+ style: {
2954
+ width: "100%",
2955
+ border: "1px solid #ddd",
2956
+ borderRadius: 4,
2957
+ // overflow: "hidden",
2958
+ background: c ? "var(--background-lightGrey)" : "#fff",
2959
+ display: "flex",
2960
+ flexDirection: "column"
2961
+ }
2962
+ },
2963
+ /* @__PURE__ */ b.createElement(
2964
+ "textarea",
2965
+ {
2966
+ value: i,
2967
+ onChange: this.handleMessageChange,
2968
+ placeholder: "Describe your email",
2969
+ name: "ai-content",
2970
+ onKeyDown: this.handleKeyDown,
2971
+ disabled: c,
2972
+ style: {
2973
+ flex: 1,
2974
+ minWidth: 0,
2975
+ borderRadius: 4,
2976
+ padding: 12,
2977
+ fontSize: 13,
2978
+ border: "none",
2979
+ resize: "none",
2980
+ outline: "none",
2981
+ minHeight: 60,
2982
+ fontFamily: "inherit"
2983
+ }
2984
+ }
2985
+ ),
2986
+ /* @__PURE__ */ b.createElement(
2987
+ "div",
2988
+ {
2989
+ style: {
2990
+ display: "flex",
2991
+ flexDirection: "row",
2992
+ alignItems: "center",
2993
+ justifyContent: "space-between",
2994
+ width: "100%",
2995
+ padding: "8px",
2996
+ boxSizing: "border-box"
2997
+ }
2998
+ },
2999
+ /* @__PURE__ */ b.createElement(
3000
+ Wn,
3001
+ {
3002
+ lang: o,
3003
+ setLang: this.setLang,
3004
+ originalEmail: u,
3005
+ setOriginalEmail: this.setOriginalEmail,
3006
+ getEditorContent: r
3007
+ }
3008
+ ),
3009
+ /* @__PURE__ */ b.createElement(
3010
+ "button",
3011
+ {
3012
+ disabled: !i.trim() || c,
3013
+ onClick: this.handleSubmit,
3014
+ className: "icon-button",
3015
+ color: "primary"
3016
+ },
3017
+ /* @__PURE__ */ b.createElement(He, null)
3018
+ )
3019
+ )
3020
+ )
3021
+ );
3022
+ }
3023
+ }
3024
+ const We = {
3025
+ baseUrl: "V3",
3026
+ signer: null
3027
+ }, Fn = ({ baseUrl: t, signer: e }) => {
3028
+ We.baseUrl = t, We.signer = e;
3029
+ }, Nn = () => {
3030
+ const t = window.location, { hostname: e } = t;
3031
+ return e === "localhost" || e === "127.0.0.1";
3032
+ }, Ot = Nn(), Un = () => {
3033
+ var n;
3034
+ let t = window.location;
3035
+ const { host: e } = t;
3036
+ if (Ot) {
3037
+ const r = (n = We.baseUrl) == null ? void 0 : n.split("/");
3038
+ return r ? "https://" + (r == null ? void 0 : r[2]) : "https://vndev.hanbiro.com";
3039
+ } else {
3040
+ const r = localStorage.getItem("host") || e, i = r == null ? void 0 : r.split("/");
3041
+ return "https://" + (i == null ? void 0 : i[0]);
3042
+ }
3043
+ }, Gn = () => {
3044
+ let t = window.location;
3045
+ if (Ot)
3046
+ return Un() || "https://vndev.hanbiro.com/ngw";
3047
+ {
3048
+ window.location !== window.parent.location && (t = window.parent.location);
3049
+ const { hostname: e, protocol: n } = t;
3050
+ return [n, "//", e, "/ngw"].join("");
3051
+ }
3052
+ };
3053
+ export {
3054
+ Zn as ChatAIDraft,
3055
+ We as SDKConfig,
3056
+ Un as getBaseUrl,
3057
+ Gn as getGroupwareUrl,
3058
+ Fn as initHanbiroReactSDK,
3059
+ Ot as isDevelopment
3060
+ };