dsh-mnemon-source-documents 0.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/lib/client.js +1594 -0
- package/lib/contracts.d.ts +89 -0
- package/lib/contracts.js +5 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +1034 -0
- package/lib/types/client/api.d.ts +9 -0
- package/lib/types/client/pages.d.ts +10 -0
- package/lib/types/client/ui.d.ts +8 -0
- package/lib/types/client.d.ts +3 -0
- package/lib/types/contracts.d.ts +86 -0
- package/package.json +87 -0
package/lib/client.js
ADDED
|
@@ -0,0 +1,1594 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-mnemon-source-documents",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
//#region \0rolldown/runtime.js
|
|
8
|
+
var __create = Object.create;
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
16
|
+
key = keys[i];
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: ((k) => from[k]).bind(null, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
//#endregion
|
|
29
|
+
let react = require("react");
|
|
30
|
+
react = __toESM(react, 1);
|
|
31
|
+
let dsh_mnemon_client = require("dsh-mnemon/client");
|
|
32
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
//#region ../../node_modules/.pnpm/markdown-to-jsx@7.7.17_react@18.3.1/node_modules/markdown-to-jsx/dist/index.module.js
|
|
34
|
+
function n() {
|
|
35
|
+
return n = Object.assign ? Object.assign.bind() : function(r) {
|
|
36
|
+
for (var n = 1; n < arguments.length; n++) {
|
|
37
|
+
var e = arguments[n];
|
|
38
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = e[t]);
|
|
39
|
+
}
|
|
40
|
+
return r;
|
|
41
|
+
}, n.apply(this, arguments);
|
|
42
|
+
}
|
|
43
|
+
var e = ["children", "options"];
|
|
44
|
+
var u = [
|
|
45
|
+
"allowFullScreen",
|
|
46
|
+
"allowTransparency",
|
|
47
|
+
"autoComplete",
|
|
48
|
+
"autoFocus",
|
|
49
|
+
"autoPlay",
|
|
50
|
+
"cellPadding",
|
|
51
|
+
"cellSpacing",
|
|
52
|
+
"charSet",
|
|
53
|
+
"classId",
|
|
54
|
+
"colSpan",
|
|
55
|
+
"contentEditable",
|
|
56
|
+
"contextMenu",
|
|
57
|
+
"crossOrigin",
|
|
58
|
+
"encType",
|
|
59
|
+
"formAction",
|
|
60
|
+
"formEncType",
|
|
61
|
+
"formMethod",
|
|
62
|
+
"formNoValidate",
|
|
63
|
+
"formTarget",
|
|
64
|
+
"frameBorder",
|
|
65
|
+
"hrefLang",
|
|
66
|
+
"inputMode",
|
|
67
|
+
"keyParams",
|
|
68
|
+
"keyType",
|
|
69
|
+
"marginHeight",
|
|
70
|
+
"marginWidth",
|
|
71
|
+
"maxLength",
|
|
72
|
+
"mediaGroup",
|
|
73
|
+
"minLength",
|
|
74
|
+
"noValidate",
|
|
75
|
+
"radioGroup",
|
|
76
|
+
"readOnly",
|
|
77
|
+
"rowSpan",
|
|
78
|
+
"spellCheck",
|
|
79
|
+
"srcDoc",
|
|
80
|
+
"srcLang",
|
|
81
|
+
"srcSet",
|
|
82
|
+
"tabIndex",
|
|
83
|
+
"useMap"
|
|
84
|
+
].reduce(function(r, n) {
|
|
85
|
+
return r[n.toLowerCase()] = n, r;
|
|
86
|
+
}, {
|
|
87
|
+
class: "className",
|
|
88
|
+
for: "htmlFor"
|
|
89
|
+
});
|
|
90
|
+
var a = {
|
|
91
|
+
amp: "&",
|
|
92
|
+
apos: "'",
|
|
93
|
+
gt: ">",
|
|
94
|
+
lt: "<",
|
|
95
|
+
nbsp: "\xA0",
|
|
96
|
+
quot: "“"
|
|
97
|
+
};
|
|
98
|
+
var i = [
|
|
99
|
+
"style",
|
|
100
|
+
"script",
|
|
101
|
+
"pre"
|
|
102
|
+
];
|
|
103
|
+
var o = [
|
|
104
|
+
"src",
|
|
105
|
+
"href",
|
|
106
|
+
"data",
|
|
107
|
+
"formAction",
|
|
108
|
+
"srcDoc",
|
|
109
|
+
"action"
|
|
110
|
+
];
|
|
111
|
+
var c = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi;
|
|
112
|
+
var f = /\n{2,}$/;
|
|
113
|
+
var l = /^(\s*>[\s\S]*?)(?=\n\n|$)/;
|
|
114
|
+
var _ = /^ *> ?/gm;
|
|
115
|
+
var d = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/;
|
|
116
|
+
var s = /^ {2,}\n/;
|
|
117
|
+
var v = /^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/;
|
|
118
|
+
var p = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/;
|
|
119
|
+
var y = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/;
|
|
120
|
+
var h = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/;
|
|
121
|
+
var g = /^(?:\n *)*\n/;
|
|
122
|
+
var m = /\r\n?/g;
|
|
123
|
+
var k = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/;
|
|
124
|
+
var x = /^\[\^([^\]]+)]/;
|
|
125
|
+
var q = /\f/g;
|
|
126
|
+
var b = /^---[ \t]*\n(.|\n)*\n---[ \t]*\n/;
|
|
127
|
+
var S = /^\s*?\[(x|\s)\]/;
|
|
128
|
+
var z = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
|
|
129
|
+
var $ = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
|
|
130
|
+
var E = /^([^\n]+)\n *(=|-)\2{2,} *\n/;
|
|
131
|
+
var A = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i;
|
|
132
|
+
var R = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;
|
|
133
|
+
var B = /^<!--[\s\S]*?(?:-->)/;
|
|
134
|
+
var L = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/;
|
|
135
|
+
var O = /^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i;
|
|
136
|
+
var j = /^\{.*\}$/;
|
|
137
|
+
var C = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/;
|
|
138
|
+
var I = /^<([^ >]+[:@\/][^ >]+)>/;
|
|
139
|
+
var T = /-([a-z])?/gi;
|
|
140
|
+
var M = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/;
|
|
141
|
+
var w = /^[^\n]+(?: \n|\n{2,})/;
|
|
142
|
+
var D = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/;
|
|
143
|
+
var F = /^!\[([^\]]*)\] ?\[([^\]]*)\]/;
|
|
144
|
+
var P = /^\[([^\]]*)\] ?\[([^\]]*)\]/;
|
|
145
|
+
var Z = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/;
|
|
146
|
+
var N = /\t/g;
|
|
147
|
+
var G = /(^ *\||\| *$)/g;
|
|
148
|
+
var U = /^ *:-+: *$/;
|
|
149
|
+
var V = /^ *:-+ *$/;
|
|
150
|
+
var H = /^ *-+: *$/;
|
|
151
|
+
var Q = function(r) {
|
|
152
|
+
return "(?=[\\s\\S]+?\\1" + (r ? "\\1" : "") + ")";
|
|
153
|
+
};
|
|
154
|
+
var W = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)";
|
|
155
|
+
var J = RegExp("^([*_])\\1" + Q(1) + W + "\\1\\1(?!\\1)");
|
|
156
|
+
var K = RegExp("^([*_])" + Q(0) + W + "\\1(?!\\1)");
|
|
157
|
+
var X = RegExp("^(==)" + Q(0) + W + "\\1");
|
|
158
|
+
var Y = RegExp("^(~~)" + Q(0) + W + "\\1");
|
|
159
|
+
var rr = /^(:[a-zA-Z0-9-_]+:)/;
|
|
160
|
+
var nr = /^\\([^0-9A-Za-z\s])/;
|
|
161
|
+
var er = /\\([^0-9A-Za-z\s])/g;
|
|
162
|
+
var tr = /^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/;
|
|
163
|
+
var ur = /^\n+/;
|
|
164
|
+
var ar = /^([ \t]*)/;
|
|
165
|
+
var ir = /(?:^|\n)( *)$/;
|
|
166
|
+
var or = "(?:\\d+\\.)";
|
|
167
|
+
var cr = "(?:[*+-])";
|
|
168
|
+
function fr(r) {
|
|
169
|
+
return "( *)(" + (1 === r ? or : cr) + ") +";
|
|
170
|
+
}
|
|
171
|
+
var lr = fr(1);
|
|
172
|
+
var _r = fr(2);
|
|
173
|
+
function dr(r) {
|
|
174
|
+
return RegExp("^" + (1 === r ? lr : _r));
|
|
175
|
+
}
|
|
176
|
+
var sr = dr(1);
|
|
177
|
+
var vr = dr(2);
|
|
178
|
+
function pr(r) {
|
|
179
|
+
return RegExp("^" + (1 === r ? lr : _r) + "[^\\n]*(?:\\n(?!\\1" + (1 === r ? or : cr) + " )[^\\n]*)*(\\n|$)", "gm");
|
|
180
|
+
}
|
|
181
|
+
var yr = pr(1);
|
|
182
|
+
var hr = pr(2);
|
|
183
|
+
function gr(r) {
|
|
184
|
+
var n = 1 === r ? or : cr;
|
|
185
|
+
return RegExp("^( *)(" + n + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + n + " (?!" + n + " ))\\n*|\\s*\\n*$)");
|
|
186
|
+
}
|
|
187
|
+
var mr = gr(1);
|
|
188
|
+
var kr = gr(2);
|
|
189
|
+
function xr(r, n) {
|
|
190
|
+
var e = 1 === n, t = e ? mr : kr, u = e ? yr : hr, a = e ? sr : vr;
|
|
191
|
+
return {
|
|
192
|
+
t: function(r) {
|
|
193
|
+
return a.test(r);
|
|
194
|
+
},
|
|
195
|
+
u: jr(function(r, n) {
|
|
196
|
+
var e = ir.exec(n.prevCapture);
|
|
197
|
+
return e && (n.list || !n.inline && !n.simple) ? t.exec(r = e[1] + r) : null;
|
|
198
|
+
}),
|
|
199
|
+
i: 1,
|
|
200
|
+
o: function(r, n, t) {
|
|
201
|
+
var i = e ? +r[2] : void 0, o = r[0].replace(f, "\n").match(u), c = !1;
|
|
202
|
+
return {
|
|
203
|
+
items: o.map(function(r, e) {
|
|
204
|
+
var u = a.exec(r)[0].length, i = RegExp("^ {1," + u + "}", "gm"), f = r.replace(i, "").replace(a, ""), l = e === o.length - 1, _ = -1 !== f.indexOf("\n\n") || l && c;
|
|
205
|
+
c = _;
|
|
206
|
+
var d, s = t.inline, v = t.list;
|
|
207
|
+
t.list = !0, _ ? (t.inline = !1, d = zr(f) + "\n\n") : (t.inline = !0, d = zr(f));
|
|
208
|
+
var p = n(d, t);
|
|
209
|
+
return t.inline = s, t.list = v, p;
|
|
210
|
+
}),
|
|
211
|
+
ordered: e,
|
|
212
|
+
start: i
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
l: function(n, e, t) {
|
|
216
|
+
return r(n.ordered ? "ol" : "ul", {
|
|
217
|
+
key: t.key,
|
|
218
|
+
start: "20" === n.type ? n.start : void 0
|
|
219
|
+
}, n.items.map(function(n, u) {
|
|
220
|
+
return r("li", { key: u }, e(n, t));
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
var qr = RegExp("^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)");
|
|
226
|
+
var br = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;
|
|
227
|
+
function Sr(r) {
|
|
228
|
+
return "string" == typeof r;
|
|
229
|
+
}
|
|
230
|
+
function zr(r) {
|
|
231
|
+
for (var n = r.length; n > 0 && r[n - 1] <= " ";) n--;
|
|
232
|
+
return r.slice(0, n);
|
|
233
|
+
}
|
|
234
|
+
function $r(r, n) {
|
|
235
|
+
return r.startsWith(n);
|
|
236
|
+
}
|
|
237
|
+
function Er(r, n, e) {
|
|
238
|
+
if (Array.isArray(e)) {
|
|
239
|
+
for (var t = 0; t < e.length; t++) if ($r(r, e[t])) return !0;
|
|
240
|
+
return !1;
|
|
241
|
+
}
|
|
242
|
+
return e(r, n);
|
|
243
|
+
}
|
|
244
|
+
function Ar(r) {
|
|
245
|
+
return r.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
|
|
246
|
+
}
|
|
247
|
+
function Rr(r) {
|
|
248
|
+
return H.test(r) ? "right" : U.test(r) ? "center" : V.test(r) ? "left" : null;
|
|
249
|
+
}
|
|
250
|
+
function Br(r, n, e, t) {
|
|
251
|
+
var u = e.inTable;
|
|
252
|
+
e.inTable = !0;
|
|
253
|
+
var a = [[]], i = "";
|
|
254
|
+
function o() {
|
|
255
|
+
if (i) {
|
|
256
|
+
var r = a[a.length - 1];
|
|
257
|
+
r.push.apply(r, n(i, e)), i = "";
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return r.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach(function(r, n, e) {
|
|
261
|
+
"|" === r.trim() && (o(), t) ? 0 !== n && n !== e.length - 1 && a.push([]) : i += r;
|
|
262
|
+
}), o(), e.inTable = u, a;
|
|
263
|
+
}
|
|
264
|
+
function Lr(r, n, e) {
|
|
265
|
+
e.inline = !0;
|
|
266
|
+
var t = r[2] ? r[2].replace(G, "").split("|").map(Rr) : [], u = r[3] ? function(r, n, e) {
|
|
267
|
+
return r.trim().split("\n").map(function(r) {
|
|
268
|
+
return Br(r, n, e, !0);
|
|
269
|
+
});
|
|
270
|
+
}(r[3], n, e) : [], a = Br(r[1], n, e, !!u.length);
|
|
271
|
+
return e.inline = !1, u.length ? {
|
|
272
|
+
align: t,
|
|
273
|
+
cells: u,
|
|
274
|
+
header: a,
|
|
275
|
+
type: "25"
|
|
276
|
+
} : {
|
|
277
|
+
children: a,
|
|
278
|
+
type: "21"
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function Or(r, n) {
|
|
282
|
+
return null == r.align[n] ? {} : { textAlign: r.align[n] };
|
|
283
|
+
}
|
|
284
|
+
function jr(r) {
|
|
285
|
+
return r.inline = 1, r;
|
|
286
|
+
}
|
|
287
|
+
function Cr(r) {
|
|
288
|
+
return jr(function(n, e) {
|
|
289
|
+
return e.inline ? r.exec(n) : null;
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function Ir(r) {
|
|
293
|
+
return jr(function(n, e) {
|
|
294
|
+
return e.inline || e.simple ? r.exec(n) : null;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function Tr(r) {
|
|
298
|
+
return function(n, e) {
|
|
299
|
+
return e.inline || e.simple ? null : r.exec(n);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function Mr(r) {
|
|
303
|
+
return jr(function(n) {
|
|
304
|
+
return r.exec(n);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
var wr = /(javascript|vbscript|data(?!:image)):/i;
|
|
308
|
+
function Dr(r) {
|
|
309
|
+
try {
|
|
310
|
+
var n = decodeURIComponent(r).replace(/[^A-Za-z0-9/:]/g, "");
|
|
311
|
+
if (wr.test(n)) return null;
|
|
312
|
+
} catch (r) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
return r;
|
|
316
|
+
}
|
|
317
|
+
function Fr(r) {
|
|
318
|
+
return r ? r.replace(er, "$1") : r;
|
|
319
|
+
}
|
|
320
|
+
function Pr(r, n, e) {
|
|
321
|
+
var t = e.inline || !1, u = e.simple || !1;
|
|
322
|
+
e.inline = !0, e.simple = !0;
|
|
323
|
+
var a = r(n, e);
|
|
324
|
+
return e.inline = t, e.simple = u, a;
|
|
325
|
+
}
|
|
326
|
+
function Zr(r, n, e) {
|
|
327
|
+
var t = e.inline || !1, u = e.simple || !1;
|
|
328
|
+
e.inline = !1, e.simple = !0;
|
|
329
|
+
var a = r(n, e);
|
|
330
|
+
return e.inline = t, e.simple = u, a;
|
|
331
|
+
}
|
|
332
|
+
function Nr(r, n, e) {
|
|
333
|
+
var t = e.inline || !1;
|
|
334
|
+
e.inline = !1;
|
|
335
|
+
var u = r(n, e);
|
|
336
|
+
return e.inline = t, u;
|
|
337
|
+
}
|
|
338
|
+
var Gr = function(r, n, e) {
|
|
339
|
+
return { children: Pr(n, r[2], e) };
|
|
340
|
+
};
|
|
341
|
+
function Ur() {
|
|
342
|
+
return {};
|
|
343
|
+
}
|
|
344
|
+
function Vr() {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
function Hr() {
|
|
348
|
+
return [].slice.call(arguments).filter(Boolean).join(" ");
|
|
349
|
+
}
|
|
350
|
+
function Qr(r, n, e) {
|
|
351
|
+
for (var t = r, u = n.split("."); u.length && void 0 !== (t = t[u[0]]);) u.shift();
|
|
352
|
+
return t || e;
|
|
353
|
+
}
|
|
354
|
+
function Wr(r, n) {
|
|
355
|
+
var e = Qr(n, r);
|
|
356
|
+
return e ? "function" == typeof e || "object" == typeof e && "render" in e ? e : Qr(n, r + ".component", r) : r;
|
|
357
|
+
}
|
|
358
|
+
function Jr(e, t) {
|
|
359
|
+
var f;
|
|
360
|
+
void 0 === e && (e = ""), void 0 === t && (t = {}), t.overrides = t.overrides || {}, t.namedCodesToUnicode = t.namedCodesToUnicode ? n({}, a, t.namedCodesToUnicode) : a;
|
|
361
|
+
var G = t.slugify || Ar, U = t.sanitizer || Dr, V = t.createElement || react.createElement, H = [
|
|
362
|
+
l,
|
|
363
|
+
p,
|
|
364
|
+
y,
|
|
365
|
+
t.enforceAtxHeadings ? $ : z,
|
|
366
|
+
E,
|
|
367
|
+
M,
|
|
368
|
+
mr,
|
|
369
|
+
kr
|
|
370
|
+
], Q = [].concat(H, [
|
|
371
|
+
w,
|
|
372
|
+
A,
|
|
373
|
+
B,
|
|
374
|
+
O
|
|
375
|
+
]);
|
|
376
|
+
function W(r, n) {
|
|
377
|
+
for (var e = 0; e < r.length; e++) if (r[e].test(n)) return !0;
|
|
378
|
+
return !1;
|
|
379
|
+
}
|
|
380
|
+
function er(r, e) {
|
|
381
|
+
var u = Qr(t.overrides, r + ".props", {});
|
|
382
|
+
return V.apply(void 0, [Wr(r, t.overrides), n({}, e, u, { className: Hr(null == e ? void 0 : e.className, u.className) || void 0 })].concat([].slice.call(arguments, 2)));
|
|
383
|
+
}
|
|
384
|
+
function ir(r) {
|
|
385
|
+
r = r.replace(b, "");
|
|
386
|
+
var n = !1;
|
|
387
|
+
t.forceInline ? n = !0 : t.forceBlock || (n = !1 === Z.test(r));
|
|
388
|
+
for (var e = dr(_r(n ? r : zr(r).replace(ur, "") + "\n\n", { inline: n })); Sr(e[e.length - 1]) && !e[e.length - 1].trim();) e.pop();
|
|
389
|
+
if (null === t.wrapper) return e;
|
|
390
|
+
var u, a = t.wrapper || (n ? "span" : "div");
|
|
391
|
+
if (e.length > 1 || t.forceWrapper) u = e;
|
|
392
|
+
else {
|
|
393
|
+
if (1 === e.length) return "string" == typeof (u = e[0]) ? er("span", { key: "outer" }, u) : u;
|
|
394
|
+
u = null;
|
|
395
|
+
}
|
|
396
|
+
return V(a, { key: "outer" }, u);
|
|
397
|
+
}
|
|
398
|
+
function or(r, n) {
|
|
399
|
+
if (!n || !n.trim()) return null;
|
|
400
|
+
var e = n.match(c);
|
|
401
|
+
return e ? e.reduce(function(n, e) {
|
|
402
|
+
var t = e.indexOf("=");
|
|
403
|
+
if (-1 !== t) {
|
|
404
|
+
var a = function(r) {
|
|
405
|
+
return -1 !== r.indexOf("-") && null === r.match(L) && (r = r.replace(T, function(r, n) {
|
|
406
|
+
return n.toUpperCase();
|
|
407
|
+
})), r;
|
|
408
|
+
}(e.slice(0, t)).trim(), i = function(r) {
|
|
409
|
+
var n = r[0];
|
|
410
|
+
return ("\"" === n || "'" === n) && r.length >= 2 && r[r.length - 1] === n ? r.slice(1, -1) : r;
|
|
411
|
+
}(e.slice(t + 1).trim()), c = u[a] || a;
|
|
412
|
+
if ("ref" === c) return n;
|
|
413
|
+
var f = n[c] = function(r, n, e, t) {
|
|
414
|
+
return "style" === n ? function(r) {
|
|
415
|
+
var n = [], e = "", t = !1, u = !1, a = "";
|
|
416
|
+
if (!r) return n;
|
|
417
|
+
for (var i = 0; i < r.length; i++) {
|
|
418
|
+
var o = r[i];
|
|
419
|
+
if ("\"" !== o && "'" !== o || t || (u ? o === a && (u = !1, a = "") : (u = !0, a = o)), "(" === o && e.endsWith("url") ? t = !0 : ")" === o && t && (t = !1), ";" !== o || u || t) e += o;
|
|
420
|
+
else {
|
|
421
|
+
var c = e.trim();
|
|
422
|
+
if (c) {
|
|
423
|
+
var f = c.indexOf(":");
|
|
424
|
+
if (f > 0) {
|
|
425
|
+
var l = c.slice(0, f).trim(), _ = c.slice(f + 1).trim();
|
|
426
|
+
n.push([l, _]);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
e = "";
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
var d = e.trim();
|
|
433
|
+
if (d) {
|
|
434
|
+
var s = d.indexOf(":");
|
|
435
|
+
if (s > 0) {
|
|
436
|
+
var v = d.slice(0, s).trim(), p = d.slice(s + 1).trim();
|
|
437
|
+
n.push([v, p]);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return n;
|
|
441
|
+
}(e).reduce(function(n, e) {
|
|
442
|
+
var u = e[0], a = e[1];
|
|
443
|
+
return n[u.replace(/(-[a-z])/g, function(r) {
|
|
444
|
+
return r[1].toUpperCase();
|
|
445
|
+
})] = t(a, r, u), n;
|
|
446
|
+
}, {}) : -1 !== o.indexOf(n) ? t(Fr(e), r, n) : (e.match(j) && (e = Fr(e.slice(1, e.length - 1))), "true" === e || "false" !== e && e);
|
|
447
|
+
}(r, a, i, U);
|
|
448
|
+
"string" == typeof f && (A.test(f) || O.test(f)) && (n[c] = ir(f.trim()));
|
|
449
|
+
} else "style" !== e && (n[u[e] || e] = !0);
|
|
450
|
+
return n;
|
|
451
|
+
}, {}) : null;
|
|
452
|
+
}
|
|
453
|
+
var cr = [], fr = {}, lr = ((f = {})[0] = {
|
|
454
|
+
t: [">"],
|
|
455
|
+
u: Tr(l),
|
|
456
|
+
i: 1,
|
|
457
|
+
o: function(r, n, e) {
|
|
458
|
+
var t = r[0].replace(_, "").match(d);
|
|
459
|
+
return {
|
|
460
|
+
alert: t[1],
|
|
461
|
+
children: n(t[2], e)
|
|
462
|
+
};
|
|
463
|
+
},
|
|
464
|
+
l: function(r, n, e) {
|
|
465
|
+
var t = { key: e.key };
|
|
466
|
+
return r.alert && (t.className = "markdown-alert-" + G(r.alert.toLowerCase(), Ar), r.children.unshift({
|
|
467
|
+
attrs: {},
|
|
468
|
+
children: [{
|
|
469
|
+
type: "27",
|
|
470
|
+
text: r.alert
|
|
471
|
+
}],
|
|
472
|
+
noInnerParse: !0,
|
|
473
|
+
type: "11",
|
|
474
|
+
tag: "header"
|
|
475
|
+
})), er("blockquote", t, n(r.children, e));
|
|
476
|
+
}
|
|
477
|
+
}, f[1] = {
|
|
478
|
+
t: [" "],
|
|
479
|
+
u: Mr(s),
|
|
480
|
+
i: 1,
|
|
481
|
+
o: Ur,
|
|
482
|
+
l: function(r, n, e) {
|
|
483
|
+
return er("br", { key: e.key });
|
|
484
|
+
}
|
|
485
|
+
}, f[2] = {
|
|
486
|
+
t: [
|
|
487
|
+
"--",
|
|
488
|
+
"__",
|
|
489
|
+
"**",
|
|
490
|
+
"- ",
|
|
491
|
+
"* ",
|
|
492
|
+
"_ "
|
|
493
|
+
],
|
|
494
|
+
u: Tr(v),
|
|
495
|
+
i: 1,
|
|
496
|
+
o: Ur,
|
|
497
|
+
l: function(r, n, e) {
|
|
498
|
+
return er("hr", { key: e.key });
|
|
499
|
+
}
|
|
500
|
+
}, f[3] = {
|
|
501
|
+
t: [" "],
|
|
502
|
+
u: Tr(y),
|
|
503
|
+
i: 0,
|
|
504
|
+
o: function(r) {
|
|
505
|
+
return {
|
|
506
|
+
lang: void 0,
|
|
507
|
+
text: Fr(zr(r[0].replace(/^ {4}/gm, "")))
|
|
508
|
+
};
|
|
509
|
+
},
|
|
510
|
+
l: function(r, e, t) {
|
|
511
|
+
return er("pre", { key: t.key }, er("code", n({}, r.attrs, { className: r.lang ? "lang-" + r.lang : "" }), r.text));
|
|
512
|
+
}
|
|
513
|
+
}, f[4] = {
|
|
514
|
+
t: ["```", "~~~"],
|
|
515
|
+
u: Tr(p),
|
|
516
|
+
i: 0,
|
|
517
|
+
o: function(r) {
|
|
518
|
+
return {
|
|
519
|
+
attrs: or("code", r[3] || ""),
|
|
520
|
+
lang: r[2] || void 0,
|
|
521
|
+
text: r[4],
|
|
522
|
+
type: "3"
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
}, f[5] = {
|
|
526
|
+
t: ["`"],
|
|
527
|
+
u: Ir(h),
|
|
528
|
+
i: 3,
|
|
529
|
+
o: function(r) {
|
|
530
|
+
return { text: Fr(r[2]) };
|
|
531
|
+
},
|
|
532
|
+
l: function(r, n, e) {
|
|
533
|
+
return er("code", { key: e.key }, r.text);
|
|
534
|
+
}
|
|
535
|
+
}, f[6] = {
|
|
536
|
+
t: ["[^"],
|
|
537
|
+
u: Tr(k),
|
|
538
|
+
i: 0,
|
|
539
|
+
o: function(r) {
|
|
540
|
+
return cr.push({
|
|
541
|
+
footnote: r[2],
|
|
542
|
+
identifier: r[1]
|
|
543
|
+
}), {};
|
|
544
|
+
},
|
|
545
|
+
l: Vr
|
|
546
|
+
}, f[7] = {
|
|
547
|
+
t: ["[^"],
|
|
548
|
+
u: Cr(x),
|
|
549
|
+
i: 1,
|
|
550
|
+
o: function(r) {
|
|
551
|
+
return {
|
|
552
|
+
target: "#" + G(r[1], Ar),
|
|
553
|
+
text: r[1]
|
|
554
|
+
};
|
|
555
|
+
},
|
|
556
|
+
l: function(r, n, e) {
|
|
557
|
+
return er("a", {
|
|
558
|
+
key: e.key,
|
|
559
|
+
href: U(r.target, "a", "href")
|
|
560
|
+
}, er("sup", { key: e.key }, r.text));
|
|
561
|
+
}
|
|
562
|
+
}, f[8] = {
|
|
563
|
+
t: ["[ ]", "[x]"],
|
|
564
|
+
u: Cr(S),
|
|
565
|
+
i: 1,
|
|
566
|
+
o: function(r) {
|
|
567
|
+
return { completed: "x" === r[1].toLowerCase() };
|
|
568
|
+
},
|
|
569
|
+
l: function(r, n, e) {
|
|
570
|
+
return er("input", {
|
|
571
|
+
checked: r.completed,
|
|
572
|
+
key: e.key,
|
|
573
|
+
readOnly: !0,
|
|
574
|
+
type: "checkbox"
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}, f[9] = {
|
|
578
|
+
t: ["#"],
|
|
579
|
+
u: Tr(t.enforceAtxHeadings ? $ : z),
|
|
580
|
+
i: 1,
|
|
581
|
+
o: function(r, n, e) {
|
|
582
|
+
return {
|
|
583
|
+
children: Pr(n, r[2], e),
|
|
584
|
+
id: G(r[2], Ar),
|
|
585
|
+
level: r[1].length
|
|
586
|
+
};
|
|
587
|
+
},
|
|
588
|
+
l: function(r, n, e) {
|
|
589
|
+
return er("h" + r.level, {
|
|
590
|
+
id: r.id,
|
|
591
|
+
key: e.key
|
|
592
|
+
}, n(r.children, e));
|
|
593
|
+
}
|
|
594
|
+
}, f[10] = {
|
|
595
|
+
t: function(r) {
|
|
596
|
+
var n = r.indexOf("\n");
|
|
597
|
+
return n > 0 && n < r.length - 1 && ("=" === r[n + 1] || "-" === r[n + 1]);
|
|
598
|
+
},
|
|
599
|
+
u: Tr(E),
|
|
600
|
+
i: 1,
|
|
601
|
+
o: function(r, n, e) {
|
|
602
|
+
return {
|
|
603
|
+
children: Pr(n, r[1], e),
|
|
604
|
+
level: "=" === r[2] ? 1 : 2,
|
|
605
|
+
type: "9"
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
}, f[11] = {
|
|
609
|
+
t: ["<"],
|
|
610
|
+
u: Mr(A),
|
|
611
|
+
i: 1,
|
|
612
|
+
o: function(r, n, e) {
|
|
613
|
+
var t = r[3].match(ar), u = RegExp("^" + t[1], "gm"), a = r[3].replace(u, ""), o = W(Q, a) ? Nr : Pr, c = r[1].toLowerCase(), f = -1 !== i.indexOf(c), l = (f ? c : r[1]).trim(), _ = {
|
|
614
|
+
attrs: or(l, r[2]),
|
|
615
|
+
noInnerParse: f,
|
|
616
|
+
tag: l
|
|
617
|
+
};
|
|
618
|
+
if (e.inAnchor = e.inAnchor || "a" === c, f) _.text = r[3];
|
|
619
|
+
else {
|
|
620
|
+
var d = e.inHTML;
|
|
621
|
+
e.inHTML = !0, _.children = o(n, a, e), e.inHTML = d;
|
|
622
|
+
}
|
|
623
|
+
return e.inAnchor = !1, _;
|
|
624
|
+
},
|
|
625
|
+
l: function(r, e, t) {
|
|
626
|
+
return er(r.tag, n({ key: t.key }, r.attrs), r.text || (r.children ? e(r.children, t) : ""));
|
|
627
|
+
}
|
|
628
|
+
}, f[13] = {
|
|
629
|
+
t: ["<"],
|
|
630
|
+
u: Mr(O),
|
|
631
|
+
i: 1,
|
|
632
|
+
o: function(r) {
|
|
633
|
+
var n = r[1].trim();
|
|
634
|
+
return {
|
|
635
|
+
attrs: or(n, r[2] || ""),
|
|
636
|
+
tag: n
|
|
637
|
+
};
|
|
638
|
+
},
|
|
639
|
+
l: function(r, e, t) {
|
|
640
|
+
return er(r.tag, n({}, r.attrs, { key: t.key }));
|
|
641
|
+
}
|
|
642
|
+
}, f[12] = {
|
|
643
|
+
t: ["<!--"],
|
|
644
|
+
u: Mr(B),
|
|
645
|
+
i: 1,
|
|
646
|
+
o: function() {
|
|
647
|
+
return {};
|
|
648
|
+
},
|
|
649
|
+
l: Vr
|
|
650
|
+
}, f[14] = {
|
|
651
|
+
t: ["!["],
|
|
652
|
+
u: Ir(br),
|
|
653
|
+
i: 1,
|
|
654
|
+
o: function(r) {
|
|
655
|
+
return {
|
|
656
|
+
alt: Fr(r[1]),
|
|
657
|
+
target: Fr(r[2]),
|
|
658
|
+
title: Fr(r[3])
|
|
659
|
+
};
|
|
660
|
+
},
|
|
661
|
+
l: function(r, n, e) {
|
|
662
|
+
return er("img", {
|
|
663
|
+
key: e.key,
|
|
664
|
+
alt: r.alt || void 0,
|
|
665
|
+
title: r.title || void 0,
|
|
666
|
+
src: U(r.target, "img", "src")
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
}, f[15] = {
|
|
670
|
+
t: ["["],
|
|
671
|
+
u: Cr(qr),
|
|
672
|
+
i: 3,
|
|
673
|
+
o: function(r, n, e) {
|
|
674
|
+
return {
|
|
675
|
+
children: Zr(n, r[1], e),
|
|
676
|
+
target: Fr(r[2]),
|
|
677
|
+
title: Fr(r[3])
|
|
678
|
+
};
|
|
679
|
+
},
|
|
680
|
+
l: function(r, n, e) {
|
|
681
|
+
return er("a", {
|
|
682
|
+
key: e.key,
|
|
683
|
+
href: U(r.target, "a", "href"),
|
|
684
|
+
title: r.title
|
|
685
|
+
}, n(r.children, e));
|
|
686
|
+
}
|
|
687
|
+
}, f[16] = {
|
|
688
|
+
t: ["<"],
|
|
689
|
+
u: Cr(I),
|
|
690
|
+
i: 0,
|
|
691
|
+
o: function(r) {
|
|
692
|
+
var n = r[1], e = !1;
|
|
693
|
+
return -1 !== n.indexOf("@") && -1 === n.indexOf("//") && (e = !0, n = n.replace("mailto:", "")), {
|
|
694
|
+
children: [{
|
|
695
|
+
text: n,
|
|
696
|
+
type: "27"
|
|
697
|
+
}],
|
|
698
|
+
target: e ? "mailto:" + n : n,
|
|
699
|
+
type: "15"
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
}, f[17] = {
|
|
703
|
+
t: function(r, n) {
|
|
704
|
+
return !n.inAnchor && !t.disableAutoLink && ($r(r, "http://") || $r(r, "https://"));
|
|
705
|
+
},
|
|
706
|
+
u: Cr(C),
|
|
707
|
+
i: 0,
|
|
708
|
+
o: function(r) {
|
|
709
|
+
return {
|
|
710
|
+
children: [{
|
|
711
|
+
text: r[1],
|
|
712
|
+
type: "27"
|
|
713
|
+
}],
|
|
714
|
+
target: r[1],
|
|
715
|
+
title: void 0,
|
|
716
|
+
type: "15"
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
}, f[20] = xr(er, 1), f[33] = xr(er, 2), f[19] = {
|
|
720
|
+
t: ["\n"],
|
|
721
|
+
u: Tr(g),
|
|
722
|
+
i: 3,
|
|
723
|
+
o: Ur,
|
|
724
|
+
l: function() {
|
|
725
|
+
return "\n";
|
|
726
|
+
}
|
|
727
|
+
}, f[21] = {
|
|
728
|
+
u: jr(function(r, n) {
|
|
729
|
+
if (n.inline || n.simple || n.inHTML && -1 === r.indexOf("\n\n") && -1 === n.prevCapture.indexOf("\n\n")) return null;
|
|
730
|
+
for (var e = "", t = 0;;) {
|
|
731
|
+
var u = r.indexOf("\n", t), a = r.slice(t, -1 === u ? void 0 : u + 1);
|
|
732
|
+
if (W(H, a)) break;
|
|
733
|
+
if (e += a, -1 === u || !a.trim()) break;
|
|
734
|
+
t = u + 1;
|
|
735
|
+
}
|
|
736
|
+
var i = zr(e);
|
|
737
|
+
return "" === i ? null : [
|
|
738
|
+
e,
|
|
739
|
+
,
|
|
740
|
+
i
|
|
741
|
+
];
|
|
742
|
+
}),
|
|
743
|
+
i: 3,
|
|
744
|
+
o: Gr,
|
|
745
|
+
l: function(r, n, e) {
|
|
746
|
+
return er("p", { key: e.key }, n(r.children, e));
|
|
747
|
+
}
|
|
748
|
+
}, f[22] = {
|
|
749
|
+
t: ["["],
|
|
750
|
+
u: Cr(D),
|
|
751
|
+
i: 0,
|
|
752
|
+
o: function(r) {
|
|
753
|
+
return fr[r[1]] = {
|
|
754
|
+
target: r[2],
|
|
755
|
+
title: r[4]
|
|
756
|
+
}, {};
|
|
757
|
+
},
|
|
758
|
+
l: Vr
|
|
759
|
+
}, f[23] = {
|
|
760
|
+
t: ["!["],
|
|
761
|
+
u: Ir(F),
|
|
762
|
+
i: 0,
|
|
763
|
+
o: function(r) {
|
|
764
|
+
return {
|
|
765
|
+
alt: r[1] ? Fr(r[1]) : void 0,
|
|
766
|
+
ref: r[2]
|
|
767
|
+
};
|
|
768
|
+
},
|
|
769
|
+
l: function(r, n, e) {
|
|
770
|
+
return fr[r.ref] ? er("img", {
|
|
771
|
+
key: e.key,
|
|
772
|
+
alt: r.alt,
|
|
773
|
+
src: U(fr[r.ref].target, "img", "src"),
|
|
774
|
+
title: fr[r.ref].title
|
|
775
|
+
}) : null;
|
|
776
|
+
}
|
|
777
|
+
}, f[24] = {
|
|
778
|
+
t: function(r) {
|
|
779
|
+
return "[" === r[0] && -1 === r.indexOf("](");
|
|
780
|
+
},
|
|
781
|
+
u: Cr(P),
|
|
782
|
+
i: 0,
|
|
783
|
+
o: function(r, n, e) {
|
|
784
|
+
return {
|
|
785
|
+
children: n(r[1], e),
|
|
786
|
+
fallbackChildren: r[0],
|
|
787
|
+
ref: r[2]
|
|
788
|
+
};
|
|
789
|
+
},
|
|
790
|
+
l: function(r, n, e) {
|
|
791
|
+
return fr[r.ref] ? er("a", {
|
|
792
|
+
key: e.key,
|
|
793
|
+
href: U(fr[r.ref].target, "a", "href"),
|
|
794
|
+
title: fr[r.ref].title
|
|
795
|
+
}, n(r.children, e)) : er("span", { key: e.key }, r.fallbackChildren);
|
|
796
|
+
}
|
|
797
|
+
}, f[25] = {
|
|
798
|
+
t: ["|"],
|
|
799
|
+
u: Tr(M),
|
|
800
|
+
i: 1,
|
|
801
|
+
o: Lr,
|
|
802
|
+
l: function(r, n, e) {
|
|
803
|
+
var t = r;
|
|
804
|
+
return er("table", { key: e.key }, er("thead", null, er("tr", null, t.header.map(function(r, u) {
|
|
805
|
+
return er("th", {
|
|
806
|
+
key: u,
|
|
807
|
+
style: Or(t, u)
|
|
808
|
+
}, n(r, e));
|
|
809
|
+
}))), er("tbody", null, t.cells.map(function(r, u) {
|
|
810
|
+
return er("tr", { key: u }, r.map(function(r, u) {
|
|
811
|
+
return er("td", {
|
|
812
|
+
key: u,
|
|
813
|
+
style: Or(t, u)
|
|
814
|
+
}, n(r, e));
|
|
815
|
+
}));
|
|
816
|
+
})));
|
|
817
|
+
}
|
|
818
|
+
}, f[27] = {
|
|
819
|
+
u: jr(function(r, n) {
|
|
820
|
+
var e;
|
|
821
|
+
return $r(r, ":") && (e = rr.exec(r)), e || tr.exec(r);
|
|
822
|
+
}),
|
|
823
|
+
i: 4,
|
|
824
|
+
o: function(r) {
|
|
825
|
+
var n = r[0];
|
|
826
|
+
return { text: -1 === n.indexOf("&") ? n : n.replace(R, function(r, n) {
|
|
827
|
+
return t.namedCodesToUnicode[n] || r;
|
|
828
|
+
}) };
|
|
829
|
+
},
|
|
830
|
+
l: function(r) {
|
|
831
|
+
return r.text;
|
|
832
|
+
}
|
|
833
|
+
}, f[28] = {
|
|
834
|
+
t: ["**", "__"],
|
|
835
|
+
u: Ir(J),
|
|
836
|
+
i: 2,
|
|
837
|
+
o: function(r, n, e) {
|
|
838
|
+
return { children: n(r[2], e) };
|
|
839
|
+
},
|
|
840
|
+
l: function(r, n, e) {
|
|
841
|
+
return er("strong", { key: e.key }, n(r.children, e));
|
|
842
|
+
}
|
|
843
|
+
}, f[29] = {
|
|
844
|
+
t: function(r) {
|
|
845
|
+
var n = r[0];
|
|
846
|
+
return ("*" === n || "_" === n) && r[1] !== n;
|
|
847
|
+
},
|
|
848
|
+
u: Ir(K),
|
|
849
|
+
i: 3,
|
|
850
|
+
o: function(r, n, e) {
|
|
851
|
+
return { children: n(r[2], e) };
|
|
852
|
+
},
|
|
853
|
+
l: function(r, n, e) {
|
|
854
|
+
return er("em", { key: e.key }, n(r.children, e));
|
|
855
|
+
}
|
|
856
|
+
}, f[30] = {
|
|
857
|
+
t: ["\\"],
|
|
858
|
+
u: Ir(nr),
|
|
859
|
+
i: 1,
|
|
860
|
+
o: function(r) {
|
|
861
|
+
return {
|
|
862
|
+
text: r[1],
|
|
863
|
+
type: "27"
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
}, f[31] = {
|
|
867
|
+
t: ["=="],
|
|
868
|
+
u: Ir(X),
|
|
869
|
+
i: 3,
|
|
870
|
+
o: Gr,
|
|
871
|
+
l: function(r, n, e) {
|
|
872
|
+
return er("mark", { key: e.key }, n(r.children, e));
|
|
873
|
+
}
|
|
874
|
+
}, f[32] = {
|
|
875
|
+
t: ["~~"],
|
|
876
|
+
u: Ir(Y),
|
|
877
|
+
i: 3,
|
|
878
|
+
o: Gr,
|
|
879
|
+
l: function(r, n, e) {
|
|
880
|
+
return er("del", { key: e.key }, n(r.children, e));
|
|
881
|
+
}
|
|
882
|
+
}, f);
|
|
883
|
+
!0 === t.disableParsingRawHTML && (delete lr[11], delete lr[13]);
|
|
884
|
+
var _r = function(r) {
|
|
885
|
+
var n = Object.keys(r);
|
|
886
|
+
function e(t, u) {
|
|
887
|
+
var a = [];
|
|
888
|
+
if (u.prevCapture = u.prevCapture || "", t.trim()) for (; t;) for (var i = 0; i < n.length;) {
|
|
889
|
+
var o = n[i], c = r[o];
|
|
890
|
+
if (!c.t || Er(t, u, c.t)) {
|
|
891
|
+
var f = c.u(t, u);
|
|
892
|
+
if (f && f[0]) {
|
|
893
|
+
t = t.substring(f[0].length);
|
|
894
|
+
var l = c.o(f, e, u);
|
|
895
|
+
u.prevCapture += f[0], l.type || (l.type = o), a.push(l);
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
i++;
|
|
899
|
+
} else i++;
|
|
900
|
+
}
|
|
901
|
+
return u.prevCapture = "", a;
|
|
902
|
+
}
|
|
903
|
+
return n.sort(function(n, e) {
|
|
904
|
+
return r[n].i - r[e].i || (n < e ? -1 : 1);
|
|
905
|
+
}), function(r, n) {
|
|
906
|
+
return e(function(r) {
|
|
907
|
+
return r.replace(m, "\n").replace(q, "").replace(N, " ");
|
|
908
|
+
}(r), n);
|
|
909
|
+
};
|
|
910
|
+
}(lr), dr = function(r, n) {
|
|
911
|
+
return function e(t, u) {
|
|
912
|
+
if (void 0 === u && (u = {}), Array.isArray(t)) {
|
|
913
|
+
for (var a = u.key, i = [], o = !1, c = 0; c < t.length; c++) {
|
|
914
|
+
u.key = c;
|
|
915
|
+
var f = e(t[c], u), l = Sr(f);
|
|
916
|
+
l && o ? i[i.length - 1] += f : null !== f && i.push(f), o = l;
|
|
917
|
+
}
|
|
918
|
+
return u.key = a, i;
|
|
919
|
+
}
|
|
920
|
+
return function(e, t, u) {
|
|
921
|
+
var a = r[e.type].l;
|
|
922
|
+
return n ? n(function() {
|
|
923
|
+
return a(e, t, u);
|
|
924
|
+
}, e, t, u) : a(e, t, u);
|
|
925
|
+
}(t, e, u);
|
|
926
|
+
};
|
|
927
|
+
}(lr, t.renderRule), sr = ir(e);
|
|
928
|
+
return cr.length ? er("div", null, sr, er("footer", { key: "footer" }, cr.map(function(r) {
|
|
929
|
+
return er("div", {
|
|
930
|
+
id: G(r.identifier, Ar),
|
|
931
|
+
key: r.identifier
|
|
932
|
+
}, r.identifier, dr(_r(r.footnote, { inline: !0 })));
|
|
933
|
+
}))) : sr;
|
|
934
|
+
}
|
|
935
|
+
function index_module_default(n) {
|
|
936
|
+
var t = n.children, u = n.options, a = function(r, n) {
|
|
937
|
+
if (null == r) return {};
|
|
938
|
+
var e, t, u = {}, a = Object.keys(r);
|
|
939
|
+
for (t = 0; t < a.length; t++) n.indexOf(e = a[t]) >= 0 || (u[e] = r[e]);
|
|
940
|
+
return u;
|
|
941
|
+
}(n, e);
|
|
942
|
+
return react.cloneElement(Jr(null == t ? "" : t, u), a);
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/client/pages.tsx
|
|
946
|
+
const SAFE_LINK_PATTERN = /^(?:https?:|mailto:|#|\/)/iu;
|
|
947
|
+
function safeLink(href) {
|
|
948
|
+
if (href == null) return void 0;
|
|
949
|
+
const value = href.trim();
|
|
950
|
+
return SAFE_LINK_PATTERN.test(value) ? value : void 0;
|
|
951
|
+
}
|
|
952
|
+
/** Render managed Markdown without raw HTML and with a deliberately small link surface. */
|
|
953
|
+
function DocumentMarkdown(props) {
|
|
954
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
955
|
+
className: dsh_mnemon_client.memoryPageStyles.markdownBody,
|
|
956
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(index_module_default, {
|
|
957
|
+
options: {
|
|
958
|
+
disableParsingRawHTML: true,
|
|
959
|
+
forceBlock: true,
|
|
960
|
+
overrides: { a: { component: ({ href, children, ...rest }) => {
|
|
961
|
+
const target = safeLink(href);
|
|
962
|
+
return target === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
963
|
+
...rest,
|
|
964
|
+
href: target,
|
|
965
|
+
target: target.startsWith("http") ? "_blank" : void 0,
|
|
966
|
+
rel: target.startsWith("http") ? "noreferrer noopener" : void 0,
|
|
967
|
+
children
|
|
968
|
+
});
|
|
969
|
+
} } }
|
|
970
|
+
},
|
|
971
|
+
children: props.content
|
|
972
|
+
})
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
function DocumentsPage(props) {
|
|
976
|
+
const t = (0, dsh_mnemon_client.useT)();
|
|
977
|
+
const locale = (0, dsh_mnemon_client.useLocale)();
|
|
978
|
+
const documentCreateFormId = (0, react.useId)();
|
|
979
|
+
const documentEditFormId = (0, react.useId)();
|
|
980
|
+
const pageSize = 8;
|
|
981
|
+
const readerRef = (0, react.useRef)(null);
|
|
982
|
+
const [snapshot, setSnapshot] = (0, react.useState)(null);
|
|
983
|
+
const [items, setItems] = (0, react.useState)([]);
|
|
984
|
+
const [visibleLimit, setVisibleLimit] = (0, react.useState)(pageSize);
|
|
985
|
+
const [selectedId, setSelectedId] = (0, react.useState)(null);
|
|
986
|
+
const [selected, setSelected] = (0, react.useState)(null);
|
|
987
|
+
const [status, setStatus] = (0, react.useState)("active");
|
|
988
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
989
|
+
const [loading, setLoading] = (0, react.useState)(true);
|
|
990
|
+
const [saving, setSaving] = (0, react.useState)(false);
|
|
991
|
+
const [error, setError] = (0, react.useState)(null);
|
|
992
|
+
const [notice, setNotice] = (0, react.useState)(null);
|
|
993
|
+
const [composing, setComposing] = (0, react.useState)(false);
|
|
994
|
+
const [editing, setEditing] = (0, react.useState)(false);
|
|
995
|
+
const [confirmArchive, setConfirmArchive] = (0, react.useState)(false);
|
|
996
|
+
const [title, setTitle] = (0, react.useState)("");
|
|
997
|
+
const [description, setDescription] = (0, react.useState)("");
|
|
998
|
+
const [content, setContent] = (0, react.useState)("");
|
|
999
|
+
const [sources, setSources] = (0, react.useState)("");
|
|
1000
|
+
const displayRequests = (0, dsh_mnemon_client.useRequestVersion)();
|
|
1001
|
+
const display = (0, react.useCallback)(async (nextQuery, nextStatus) => {
|
|
1002
|
+
const request = displayRequests.begin();
|
|
1003
|
+
setLoading(true);
|
|
1004
|
+
setError(null);
|
|
1005
|
+
setVisibleLimit(pageSize);
|
|
1006
|
+
try {
|
|
1007
|
+
const current = await props.client.documents();
|
|
1008
|
+
const filtered = (nextQuery.trim() === "" ? current.documents : (await props.client.searchDocuments(nextQuery, nextStatus === "archived")).results).filter((record) => record.status === nextStatus);
|
|
1009
|
+
if (!displayRequests.isCurrent(request)) return;
|
|
1010
|
+
setSnapshot(current);
|
|
1011
|
+
setItems(filtered);
|
|
1012
|
+
setSelectedId((previous) => previous !== null && filtered.some((record) => record.id === previous) ? previous : filtered[0]?.id ?? null);
|
|
1013
|
+
} catch (reason) {
|
|
1014
|
+
if (!displayRequests.isCurrent(request)) return;
|
|
1015
|
+
setError((0, dsh_mnemon_client.message)(reason));
|
|
1016
|
+
setSnapshot(null);
|
|
1017
|
+
setItems([]);
|
|
1018
|
+
setSelectedId(null);
|
|
1019
|
+
} finally {
|
|
1020
|
+
if (displayRequests.isCurrent(request)) setLoading(false);
|
|
1021
|
+
}
|
|
1022
|
+
}, [
|
|
1023
|
+
displayRequests,
|
|
1024
|
+
pageSize,
|
|
1025
|
+
props.client
|
|
1026
|
+
]);
|
|
1027
|
+
(0, react.useEffect)(() => {
|
|
1028
|
+
display(query, status);
|
|
1029
|
+
}, [
|
|
1030
|
+
display,
|
|
1031
|
+
props.revision,
|
|
1032
|
+
status
|
|
1033
|
+
]);
|
|
1034
|
+
(0, react.useEffect)(() => {
|
|
1035
|
+
setSelected(null);
|
|
1036
|
+
if (selectedId === null) return;
|
|
1037
|
+
let active = true;
|
|
1038
|
+
props.client.document(selectedId).then((value) => {
|
|
1039
|
+
if (active) setSelected(value);
|
|
1040
|
+
}).catch((reason) => {
|
|
1041
|
+
if (active) setError((0, dsh_mnemon_client.message)(reason));
|
|
1042
|
+
});
|
|
1043
|
+
return () => {
|
|
1044
|
+
active = false;
|
|
1045
|
+
};
|
|
1046
|
+
}, [
|
|
1047
|
+
props.client,
|
|
1048
|
+
selectedId,
|
|
1049
|
+
props.revision
|
|
1050
|
+
]);
|
|
1051
|
+
(0, react.useLayoutEffect)(() => {
|
|
1052
|
+
if (readerRef.current !== null) readerRef.current.scrollTop = 0;
|
|
1053
|
+
}, [selectedId]);
|
|
1054
|
+
(0, react.useEffect)(() => {
|
|
1055
|
+
if (selectedId === null) return;
|
|
1056
|
+
const index = items.findIndex((item) => item.id === selectedId);
|
|
1057
|
+
if (index >= visibleLimit) setVisibleLimit(Math.ceil((index + 1) / pageSize) * pageSize);
|
|
1058
|
+
}, [
|
|
1059
|
+
items,
|
|
1060
|
+
pageSize,
|
|
1061
|
+
selectedId,
|
|
1062
|
+
visibleLimit
|
|
1063
|
+
]);
|
|
1064
|
+
const resetComposer = () => {
|
|
1065
|
+
setTitle("");
|
|
1066
|
+
setDescription("");
|
|
1067
|
+
setContent("");
|
|
1068
|
+
setSources("");
|
|
1069
|
+
setComposing(false);
|
|
1070
|
+
};
|
|
1071
|
+
const startComposer = () => {
|
|
1072
|
+
setTitle("");
|
|
1073
|
+
setDescription("");
|
|
1074
|
+
setContent("");
|
|
1075
|
+
setSources("");
|
|
1076
|
+
setEditing(false);
|
|
1077
|
+
setComposing(true);
|
|
1078
|
+
};
|
|
1079
|
+
const sourcePaths = (value) => value.split(/\r?\n|,/gu).map((path) => path.trim()).filter(Boolean);
|
|
1080
|
+
const create = async (event) => {
|
|
1081
|
+
event.preventDefault();
|
|
1082
|
+
setSaving(true);
|
|
1083
|
+
setError(null);
|
|
1084
|
+
setNotice(null);
|
|
1085
|
+
try {
|
|
1086
|
+
const result = await props.client.mutateDocument({
|
|
1087
|
+
action: "create",
|
|
1088
|
+
title,
|
|
1089
|
+
description,
|
|
1090
|
+
content,
|
|
1091
|
+
sourcePaths: sourcePaths(sources)
|
|
1092
|
+
});
|
|
1093
|
+
setNotice(result.maintenance === void 0 ? t("documents.created") : t("documents.createdAfterArchive", { count: result.maintenance.archivedDocumentIds.length }));
|
|
1094
|
+
setStatus("active");
|
|
1095
|
+
setQuery("");
|
|
1096
|
+
resetComposer();
|
|
1097
|
+
props.onMutate();
|
|
1098
|
+
await display("", "active");
|
|
1099
|
+
setSelectedId(result.document.id);
|
|
1100
|
+
} catch (reason) {
|
|
1101
|
+
setError((0, dsh_mnemon_client.message)(reason));
|
|
1102
|
+
} finally {
|
|
1103
|
+
setSaving(false);
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
const beginEdit = () => {
|
|
1107
|
+
if (selected === null) return;
|
|
1108
|
+
setTitle(selected.title);
|
|
1109
|
+
setDescription(selected.description);
|
|
1110
|
+
setContent(selected.content);
|
|
1111
|
+
setSources(selected.sourcePaths.join("\n"));
|
|
1112
|
+
setEditing(true);
|
|
1113
|
+
setComposing(false);
|
|
1114
|
+
setConfirmArchive(false);
|
|
1115
|
+
};
|
|
1116
|
+
const update = async (event) => {
|
|
1117
|
+
event.preventDefault();
|
|
1118
|
+
if (selected === null) return;
|
|
1119
|
+
setSaving(true);
|
|
1120
|
+
setError(null);
|
|
1121
|
+
setNotice(null);
|
|
1122
|
+
try {
|
|
1123
|
+
const result = await props.client.mutateDocument({
|
|
1124
|
+
action: "update",
|
|
1125
|
+
id: selected.id,
|
|
1126
|
+
title,
|
|
1127
|
+
description,
|
|
1128
|
+
content,
|
|
1129
|
+
sourcePaths: sourcePaths(sources)
|
|
1130
|
+
});
|
|
1131
|
+
setNotice(result.maintenance === void 0 ? t("documents.updated") : t("documents.updatedAfterArchive", { count: result.maintenance.archivedDocumentIds.length }));
|
|
1132
|
+
setEditing(false);
|
|
1133
|
+
props.onMutate();
|
|
1134
|
+
await display(query, status);
|
|
1135
|
+
setSelectedId(result.document.id);
|
|
1136
|
+
} catch (reason) {
|
|
1137
|
+
setError((0, dsh_mnemon_client.message)(reason));
|
|
1138
|
+
} finally {
|
|
1139
|
+
setSaving(false);
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
const archive = async () => {
|
|
1143
|
+
if (selected === null) return;
|
|
1144
|
+
setSaving(true);
|
|
1145
|
+
setError(null);
|
|
1146
|
+
setNotice(null);
|
|
1147
|
+
try {
|
|
1148
|
+
const result = await props.client.archiveDocument(selected.id);
|
|
1149
|
+
setNotice(t("documents.archived", { spaces: result.maintenance?.memoryBodyIds.join(", ") || "—" }));
|
|
1150
|
+
setConfirmArchive(false);
|
|
1151
|
+
setStatus("archived");
|
|
1152
|
+
setQuery("");
|
|
1153
|
+
props.onMutate();
|
|
1154
|
+
await display("", "archived");
|
|
1155
|
+
setSelectedId(result.document.id);
|
|
1156
|
+
} catch (reason) {
|
|
1157
|
+
setError((0, dsh_mnemon_client.message)(reason));
|
|
1158
|
+
} finally {
|
|
1159
|
+
setSaving(false);
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
const usage = snapshot === null ? 0 : Math.min(100, snapshot.activeBytes / snapshot.limitBytes * 100);
|
|
1163
|
+
const activeCount = snapshot?.activeCount ?? 0;
|
|
1164
|
+
const archivedCount = snapshot?.archivedCount ?? 0;
|
|
1165
|
+
const composer = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1166
|
+
id: documentCreateFormId,
|
|
1167
|
+
className: dsh_mnemon_client.memoryPageStyles.documentEditor,
|
|
1168
|
+
onSubmit: (event) => void create(event),
|
|
1169
|
+
children: [
|
|
1170
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("documents.newTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.editorHint") })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.managedCopy") })] }),
|
|
1171
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1172
|
+
className: dsh_mnemon_client.memoryPageStyles.documentEditorMeta,
|
|
1173
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.name"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1174
|
+
value: title,
|
|
1175
|
+
onChange: (event) => setTitle(event.target.value),
|
|
1176
|
+
required: true
|
|
1177
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.routing"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1178
|
+
value: description,
|
|
1179
|
+
onChange: (event) => setDescription(event.target.value)
|
|
1180
|
+
})] })]
|
|
1181
|
+
}),
|
|
1182
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.sources"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1183
|
+
value: sources,
|
|
1184
|
+
onChange: (event) => setSources(event.target.value),
|
|
1185
|
+
placeholder: t("documents.sourcesPlaceholder")
|
|
1186
|
+
})] }),
|
|
1187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.markdown"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1188
|
+
value: content,
|
|
1189
|
+
onChange: (event) => setContent(event.target.value),
|
|
1190
|
+
rows: 10,
|
|
1191
|
+
required: true
|
|
1192
|
+
})] })
|
|
1193
|
+
]
|
|
1194
|
+
});
|
|
1195
|
+
const editComposer = selected === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1196
|
+
id: documentEditFormId,
|
|
1197
|
+
className: dsh_mnemon_client.memoryPageStyles.documentEditor,
|
|
1198
|
+
onSubmit: (event) => void update(event),
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("documents.editTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.editorHint") })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: selected.id })] }),
|
|
1201
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1202
|
+
className: dsh_mnemon_client.memoryPageStyles.documentEditorMeta,
|
|
1203
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.name"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1204
|
+
value: title,
|
|
1205
|
+
onChange: (event) => setTitle(event.target.value),
|
|
1206
|
+
required: true
|
|
1207
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.routing"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1208
|
+
value: description,
|
|
1209
|
+
onChange: (event) => setDescription(event.target.value)
|
|
1210
|
+
})] })]
|
|
1211
|
+
}),
|
|
1212
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.sources"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1213
|
+
value: sources,
|
|
1214
|
+
onChange: (event) => setSources(event.target.value)
|
|
1215
|
+
})] }),
|
|
1216
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.markdown"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1217
|
+
value: content,
|
|
1218
|
+
onChange: (event) => setContent(event.target.value),
|
|
1219
|
+
rows: 18,
|
|
1220
|
+
required: true
|
|
1221
|
+
})] })
|
|
1222
|
+
]
|
|
1223
|
+
});
|
|
1224
|
+
const documentEditActionClass = (0, dsh_mnemon_client.appearanceClass)(dsh_mnemon_client.memoryPageStyles.ghostButton, (0, dsh_mnemon_client.appearanceClass)(dsh_mnemon_client.memorySidebarStyles.itemActionButton, dsh_mnemon_client.memorySidebarStyles.itemEditAction));
|
|
1225
|
+
const documentArchiveActionClass = (0, dsh_mnemon_client.appearanceClass)(dsh_mnemon_client.memoryPageStyles.dangerButton, (0, dsh_mnemon_client.appearanceClass)(dsh_mnemon_client.memorySidebarStyles.itemActionButton, dsh_mnemon_client.memorySidebarStyles.itemDangerAction));
|
|
1226
|
+
const visibleItems = items.slice(0, visibleLimit);
|
|
1227
|
+
const selectDocument = (documentId) => {
|
|
1228
|
+
if (selectedId === documentId) return;
|
|
1229
|
+
setSelected(null);
|
|
1230
|
+
setSelectedId(documentId);
|
|
1231
|
+
setEditing(false);
|
|
1232
|
+
setConfirmArchive(false);
|
|
1233
|
+
};
|
|
1234
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1235
|
+
className: dsh_mnemon_client.memoryPageStyles.page,
|
|
1236
|
+
children: [
|
|
1237
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.PageHeader, {
|
|
1238
|
+
title: t("documents.title"),
|
|
1239
|
+
description: t("documents.description"),
|
|
1240
|
+
meta: snapshot === null ? t("common.loading") : t("documents.capacity", {
|
|
1241
|
+
used: (0, dsh_mnemon_client.humanBytes)(snapshot.activeBytes),
|
|
1242
|
+
limit: (0, dsh_mnemon_client.humanBytes)(snapshot.limitBytes)
|
|
1243
|
+
}),
|
|
1244
|
+
action: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1245
|
+
type: "button",
|
|
1246
|
+
className: dsh_mnemon_client.memoryPageStyles.secondaryButton,
|
|
1247
|
+
disabled: loading,
|
|
1248
|
+
onClick: () => void display(query, status),
|
|
1249
|
+
children: t("documents.refresh")
|
|
1250
|
+
}), props.writeEnabled && (props.canCreate ?? props.sessionId !== void 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1251
|
+
type: "button",
|
|
1252
|
+
className: dsh_mnemon_client.memoryPageStyles.primaryButton,
|
|
1253
|
+
onClick: startComposer,
|
|
1254
|
+
children: t("documents.new")
|
|
1255
|
+
})] })
|
|
1256
|
+
}),
|
|
1257
|
+
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1258
|
+
className: dsh_mnemon_client.memoryPageStyles.inlineError,
|
|
1259
|
+
role: "alert",
|
|
1260
|
+
children: error
|
|
1261
|
+
}),
|
|
1262
|
+
notice !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1263
|
+
className: dsh_mnemon_client.memoryPageStyles.runtimeNotice,
|
|
1264
|
+
role: "status",
|
|
1265
|
+
children: notice
|
|
1266
|
+
}),
|
|
1267
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1268
|
+
className: dsh_mnemon_client.memoryPageStyles.documentSummary,
|
|
1269
|
+
"aria-label": t("documents.summary"),
|
|
1270
|
+
children: [
|
|
1271
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", { children: [
|
|
1272
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.active") }),
|
|
1273
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: activeCount }),
|
|
1274
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("documents.activeHint") })
|
|
1275
|
+
] }),
|
|
1276
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", { children: [
|
|
1277
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.archivedCount") }),
|
|
1278
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: archivedCount }),
|
|
1279
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("documents.archivedHint") })
|
|
1280
|
+
] }),
|
|
1281
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
1282
|
+
className: dsh_mnemon_client.memoryPageStyles.documentCapacity,
|
|
1283
|
+
children: [
|
|
1284
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.activeCapacity") }),
|
|
1285
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: snapshot === null ? "—" : `${usage.toFixed(1)}%` }),
|
|
1286
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { style: { width: `${usage}%` } }) }),
|
|
1287
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("documents.capacityHint") })
|
|
1288
|
+
]
|
|
1289
|
+
})
|
|
1290
|
+
]
|
|
1291
|
+
}),
|
|
1292
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1293
|
+
className: dsh_mnemon_client.memoryPageStyles.documentToolbar,
|
|
1294
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1295
|
+
onSubmit: (event) => {
|
|
1296
|
+
event.preventDefault();
|
|
1297
|
+
display(query, status);
|
|
1298
|
+
},
|
|
1299
|
+
children: [
|
|
1300
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1301
|
+
"aria-hidden": "true",
|
|
1302
|
+
children: "⌕"
|
|
1303
|
+
}),
|
|
1304
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1305
|
+
"aria-label": t("documents.searchAria"),
|
|
1306
|
+
value: query,
|
|
1307
|
+
onChange: (event) => setQuery(event.target.value),
|
|
1308
|
+
placeholder: t("documents.searchPlaceholder")
|
|
1309
|
+
}),
|
|
1310
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1311
|
+
type: "submit",
|
|
1312
|
+
className: dsh_mnemon_client.memoryPageStyles.secondaryButton,
|
|
1313
|
+
children: t("documents.search")
|
|
1314
|
+
})
|
|
1315
|
+
]
|
|
1316
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1317
|
+
role: "group",
|
|
1318
|
+
"aria-label": t("documents.scope"),
|
|
1319
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1320
|
+
type: "button",
|
|
1321
|
+
"data-active": status === "active" || void 0,
|
|
1322
|
+
onClick: () => setStatus("active"),
|
|
1323
|
+
children: [
|
|
1324
|
+
t("documents.active"),
|
|
1325
|
+
" ",
|
|
1326
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: activeCount })
|
|
1327
|
+
]
|
|
1328
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1329
|
+
type: "button",
|
|
1330
|
+
"data-active": status === "archived" || void 0,
|
|
1331
|
+
onClick: () => setStatus("archived"),
|
|
1332
|
+
children: [
|
|
1333
|
+
t("documents.archivedCount"),
|
|
1334
|
+
" ",
|
|
1335
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: archivedCount })
|
|
1336
|
+
]
|
|
1337
|
+
})]
|
|
1338
|
+
})]
|
|
1339
|
+
}),
|
|
1340
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1341
|
+
className: dsh_mnemon_client.memoryPageStyles.documentWorkspace,
|
|
1342
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
|
|
1343
|
+
className: dsh_mnemon_client.memoryPageStyles.documentList,
|
|
1344
|
+
"aria-label": t("documents.list"),
|
|
1345
|
+
children: [
|
|
1346
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: status === "active" ? t("documents.activeList") : t("documents.archiveList") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: items.length })] }),
|
|
1347
|
+
visibleItems.map((document) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1348
|
+
type: "button",
|
|
1349
|
+
"aria-pressed": selectedId === document.id,
|
|
1350
|
+
"data-selected": selectedId === document.id || void 0,
|
|
1351
|
+
onClick: () => selectDocument(document.id),
|
|
1352
|
+
children: [
|
|
1353
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: document.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
|
|
1354
|
+
dateTime: document.updatedAt,
|
|
1355
|
+
children: new Date(document.updatedAt).toLocaleDateString(locale)
|
|
1356
|
+
})] }),
|
|
1357
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: document.description || document.excerpt || t("documents.noDescription") }),
|
|
1358
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", { children: [
|
|
1359
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: (0, dsh_mnemon_client.humanBytes)(document.sizeBytes) }),
|
|
1360
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: document.id.slice(0, 8) }),
|
|
1361
|
+
document.healthy === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("em", { children: t("documents.missing") })
|
|
1362
|
+
] })
|
|
1363
|
+
]
|
|
1364
|
+
}, document.id)),
|
|
1365
|
+
!loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.ProgressiveFooter, {
|
|
1366
|
+
compact: true,
|
|
1367
|
+
visible: visibleItems.length,
|
|
1368
|
+
total: items.length,
|
|
1369
|
+
pageSize,
|
|
1370
|
+
onMore: () => setVisibleLimit((value) => value + pageSize)
|
|
1371
|
+
}),
|
|
1372
|
+
!loading && items.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1373
|
+
className: dsh_mnemon_client.memoryPageStyles.documentListEmpty,
|
|
1374
|
+
children: [
|
|
1375
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "▤" }),
|
|
1376
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: status === "active" ? t("documents.emptyActive") : t("documents.emptyArchived") }),
|
|
1377
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: status === "active" ? t("documents.emptyActiveText") : t("documents.emptyArchivedText") })
|
|
1378
|
+
]
|
|
1379
|
+
}),
|
|
1380
|
+
loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1381
|
+
className: dsh_mnemon_client.memoryPageStyles.loading,
|
|
1382
|
+
children: t("common.loading")
|
|
1383
|
+
})
|
|
1384
|
+
]
|
|
1385
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
1386
|
+
ref: readerRef,
|
|
1387
|
+
className: dsh_mnemon_client.memoryPageStyles.documentReader,
|
|
1388
|
+
"aria-label": t("documents.reader"),
|
|
1389
|
+
"data-scroll-region": "",
|
|
1390
|
+
children: selected === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.EmptyState, {
|
|
1391
|
+
glyph: "▤",
|
|
1392
|
+
title: t("documents.selectTitle"),
|
|
1393
|
+
children: t("documents.selectText")
|
|
1394
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
1395
|
+
className: dsh_mnemon_client.memoryPageStyles.documentDetail,
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
1398
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selected.status === "active" ? t("documents.active") : t("documents.coldArchive") }),
|
|
1399
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: selected.title }),
|
|
1400
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: selected.description || t("documents.noDescription") })
|
|
1401
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: props.writeEnabled && selected.status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1402
|
+
type: "button",
|
|
1403
|
+
className: documentEditActionClass,
|
|
1404
|
+
onClick: beginEdit,
|
|
1405
|
+
children: t("documents.edit")
|
|
1406
|
+
}) })] }),
|
|
1407
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", { children: [
|
|
1408
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.path") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: selected.relativePath }) })] }),
|
|
1409
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.revision") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: selected.revision })] }),
|
|
1410
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.hash") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: selected.contentHash.slice(0, 16) }) })] }),
|
|
1411
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.size") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: (0, dsh_mnemon_client.humanBytes)(selected.sizeBytes) })] })
|
|
1412
|
+
] }),
|
|
1413
|
+
selected.sourcePaths.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1414
|
+
className: dsh_mnemon_client.memoryPageStyles.documentSources,
|
|
1415
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.sources") }), selected.sourcePaths.map((path) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: path }, path))]
|
|
1416
|
+
}),
|
|
1417
|
+
selected.status === "archived" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1418
|
+
className: dsh_mnemon_client.memoryPageStyles.documentArchiveReceipt,
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("documents.archiveReceipt") }),
|
|
1421
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: selected.archiveSummary }),
|
|
1422
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: selected.memoryBodyIds.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: id }, id)) })
|
|
1423
|
+
]
|
|
1424
|
+
}),
|
|
1425
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocumentMarkdown, { content: selected.content }),
|
|
1426
|
+
props.writeEnabled && selected.status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
|
|
1427
|
+
className: dsh_mnemon_client.memoryPageStyles.documentDanger,
|
|
1428
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("documents.archiveTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.archiveDescription") })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1429
|
+
type: "button",
|
|
1430
|
+
className: documentArchiveActionClass,
|
|
1431
|
+
onClick: () => setConfirmArchive(true),
|
|
1432
|
+
children: t("documents.archive")
|
|
1433
|
+
})] })
|
|
1434
|
+
})
|
|
1435
|
+
]
|
|
1436
|
+
})
|
|
1437
|
+
})]
|
|
1438
|
+
}),
|
|
1439
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1440
|
+
className: dsh_mnemon_client.memoryPageStyles.runtimeFootnote,
|
|
1441
|
+
children: t("documents.footnote")
|
|
1442
|
+
}),
|
|
1443
|
+
composing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
|
|
1444
|
+
title: t("documents.newTitle"),
|
|
1445
|
+
description: t("documents.editorHint"),
|
|
1446
|
+
busy: saving,
|
|
1447
|
+
onClose: resetComposer,
|
|
1448
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1449
|
+
className: dsh_mnemon_client.memoryPageStyles.modalFooterActions,
|
|
1450
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1451
|
+
type: "button",
|
|
1452
|
+
"data-dialog-close": true,
|
|
1453
|
+
className: dsh_mnemon_client.memoryPageStyles.ghostButton,
|
|
1454
|
+
disabled: saving,
|
|
1455
|
+
onClick: resetComposer,
|
|
1456
|
+
children: t("common.cancel")
|
|
1457
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1458
|
+
type: "submit",
|
|
1459
|
+
form: documentCreateFormId,
|
|
1460
|
+
className: dsh_mnemon_client.memoryPageStyles.primaryButton,
|
|
1461
|
+
disabled: saving || title.trim() === "" || content.trim() === "",
|
|
1462
|
+
children: saving ? t("documents.saving") : t("documents.create")
|
|
1463
|
+
})]
|
|
1464
|
+
}),
|
|
1465
|
+
children: composer
|
|
1466
|
+
}),
|
|
1467
|
+
editing && selected !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
|
|
1468
|
+
title: t("documents.editTitle"),
|
|
1469
|
+
description: selected.title,
|
|
1470
|
+
busy: saving,
|
|
1471
|
+
onClose: () => setEditing(false),
|
|
1472
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1473
|
+
className: dsh_mnemon_client.memoryPageStyles.modalFooterActions,
|
|
1474
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1475
|
+
type: "button",
|
|
1476
|
+
"data-dialog-close": true,
|
|
1477
|
+
className: dsh_mnemon_client.memoryPageStyles.ghostButton,
|
|
1478
|
+
disabled: saving,
|
|
1479
|
+
onClick: () => setEditing(false),
|
|
1480
|
+
children: t("common.cancel")
|
|
1481
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1482
|
+
type: "submit",
|
|
1483
|
+
form: documentEditFormId,
|
|
1484
|
+
className: dsh_mnemon_client.memoryPageStyles.primaryButton,
|
|
1485
|
+
disabled: saving,
|
|
1486
|
+
children: saving ? t("documents.saving") : t("documents.save")
|
|
1487
|
+
})]
|
|
1488
|
+
}),
|
|
1489
|
+
children: editComposer
|
|
1490
|
+
}),
|
|
1491
|
+
confirmArchive && selected !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
|
|
1492
|
+
title: t("documents.archiveConfirm"),
|
|
1493
|
+
description: selected.title,
|
|
1494
|
+
busy: saving,
|
|
1495
|
+
onClose: () => setConfirmArchive(false),
|
|
1496
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1497
|
+
className: dsh_mnemon_client.memoryPageStyles.modalFooterActions,
|
|
1498
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1499
|
+
type: "button",
|
|
1500
|
+
"data-dialog-close": true,
|
|
1501
|
+
"data-autofocus": true,
|
|
1502
|
+
className: dsh_mnemon_client.memoryPageStyles.ghostButton,
|
|
1503
|
+
disabled: saving,
|
|
1504
|
+
onClick: () => setConfirmArchive(false),
|
|
1505
|
+
children: t("common.cancel")
|
|
1506
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1507
|
+
type: "button",
|
|
1508
|
+
className: dsh_mnemon_client.memoryPageStyles.dangerSolidButton,
|
|
1509
|
+
disabled: saving,
|
|
1510
|
+
onClick: () => void archive(),
|
|
1511
|
+
children: saving ? t("documents.archiving") : t("documents.archiveNow")
|
|
1512
|
+
})]
|
|
1513
|
+
}),
|
|
1514
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1515
|
+
className: dsh_mnemon_client.memoryPageStyles.bodyDeleteConfirm,
|
|
1516
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.archiveDescription") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1517
|
+
className: dsh_mnemon_client.memoryPageStyles.bodyDeleteSummary,
|
|
1518
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: selected.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1519
|
+
selected.relativePath,
|
|
1520
|
+
" · ",
|
|
1521
|
+
(0, dsh_mnemon_client.humanBytes)(selected.sizeBytes)
|
|
1522
|
+
] })]
|
|
1523
|
+
})]
|
|
1524
|
+
})
|
|
1525
|
+
})
|
|
1526
|
+
]
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region src/client/ui.tsx
|
|
1531
|
+
function documentsPageClient(management) {
|
|
1532
|
+
const client = (0, dsh_mnemon_client.createMemorySourcePageClient)(management);
|
|
1533
|
+
return {
|
|
1534
|
+
documents: () => client.read("snapshot"),
|
|
1535
|
+
document: (id) => client.read("document", { id }),
|
|
1536
|
+
searchDocuments: (query, includeArchived = false, limit = 50) => client.read("search", {
|
|
1537
|
+
query,
|
|
1538
|
+
includeArchived,
|
|
1539
|
+
limit
|
|
1540
|
+
}),
|
|
1541
|
+
mutateDocument: (input) => client.canAssist("mutate") ? client.assist("mutate", { ...input }, true) : client.mutate("mutate", { ...input }, true),
|
|
1542
|
+
archiveDocument: (id) => client.canAssist("archive") ? client.assist("archive", { id }, true) : client.mutate("archive", { id }, true)
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
function DocumentsSourceView(props) {
|
|
1546
|
+
const client = (0, react.useMemo)(() => props.management === void 0 ? void 0 : documentsPageClient(props.management), [props.management]);
|
|
1547
|
+
const [revision, setRevision] = (0, react.useState)(0);
|
|
1548
|
+
if (client === void 0) return null;
|
|
1549
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocumentsPage, {
|
|
1550
|
+
canCreate: true,
|
|
1551
|
+
client,
|
|
1552
|
+
revision,
|
|
1553
|
+
writeEnabled: props.writable === true,
|
|
1554
|
+
onMutate: () => {
|
|
1555
|
+
setRevision((value) => value + 1);
|
|
1556
|
+
props.onRefresh?.();
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
function DocumentsSourcePage(props) {
|
|
1561
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.MemorySourcePageFrame, {
|
|
1562
|
+
locale: props.locale,
|
|
1563
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocumentsSourceView, { ...props }, props.sourceInstanceKey)
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
function installDocumentsMemoryUI(ctx, t = dsh_mnemon_client.translateEn) {
|
|
1567
|
+
return (0, dsh_mnemon_client.installMemorySourceUI)(ctx, {
|
|
1568
|
+
sourceTypeId: "documents",
|
|
1569
|
+
pages: [{
|
|
1570
|
+
id: "library",
|
|
1571
|
+
order: 200,
|
|
1572
|
+
navigation: {
|
|
1573
|
+
group: "storage",
|
|
1574
|
+
glyph: "▤"
|
|
1575
|
+
},
|
|
1576
|
+
label: () => t("nav.documents"),
|
|
1577
|
+
component: DocumentsSourcePage
|
|
1578
|
+
}]
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
const inject = ["slots", "locale"];
|
|
1582
|
+
function apply(ctx) {
|
|
1583
|
+
installDocumentsMemoryUI(ctx, ctx.locale?.bind("mnemon") ?? dsh_mnemon_client.translateEn);
|
|
1584
|
+
}
|
|
1585
|
+
//#endregion
|
|
1586
|
+
exports.DocumentsPage = DocumentsPage;
|
|
1587
|
+
exports.DocumentsSourcePage = DocumentsSourcePage;
|
|
1588
|
+
exports.apply = apply;
|
|
1589
|
+
exports.documentsPageClient = documentsPageClient;
|
|
1590
|
+
exports.inject = inject;
|
|
1591
|
+
exports.installDocumentsMemoryUI = installDocumentsMemoryUI;
|
|
1592
|
+
return module.exports;
|
|
1593
|
+
}
|
|
1594
|
+
});
|