@loomcycle/explorer 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PathExplorer.d.ts +2 -0
- package/dist/components/TransferModal.d.ts +14 -0
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1175 -908
- package/dist/index.js.map +1 -1
- package/dist/lib/dataLayer.d.ts +2 -0
- package/dist/lib/transfer.d.ts +61 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,11 +37,59 @@ function y(e, t) {
|
|
|
37
37
|
return n === "" || e.some((e) => e.toLowerCase() === n.toLowerCase()) ? e : [n, ...e];
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
|
+
//#region src/lib/transfer.ts
|
|
41
|
+
function b(e) {
|
|
42
|
+
let t = {
|
|
43
|
+
op: e.op === "copy" ? "copy_documents" : "move_documents",
|
|
44
|
+
scope: e.scope,
|
|
45
|
+
to_scope: e.toScope,
|
|
46
|
+
dry_run: e.dryRun
|
|
47
|
+
};
|
|
48
|
+
e.documentId && (t.document_ids = [e.documentId]), e.underPath && (t.under_path = e.underPath);
|
|
49
|
+
let n = w(e.from), r = w(e.to);
|
|
50
|
+
return n && r && n !== r && (t.path_map = { [n]: r }), e.op === "move" && (e.dropDangling && (t.dangling = "drop"), e.dryRun || (t.expect_count = e.expectCount ?? 0)), t;
|
|
51
|
+
}
|
|
52
|
+
function x(e) {
|
|
53
|
+
let t = e.to.trim();
|
|
54
|
+
return t.startsWith("/") ? e.op === "move" && e.toScope === e.scope ? "a move goes to another scope; to rename within this one, use rename / move" : e.op === "copy" && e.toScope === e.scope && w(t) === w(e.from) ? "a copy into the same scope needs a new path" : null : "the new path must start with /";
|
|
55
|
+
}
|
|
56
|
+
function S(e, t) {
|
|
57
|
+
let n = t.counts ?? {}, r = n.documents ?? 0, i = e === "copy" ? "copied" : "moved", a = [], o = `${n.chunks ?? 0} parts, ${n.revisions ?? 0} revisions, ${n.statements ?? 0} relations, ${n.assets ?? 0} images`;
|
|
58
|
+
if (t.dry_run) a.push(`${r} ${T(r, "document")} would be ${i}: ${o}.`), t.to_finish?.length && a.push(`${t.to_finish.length} ${T(t.to_finish.length, "document")} left by an earlier interrupted move will be finished.`);
|
|
59
|
+
else if (e === "move") {
|
|
60
|
+
let e = t.moved?.length ?? 0;
|
|
61
|
+
a.push(`${e} ${T(e, "document")} moved: ${o}.`);
|
|
62
|
+
} else a.push(`${r} ${T(r, "document")} copied: ${o}.`);
|
|
63
|
+
let s = t.refused_count ?? t.refused?.length ?? 0;
|
|
64
|
+
if (s > 0) {
|
|
65
|
+
a.push(`${s} ${T(s, "document")} refused:`);
|
|
66
|
+
for (let e of t.refused ?? []) a.push(` ${e.document_id}: ${e.code}${e.detail ? ` — ${e.detail}` : ""}`);
|
|
67
|
+
}
|
|
68
|
+
if (t.dangling_count > 0) {
|
|
69
|
+
e === "copy" ? a.push(`${t.dangling_count} ${T(t.dangling_count, "relation")} to documents outside the set stay behind.`) : t.dropped === void 0 ? t.blocked_by === "dangling_relations" ? a.push(`${t.dangling_count} ${T(t.dangling_count, "relation")} join these documents to ones outside the set. A relation cannot span two scopes: include the other documents, or drop these relations.`) : a.push(`${t.dangling_count} ${T(t.dangling_count, "relation")} to documents outside the set will be dropped.`) : a.push(`${t.dropped} ${T(t.dropped, "relation")} to documents outside the set were dropped.`);
|
|
70
|
+
for (let e of t.dangling ?? []) a.push(` ${e.kind}: ${e.from} → ${e.to} (outside: ${e.outside})`);
|
|
71
|
+
}
|
|
72
|
+
for (let e of t.unfinished ?? []) a.push(`not finished: ${e.document_id}: ${e.code}${e.detail ? ` — ${e.detail}` : ""}. Run the move again.`);
|
|
73
|
+
for (let e of t.name_failures ?? []) a.push(`no name ${e.path} for ${e.document_id}: ${e.error}`);
|
|
74
|
+
return t.body_failures && a.push(`${t.body_failures} ${T(t.body_failures, "body", "bodies")} could not be written.`), t.statements_failed && a.push(`${t.statements_failed} ${T(t.statements_failed, "relation")} could not be written${t.statement_error ? `: ${t.statement_error}` : ""}.`), a;
|
|
75
|
+
}
|
|
76
|
+
function C(e, t, n) {
|
|
77
|
+
return e === "move" && t.dangling_count > 0 && !n || (t.counts?.documents ?? 0) === 0 && !(t.to_finish?.length ?? 0);
|
|
78
|
+
}
|
|
79
|
+
function w(e) {
|
|
80
|
+
let t = e.trim(), n = t.length;
|
|
81
|
+
for (; n > 1 && t[n - 1] === "/";) n--;
|
|
82
|
+
return t.slice(0, n);
|
|
83
|
+
}
|
|
84
|
+
function T(e, t, n = t + "s") {
|
|
85
|
+
return e === 1 ? t : n;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
40
88
|
//#region src/lib/dataLayer.tsx
|
|
41
|
-
var
|
|
42
|
-
function
|
|
89
|
+
var E = 4, D = 5e3;
|
|
90
|
+
function O(e, t, n) {
|
|
43
91
|
return {
|
|
44
|
-
...
|
|
92
|
+
...k(e, n),
|
|
45
93
|
pathLs: (t, n, r, i, a) => e.path({
|
|
46
94
|
op: "ls",
|
|
47
95
|
path: t,
|
|
@@ -60,14 +108,14 @@ function S(e, t, n) {
|
|
|
60
108
|
}),
|
|
61
109
|
documentPath: async (t, n, r) => {
|
|
62
110
|
let i;
|
|
63
|
-
for (let a = 0; a <
|
|
111
|
+
for (let a = 0; a < E; a++) {
|
|
64
112
|
let a = await e.path({
|
|
65
113
|
op: "ls",
|
|
66
114
|
path: "/",
|
|
67
115
|
scope: n,
|
|
68
116
|
recursive: !0,
|
|
69
117
|
kind_filter: "document",
|
|
70
|
-
limit:
|
|
118
|
+
limit: D,
|
|
71
119
|
...i ? { cursor: i } : {}
|
|
72
120
|
}, r), o = (a.entries ?? []).find((e) => e.resource_ref?.document_id === t);
|
|
73
121
|
if (o) return o.full_path;
|
|
@@ -102,6 +150,7 @@ function S(e, t, n) {
|
|
|
102
150
|
id: t,
|
|
103
151
|
scope: n
|
|
104
152
|
}, r),
|
|
153
|
+
documentsTransfer: (t, n) => e.document(b(t), n),
|
|
105
154
|
documentGet: (t, n, r) => e.document({
|
|
106
155
|
op: "get_document",
|
|
107
156
|
id: t,
|
|
@@ -261,7 +310,7 @@ function S(e, t, n) {
|
|
|
261
310
|
} } : {}
|
|
262
311
|
};
|
|
263
312
|
}
|
|
264
|
-
function
|
|
313
|
+
function k(e, t) {
|
|
265
314
|
let n = e, r = (e) => e?.tenant ? `?tenant=${encodeURIComponent(e.tenant)}` : "", i = {};
|
|
266
315
|
typeof n.ruleStatements == "function" ? i.documentRuleStatements = (e, t) => n.ruleStatements(e.action, e.ids ? { ids: e.ids } : { filter: e.filter }, {
|
|
267
316
|
reason: e.reason,
|
|
@@ -286,35 +335,35 @@ function C(e, t) {
|
|
|
286
335
|
});
|
|
287
336
|
}), i;
|
|
288
337
|
}
|
|
289
|
-
var
|
|
290
|
-
function
|
|
291
|
-
return /* @__PURE__ */ l(
|
|
338
|
+
var A = e(null);
|
|
339
|
+
function j({ value: e, children: t }) {
|
|
340
|
+
return /* @__PURE__ */ l(A.Provider, {
|
|
292
341
|
value: e,
|
|
293
342
|
children: t
|
|
294
343
|
});
|
|
295
344
|
}
|
|
296
|
-
function
|
|
297
|
-
let e = n(
|
|
345
|
+
function M() {
|
|
346
|
+
let e = n(A);
|
|
298
347
|
if (!e) throw Error("useExplorerData must be used within <PathExplorer> or <DocumentViewer> (no ExplorerDataLayer in context)");
|
|
299
348
|
return e;
|
|
300
349
|
}
|
|
301
|
-
var
|
|
302
|
-
function
|
|
350
|
+
var N = 5e3;
|
|
351
|
+
function P(e) {
|
|
303
352
|
return e === "" ? "/" : e;
|
|
304
353
|
}
|
|
305
|
-
function
|
|
354
|
+
function F(e) {
|
|
306
355
|
let t = e.lastIndexOf("/");
|
|
307
356
|
return t <= 0 ? "" : e.slice(0, t);
|
|
308
357
|
}
|
|
309
|
-
function
|
|
358
|
+
function ee(e) {
|
|
310
359
|
let t = [""], n = e.split("/").filter(Boolean), r = "";
|
|
311
360
|
for (let e = 0; e < n.length - 1; e++) r = `${r}/${n[e]}`, t.push(r);
|
|
312
361
|
return t;
|
|
313
362
|
}
|
|
314
|
-
function
|
|
363
|
+
function te(e) {
|
|
315
364
|
return e instanceof Error ? e.message : String(e);
|
|
316
365
|
}
|
|
317
|
-
function
|
|
366
|
+
function ne(e, t) {
|
|
318
367
|
return {
|
|
319
368
|
entries: [...t, ...e.entries ?? []],
|
|
320
369
|
nextCursor: e.next_cursor || void 0,
|
|
@@ -322,7 +371,7 @@ function M(e, t) {
|
|
|
322
371
|
loading: !1
|
|
323
372
|
};
|
|
324
373
|
}
|
|
325
|
-
var
|
|
374
|
+
var re = class {
|
|
326
375
|
data;
|
|
327
376
|
scope;
|
|
328
377
|
browse;
|
|
@@ -356,7 +405,7 @@ var ee = class {
|
|
|
356
405
|
}
|
|
357
406
|
reload(e) {
|
|
358
407
|
let t = this.dirs.get(e), n = t?.entries.length ?? 0, r = t?.loaded && !t.nextCursor ? n + this.pageLimit : n;
|
|
359
|
-
return this.fetchFirst(e, Math.min(
|
|
408
|
+
return this.fetchFirst(e, Math.min(N, Math.max(this.pageLimit, r)));
|
|
360
409
|
}
|
|
361
410
|
fetchFirst(e, t) {
|
|
362
411
|
let n = (this.epoch.get(e) ?? 0) + 1;
|
|
@@ -368,15 +417,15 @@ var ee = class {
|
|
|
368
417
|
loaded: r?.loaded ?? !1,
|
|
369
418
|
loading: !0
|
|
370
419
|
});
|
|
371
|
-
let i = this.data.pathLs(
|
|
372
|
-
this.epoch.get(e) === n && this.set(e,
|
|
420
|
+
let i = this.data.pathLs(P(e), this.scope, !1, this.browse, { limit: t }).then((t) => {
|
|
421
|
+
this.epoch.get(e) === n && this.set(e, ne(t, []));
|
|
373
422
|
}, (t) => {
|
|
374
423
|
throw this.epoch.get(e) === n && this.set(e, {
|
|
375
424
|
entries: r?.entries ?? [],
|
|
376
425
|
nextCursor: r?.nextCursor,
|
|
377
426
|
loaded: r?.loaded ?? !1,
|
|
378
427
|
loading: !1,
|
|
379
|
-
error:
|
|
428
|
+
error: te(t)
|
|
380
429
|
}), t;
|
|
381
430
|
});
|
|
382
431
|
return this.track(e, i);
|
|
@@ -392,16 +441,16 @@ var ee = class {
|
|
|
392
441
|
loading: !0,
|
|
393
442
|
error: void 0
|
|
394
443
|
});
|
|
395
|
-
let i = this.data.pathLs(
|
|
444
|
+
let i = this.data.pathLs(P(e), this.scope, !1, this.browse, {
|
|
396
445
|
limit: this.pageLimit,
|
|
397
446
|
cursor: n.nextCursor
|
|
398
447
|
}).then((t) => {
|
|
399
|
-
this.epoch.get(e) === r && this.set(e,
|
|
448
|
+
this.epoch.get(e) === r && this.set(e, ne(t, n.entries));
|
|
400
449
|
}, (t) => {
|
|
401
450
|
throw this.epoch.get(e) === r && this.set(e, {
|
|
402
451
|
...n,
|
|
403
452
|
loading: !1,
|
|
404
|
-
error:
|
|
453
|
+
error: te(t)
|
|
405
454
|
}), t;
|
|
406
455
|
});
|
|
407
456
|
return this.track(e, i);
|
|
@@ -427,7 +476,7 @@ var ee = class {
|
|
|
427
476
|
for (let t of [...this.dirs.keys()]) (t === e || t.startsWith(`${e}/`)) && (this.dirs.delete(t), this.epoch.set(t, (this.epoch.get(t) ?? 0) + 1), this.inflight.delete(t));
|
|
428
477
|
this.publish();
|
|
429
478
|
}
|
|
430
|
-
let n =
|
|
479
|
+
let n = ee(e).filter((e) => this.dirs.has(e));
|
|
431
480
|
await Promise.all(n.map((e) => this.reload(e)));
|
|
432
481
|
}
|
|
433
482
|
async refresh(e) {
|
|
@@ -439,11 +488,11 @@ var ee = class {
|
|
|
439
488
|
await Promise.all(n.map((e) => this.reload(e)));
|
|
440
489
|
}
|
|
441
490
|
};
|
|
442
|
-
async function
|
|
491
|
+
async function ie(e, t, n, r) {
|
|
443
492
|
let i = [], a;
|
|
444
493
|
for (;;) {
|
|
445
|
-
let o = await e.pathLs(
|
|
446
|
-
limit:
|
|
494
|
+
let o = await e.pathLs(P(t), n, !0, r, {
|
|
495
|
+
limit: N,
|
|
447
496
|
cursor: a
|
|
448
497
|
});
|
|
449
498
|
i.push(...o.entries ?? []);
|
|
@@ -452,7 +501,7 @@ async function te(e, t, n, r) {
|
|
|
452
501
|
a = s;
|
|
453
502
|
}
|
|
454
503
|
}
|
|
455
|
-
function
|
|
504
|
+
function ae(e) {
|
|
456
505
|
let t = [];
|
|
457
506
|
for (let n of e) {
|
|
458
507
|
if (n.kind !== "document") continue;
|
|
@@ -463,7 +512,7 @@ function ne(e) {
|
|
|
463
512
|
}
|
|
464
513
|
//#endregion
|
|
465
514
|
//#region src/lib/createClient.ts
|
|
466
|
-
function
|
|
515
|
+
function I(e) {
|
|
467
516
|
let t = e.fetch;
|
|
468
517
|
return new d({
|
|
469
518
|
baseUrl: e.baseUrl,
|
|
@@ -471,21 +520,21 @@ function N(e) {
|
|
|
471
520
|
fetch: (e, n) => t ? t(e, n) : fetch(e, n)
|
|
472
521
|
});
|
|
473
522
|
}
|
|
474
|
-
function
|
|
523
|
+
function L(e) {
|
|
475
524
|
let t = e.fetch, n = (e, n) => t ? t(e, n) : fetch(e, n);
|
|
476
525
|
return (t) => {
|
|
477
526
|
let r = {};
|
|
478
527
|
return e.token && (r.Authorization = `Bearer ${e.token}`), n(e.baseUrl + t, { headers: r });
|
|
479
528
|
};
|
|
480
529
|
}
|
|
481
|
-
var
|
|
530
|
+
var oe = class extends Error {
|
|
482
531
|
status;
|
|
483
532
|
code;
|
|
484
533
|
constructor(e, t, n) {
|
|
485
534
|
super(e), this.name = "RequestError", this.status = t, this.code = n;
|
|
486
535
|
}
|
|
487
536
|
};
|
|
488
|
-
function
|
|
537
|
+
function se(e) {
|
|
489
538
|
let t = e.fetch, n = (e, n) => t ? t(e, n) : fetch(e, n);
|
|
490
539
|
return async (t, r) => {
|
|
491
540
|
let i = {
|
|
@@ -503,16 +552,16 @@ function P(e) {
|
|
|
503
552
|
} catch {}
|
|
504
553
|
if (!a.ok) {
|
|
505
554
|
let e = s && typeof s == "object" ? s : {};
|
|
506
|
-
throw new
|
|
555
|
+
throw new oe(typeof e.error == "string" && e.error ? e.error : `${a.status} ${a.statusText}`.trim(), a.status, typeof e.code == "string" ? e.code : void 0);
|
|
507
556
|
}
|
|
508
557
|
return s;
|
|
509
558
|
};
|
|
510
559
|
}
|
|
511
560
|
//#endregion
|
|
512
561
|
//#region src/components/ExplorerRoot.tsx
|
|
513
|
-
function
|
|
562
|
+
function R(e) {
|
|
514
563
|
let { dataLayer: t, client: n, connection: r } = e;
|
|
515
|
-
return i(() => t || (n ?
|
|
564
|
+
return i(() => t || (n ? O(n) : r ? O(I(r), L(r), se(r)) : null), [
|
|
516
565
|
t,
|
|
517
566
|
n,
|
|
518
567
|
r?.baseUrl,
|
|
@@ -520,12 +569,12 @@ function F(e) {
|
|
|
520
569
|
r?.fetch
|
|
521
570
|
]);
|
|
522
571
|
}
|
|
523
|
-
function
|
|
572
|
+
function z({ theme: e, dataLayer: t, children: n }) {
|
|
524
573
|
let r = e ? { "data-theme": e } : {};
|
|
525
574
|
return t ? /* @__PURE__ */ l("div", {
|
|
526
575
|
className: "loomcycle-explorer",
|
|
527
576
|
...r,
|
|
528
|
-
children: /* @__PURE__ */ l(
|
|
577
|
+
children: /* @__PURE__ */ l(j, {
|
|
529
578
|
value: t,
|
|
530
579
|
children: n
|
|
531
580
|
})
|
|
@@ -549,32 +598,32 @@ function I({ theme: e, dataLayer: t, children: n }) {
|
|
|
549
598
|
}
|
|
550
599
|
//#endregion
|
|
551
600
|
//#region src/lib/docTrail.ts
|
|
552
|
-
function
|
|
601
|
+
function ce(e, t, n) {
|
|
553
602
|
let r = e[e.length - 1];
|
|
554
603
|
return [...r && r.documentId === t.documentId ? [...e.slice(0, -1), {
|
|
555
604
|
...r,
|
|
556
|
-
...
|
|
605
|
+
...B(t)
|
|
557
606
|
}] : [...e, t], n];
|
|
558
607
|
}
|
|
559
|
-
function
|
|
608
|
+
function le(e, t) {
|
|
560
609
|
return t < 0 || t >= e.length - 1 ? e : e.slice(0, t + 1);
|
|
561
610
|
}
|
|
562
|
-
function
|
|
611
|
+
function ue(e, t, n) {
|
|
563
612
|
let r = e[e.length - 1];
|
|
564
613
|
if (!r || r.documentId !== t) return e;
|
|
565
614
|
let i = {
|
|
566
615
|
...r,
|
|
567
|
-
...
|
|
616
|
+
...B(n)
|
|
568
617
|
};
|
|
569
618
|
return i.title === r.title && i.path === r.path ? e : [...e.slice(0, -1), i];
|
|
570
619
|
}
|
|
571
|
-
function
|
|
620
|
+
function B(e) {
|
|
572
621
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
573
622
|
}
|
|
574
|
-
function
|
|
623
|
+
function de(e) {
|
|
575
624
|
return e.title ? e.title : e.path ? e.path.slice(e.path.lastIndexOf("/") + 1) || e.path : e.documentId.slice(0, 8);
|
|
576
625
|
}
|
|
577
|
-
function
|
|
626
|
+
function V(e, t = 4) {
|
|
578
627
|
let n = Array.from({ length: e }, (e, t) => ({
|
|
579
628
|
kind: "crumb",
|
|
580
629
|
index: t
|
|
@@ -590,24 +639,24 @@ function R(e, t = 4) {
|
|
|
590
639
|
...n.slice(e - r)
|
|
591
640
|
];
|
|
592
641
|
}
|
|
593
|
-
function
|
|
642
|
+
function fe(e, t) {
|
|
594
643
|
for (let n of e.values()) {
|
|
595
|
-
let e = n.entries.find((e) =>
|
|
644
|
+
let e = n.entries.find((e) => H(e) === t);
|
|
596
645
|
if (e) return e.full_path;
|
|
597
646
|
}
|
|
598
647
|
}
|
|
599
|
-
function
|
|
648
|
+
function H(e) {
|
|
600
649
|
if (e.kind === "document") return e.resource_ref?.document_id || void 0;
|
|
601
650
|
}
|
|
602
|
-
function
|
|
651
|
+
function U(e, t) {
|
|
603
652
|
return t && e.some((e) => e.id === t) ? t : e.find((e) => !e.parent_id)?.id;
|
|
604
653
|
}
|
|
605
654
|
//#endregion
|
|
606
655
|
//#region src/components/DocTrail.tsx
|
|
607
|
-
function
|
|
656
|
+
function pe({ trail: e, onJump: t }) {
|
|
608
657
|
let [n, r] = o(!1);
|
|
609
658
|
if (e.length < 2) return null;
|
|
610
|
-
let i = e.length - 1, a = e[i - 1], s =
|
|
659
|
+
let i = e.length - 1, a = e[i - 1], s = V(e.length, n ? e.length : void 0);
|
|
611
660
|
return /* @__PURE__ */ u("nav", {
|
|
612
661
|
className: "doc-trail",
|
|
613
662
|
"aria-label": "Documents you came through",
|
|
@@ -615,7 +664,7 @@ function ue({ trail: e, onJump: t }) {
|
|
|
615
664
|
type: "button",
|
|
616
665
|
className: "doc-trail-back",
|
|
617
666
|
onClick: () => t(i - 1),
|
|
618
|
-
title: `Back to ${
|
|
667
|
+
title: `Back to ${de(a)}`,
|
|
619
668
|
children: "← Back"
|
|
620
669
|
}), /* @__PURE__ */ l("ol", {
|
|
621
670
|
className: "doc-trail-list",
|
|
@@ -625,7 +674,7 @@ function ue({ trail: e, onJump: t }) {
|
|
|
625
674
|
type: "button",
|
|
626
675
|
className: "doc-trail-gap",
|
|
627
676
|
onClick: () => r(!0),
|
|
628
|
-
title: `Show ${n.hidden.length} more: ${n.hidden.map((t) =>
|
|
677
|
+
title: `Show ${n.hidden.length} more: ${n.hidden.map((t) => de(e[t])).join(" › ")}`,
|
|
629
678
|
"aria-label": `Show ${n.hidden.length} hidden documents`,
|
|
630
679
|
children: "…"
|
|
631
680
|
})
|
|
@@ -634,8 +683,8 @@ function ue({ trail: e, onJump: t }) {
|
|
|
634
683
|
children: /* @__PURE__ */ l("span", {
|
|
635
684
|
className: "doc-trail-current",
|
|
636
685
|
"aria-current": "page",
|
|
637
|
-
title:
|
|
638
|
-
children:
|
|
686
|
+
title: de(e[i]),
|
|
687
|
+
children: de(e[i])
|
|
639
688
|
})
|
|
640
689
|
}, n.index) : /* @__PURE__ */ l("li", {
|
|
641
690
|
className: "doc-trail-item",
|
|
@@ -643,17 +692,175 @@ function ue({ trail: e, onJump: t }) {
|
|
|
643
692
|
type: "button",
|
|
644
693
|
className: "doc-trail-crumb",
|
|
645
694
|
onClick: () => t(n.index),
|
|
646
|
-
title:
|
|
647
|
-
children:
|
|
695
|
+
title: de(e[n.index]),
|
|
696
|
+
children: de(e[n.index])
|
|
648
697
|
})
|
|
649
698
|
}, n.index))
|
|
650
699
|
})]
|
|
651
700
|
});
|
|
652
701
|
}
|
|
653
702
|
//#endregion
|
|
703
|
+
//#region src/components/TransferModal.tsx
|
|
704
|
+
function me({ data: e, scope: t, browse: n, documentId: r, underPath: a, fromPath: s, onClose: c, onDone: d }) {
|
|
705
|
+
let [f, p] = o("copy"), [m, h] = o(t === "tenant" ? "user" : "tenant"), [g, _] = o(s), [v, y] = o(!1), [w, T] = o(null), [E, D] = o(null), [O, k] = o(!1), [A, j] = o(null), M = i(() => ({
|
|
706
|
+
op: f,
|
|
707
|
+
scope: t,
|
|
708
|
+
toScope: m,
|
|
709
|
+
documentId: r,
|
|
710
|
+
underPath: a,
|
|
711
|
+
from: s,
|
|
712
|
+
to: g,
|
|
713
|
+
dropDangling: v,
|
|
714
|
+
dryRun: !0
|
|
715
|
+
}), [
|
|
716
|
+
f,
|
|
717
|
+
t,
|
|
718
|
+
m,
|
|
719
|
+
r,
|
|
720
|
+
a,
|
|
721
|
+
s,
|
|
722
|
+
g,
|
|
723
|
+
v
|
|
724
|
+
]), N = JSON.stringify(b(M)), P = x(M), F = w && w.key === N ? w.res : null, ee = F ? C(f, F, v) : !1, te = F ? f === "move" ? (F.counts?.documents ?? 0) + (F.to_finish?.length ?? 0) : F.counts?.documents ?? 0 : 0, ne = async (t) => {
|
|
725
|
+
if (t.preventDefault(), E) c();
|
|
726
|
+
else if (!P && e.documentsTransfer) {
|
|
727
|
+
k(!0), j(null);
|
|
728
|
+
try {
|
|
729
|
+
if (!F) T({
|
|
730
|
+
key: N,
|
|
731
|
+
res: await e.documentsTransfer(M, n)
|
|
732
|
+
});
|
|
733
|
+
else {
|
|
734
|
+
let t = {
|
|
735
|
+
...M,
|
|
736
|
+
dryRun: !1,
|
|
737
|
+
expectCount: F.counts?.documents ?? 0
|
|
738
|
+
}, r = await e.documentsTransfer(t, n);
|
|
739
|
+
D(r), d(t, r);
|
|
740
|
+
}
|
|
741
|
+
} catch (e) {
|
|
742
|
+
j(e instanceof Error ? e.message : String(e));
|
|
743
|
+
} finally {
|
|
744
|
+
k(!1);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}, re = E ? "close" : O ? "working…" : F ? `${f} ${te} document${te === 1 ? "" : "s"}` : "check", ie = E ?? F;
|
|
748
|
+
return /* @__PURE__ */ l("div", {
|
|
749
|
+
className: "modal-overlay",
|
|
750
|
+
onClick: O ? void 0 : c,
|
|
751
|
+
children: /* @__PURE__ */ u("form", {
|
|
752
|
+
className: "modal",
|
|
753
|
+
onClick: (e) => e.stopPropagation(),
|
|
754
|
+
onSubmit: ne,
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ u("div", {
|
|
757
|
+
className: "modal-header sticky-top",
|
|
758
|
+
children: [/* @__PURE__ */ u("h3", { children: [
|
|
759
|
+
"Copy or move the ",
|
|
760
|
+
r ? "document" : "documents under",
|
|
761
|
+
" ",
|
|
762
|
+
s
|
|
763
|
+
] }), /* @__PURE__ */ u("div", {
|
|
764
|
+
className: "modal-buttons modal-buttons-top",
|
|
765
|
+
children: [!E && /* @__PURE__ */ l("button", {
|
|
766
|
+
type: "button",
|
|
767
|
+
onClick: c,
|
|
768
|
+
disabled: O,
|
|
769
|
+
children: "cancel"
|
|
770
|
+
}), /* @__PURE__ */ l("button", {
|
|
771
|
+
type: "submit",
|
|
772
|
+
className: F && f === "move" && !E ? "danger" : "primary",
|
|
773
|
+
disabled: O || !E && (!!P || ee),
|
|
774
|
+
children: re
|
|
775
|
+
})]
|
|
776
|
+
})]
|
|
777
|
+
}),
|
|
778
|
+
/* @__PURE__ */ u("p", {
|
|
779
|
+
className: "modal-context",
|
|
780
|
+
children: [
|
|
781
|
+
"A copy gets new ids and leaves the source as it is. A move keeps every id and removes the documents from ",
|
|
782
|
+
/* @__PURE__ */ l("code", { children: t }),
|
|
783
|
+
". Relations between the documents go with them."
|
|
784
|
+
]
|
|
785
|
+
}),
|
|
786
|
+
/* @__PURE__ */ l("div", {
|
|
787
|
+
className: "paths-nav-switch",
|
|
788
|
+
role: "group",
|
|
789
|
+
"aria-label": "Copy or move",
|
|
790
|
+
children: ["copy", "move"].map((e) => /* @__PURE__ */ l("button", {
|
|
791
|
+
type: "button",
|
|
792
|
+
"aria-pressed": f === e,
|
|
793
|
+
className: f === e ? "active" : void 0,
|
|
794
|
+
disabled: O || !!E,
|
|
795
|
+
onClick: () => p(e),
|
|
796
|
+
children: e
|
|
797
|
+
}, e))
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ u("label", {
|
|
800
|
+
className: "path-field",
|
|
801
|
+
children: [/* @__PURE__ */ l("span", { children: "To scope" }), /* @__PURE__ */ u("select", {
|
|
802
|
+
value: m,
|
|
803
|
+
disabled: O || !!E,
|
|
804
|
+
onChange: (e) => h(e.target.value),
|
|
805
|
+
children: [
|
|
806
|
+
/* @__PURE__ */ l("option", {
|
|
807
|
+
value: "user",
|
|
808
|
+
children: "user"
|
|
809
|
+
}),
|
|
810
|
+
/* @__PURE__ */ l("option", {
|
|
811
|
+
value: "agent",
|
|
812
|
+
children: "agent"
|
|
813
|
+
}),
|
|
814
|
+
/* @__PURE__ */ l("option", {
|
|
815
|
+
value: "tenant",
|
|
816
|
+
children: "tenant"
|
|
817
|
+
})
|
|
818
|
+
]
|
|
819
|
+
})]
|
|
820
|
+
}),
|
|
821
|
+
/* @__PURE__ */ u("label", {
|
|
822
|
+
className: "path-field",
|
|
823
|
+
children: [/* @__PURE__ */ l("span", { children: "New path" }), /* @__PURE__ */ l("input", {
|
|
824
|
+
className: "path-modal-input",
|
|
825
|
+
value: g,
|
|
826
|
+
disabled: O || !!E,
|
|
827
|
+
onChange: (e) => _(e.target.value)
|
|
828
|
+
})]
|
|
829
|
+
}),
|
|
830
|
+
f === "move" && /* @__PURE__ */ l("label", {
|
|
831
|
+
className: "path-field",
|
|
832
|
+
children: /* @__PURE__ */ u("span", { children: [
|
|
833
|
+
/* @__PURE__ */ l("input", {
|
|
834
|
+
type: "checkbox",
|
|
835
|
+
checked: v,
|
|
836
|
+
disabled: O || !!E,
|
|
837
|
+
onChange: (e) => y(e.target.checked)
|
|
838
|
+
}),
|
|
839
|
+
" ",
|
|
840
|
+
"Drop relations to documents outside the set"
|
|
841
|
+
] })
|
|
842
|
+
}),
|
|
843
|
+
P && /* @__PURE__ */ l("div", {
|
|
844
|
+
className: "modal-err",
|
|
845
|
+
children: P
|
|
846
|
+
}),
|
|
847
|
+
ie && /* @__PURE__ */ l("div", {
|
|
848
|
+
className: "modal-context",
|
|
849
|
+
"aria-live": "polite",
|
|
850
|
+
children: S(f, ie).map((e, t) => e.startsWith(" ") ? /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l("code", { children: e.trim() }) }, t) : /* @__PURE__ */ l("div", { children: e }, t))
|
|
851
|
+
}),
|
|
852
|
+
A && /* @__PURE__ */ l("div", {
|
|
853
|
+
className: "modal-err",
|
|
854
|
+
children: A
|
|
855
|
+
})
|
|
856
|
+
]
|
|
857
|
+
})
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
//#endregion
|
|
654
861
|
//#region src/components/Splitter.tsx
|
|
655
|
-
var
|
|
656
|
-
function
|
|
862
|
+
var W = 6;
|
|
863
|
+
function he({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, minRightWidth: s = 240, storageKey: c, className: d, hideRight: f = !1 }) {
|
|
657
864
|
let p = () => {
|
|
658
865
|
if (c) {
|
|
659
866
|
let e = localStorage.getItem(c), t = e ? parseInt(e, 10) : NaN;
|
|
@@ -675,7 +882,7 @@ function de({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, min
|
|
|
675
882
|
e.preventDefault(), b(!0), e.target.setPointerCapture(e.pointerId);
|
|
676
883
|
}, []), S = t((e) => {
|
|
677
884
|
if (!y || !v.current) return;
|
|
678
|
-
let t = v.current.getBoundingClientRect(), n = e.clientX - t.left, r = t.width - s -
|
|
885
|
+
let t = v.current.getBoundingClientRect(), n = e.clientX - t.left, r = t.width - s - W;
|
|
679
886
|
h(Math.max(i, Math.min(n, r)));
|
|
680
887
|
}, [
|
|
681
888
|
y,
|
|
@@ -690,7 +897,7 @@ function de({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, min
|
|
|
690
897
|
return /* @__PURE__ */ u("div", {
|
|
691
898
|
ref: v,
|
|
692
899
|
className: `splitter ${d ?? ""} ${y ? "dragging" : ""}`,
|
|
693
|
-
style: { gridTemplateColumns: f ? "1fr 0 0" : `min(${m}px, calc(100% - ${s +
|
|
900
|
+
style: { gridTemplateColumns: f ? "1fr 0 0" : `min(${m}px, calc(100% - ${s + W}px)) ${W}px 1fr` },
|
|
694
901
|
children: [
|
|
695
902
|
/* @__PURE__ */ l("div", {
|
|
696
903
|
className: "splitter-pane splitter-left",
|
|
@@ -717,18 +924,18 @@ function de({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, min
|
|
|
717
924
|
}
|
|
718
925
|
//#endregion
|
|
719
926
|
//#region src/lib/imageUpload.ts
|
|
720
|
-
var
|
|
927
|
+
var ge = [
|
|
721
928
|
"image/png",
|
|
722
929
|
"image/jpeg",
|
|
723
930
|
"image/gif",
|
|
724
931
|
"image/webp"
|
|
725
932
|
];
|
|
726
|
-
function
|
|
727
|
-
return
|
|
933
|
+
function G(e) {
|
|
934
|
+
return ge.includes(e);
|
|
728
935
|
}
|
|
729
|
-
function
|
|
936
|
+
function _e(e) {
|
|
730
937
|
return new Promise((t, n) => {
|
|
731
|
-
if (!
|
|
938
|
+
if (!G(e.type)) {
|
|
732
939
|
n(/* @__PURE__ */ Error(`unsupported image type "${e.type || "unknown"}" (png, jpeg, gif, webp only)`));
|
|
733
940
|
return;
|
|
734
941
|
}
|
|
@@ -742,11 +949,11 @@ function fe(e) {
|
|
|
742
949
|
}, r.readAsDataURL(e);
|
|
743
950
|
});
|
|
744
951
|
}
|
|
745
|
-
function
|
|
952
|
+
function ve(e) {
|
|
746
953
|
if (!e) return null;
|
|
747
954
|
for (let t = 0; t < e.length; t++) {
|
|
748
955
|
let n = e[t];
|
|
749
|
-
if (n.kind === "file" &&
|
|
956
|
+
if (n.kind === "file" && G(n.type)) {
|
|
750
957
|
let e = n.getAsFile();
|
|
751
958
|
if (e) return e;
|
|
752
959
|
}
|
|
@@ -755,8 +962,8 @@ function pe(e) {
|
|
|
755
962
|
}
|
|
756
963
|
//#endregion
|
|
757
964
|
//#region src/lib/edgePages.ts
|
|
758
|
-
var
|
|
759
|
-
async function
|
|
965
|
+
var ye = 20;
|
|
966
|
+
async function be(e, t, n, r, i = 20) {
|
|
760
967
|
let a = [], o;
|
|
761
968
|
for (let s = 0; s < i; s++) {
|
|
762
969
|
let i = await e.documentGetEdges(t, n, r, o ? { after: o } : void 0);
|
|
@@ -781,7 +988,7 @@ async function me(e, t, n, r, i = 20) {
|
|
|
781
988
|
}
|
|
782
989
|
//#endregion
|
|
783
990
|
//#region src/lib/chunkAncestry.ts
|
|
784
|
-
function
|
|
991
|
+
function xe(e, t) {
|
|
785
992
|
if (!t) return [];
|
|
786
993
|
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Set([t]), i = [], a = n.get(t)?.parent_id;
|
|
787
994
|
for (; a && !r.has(a);) {
|
|
@@ -793,48 +1000,48 @@ function he(e, t) {
|
|
|
793
1000
|
}
|
|
794
1001
|
//#endregion
|
|
795
1002
|
//#region src/lib/statement.ts
|
|
796
|
-
var
|
|
797
|
-
function
|
|
1003
|
+
var K = /* @__PURE__ */ new Set(["manual", "wikilink"]), Se = 280;
|
|
1004
|
+
function Ce(e) {
|
|
798
1005
|
return e.status && e.status !== "asserted" ? e.status : void 0;
|
|
799
1006
|
}
|
|
800
|
-
function
|
|
801
|
-
return e.method && !
|
|
1007
|
+
function we(e) {
|
|
1008
|
+
return e.method && !K.has(e.method) ? e.method : void 0;
|
|
802
1009
|
}
|
|
803
|
-
function
|
|
1010
|
+
function q(e) {
|
|
804
1011
|
return e.status === "proposed" && !!e.id;
|
|
805
1012
|
}
|
|
806
|
-
function
|
|
1013
|
+
function Te(e) {
|
|
807
1014
|
return new Date(Math.floor(e / 1e6)).toISOString().slice(0, 10);
|
|
808
1015
|
}
|
|
809
|
-
function
|
|
810
|
-
let t = e.valid_at == null ? void 0 :
|
|
1016
|
+
function Ee(e) {
|
|
1017
|
+
let t = e.valid_at == null ? void 0 : Te(e.valid_at), n = e.invalid_at == null ? void 0 : Te(e.invalid_at);
|
|
811
1018
|
if (t && n) return `valid ${t} → ${n}`;
|
|
812
1019
|
if (t) return `valid from ${t}`;
|
|
813
1020
|
if (n) return `valid until ${n}`;
|
|
814
1021
|
}
|
|
815
|
-
function
|
|
1022
|
+
function De(e) {
|
|
816
1023
|
if (e.judged_at == null) return;
|
|
817
|
-
let t = `judged by ${e.judged_by || "a judge"} on ${
|
|
1024
|
+
let t = `judged by ${e.judged_by || "a judge"} on ${Te(e.judged_at)}`;
|
|
818
1025
|
return e.judge_reason ? `${t}: ${e.judge_reason}` : t;
|
|
819
1026
|
}
|
|
820
|
-
function
|
|
1027
|
+
function Oe(e, t = 3) {
|
|
821
1028
|
let n = (e.evidence ?? []).slice(0, t), r = Math.max(e.evidence_count ?? 0, e.evidence?.length ?? 0);
|
|
822
1029
|
return {
|
|
823
1030
|
rows: n,
|
|
824
1031
|
more: Math.max(0, r - n.length)
|
|
825
1032
|
};
|
|
826
1033
|
}
|
|
827
|
-
function
|
|
1034
|
+
function ke(e, t = Se) {
|
|
828
1035
|
let n = e.replace(/\s+/g, " ").trim();
|
|
829
1036
|
return n.length > t ? n.slice(0, t - 1) + "…" : n;
|
|
830
1037
|
}
|
|
831
1038
|
//#endregion
|
|
832
1039
|
//#region src/lib/ruling.ts
|
|
833
|
-
var
|
|
834
|
-
function
|
|
1040
|
+
var J = 1e3, Ae = 3, je = 1e3;
|
|
1041
|
+
function Me(e) {
|
|
835
1042
|
return !!e && typeof e == "object" && e.code === "queue_changed";
|
|
836
1043
|
}
|
|
837
|
-
async function
|
|
1044
|
+
async function Ne(e, t, n = {}) {
|
|
838
1045
|
let r = {
|
|
839
1046
|
action: t.action,
|
|
840
1047
|
...t.ids ? { ids: t.ids } : { filter: t.filter ?? {} },
|
|
@@ -863,7 +1070,7 @@ async function Oe(e, t, n = {}) {
|
|
|
863
1070
|
}
|
|
864
1071
|
if (s.matched === 0 || !await o(s, "first")) return i;
|
|
865
1072
|
let c = 0;
|
|
866
|
-
for (let t = 0; t <
|
|
1073
|
+
for (let t = 0; t < je && s.to_rule !== 0; t++) {
|
|
867
1074
|
let t;
|
|
868
1075
|
try {
|
|
869
1076
|
t = await e.rule({
|
|
@@ -872,7 +1079,7 @@ async function Oe(e, t, n = {}) {
|
|
|
872
1079
|
expect_count: s.matched
|
|
873
1080
|
});
|
|
874
1081
|
} catch (e) {
|
|
875
|
-
if (!
|
|
1082
|
+
if (!Me(e) || c >= 3) return i.error = e, i;
|
|
876
1083
|
c++;
|
|
877
1084
|
try {
|
|
878
1085
|
s = await a();
|
|
@@ -900,7 +1107,7 @@ async function Oe(e, t, n = {}) {
|
|
|
900
1107
|
}
|
|
901
1108
|
return i;
|
|
902
1109
|
}
|
|
903
|
-
async function
|
|
1110
|
+
async function Y(e, t) {
|
|
904
1111
|
let n = {
|
|
905
1112
|
reverted: 0,
|
|
906
1113
|
changed: 0,
|
|
@@ -914,21 +1121,21 @@ async function ke(e, t) {
|
|
|
914
1121
|
}
|
|
915
1122
|
return n;
|
|
916
1123
|
}
|
|
917
|
-
function
|
|
918
|
-
return Math.max(1, Math.ceil(e /
|
|
1124
|
+
function X(e) {
|
|
1125
|
+
return Math.max(1, Math.ceil(e / J));
|
|
919
1126
|
}
|
|
920
1127
|
//#endregion
|
|
921
1128
|
//#region src/lib/bulkReview.ts
|
|
922
|
-
function
|
|
1129
|
+
function Z(e) {
|
|
923
1130
|
return e === "tenant" || e === "user" ? e : void 0;
|
|
924
1131
|
}
|
|
925
|
-
function
|
|
926
|
-
return e.documentRuleStatements ?
|
|
1132
|
+
function Pe(e, t) {
|
|
1133
|
+
return e.documentRuleStatements ? Z(t) : void 0;
|
|
927
1134
|
}
|
|
928
|
-
function
|
|
929
|
-
return e.filter((e) =>
|
|
1135
|
+
function Fe(e, t) {
|
|
1136
|
+
return e.filter((e) => q(e) && !!e.id && e.from_document_id === t);
|
|
930
1137
|
}
|
|
931
|
-
function
|
|
1138
|
+
function Ie(e, t, n, r) {
|
|
932
1139
|
return e ? {
|
|
933
1140
|
proposals: t,
|
|
934
1141
|
scope: e,
|
|
@@ -936,8 +1143,8 @@ function J(e, t, n, r) {
|
|
|
936
1143
|
onChanged: r
|
|
937
1144
|
} : void 0;
|
|
938
1145
|
}
|
|
939
|
-
function
|
|
940
|
-
return e.documentRuleStatements ?
|
|
1146
|
+
function Le(e, t, n) {
|
|
1147
|
+
return e.documentRuleStatements ? Ne({ rule: (n) => e.documentRuleStatements(n, t.browse) }, {
|
|
941
1148
|
action: t.action,
|
|
942
1149
|
...t.ids && t.ids.length > 0 ? { ids: t.ids } : { filter: { from_document_id: t.documentId } },
|
|
943
1150
|
...t.reason ? { reason: t.reason } : {},
|
|
@@ -945,13 +1152,13 @@ function Ne(e, t, n) {
|
|
|
945
1152
|
...t.scope === "user" && t.browse?.scopeId ? { scopeId: t.browse.scopeId } : {}
|
|
946
1153
|
}, n) : Promise.reject(/* @__PURE__ */ Error("this data layer cannot rule in bulk"));
|
|
947
1154
|
}
|
|
948
|
-
function
|
|
1155
|
+
function Re(e, t) {
|
|
949
1156
|
let n = (e) => e.toLocaleString("en-US"), r = [`${e === "accept" ? "Accepted" : "Rejected"} ${n(t.ruled)} statement${t.ruled === 1 ? "" : "s"}`];
|
|
950
1157
|
return t.failed > 0 && r.push(`${n(t.failed)} did not take the ruling`), t.skipped > 0 && r.push(`${n(t.skipped)} skipped: not yours to rule`), r.join("; ") + ".";
|
|
951
1158
|
}
|
|
952
1159
|
//#endregion
|
|
953
1160
|
//#region src/lib/colorScheme.ts
|
|
954
|
-
var
|
|
1161
|
+
var Q = {
|
|
955
1162
|
"doc.rfc.draft": "#c99a3a",
|
|
956
1163
|
"doc.rfc.review": "#6a7bd6",
|
|
957
1164
|
"doc.rfc.confirmed": "#3a9ad6",
|
|
@@ -970,28 +1177,28 @@ var Y = {
|
|
|
970
1177
|
"chunk.backlog": "#8a8f98",
|
|
971
1178
|
"chunk.implementation": "#d1863a",
|
|
972
1179
|
"chunk.merged": "#3aa06a"
|
|
973
|
-
},
|
|
974
|
-
function
|
|
975
|
-
return e && Object.keys(e).length > 0 ? e :
|
|
1180
|
+
}, ze = .16;
|
|
1181
|
+
function Be(e) {
|
|
1182
|
+
return e && Object.keys(e).length > 0 ? e : Q;
|
|
976
1183
|
}
|
|
977
|
-
function
|
|
1184
|
+
function Ve(e, t, n) {
|
|
978
1185
|
let r = e ?? "", i = t ?? "";
|
|
979
1186
|
if (r && i && n[`doc.${r}.${i}`]) return n[`doc.${r}.${i}`];
|
|
980
1187
|
if (r && n[`doc.${r}`]) return n[`doc.${r}`];
|
|
981
1188
|
}
|
|
982
|
-
function
|
|
1189
|
+
function He(e, t) {
|
|
983
1190
|
let n = e ?? "";
|
|
984
1191
|
return n ? t[`chunk.${n}`] : void 0;
|
|
985
1192
|
}
|
|
986
|
-
function
|
|
1193
|
+
function Ue(e) {
|
|
987
1194
|
let t = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
988
1195
|
if (!t) return;
|
|
989
1196
|
let n = t[1];
|
|
990
|
-
return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), `rgba(${parseInt(n.slice(0, 2), 16)}, ${parseInt(n.slice(2, 4), 16)}, ${parseInt(n.slice(4, 6), 16)}, ${
|
|
1197
|
+
return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), `rgba(${parseInt(n.slice(0, 2), 16)}, ${parseInt(n.slice(2, 4), 16)}, ${parseInt(n.slice(4, 6), 16)}, ${ze})`;
|
|
991
1198
|
}
|
|
992
|
-
function
|
|
1199
|
+
function We(e) {
|
|
993
1200
|
if (!e) return;
|
|
994
|
-
let t =
|
|
1201
|
+
let t = Ue(e);
|
|
995
1202
|
if (t) return {
|
|
996
1203
|
background: t,
|
|
997
1204
|
borderLeft: `3px solid ${e}`
|
|
@@ -999,7 +1206,7 @@ function Re(e) {
|
|
|
999
1206
|
}
|
|
1000
1207
|
//#endregion
|
|
1001
1208
|
//#region src/lib/clipboard.ts
|
|
1002
|
-
async function
|
|
1209
|
+
async function Ge(e) {
|
|
1003
1210
|
try {
|
|
1004
1211
|
return typeof navigator > "u" || !navigator.clipboard ? !1 : (await navigator.clipboard.writeText(e), !0);
|
|
1005
1212
|
} catch {
|
|
@@ -1008,10 +1215,10 @@ async function Q(e) {
|
|
|
1008
1215
|
}
|
|
1009
1216
|
//#endregion
|
|
1010
1217
|
//#region src/components/IdCopy.tsx
|
|
1011
|
-
function
|
|
1218
|
+
function Ke({ value: e, label: t, compact: n, title: r }) {
|
|
1012
1219
|
let [i, a] = o("idle"), s = async (t) => {
|
|
1013
1220
|
t.stopPropagation(), t.preventDefault();
|
|
1014
|
-
let n = await
|
|
1221
|
+
let n = await Ge(e);
|
|
1015
1222
|
a(n ? "copied" : "error"), window.setTimeout(() => a("idle"), n ? 1200 : 1500);
|
|
1016
1223
|
}, c = i === "copied" ? "✓" : i === "error" ? "✗" : "⎘", d = r ?? `Copy ${t ?? "id"}: ${e}`, f = /* @__PURE__ */ l("button", {
|
|
1017
1224
|
type: "button",
|
|
@@ -1039,7 +1246,7 @@ function ze({ value: e, label: t, compact: n, title: r }) {
|
|
|
1039
1246
|
}
|
|
1040
1247
|
//#endregion
|
|
1041
1248
|
//#region src/components/DocumentChunkTree.tsx
|
|
1042
|
-
function
|
|
1249
|
+
function qe(e) {
|
|
1043
1250
|
let t = /* @__PURE__ */ new Map();
|
|
1044
1251
|
e.forEach((e) => t.set(e.id, {
|
|
1045
1252
|
row: e,
|
|
@@ -1055,7 +1262,7 @@ function Be(e) {
|
|
|
1055
1262
|
};
|
|
1056
1263
|
return r(n), n;
|
|
1057
1264
|
}
|
|
1058
|
-
function
|
|
1265
|
+
function Je(e) {
|
|
1059
1266
|
return e === "image" ? "🖼" : e === "mermaid" ? "📊" : "";
|
|
1060
1267
|
}
|
|
1061
1268
|
function $(e, t) {
|
|
@@ -1065,7 +1272,7 @@ function $(e, t) {
|
|
|
1065
1272
|
if (e) return e;
|
|
1066
1273
|
}
|
|
1067
1274
|
}
|
|
1068
|
-
function
|
|
1275
|
+
function Ye({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, linkedIds: c }) {
|
|
1069
1276
|
let [u, d] = o(() => /* @__PURE__ */ new Map()), f = t((e) => {
|
|
1070
1277
|
d((t) => {
|
|
1071
1278
|
let n = new Map(t);
|
|
@@ -1074,20 +1281,20 @@ function He({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, l
|
|
|
1074
1281
|
}, []);
|
|
1075
1282
|
r(() => {
|
|
1076
1283
|
if (!n) return;
|
|
1077
|
-
let t =
|
|
1284
|
+
let t = Xe(e, n);
|
|
1078
1285
|
t.length !== 0 && d((e) => {
|
|
1079
1286
|
let n = !1, r = new Map(e);
|
|
1080
1287
|
for (let e of t) r.get(e) === !1 && (r.set(e, !0), n = !0);
|
|
1081
1288
|
return n ? r : e;
|
|
1082
1289
|
});
|
|
1083
1290
|
}, [e, n]);
|
|
1084
|
-
let p = a ?
|
|
1291
|
+
let p = a ? Be(s) : null;
|
|
1085
1292
|
return e.length === 0 ? /* @__PURE__ */ l("div", {
|
|
1086
1293
|
className: "empty",
|
|
1087
1294
|
children: /* @__PURE__ */ l("p", { children: "No chunks." })
|
|
1088
1295
|
}) : /* @__PURE__ */ l("ul", {
|
|
1089
1296
|
className: "tree chunk-tree",
|
|
1090
|
-
children: e.map((e) => /* @__PURE__ */ l(
|
|
1297
|
+
children: e.map((e) => /* @__PURE__ */ l(Ze, {
|
|
1091
1298
|
node: e,
|
|
1092
1299
|
expanded: u,
|
|
1093
1300
|
toggle: f,
|
|
@@ -1098,7 +1305,7 @@ function He({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, l
|
|
|
1098
1305
|
}, e.row.id))
|
|
1099
1306
|
});
|
|
1100
1307
|
}
|
|
1101
|
-
function
|
|
1308
|
+
function Xe(e, t) {
|
|
1102
1309
|
let n = [], r = (e, i) => {
|
|
1103
1310
|
for (let a of e) {
|
|
1104
1311
|
if (a.row.id === t) return n.push(...i), !0;
|
|
@@ -1108,8 +1315,8 @@ function Ue(e, t) {
|
|
|
1108
1315
|
};
|
|
1109
1316
|
return r(e, []), n;
|
|
1110
1317
|
}
|
|
1111
|
-
function
|
|
1112
|
-
let s = e.children.length > 0, c = t.get(e.row.id) !== !1, d = r === e.row.id, f = a ?
|
|
1318
|
+
function Ze({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintScheme: a, linkedIds: o }) {
|
|
1319
|
+
let s = e.children.length > 0, c = t.get(e.row.id) !== !1, d = r === e.row.id, f = a ? We(He(e.row.status, a)) : void 0, p = o?.has(e.row.id);
|
|
1113
1320
|
return /* @__PURE__ */ u("li", {
|
|
1114
1321
|
className: `node chunk-node ${d ? "selected" : ""}`,
|
|
1115
1322
|
children: [/* @__PURE__ */ u("div", {
|
|
@@ -1132,10 +1339,10 @@ function We({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
|
|
|
1132
1339
|
onClick: () => i(e),
|
|
1133
1340
|
title: e.row.title,
|
|
1134
1341
|
children: [
|
|
1135
|
-
|
|
1342
|
+
Je(e.row.type) && /* @__PURE__ */ l("span", {
|
|
1136
1343
|
className: "chunk-type-icon",
|
|
1137
1344
|
"aria-hidden": !0,
|
|
1138
|
-
children:
|
|
1345
|
+
children: Je(e.row.type)
|
|
1139
1346
|
}),
|
|
1140
1347
|
/* @__PURE__ */ l("span", {
|
|
1141
1348
|
className: "chunk-title",
|
|
@@ -1157,7 +1364,7 @@ function We({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
|
|
|
1157
1364
|
})
|
|
1158
1365
|
]
|
|
1159
1366
|
}),
|
|
1160
|
-
/* @__PURE__ */ l(
|
|
1367
|
+
/* @__PURE__ */ l(Ke, {
|
|
1161
1368
|
value: e.row.id,
|
|
1162
1369
|
compact: !0,
|
|
1163
1370
|
title: `Copy chunk id: ${e.row.id}`
|
|
@@ -1165,7 +1372,7 @@ function We({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
|
|
|
1165
1372
|
]
|
|
1166
1373
|
}), s && c && /* @__PURE__ */ l("ul", {
|
|
1167
1374
|
className: "children chunk-children",
|
|
1168
|
-
children: e.children.map((e) => /* @__PURE__ */ l(
|
|
1375
|
+
children: e.children.map((e) => /* @__PURE__ */ l(Ze, {
|
|
1169
1376
|
node: e,
|
|
1170
1377
|
expanded: t,
|
|
1171
1378
|
toggle: n,
|
|
@@ -1179,12 +1386,12 @@ function We({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
|
|
|
1179
1386
|
}
|
|
1180
1387
|
//#endregion
|
|
1181
1388
|
//#region src/components/Mermaid.tsx
|
|
1182
|
-
var
|
|
1183
|
-
function
|
|
1389
|
+
var Qe = 0;
|
|
1390
|
+
function $e(e) {
|
|
1184
1391
|
let t = e?.closest("g.node");
|
|
1185
1392
|
return t ? /flowchart-(.+)-\d+$/.exec(t.id)?.[1] : void 0;
|
|
1186
1393
|
}
|
|
1187
|
-
function
|
|
1394
|
+
function et({ code: e, onNodeClick: t }) {
|
|
1188
1395
|
let n = a(null), [i, s] = o({});
|
|
1189
1396
|
return r(() => {
|
|
1190
1397
|
let t = !1;
|
|
@@ -1196,7 +1403,7 @@ function qe({ code: e, onNodeClick: t }) {
|
|
|
1196
1403
|
theme: a ? "dark" : "default",
|
|
1197
1404
|
securityLevel: "strict"
|
|
1198
1405
|
});
|
|
1199
|
-
let { svg: o } = await r.render(`lc-mmd-${
|
|
1406
|
+
let { svg: o } = await r.render(`lc-mmd-${Qe++}`, e);
|
|
1200
1407
|
t || s({ svg: o });
|
|
1201
1408
|
} catch {
|
|
1202
1409
|
t || s({ err: !0 });
|
|
@@ -1212,7 +1419,7 @@ function qe({ code: e, onNodeClick: t }) {
|
|
|
1212
1419
|
ref: n,
|
|
1213
1420
|
className: t ? "md-mermaid md-mermaid-nav" : "md-mermaid",
|
|
1214
1421
|
onClick: t && ((e) => {
|
|
1215
|
-
let n =
|
|
1422
|
+
let n = $e(e.target);
|
|
1216
1423
|
n && t(n);
|
|
1217
1424
|
}),
|
|
1218
1425
|
dangerouslySetInnerHTML: { __html: i.svg }
|
|
@@ -1224,17 +1431,17 @@ function qe({ code: e, onNodeClick: t }) {
|
|
|
1224
1431
|
}
|
|
1225
1432
|
//#endregion
|
|
1226
1433
|
//#region src/components/ChunkEditorModal.tsx
|
|
1227
|
-
function
|
|
1228
|
-
let s =
|
|
1434
|
+
function tt({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
1435
|
+
let s = M(), [c, d] = o(e.title), [f, p] = o(e.type ?? ""), [m, h] = o(e.status ?? ""), [g, _] = o(e.body ?? ""), [v, y] = o(e.fields ? JSON.stringify(e.fields, null, 2) : ""), [b, x] = o((e.tags ?? []).join(", ")), [S, C] = o(!1), [w, T] = o(null), [E, D] = o(!1), O = f === "mermaid", k = f === "image" || !!e.asset, [A, j] = o(g);
|
|
1229
1436
|
r(() => {
|
|
1230
|
-
if (!
|
|
1231
|
-
let e = setTimeout(() =>
|
|
1437
|
+
if (!O) return;
|
|
1438
|
+
let e = setTimeout(() => j(g), 400);
|
|
1232
1439
|
return () => clearTimeout(e);
|
|
1233
|
-
}, [g,
|
|
1234
|
-
let
|
|
1440
|
+
}, [g, O]);
|
|
1441
|
+
let N = async (r) => {
|
|
1235
1442
|
T(null), C(!0);
|
|
1236
1443
|
try {
|
|
1237
|
-
let { mediaType: o, data: c } = await
|
|
1444
|
+
let { mediaType: o, data: c } = await _e(r);
|
|
1238
1445
|
a(await s.documentSetAsset(e.id, o, c, r.name, t, n)), i();
|
|
1239
1446
|
} catch (e) {
|
|
1240
1447
|
T(e instanceof Error ? e.message : String(e)), C(!1);
|
|
@@ -1247,7 +1454,7 @@ function Je({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1247
1454
|
className: "modal chunk-editor",
|
|
1248
1455
|
onClick: (e) => e.stopPropagation(),
|
|
1249
1456
|
onSubmit: async (r) => {
|
|
1250
|
-
r.preventDefault(), T(null),
|
|
1457
|
+
r.preventDefault(), T(null), D(!1);
|
|
1251
1458
|
let o = {
|
|
1252
1459
|
body: g,
|
|
1253
1460
|
title: c,
|
|
@@ -1266,7 +1473,7 @@ function Je({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1266
1473
|
a(await s.documentUpdateChunk(e.id, e.revision, o, t, n)), i();
|
|
1267
1474
|
} catch (e) {
|
|
1268
1475
|
let t = e instanceof Error ? e.message : String(e);
|
|
1269
|
-
T(t),
|
|
1476
|
+
T(t), D(/revision conflict/i.test(t)), C(!1);
|
|
1270
1477
|
}
|
|
1271
1478
|
},
|
|
1272
1479
|
children: [
|
|
@@ -1289,7 +1496,7 @@ function Je({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1289
1496
|
}),
|
|
1290
1497
|
w && /* @__PURE__ */ u("div", {
|
|
1291
1498
|
className: "modal-err",
|
|
1292
|
-
children: [w,
|
|
1499
|
+
children: [w, E && " — reopen the chunk to load the latest, then reapply your edit."]
|
|
1293
1500
|
}),
|
|
1294
1501
|
/* @__PURE__ */ u("label", {
|
|
1295
1502
|
className: "path-field",
|
|
@@ -1328,7 +1535,7 @@ function Je({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1328
1535
|
onChange: (e) => x(e.target.value)
|
|
1329
1536
|
})]
|
|
1330
1537
|
}),
|
|
1331
|
-
|
|
1538
|
+
k && /* @__PURE__ */ u("label", {
|
|
1332
1539
|
className: "path-field",
|
|
1333
1540
|
children: [/* @__PURE__ */ l("span", { children: "Replace image" }), /* @__PURE__ */ l("input", {
|
|
1334
1541
|
type: "file",
|
|
@@ -1336,24 +1543,24 @@ function Je({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1336
1543
|
disabled: S,
|
|
1337
1544
|
onChange: (e) => {
|
|
1338
1545
|
let t = e.target.files?.[0];
|
|
1339
|
-
t &&
|
|
1546
|
+
t && N(t);
|
|
1340
1547
|
}
|
|
1341
1548
|
})]
|
|
1342
1549
|
}),
|
|
1343
1550
|
/* @__PURE__ */ u("label", {
|
|
1344
1551
|
className: "path-field",
|
|
1345
|
-
children: [/* @__PURE__ */ l("span", { children:
|
|
1552
|
+
children: [/* @__PURE__ */ l("span", { children: O ? "Mermaid source" : k ? "Caption (optional)" : "Body (Markdown)" }), /* @__PURE__ */ l("textarea", {
|
|
1346
1553
|
className: "modal-textarea chunk-body-input",
|
|
1347
|
-
rows:
|
|
1554
|
+
rows: O ? 8 : 12,
|
|
1348
1555
|
value: g,
|
|
1349
1556
|
onChange: (e) => _(e.target.value)
|
|
1350
1557
|
})]
|
|
1351
1558
|
}),
|
|
1352
|
-
|
|
1559
|
+
O && /* @__PURE__ */ u("div", {
|
|
1353
1560
|
className: "path-field",
|
|
1354
1561
|
children: [/* @__PURE__ */ l("span", { children: "Preview" }), /* @__PURE__ */ l("div", {
|
|
1355
1562
|
className: "chunk-mermaid-preview",
|
|
1356
|
-
children:
|
|
1563
|
+
children: A.trim() ? /* @__PURE__ */ l(et, { code: A }) : /* @__PURE__ */ l("p", {
|
|
1357
1564
|
className: "doc-empty-body",
|
|
1358
1565
|
children: "(enter Mermaid source above)"
|
|
1359
1566
|
})
|
|
@@ -1375,8 +1582,8 @@ function Je({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1375
1582
|
}
|
|
1376
1583
|
//#endregion
|
|
1377
1584
|
//#region src/components/SubjectTypeModal.tsx
|
|
1378
|
-
function
|
|
1379
|
-
let s =
|
|
1585
|
+
function nt({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
1586
|
+
let s = M(), [c, d] = o(null), [f, p] = o(e.type ?? ""), [m, h] = o(!1), [g, _] = o(null), [v, b] = o(null);
|
|
1380
1587
|
r(() => {
|
|
1381
1588
|
let e = !1;
|
|
1382
1589
|
return s.documentEntityTypes?.(t, n).then((t) => {
|
|
@@ -1468,18 +1675,18 @@ function Ye({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1468
1675
|
}
|
|
1469
1676
|
//#endregion
|
|
1470
1677
|
//#region src/lib/classify.ts
|
|
1471
|
-
function
|
|
1678
|
+
function rt(e) {
|
|
1472
1679
|
return Array.isArray(e) && e.every((e) => typeof e == "string");
|
|
1473
1680
|
}
|
|
1474
|
-
function
|
|
1681
|
+
function it(e) {
|
|
1475
1682
|
if (!e || typeof e != "object") return;
|
|
1476
1683
|
let t = e.classification;
|
|
1477
1684
|
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
1478
1685
|
let n = t, r = {};
|
|
1479
|
-
return typeof n.by == "string" && (r.by = n.by), typeof n.at == "number" && (r.at = n.at), typeof n.applied_type == "string" && n.applied_type && (r.applied_type = n.applied_type), typeof n.proposed_type == "string" && n.proposed_type && (r.proposed_type = n.proposed_type), n.proposed_fields && typeof n.proposed_fields == "object" && !Array.isArray(n.proposed_fields) && (r.proposed_fields = n.proposed_fields),
|
|
1686
|
+
return typeof n.by == "string" && (r.by = n.by), typeof n.at == "number" && (r.at = n.at), typeof n.applied_type == "string" && n.applied_type && (r.applied_type = n.applied_type), typeof n.proposed_type == "string" && n.proposed_type && (r.proposed_type = n.proposed_type), n.proposed_fields && typeof n.proposed_fields == "object" && !Array.isArray(n.proposed_fields) && (r.proposed_fields = n.proposed_fields), rt(n.proposed_tags) && (r.proposed_tags = n.proposed_tags), rt(n.statements) && (r.statements = n.statements), r;
|
|
1480
1687
|
}
|
|
1481
|
-
function
|
|
1482
|
-
let t =
|
|
1688
|
+
function at(e) {
|
|
1689
|
+
let t = it(e);
|
|
1483
1690
|
if (!t) return;
|
|
1484
1691
|
let n = t.proposed_tags ?? [], r = t.statements?.length ?? 0;
|
|
1485
1692
|
if (t.proposed_type || n.length !== 0 || r !== 0) return {
|
|
@@ -1488,7 +1695,7 @@ function Qe(e) {
|
|
|
1488
1695
|
statementCount: r
|
|
1489
1696
|
};
|
|
1490
1697
|
}
|
|
1491
|
-
function
|
|
1698
|
+
function ot(e) {
|
|
1492
1699
|
let t = e.write === "report";
|
|
1493
1700
|
switch (e.result) {
|
|
1494
1701
|
case "classified": return t ? "would be classified" : "classified";
|
|
@@ -1498,46 +1705,46 @@ function $e(e) {
|
|
|
1498
1705
|
default: return String(e.result);
|
|
1499
1706
|
}
|
|
1500
1707
|
}
|
|
1501
|
-
function
|
|
1708
|
+
function st(e) {
|
|
1502
1709
|
if (!e.class) return;
|
|
1503
1710
|
if (e.result === "kept") return "not applied";
|
|
1504
1711
|
let t = e.write === "report";
|
|
1505
1712
|
return e.live ? t ? "would be applied" : "applied" : t ? "would be proposed" : "proposed";
|
|
1506
1713
|
}
|
|
1507
|
-
function
|
|
1714
|
+
function ct(e) {
|
|
1508
1715
|
return e.write === "report" ? e.result === "classified" || e.result === "proposed" || (e.concepts?.length ?? 0) > 0 || (e.issued_by?.length ?? 0) > 0 : !1;
|
|
1509
1716
|
}
|
|
1510
|
-
function
|
|
1717
|
+
function lt(e) {
|
|
1511
1718
|
return e == null || !Number.isFinite(e) ? "" : `${Math.round(e * 100)}%`;
|
|
1512
1719
|
}
|
|
1513
|
-
var
|
|
1720
|
+
var ut = {
|
|
1514
1721
|
rules: "Rules",
|
|
1515
1722
|
vote: "Neighbourhood vote",
|
|
1516
1723
|
model: "Model"
|
|
1517
1724
|
};
|
|
1518
|
-
function
|
|
1519
|
-
return
|
|
1725
|
+
function dt(e) {
|
|
1726
|
+
return ut[e] ?? e;
|
|
1520
1727
|
}
|
|
1521
|
-
function
|
|
1728
|
+
function ft(e) {
|
|
1522
1729
|
let t = [];
|
|
1523
1730
|
e.quote && t.push(e.from ? `“${e.quote}” (${e.from})` : `“${e.quote}”`), e.votes != null && t.push(`${e.votes} vote${e.votes === 1 ? "" : "s"}`);
|
|
1524
|
-
let n =
|
|
1731
|
+
let n = lt(e.share);
|
|
1525
1732
|
return n && t.push(n), t.join(" · ");
|
|
1526
1733
|
}
|
|
1527
|
-
function
|
|
1734
|
+
function pt(e) {
|
|
1528
1735
|
return {
|
|
1529
|
-
label:
|
|
1736
|
+
label: dt(e.step),
|
|
1530
1737
|
...e.chosen ? { chosen: e.chosen } : {},
|
|
1531
1738
|
...e.method ? { method: e.method } : {},
|
|
1532
1739
|
...e.neighbours ? { neighbours: e.neighbours } : {},
|
|
1533
1740
|
...e.reason ? { reason: e.reason } : {},
|
|
1534
1741
|
candidates: (e.candidates ?? []).map((e) => ({
|
|
1535
1742
|
class: e.class,
|
|
1536
|
-
detail:
|
|
1743
|
+
detail: ft(e)
|
|
1537
1744
|
}))
|
|
1538
1745
|
};
|
|
1539
1746
|
}
|
|
1540
|
-
function
|
|
1747
|
+
function mt(e) {
|
|
1541
1748
|
let t = [];
|
|
1542
1749
|
e.type && t.push(`type ${e.type}`);
|
|
1543
1750
|
let n = e.accepted_statements?.length ?? 0;
|
|
@@ -1550,18 +1757,18 @@ function st(e) {
|
|
|
1550
1757
|
notices: r
|
|
1551
1758
|
};
|
|
1552
1759
|
}
|
|
1553
|
-
function
|
|
1760
|
+
function ht(e) {
|
|
1554
1761
|
let t = e instanceof Error ? e.message : String(e);
|
|
1555
1762
|
return t.includes("nothing_pending") ? "Nothing is pending for this document — it may already have been accepted." : t;
|
|
1556
1763
|
}
|
|
1557
1764
|
//#endregion
|
|
1558
1765
|
//#region src/components/Classification.tsx
|
|
1559
|
-
function
|
|
1560
|
-
let f =
|
|
1766
|
+
function gt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s, onClose: c, onChanged: d }) {
|
|
1767
|
+
let f = M(), [p, m] = o(null), [h, g] = o(!1), [_, v] = o(null), [y, b] = o(!1), [x, S] = o(null), [C, w] = o(null), T = i(() => f.documentAcceptClassification ? at(a) : void 0, [f, a]);
|
|
1561
1768
|
r(() => {
|
|
1562
1769
|
if (s === 0 || !f.documentClassify) return;
|
|
1563
1770
|
let r = !1;
|
|
1564
|
-
return g(!0), v(null), m(null), f.documentClassify(e, "report", t, n).then((e) => !r && m(e)).catch((e) => !r && v(
|
|
1771
|
+
return g(!0), v(null), m(null), f.documentClassify(e, "report", t, n).then((e) => !r && m(e)).catch((e) => !r && v(ht(e))).finally(() => !r && g(!1)), () => {
|
|
1565
1772
|
r = !0;
|
|
1566
1773
|
};
|
|
1567
1774
|
}, [
|
|
@@ -1571,31 +1778,31 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1571
1778
|
n,
|
|
1572
1779
|
s
|
|
1573
1780
|
]);
|
|
1574
|
-
let
|
|
1781
|
+
let E = async () => {
|
|
1575
1782
|
if (f.documentClassify) {
|
|
1576
1783
|
g(!0), v(null);
|
|
1577
1784
|
try {
|
|
1578
1785
|
m(await f.documentClassify(e, "propose", t, n)), d();
|
|
1579
1786
|
} catch (e) {
|
|
1580
|
-
v(
|
|
1787
|
+
v(ht(e));
|
|
1581
1788
|
} finally {
|
|
1582
1789
|
g(!1);
|
|
1583
1790
|
}
|
|
1584
1791
|
}
|
|
1585
|
-
},
|
|
1792
|
+
}, D = async () => {
|
|
1586
1793
|
if (f.documentAcceptClassification) {
|
|
1587
1794
|
b(!0), S(null);
|
|
1588
1795
|
try {
|
|
1589
1796
|
w(await f.documentAcceptClassification(e, t, n)), d();
|
|
1590
1797
|
} catch (e) {
|
|
1591
|
-
S(
|
|
1798
|
+
S(ht(e));
|
|
1592
1799
|
} finally {
|
|
1593
1800
|
b(!1);
|
|
1594
1801
|
}
|
|
1595
1802
|
}
|
|
1596
|
-
},
|
|
1597
|
-
if (!
|
|
1598
|
-
let
|
|
1803
|
+
}, O = s > 0;
|
|
1804
|
+
if (!O && !T && !C && !x) return null;
|
|
1805
|
+
let k = C ? mt(C) : void 0;
|
|
1599
1806
|
return /* @__PURE__ */ u("div", {
|
|
1600
1807
|
className: "doc-classify",
|
|
1601
1808
|
children: [
|
|
@@ -1623,7 +1830,7 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1623
1830
|
/* @__PURE__ */ l("button", {
|
|
1624
1831
|
type: "button",
|
|
1625
1832
|
disabled: y,
|
|
1626
|
-
onClick: () => void
|
|
1833
|
+
onClick: () => void D(),
|
|
1627
1834
|
children: y ? "Accepting…" : "Accept"
|
|
1628
1835
|
})
|
|
1629
1836
|
]
|
|
@@ -1639,12 +1846,12 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1639
1846
|
children: "×"
|
|
1640
1847
|
})]
|
|
1641
1848
|
}),
|
|
1642
|
-
|
|
1849
|
+
k && /* @__PURE__ */ u("div", {
|
|
1643
1850
|
className: "doc-classify-notice",
|
|
1644
1851
|
role: "status",
|
|
1645
1852
|
children: [
|
|
1646
|
-
/* @__PURE__ */ l("span", { children:
|
|
1647
|
-
|
|
1853
|
+
/* @__PURE__ */ l("span", { children: k.applied }),
|
|
1854
|
+
k.notices.map((e, t) => /* @__PURE__ */ l("span", {
|
|
1648
1855
|
className: "doc-classify-warn",
|
|
1649
1856
|
children: e
|
|
1650
1857
|
}, t)),
|
|
@@ -1657,7 +1864,7 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1657
1864
|
})
|
|
1658
1865
|
]
|
|
1659
1866
|
}),
|
|
1660
|
-
|
|
1867
|
+
O && /* @__PURE__ */ u("div", {
|
|
1661
1868
|
className: "doc-classify-panel",
|
|
1662
1869
|
children: [
|
|
1663
1870
|
/* @__PURE__ */ u("div", {
|
|
@@ -1666,7 +1873,7 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1666
1873
|
/* @__PURE__ */ l("h4", { children: "Classify" }),
|
|
1667
1874
|
p && /* @__PURE__ */ l("span", {
|
|
1668
1875
|
className: `doc-classify-result ${p.result}`,
|
|
1669
|
-
children:
|
|
1876
|
+
children: ot(p)
|
|
1670
1877
|
}),
|
|
1671
1878
|
p?.write === "report" && /* @__PURE__ */ l("span", {
|
|
1672
1879
|
className: "doc-classify-hint",
|
|
@@ -1690,13 +1897,13 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1690
1897
|
role: "alert",
|
|
1691
1898
|
children: _
|
|
1692
1899
|
}),
|
|
1693
|
-
p && /* @__PURE__ */ l(
|
|
1694
|
-
p &&
|
|
1900
|
+
p && /* @__PURE__ */ l(_t, { answer: p }),
|
|
1901
|
+
p && ct(p) && /* @__PURE__ */ l("div", {
|
|
1695
1902
|
className: "doc-classify-actions",
|
|
1696
1903
|
children: /* @__PURE__ */ l("button", {
|
|
1697
1904
|
type: "button",
|
|
1698
1905
|
disabled: h,
|
|
1699
|
-
onClick: () => void
|
|
1906
|
+
onClick: () => void E(),
|
|
1700
1907
|
title: "Apply a unique rule match to the document; file everything else for review",
|
|
1701
1908
|
children: h ? "Applying…" : "Apply"
|
|
1702
1909
|
})
|
|
@@ -1706,8 +1913,8 @@ function lt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
|
|
|
1706
1913
|
]
|
|
1707
1914
|
});
|
|
1708
1915
|
}
|
|
1709
|
-
function
|
|
1710
|
-
let t =
|
|
1916
|
+
function _t({ answer: e }) {
|
|
1917
|
+
let t = st(e), n = Object.entries(e.fields ?? {}), r = e.issued_by ?? [], i = e.concepts ?? [], a = (e.steps ?? []).map(pt), o = e.statements?.length ?? 0;
|
|
1711
1918
|
return /* @__PURE__ */ u(c, { children: [
|
|
1712
1919
|
/* @__PURE__ */ u("dl", {
|
|
1713
1920
|
className: "doc-classify-rows",
|
|
@@ -1745,7 +1952,7 @@ function ut({ answer: e }) {
|
|
|
1745
1952
|
title: e.tag,
|
|
1746
1953
|
children: [e.concept, /* @__PURE__ */ u("span", {
|
|
1747
1954
|
className: "doc-classify-hint",
|
|
1748
|
-
children: [" ",
|
|
1955
|
+
children: [" ", lt(e.share)]
|
|
1749
1956
|
})]
|
|
1750
1957
|
}, e.tag)) })] }),
|
|
1751
1958
|
o > 0 && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("dt", { children: "statements" }), /* @__PURE__ */ u("dd", { children: [
|
|
@@ -1813,15 +2020,15 @@ function ut({ answer: e }) {
|
|
|
1813
2020
|
}
|
|
1814
2021
|
//#endregion
|
|
1815
2022
|
//#region src/components/ColorSchemeEditor.tsx
|
|
1816
|
-
function
|
|
2023
|
+
function vt(e) {
|
|
1817
2024
|
let t = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec((e ?? "").trim());
|
|
1818
2025
|
if (!t) return "#888888";
|
|
1819
2026
|
let n = t[1];
|
|
1820
2027
|
return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), "#" + n.toLowerCase();
|
|
1821
2028
|
}
|
|
1822
|
-
function
|
|
1823
|
-
let h =
|
|
1824
|
-
let e = new Set(Object.keys(
|
|
2029
|
+
function yt({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStatuses: s, scope: d, browse: f, onClose: p, onSaved: m }) {
|
|
2030
|
+
let h = M(), [g, _] = o(null), [v, y] = o(!1), [b, x] = o({}), [S, C] = o(!1), [w, T] = o(null), [E, D] = o(null), O = i(() => {
|
|
2031
|
+
let e = new Set(Object.keys(Q));
|
|
1825
2032
|
n && e.add(`doc.${n}.${a || "draft"}`);
|
|
1826
2033
|
for (let t of s) t && e.add(`chunk.${t}`);
|
|
1827
2034
|
return [...e].sort();
|
|
@@ -1839,10 +2046,10 @@ function ft({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
|
|
|
1839
2046
|
y(n.color_enabled === !0);
|
|
1840
2047
|
let r = n.color_scheme ?? {};
|
|
1841
2048
|
x({
|
|
1842
|
-
...
|
|
2049
|
+
...Q,
|
|
1843
2050
|
...r
|
|
1844
2051
|
});
|
|
1845
|
-
}).catch((t) => !e &&
|
|
2052
|
+
}).catch((t) => !e && D(t instanceof Error ? t.message : String(t))), () => {
|
|
1846
2053
|
e = !0;
|
|
1847
2054
|
};
|
|
1848
2055
|
}, [
|
|
@@ -1851,40 +2058,40 @@ function ft({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
|
|
|
1851
2058
|
d,
|
|
1852
2059
|
f
|
|
1853
2060
|
]);
|
|
1854
|
-
let
|
|
2061
|
+
let k = (e, t) => x((n) => ({
|
|
1855
2062
|
...n,
|
|
1856
2063
|
[e]: t
|
|
1857
|
-
})),
|
|
2064
|
+
})), A = (e) => ({
|
|
1858
2065
|
...e ?? {},
|
|
1859
2066
|
color_enabled: v,
|
|
1860
2067
|
color_scheme: b
|
|
1861
|
-
}),
|
|
2068
|
+
}), j = async () => {
|
|
1862
2069
|
if (g) {
|
|
1863
|
-
C(!0),
|
|
2070
|
+
C(!0), D(null), T(null);
|
|
1864
2071
|
try {
|
|
1865
|
-
await h.documentUpdateChunk(t, g.revision, { fields:
|
|
2072
|
+
await h.documentUpdateChunk(t, g.revision, { fields: A(g.fields) }, d, f), m(), p();
|
|
1866
2073
|
} catch (e) {
|
|
1867
|
-
|
|
2074
|
+
D(e instanceof Error ? e.message : String(e)), C(!1);
|
|
1868
2075
|
}
|
|
1869
2076
|
}
|
|
1870
|
-
},
|
|
1871
|
-
if (!n)
|
|
2077
|
+
}, N = async () => {
|
|
2078
|
+
if (!n) D("this document has no type to match");
|
|
1872
2079
|
else {
|
|
1873
|
-
C(!0),
|
|
2080
|
+
C(!0), D(null), T(null);
|
|
1874
2081
|
try {
|
|
1875
2082
|
let { documents: t } = await h.documentsSummary({ underPath: "/" }, d, f), r = (t ?? []).filter((t) => t.type === n && t.document_id !== e && t.root_chunk_id), i = 0;
|
|
1876
2083
|
for (let e of r) try {
|
|
1877
2084
|
let t = await h.documentGetChunk(e.root_chunk_id, d, f);
|
|
1878
|
-
await h.documentUpdateChunk(e.root_chunk_id, t.revision, { fields:
|
|
2085
|
+
await h.documentUpdateChunk(e.root_chunk_id, t.revision, { fields: A(t.fields) }, d, f), i++;
|
|
1879
2086
|
} catch {}
|
|
1880
2087
|
T(`Applied to ${i} other ${n} document(s).`), m();
|
|
1881
2088
|
} catch (e) {
|
|
1882
|
-
|
|
2089
|
+
D(e instanceof Error ? e.message : String(e));
|
|
1883
2090
|
} finally {
|
|
1884
2091
|
C(!1);
|
|
1885
2092
|
}
|
|
1886
2093
|
}
|
|
1887
|
-
},
|
|
2094
|
+
}, P = O.filter((e) => e.startsWith("doc.")), F = O.filter((e) => e.startsWith("chunk."));
|
|
1888
2095
|
return /* @__PURE__ */ l("div", {
|
|
1889
2096
|
className: "modal-overlay",
|
|
1890
2097
|
onClick: p,
|
|
@@ -1904,15 +2111,15 @@ function ft({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
|
|
|
1904
2111
|
}), /* @__PURE__ */ l("button", {
|
|
1905
2112
|
type: "button",
|
|
1906
2113
|
className: "primary",
|
|
1907
|
-
onClick: () => void
|
|
2114
|
+
onClick: () => void j(),
|
|
1908
2115
|
disabled: S || !g,
|
|
1909
2116
|
children: S ? "saving…" : "save"
|
|
1910
2117
|
})]
|
|
1911
2118
|
})]
|
|
1912
2119
|
}),
|
|
1913
|
-
|
|
2120
|
+
E && /* @__PURE__ */ l("div", {
|
|
1914
2121
|
className: "modal-err",
|
|
1915
|
-
children:
|
|
2122
|
+
children: E
|
|
1916
2123
|
}),
|
|
1917
2124
|
g ? /* @__PURE__ */ u(c, { children: [
|
|
1918
2125
|
/* @__PURE__ */ u("label", {
|
|
@@ -1929,25 +2136,25 @@ function ft({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
|
|
|
1929
2136
|
}),
|
|
1930
2137
|
/* @__PURE__ */ u("div", {
|
|
1931
2138
|
className: "scheme-group",
|
|
1932
|
-
children: [/* @__PURE__ */ l("h4", { children: "Document (type · status)" }),
|
|
2139
|
+
children: [/* @__PURE__ */ l("h4", { children: "Document (type · status)" }), P.map((e) => /* @__PURE__ */ l(bt, {
|
|
1933
2140
|
label: e.slice(4),
|
|
1934
2141
|
value: b[e],
|
|
1935
|
-
onChange: (t) =>
|
|
2142
|
+
onChange: (t) => k(e, t)
|
|
1936
2143
|
}, e))]
|
|
1937
2144
|
}),
|
|
1938
2145
|
/* @__PURE__ */ u("div", {
|
|
1939
2146
|
className: "scheme-group",
|
|
1940
|
-
children: [/* @__PURE__ */ l("h4", { children: "Chunks (status)" }),
|
|
2147
|
+
children: [/* @__PURE__ */ l("h4", { children: "Chunks (status)" }), F.map((e) => /* @__PURE__ */ l(bt, {
|
|
1941
2148
|
label: e.slice(6),
|
|
1942
2149
|
value: b[e],
|
|
1943
|
-
onChange: (t) =>
|
|
2150
|
+
onChange: (t) => k(e, t)
|
|
1944
2151
|
}, e))]
|
|
1945
2152
|
}),
|
|
1946
2153
|
/* @__PURE__ */ u("div", {
|
|
1947
2154
|
className: "scheme-editor-foot",
|
|
1948
2155
|
children: [/* @__PURE__ */ u("button", {
|
|
1949
2156
|
type: "button",
|
|
1950
|
-
onClick: () => void
|
|
2157
|
+
onClick: () => void N(),
|
|
1951
2158
|
disabled: S || !n,
|
|
1952
2159
|
title: n ? `Apply this palette to every other ${n} document` : "This document has no type",
|
|
1953
2160
|
children: [
|
|
@@ -1968,8 +2175,8 @@ function ft({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
|
|
|
1968
2175
|
})
|
|
1969
2176
|
});
|
|
1970
2177
|
}
|
|
1971
|
-
function
|
|
1972
|
-
let r =
|
|
2178
|
+
function bt({ label: e, value: t, onChange: n }) {
|
|
2179
|
+
let r = vt(t);
|
|
1973
2180
|
return /* @__PURE__ */ u("label", {
|
|
1974
2181
|
className: "scheme-row",
|
|
1975
2182
|
children: [
|
|
@@ -1991,7 +2198,7 @@ function pt({ label: e, value: t, onChange: n }) {
|
|
|
1991
2198
|
}
|
|
1992
2199
|
//#endregion
|
|
1993
2200
|
//#region src/components/ChunkTarget.tsx
|
|
1994
|
-
function
|
|
2201
|
+
function xt({ id: e, title: t, targetDocumentId: n, documentId: r, onSelectChunk: i, onOpenDocument: a }) {
|
|
1995
2202
|
let o = t || e.slice(0, 8);
|
|
1996
2203
|
return !n || n === r ? /* @__PURE__ */ l("button", {
|
|
1997
2204
|
type: "button",
|
|
@@ -2012,8 +2219,8 @@ function mt({ id: e, title: t, targetDocumentId: n, documentId: r, onSelectChunk
|
|
|
2012
2219
|
}
|
|
2013
2220
|
//#endregion
|
|
2014
2221
|
//#region src/components/Statement.tsx
|
|
2015
|
-
function
|
|
2016
|
-
let t =
|
|
2222
|
+
function St({ statement: e }) {
|
|
2223
|
+
let t = Ce(e), n = we(e), r = De(e), i = Ee(e), { rows: a, more: o } = Oe(e);
|
|
2017
2224
|
return /* @__PURE__ */ u(c, { children: [
|
|
2018
2225
|
t && /* @__PURE__ */ l("span", {
|
|
2019
2226
|
className: `doc-stmt-status ${t}`,
|
|
@@ -2039,7 +2246,7 @@ function ht({ statement: e }) {
|
|
|
2039
2246
|
title: e.quote,
|
|
2040
2247
|
children: [
|
|
2041
2248
|
"“",
|
|
2042
|
-
|
|
2249
|
+
ke(e.quote),
|
|
2043
2250
|
"”",
|
|
2044
2251
|
e.stale && /* @__PURE__ */ l("span", {
|
|
2045
2252
|
className: "doc-stmt-stale",
|
|
@@ -2057,7 +2264,7 @@ function ht({ statement: e }) {
|
|
|
2057
2264
|
})
|
|
2058
2265
|
] });
|
|
2059
2266
|
}
|
|
2060
|
-
function
|
|
2267
|
+
function Ct({ id: e, onRule: t }) {
|
|
2061
2268
|
let [n, r] = o(!1), [i, a] = o(""), [s, d] = o(!1), [f, p] = o(null), m = async (n) => {
|
|
2062
2269
|
d(!0), p(null);
|
|
2063
2270
|
try {
|
|
@@ -2115,15 +2322,15 @@ function gt({ id: e, onRule: t }) {
|
|
|
2115
2322
|
}
|
|
2116
2323
|
//#endregion
|
|
2117
2324
|
//#region src/components/ProposalReview.tsx
|
|
2118
|
-
var
|
|
2119
|
-
function
|
|
2120
|
-
let f =
|
|
2325
|
+
var wt = 3;
|
|
2326
|
+
function Tt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, onChanged: s, onSelectChunk: c, onOpenDocument: d }) {
|
|
2327
|
+
let f = M(), [p, m] = o(/* @__PURE__ */ new Set()), [h, g] = o({ kind: "idle" }), [_, v] = o(""), [y, b] = o(null), [x, S] = o(null), C = a(null), w = new Set(t.map((e) => e.id)), T = [...p].filter((e) => w.has(e)), E = h.kind !== "idle" && h.kind !== "reason", D = (e, t) => {
|
|
2121
2328
|
b(null), S(null), e === "reject" ? g({
|
|
2122
2329
|
kind: "reason",
|
|
2123
2330
|
action: e,
|
|
2124
2331
|
all: t
|
|
2125
|
-
}) :
|
|
2126
|
-
},
|
|
2332
|
+
}) : O(e, t, "");
|
|
2333
|
+
}, O = async (t, n, a) => {
|
|
2127
2334
|
g({
|
|
2128
2335
|
kind: "counting",
|
|
2129
2336
|
action: t,
|
|
@@ -2131,7 +2338,7 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2131
2338
|
});
|
|
2132
2339
|
let o;
|
|
2133
2340
|
try {
|
|
2134
|
-
o = await
|
|
2341
|
+
o = await Le(f, {
|
|
2135
2342
|
documentId: e,
|
|
2136
2343
|
action: t,
|
|
2137
2344
|
ids: n ? void 0 : T,
|
|
@@ -2168,29 +2375,29 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2168
2375
|
};
|
|
2169
2376
|
}
|
|
2170
2377
|
C.current = null, g({ kind: "idle" }), v(""), o.rulingIds.length > 0 ? (m(/* @__PURE__ */ new Set()), S({
|
|
2171
|
-
text:
|
|
2378
|
+
text: Re(t, o),
|
|
2172
2379
|
rulingIds: o.rulingIds
|
|
2173
2380
|
}), s()) : o.error === void 0 && !o.cancelled && S({
|
|
2174
2381
|
text: "Nothing to rule: no proposals match.",
|
|
2175
2382
|
rulingIds: []
|
|
2176
2383
|
}), o.error !== void 0 && b(o.error instanceof Error ? o.error.message : String(o.error));
|
|
2177
|
-
},
|
|
2384
|
+
}, k = (e) => {
|
|
2178
2385
|
e && h.kind === "confirm" && g({
|
|
2179
2386
|
kind: "ruling",
|
|
2180
2387
|
action: h.action
|
|
2181
2388
|
}), C.current?.(e);
|
|
2182
|
-
},
|
|
2389
|
+
}, A = async () => {
|
|
2183
2390
|
if (!x || !f.documentRevertRuling) return;
|
|
2184
|
-
let e = x, t = await
|
|
2391
|
+
let e = x, t = await Y((e) => f.documentRevertRuling(e, r, i), e.rulingIds), n = [`${t.reverted} came back to review`];
|
|
2185
2392
|
t.changed > 0 && n.push(`${t.changed} changed since and left as ruled`), t.errors.length > 0 && n.push(`not undone: ${t.errors.join("; ")}`), S({
|
|
2186
2393
|
...e,
|
|
2187
2394
|
undone: !0,
|
|
2188
2395
|
text: n.join("; ") + "."
|
|
2189
2396
|
}), s();
|
|
2190
|
-
},
|
|
2397
|
+
}, j = (e) => m((t) => {
|
|
2191
2398
|
let n = new Set(t);
|
|
2192
2399
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
2193
|
-
}),
|
|
2400
|
+
}), N = t.length > 0 && T.length === t.length, P = t.length === 0 && !n;
|
|
2194
2401
|
return /* @__PURE__ */ u("div", {
|
|
2195
2402
|
className: "doc-conn-group doc-bulk",
|
|
2196
2403
|
children: [
|
|
@@ -2206,17 +2413,17 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2206
2413
|
/* @__PURE__ */ l("input", {
|
|
2207
2414
|
type: "checkbox",
|
|
2208
2415
|
"aria-label": "select every proposal shown",
|
|
2209
|
-
checked:
|
|
2210
|
-
disabled:
|
|
2211
|
-
onChange: () => m(
|
|
2416
|
+
checked: N,
|
|
2417
|
+
disabled: E || t.length === 0,
|
|
2418
|
+
onChange: () => m(N ? /* @__PURE__ */ new Set() : new Set(w))
|
|
2212
2419
|
}),
|
|
2213
2420
|
" ",
|
|
2214
2421
|
"all shown"
|
|
2215
2422
|
] }),
|
|
2216
2423
|
/* @__PURE__ */ u("button", {
|
|
2217
2424
|
type: "button",
|
|
2218
|
-
disabled:
|
|
2219
|
-
onClick: () =>
|
|
2425
|
+
disabled: E || T.length === 0,
|
|
2426
|
+
onClick: () => D("accept", !1),
|
|
2220
2427
|
children: [
|
|
2221
2428
|
"Accept selected (",
|
|
2222
2429
|
T.length,
|
|
@@ -2226,21 +2433,21 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2226
2433
|
/* @__PURE__ */ l("button", {
|
|
2227
2434
|
type: "button",
|
|
2228
2435
|
className: "danger",
|
|
2229
|
-
disabled:
|
|
2230
|
-
onClick: () =>
|
|
2436
|
+
disabled: E || T.length === 0,
|
|
2437
|
+
onClick: () => D("reject", !1),
|
|
2231
2438
|
children: "Reject selected…"
|
|
2232
2439
|
}),
|
|
2233
2440
|
/* @__PURE__ */ l("button", {
|
|
2234
2441
|
type: "button",
|
|
2235
|
-
disabled:
|
|
2236
|
-
onClick: () =>
|
|
2442
|
+
disabled: E || P,
|
|
2443
|
+
onClick: () => D("accept", !0),
|
|
2237
2444
|
children: "Accept all from this document"
|
|
2238
2445
|
}),
|
|
2239
2446
|
/* @__PURE__ */ l("button", {
|
|
2240
2447
|
type: "button",
|
|
2241
2448
|
className: "danger",
|
|
2242
|
-
disabled:
|
|
2243
|
-
onClick: () =>
|
|
2449
|
+
disabled: E || P,
|
|
2450
|
+
onClick: () => D("reject", !0),
|
|
2244
2451
|
children: "Reject all…"
|
|
2245
2452
|
})
|
|
2246
2453
|
]
|
|
@@ -2248,7 +2455,7 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2248
2455
|
h.kind === "reason" && /* @__PURE__ */ u("form", {
|
|
2249
2456
|
className: "doc-bulk-step",
|
|
2250
2457
|
onSubmit: (e) => {
|
|
2251
|
-
e.preventDefault(), _.trim() &&
|
|
2458
|
+
e.preventDefault(), _.trim() && O(h.action, h.all, _);
|
|
2252
2459
|
},
|
|
2253
2460
|
children: [
|
|
2254
2461
|
/* @__PURE__ */ l("input", {
|
|
@@ -2276,9 +2483,9 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2276
2483
|
className: "doc-conn-empty",
|
|
2277
2484
|
children: "counting…"
|
|
2278
2485
|
}),
|
|
2279
|
-
h.kind === "confirm" && /* @__PURE__ */ l(
|
|
2486
|
+
h.kind === "confirm" && /* @__PURE__ */ l(Et, {
|
|
2280
2487
|
step: h,
|
|
2281
|
-
onAnswer:
|
|
2488
|
+
onAnswer: k
|
|
2282
2489
|
}),
|
|
2283
2490
|
h.kind === "ruling" && /* @__PURE__ */ l("p", {
|
|
2284
2491
|
className: "doc-conn-empty",
|
|
@@ -2294,7 +2501,7 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2294
2501
|
role: "status",
|
|
2295
2502
|
children: [x.text, x.rulingIds.length > 0 && !x.undone && f.documentRevertRuling && /* @__PURE__ */ l("button", {
|
|
2296
2503
|
type: "button",
|
|
2297
|
-
onClick: () => void
|
|
2504
|
+
onClick: () => void A(),
|
|
2298
2505
|
children: "Undo"
|
|
2299
2506
|
})]
|
|
2300
2507
|
}),
|
|
@@ -2310,10 +2517,10 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2310
2517
|
type: "checkbox",
|
|
2311
2518
|
"aria-label": `select ${t.from_title ?? t.from_id} ${t.kind} ${t.to_title ?? t.to_id}`,
|
|
2312
2519
|
checked: p.has(t.id),
|
|
2313
|
-
disabled:
|
|
2314
|
-
onChange: () =>
|
|
2520
|
+
disabled: E,
|
|
2521
|
+
onChange: () => j(t.id)
|
|
2315
2522
|
}),
|
|
2316
|
-
/* @__PURE__ */ l(
|
|
2523
|
+
/* @__PURE__ */ l(xt, {
|
|
2317
2524
|
id: t.from_id,
|
|
2318
2525
|
title: t.from_title,
|
|
2319
2526
|
targetDocumentId: t.from_document_id,
|
|
@@ -2325,7 +2532,7 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2325
2532
|
className: "doc-ref-kind",
|
|
2326
2533
|
children: t.kind
|
|
2327
2534
|
}),
|
|
2328
|
-
/* @__PURE__ */ l(
|
|
2535
|
+
/* @__PURE__ */ l(xt, {
|
|
2329
2536
|
id: t.to_id,
|
|
2330
2537
|
title: t.to_title,
|
|
2331
2538
|
targetDocumentId: t.to_document_id,
|
|
@@ -2333,15 +2540,15 @@ function vt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
|
|
|
2333
2540
|
onSelectChunk: c,
|
|
2334
2541
|
onOpenDocument: d
|
|
2335
2542
|
}),
|
|
2336
|
-
/* @__PURE__ */ l(
|
|
2543
|
+
/* @__PURE__ */ l(St, { statement: t })
|
|
2337
2544
|
]
|
|
2338
2545
|
}, t.id))
|
|
2339
2546
|
})
|
|
2340
2547
|
]
|
|
2341
2548
|
});
|
|
2342
2549
|
}
|
|
2343
|
-
function
|
|
2344
|
-
let { dry: n } = e, r = e.action === "accept" ? "Accept" : "Reject", i =
|
|
2550
|
+
function Et({ step: e, onAnswer: t }) {
|
|
2551
|
+
let { dry: n } = e, r = e.action === "accept" ? "Accept" : "Reject", i = X(n.matched);
|
|
2345
2552
|
return /* @__PURE__ */ u("div", {
|
|
2346
2553
|
className: "doc-bulk-step doc-bulk-confirm",
|
|
2347
2554
|
children: [
|
|
@@ -2362,7 +2569,7 @@ function yt({ step: e, onAnswer: t }) {
|
|
|
2362
2569
|
] }),
|
|
2363
2570
|
(n.sample ?? []).length > 0 && /* @__PURE__ */ l("ul", {
|
|
2364
2571
|
className: "doc-bulk-sample",
|
|
2365
|
-
children: (n.sample ?? []).slice(0,
|
|
2572
|
+
children: (n.sample ?? []).slice(0, wt).map((e) => /* @__PURE__ */ u("li", { children: [
|
|
2366
2573
|
e.from_title || e.from_id,
|
|
2367
2574
|
" ",
|
|
2368
2575
|
/* @__PURE__ */ l("span", {
|
|
@@ -2393,28 +2600,28 @@ function yt({ step: e, onAnswer: t }) {
|
|
|
2393
2600
|
}
|
|
2394
2601
|
//#endregion
|
|
2395
2602
|
//#region src/components/Connections.tsx
|
|
2396
|
-
var
|
|
2397
|
-
function
|
|
2603
|
+
var Dt = 8, Ot = 20;
|
|
2604
|
+
function kt(e) {
|
|
2398
2605
|
return /embedder|embedding|vector|semantic|not configured/i.test(e);
|
|
2399
2606
|
}
|
|
2400
|
-
function
|
|
2401
|
-
let p =
|
|
2607
|
+
function At({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk: a, onOpenDocument: s, refreshKey: d, review: f }) {
|
|
2608
|
+
let p = M(), [m, h] = o(!1), [g, _] = o(!1), [v, y] = o(void 0), [b, x] = o([]), [S, C] = o([]), [w, T] = o(null), [E, D] = o([]), [O, k] = o(!1);
|
|
2402
2609
|
r(() => {
|
|
2403
2610
|
if (!m || !t) return;
|
|
2404
2611
|
let e = t, r = !1;
|
|
2405
2612
|
return _(!0), Promise.allSettled([
|
|
2406
2613
|
p.documentBacklinks(e, n, i),
|
|
2407
|
-
p.documentRelated(e, n, i,
|
|
2408
|
-
p.documentUnlinkedMentions(e, n, i,
|
|
2614
|
+
p.documentRelated(e, n, i, Dt),
|
|
2615
|
+
p.documentUnlinkedMentions(e, n, i, Ot)
|
|
2409
2616
|
]).then(([t, n, i]) => {
|
|
2410
2617
|
if (!r) {
|
|
2411
2618
|
if (x(t.status === "fulfilled" ? t.value.backlinks ?? [] : []), n.status === "fulfilled") C(n.value.related ?? []), T(null);
|
|
2412
2619
|
else {
|
|
2413
2620
|
C([]);
|
|
2414
2621
|
let e = n.reason instanceof Error ? n.reason.message : String(n.reason);
|
|
2415
|
-
T(
|
|
2622
|
+
T(kt(e) ? "semantic search not configured" : e);
|
|
2416
2623
|
}
|
|
2417
|
-
i.status === "fulfilled" ? (
|
|
2624
|
+
i.status === "fulfilled" ? (D(i.value.unlinked_mentions ?? []), k(!!i.value.truncated)) : (D([]), k(!1)), y(e), _(!1);
|
|
2418
2625
|
}
|
|
2419
2626
|
}), () => {
|
|
2420
2627
|
r = !0;
|
|
@@ -2427,14 +2634,14 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2427
2634
|
i,
|
|
2428
2635
|
d
|
|
2429
2636
|
]);
|
|
2430
|
-
let
|
|
2637
|
+
let A = (t, n, r) => /* @__PURE__ */ l(xt, {
|
|
2431
2638
|
id: t,
|
|
2432
2639
|
title: n,
|
|
2433
2640
|
targetDocumentId: r,
|
|
2434
2641
|
documentId: e,
|
|
2435
2642
|
onSelectChunk: a,
|
|
2436
2643
|
onOpenDocument: s
|
|
2437
|
-
}),
|
|
2644
|
+
}), j = !!(m && t && !g && v === t);
|
|
2438
2645
|
return /* @__PURE__ */ u("div", {
|
|
2439
2646
|
className: "doc-conn",
|
|
2440
2647
|
children: [/* @__PURE__ */ u("button", {
|
|
@@ -2444,7 +2651,7 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2444
2651
|
children: [m ? "▼" : "▶", " Connections"]
|
|
2445
2652
|
}), m && /* @__PURE__ */ u("div", {
|
|
2446
2653
|
className: "doc-conn-body",
|
|
2447
|
-
children: [f && /* @__PURE__ */ l(
|
|
2654
|
+
children: [f && /* @__PURE__ */ l(Tt, {
|
|
2448
2655
|
documentId: e,
|
|
2449
2656
|
proposals: f.proposals,
|
|
2450
2657
|
incomplete: f.incomplete,
|
|
@@ -2453,7 +2660,7 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2453
2660
|
onChanged: f.onChanged,
|
|
2454
2661
|
onSelectChunk: a,
|
|
2455
2662
|
onOpenDocument: s
|
|
2456
|
-
}), t ?
|
|
2663
|
+
}), t ? j ? /* @__PURE__ */ u(c, { children: [
|
|
2457
2664
|
/* @__PURE__ */ u("div", {
|
|
2458
2665
|
className: "doc-conn-group",
|
|
2459
2666
|
children: [/* @__PURE__ */ l("h5", { children: "Backlinks" }), b.length === 0 ? /* @__PURE__ */ l("p", {
|
|
@@ -2464,7 +2671,7 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2464
2671
|
children: b.map((e, t) => /* @__PURE__ */ u("li", {
|
|
2465
2672
|
className: "doc-conn-row",
|
|
2466
2673
|
children: [
|
|
2467
|
-
|
|
2674
|
+
A(e.from_id, e.from_title, e.from_document_id),
|
|
2468
2675
|
/* @__PURE__ */ l("span", {
|
|
2469
2676
|
className: "doc-ref-kind",
|
|
2470
2677
|
children: e.kind
|
|
@@ -2474,7 +2681,7 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2474
2681
|
title: "Auto-linked from a [[wikilink]]",
|
|
2475
2682
|
children: "auto"
|
|
2476
2683
|
}),
|
|
2477
|
-
/* @__PURE__ */ l(
|
|
2684
|
+
/* @__PURE__ */ l(St, { statement: e })
|
|
2478
2685
|
]
|
|
2479
2686
|
}, `${e.from_id}-${e.kind}-${t}`))
|
|
2480
2687
|
})]
|
|
@@ -2491,7 +2698,7 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2491
2698
|
className: "doc-conn-list",
|
|
2492
2699
|
children: S.map((e, t) => /* @__PURE__ */ u("li", {
|
|
2493
2700
|
className: "doc-conn-row",
|
|
2494
|
-
children: [
|
|
2701
|
+
children: [A(e.chunk_id, e.title, e.document_id), /* @__PURE__ */ l("span", {
|
|
2495
2702
|
className: "doc-conn-score",
|
|
2496
2703
|
title: "similarity score",
|
|
2497
2704
|
children: e.score.toFixed(2)
|
|
@@ -2501,15 +2708,15 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2501
2708
|
}),
|
|
2502
2709
|
/* @__PURE__ */ u("div", {
|
|
2503
2710
|
className: "doc-conn-group",
|
|
2504
|
-
children: [/* @__PURE__ */ l("h5", { children: "Unlinked mentions" }),
|
|
2711
|
+
children: [/* @__PURE__ */ l("h5", { children: "Unlinked mentions" }), E.length === 0 ? /* @__PURE__ */ l("p", {
|
|
2505
2712
|
className: "doc-conn-empty",
|
|
2506
2713
|
children: "none"
|
|
2507
2714
|
}) : /* @__PURE__ */ u("ul", {
|
|
2508
2715
|
className: "doc-conn-list",
|
|
2509
|
-
children: [
|
|
2716
|
+
children: [E.map((e, t) => /* @__PURE__ */ l("li", {
|
|
2510
2717
|
className: "doc-conn-row",
|
|
2511
|
-
children:
|
|
2512
|
-
}, `${e.chunk_id}-${t}`)),
|
|
2718
|
+
children: A(e.chunk_id, e.title, e.document_id)
|
|
2719
|
+
}, `${e.chunk_id}-${t}`)), O && /* @__PURE__ */ l("li", {
|
|
2513
2720
|
className: "doc-conn-more",
|
|
2514
2721
|
"aria-hidden": !0,
|
|
2515
2722
|
children: "(more…)"
|
|
@@ -2528,11 +2735,11 @@ function Ct({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
|
|
|
2528
2735
|
}
|
|
2529
2736
|
//#endregion
|
|
2530
2737
|
//#region src/components/CrossReferences.tsx
|
|
2531
|
-
var
|
|
2532
|
-
function
|
|
2738
|
+
var jt = 24;
|
|
2739
|
+
function Mt({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDocument: i, onRuleStatement: a, incomplete: s }) {
|
|
2533
2740
|
let [d, f] = o(!1), [p, m] = o(!1);
|
|
2534
2741
|
if (e.length === 0) return null;
|
|
2535
|
-
let h = n ? e.filter((e) => e.from_id === n || e.to_id === n) : [], g = p ? e : e.slice(0,
|
|
2742
|
+
let h = n ? e.filter((e) => e.from_id === n || e.to_id === n) : [], g = p ? e : e.slice(0, jt), _ = Pt(g);
|
|
2536
2743
|
return /* @__PURE__ */ u("div", {
|
|
2537
2744
|
className: "doc-refs",
|
|
2538
2745
|
children: [
|
|
@@ -2551,7 +2758,7 @@ function Tt({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDo
|
|
|
2551
2758
|
children: "This chunk has no links."
|
|
2552
2759
|
}) : /* @__PURE__ */ l("ul", {
|
|
2553
2760
|
className: "doc-refs-list",
|
|
2554
|
-
children: h.map((e, o) => /* @__PURE__ */ l(
|
|
2761
|
+
children: h.map((e, o) => /* @__PURE__ */ l(Nt, {
|
|
2555
2762
|
edge: e,
|
|
2556
2763
|
selectedId: n,
|
|
2557
2764
|
documentId: t,
|
|
@@ -2573,23 +2780,23 @@ function Tt({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDo
|
|
|
2573
2780
|
e.length,
|
|
2574
2781
|
")"
|
|
2575
2782
|
]
|
|
2576
|
-
}), d && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(
|
|
2783
|
+
}), d && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(et, {
|
|
2577
2784
|
code: _,
|
|
2578
2785
|
onNodeClick: (e) => {
|
|
2579
|
-
let n =
|
|
2786
|
+
let n = Ft(g, e);
|
|
2580
2787
|
n && (!n.documentId || n.documentId === t ? r(n.id) : i?.(n.documentId, n.id, n.title));
|
|
2581
2788
|
}
|
|
2582
|
-
}), e.length >
|
|
2789
|
+
}), e.length > jt && /* @__PURE__ */ l("button", {
|
|
2583
2790
|
type: "button",
|
|
2584
2791
|
className: "doc-graph-more",
|
|
2585
2792
|
onClick: () => m((e) => !e),
|
|
2586
|
-
children: p ? `show top ${
|
|
2793
|
+
children: p ? `show top ${jt}` : `show all ${e.length}`
|
|
2587
2794
|
})] })]
|
|
2588
2795
|
})
|
|
2589
2796
|
]
|
|
2590
2797
|
});
|
|
2591
2798
|
}
|
|
2592
|
-
function
|
|
2799
|
+
function Nt({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDocument: i, onRuleStatement: a }) {
|
|
2593
2800
|
let o = e.from_id === t, s = o ? e.to_id : e.from_id, c = o ? e.to_title : e.from_title, d = o ? e.to_document_id : e.from_document_id;
|
|
2594
2801
|
return /* @__PURE__ */ u("li", {
|
|
2595
2802
|
className: "doc-ref",
|
|
@@ -2603,7 +2810,7 @@ function Et({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDoc
|
|
|
2603
2810
|
"aria-hidden": !0,
|
|
2604
2811
|
children: o ? "→" : "←"
|
|
2605
2812
|
}),
|
|
2606
|
-
/* @__PURE__ */ l(
|
|
2813
|
+
/* @__PURE__ */ l(xt, {
|
|
2607
2814
|
id: s,
|
|
2608
2815
|
title: c,
|
|
2609
2816
|
targetDocumentId: d,
|
|
@@ -2611,46 +2818,46 @@ function Et({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDoc
|
|
|
2611
2818
|
onSelectChunk: r,
|
|
2612
2819
|
onOpenDocument: i
|
|
2613
2820
|
}),
|
|
2614
|
-
/* @__PURE__ */ l(
|
|
2615
|
-
a &&
|
|
2821
|
+
/* @__PURE__ */ l(St, { statement: e }),
|
|
2822
|
+
a && q(e) && /* @__PURE__ */ l(Ct, {
|
|
2616
2823
|
id: e.id,
|
|
2617
2824
|
onRule: a
|
|
2618
2825
|
})
|
|
2619
2826
|
]
|
|
2620
2827
|
});
|
|
2621
2828
|
}
|
|
2622
|
-
function
|
|
2829
|
+
function Pt(e) {
|
|
2623
2830
|
let t = ["graph LR"];
|
|
2624
2831
|
for (let n of e) {
|
|
2625
|
-
let e = `${
|
|
2832
|
+
let e = `${It(n.from_id)}["${Lt(n.from_title, n.from_id)}"]`, r = `${It(n.to_id)}["${Lt(n.to_title, n.to_id)}"]`, i = (n.kind || "link").replace(/[|"]/g, " "), a = n.status === "proposed" ? "-.->" : "-->";
|
|
2626
2833
|
t.push(` ${e} ${a}|${i}| ${r}`);
|
|
2627
2834
|
}
|
|
2628
2835
|
return t.join("\n");
|
|
2629
2836
|
}
|
|
2630
|
-
function
|
|
2837
|
+
function Ft(e, t) {
|
|
2631
2838
|
for (let n of e) {
|
|
2632
|
-
if (
|
|
2839
|
+
if (It(n.from_id) === t) return {
|
|
2633
2840
|
id: n.from_id,
|
|
2634
2841
|
documentId: n.from_document_id,
|
|
2635
2842
|
title: n.from_title
|
|
2636
2843
|
};
|
|
2637
|
-
if (
|
|
2844
|
+
if (It(n.to_id) === t) return {
|
|
2638
2845
|
id: n.to_id,
|
|
2639
2846
|
documentId: n.to_document_id,
|
|
2640
2847
|
title: n.to_title
|
|
2641
2848
|
};
|
|
2642
2849
|
}
|
|
2643
2850
|
}
|
|
2644
|
-
function
|
|
2851
|
+
function It(e) {
|
|
2645
2852
|
return "n" + e.replace(/[^a-zA-Z0-9]/g, "");
|
|
2646
2853
|
}
|
|
2647
|
-
function
|
|
2854
|
+
function Lt(e, t) {
|
|
2648
2855
|
let n = (e ?? "").replace(/["[\]{}|<>]/g, " ").replace(/\s+/g, " ").trim() || t.slice(0, 6);
|
|
2649
2856
|
return n.length > 30 ? n.slice(0, 29) + "…" : n;
|
|
2650
2857
|
}
|
|
2651
2858
|
//#endregion
|
|
2652
2859
|
//#region src/components/DocUnavailable.tsx
|
|
2653
|
-
function
|
|
2860
|
+
function Rt({ documentId: e, scope: t, detail: n }) {
|
|
2654
2861
|
return /* @__PURE__ */ u("div", {
|
|
2655
2862
|
className: "doc-unavailable",
|
|
2656
2863
|
role: "alert",
|
|
@@ -2673,12 +2880,12 @@ function jt({ documentId: e, scope: t, detail: n }) {
|
|
|
2673
2880
|
}
|
|
2674
2881
|
//#endregion
|
|
2675
2882
|
//#region src/components/HistoryModal.tsx
|
|
2676
|
-
function
|
|
2883
|
+
function zt(e) {
|
|
2677
2884
|
let t = typeof e == "number" ? e / 1e6 : Date.parse(String(e));
|
|
2678
2885
|
return !Number.isFinite(t) || t <= 0 ? String(e ?? "") : new Date(t).toLocaleString();
|
|
2679
2886
|
}
|
|
2680
|
-
function
|
|
2681
|
-
let s =
|
|
2887
|
+
function Bt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
2888
|
+
let s = M(), [d, f] = o([]), [p, m] = o(!0), [h, g] = o(null), [_, v] = o("none"), [y, b] = o(null), [x, S] = o(""), [C, w] = o(!1), [T, E] = o(null), [D, O] = o(null), [k, A] = o("");
|
|
2682
2889
|
r(() => {
|
|
2683
2890
|
let t = !1;
|
|
2684
2891
|
return m(!0), g(null), s.documentHistory(e, n, i).then((e) => {
|
|
@@ -2686,7 +2893,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2686
2893
|
let n = e.revisions ?? [];
|
|
2687
2894
|
if (f(n), n.length >= 2) {
|
|
2688
2895
|
let e = n.map((e) => e.revision);
|
|
2689
|
-
|
|
2896
|
+
E(Math.min(...e)), O(Math.max(...e));
|
|
2690
2897
|
}
|
|
2691
2898
|
}).catch((e) => !t && g(e instanceof Error ? e.message : String(e))).finally(() => !t && m(!1)), () => {
|
|
2692
2899
|
t = !0;
|
|
@@ -2697,7 +2904,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2697
2904
|
n,
|
|
2698
2905
|
i
|
|
2699
2906
|
]);
|
|
2700
|
-
let
|
|
2907
|
+
let j = async (t) => {
|
|
2701
2908
|
g(null), w(!0), b(t), v("version");
|
|
2702
2909
|
try {
|
|
2703
2910
|
let r = await s.documentGetVersion(e, t, n, i);
|
|
@@ -2707,12 +2914,12 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2707
2914
|
} finally {
|
|
2708
2915
|
w(!1);
|
|
2709
2916
|
}
|
|
2710
|
-
},
|
|
2711
|
-
if (T !== null &&
|
|
2917
|
+
}, N = async () => {
|
|
2918
|
+
if (T !== null && D !== null) {
|
|
2712
2919
|
g(null), w(!0), v("diff");
|
|
2713
2920
|
try {
|
|
2714
|
-
let t = await s.documentDiff(e, T,
|
|
2715
|
-
|
|
2921
|
+
let t = await s.documentDiff(e, T, D, n, i);
|
|
2922
|
+
A(t.diff ?? "");
|
|
2716
2923
|
} catch (e) {
|
|
2717
2924
|
g(e instanceof Error ? e.message : String(e));
|
|
2718
2925
|
} finally {
|
|
@@ -2754,7 +2961,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2754
2961
|
children: d.map((e) => /* @__PURE__ */ u("button", {
|
|
2755
2962
|
type: "button",
|
|
2756
2963
|
className: "doc-hist-rev" + (_ === "version" && y === e.revision ? " active" : ""),
|
|
2757
|
-
onClick: () => void
|
|
2964
|
+
onClick: () => void j(e.revision),
|
|
2758
2965
|
children: [
|
|
2759
2966
|
/* @__PURE__ */ u("span", {
|
|
2760
2967
|
className: "doc-hist-rev-num",
|
|
@@ -2762,7 +2969,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2762
2969
|
}),
|
|
2763
2970
|
/* @__PURE__ */ l("span", {
|
|
2764
2971
|
className: "doc-hist-rev-time",
|
|
2765
|
-
children:
|
|
2972
|
+
children: zt(e.created_at)
|
|
2766
2973
|
}),
|
|
2767
2974
|
/* @__PURE__ */ l("span", {
|
|
2768
2975
|
className: "doc-hist-rev-actor",
|
|
@@ -2777,7 +2984,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2777
2984
|
/* @__PURE__ */ l("span", { children: "Compare" }),
|
|
2778
2985
|
/* @__PURE__ */ l("select", {
|
|
2779
2986
|
value: T ?? "",
|
|
2780
|
-
onChange: (e) =>
|
|
2987
|
+
onChange: (e) => E(e.target.value === "" ? null : Number(e.target.value)),
|
|
2781
2988
|
"aria-label": "diff from revision",
|
|
2782
2989
|
children: d.map((e) => /* @__PURE__ */ u("option", {
|
|
2783
2990
|
value: e.revision,
|
|
@@ -2789,8 +2996,8 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2789
2996
|
children: "→"
|
|
2790
2997
|
}),
|
|
2791
2998
|
/* @__PURE__ */ l("select", {
|
|
2792
|
-
value:
|
|
2793
|
-
onChange: (e) =>
|
|
2999
|
+
value: D ?? "",
|
|
3000
|
+
onChange: (e) => O(e.target.value === "" ? null : Number(e.target.value)),
|
|
2794
3001
|
"aria-label": "diff to revision",
|
|
2795
3002
|
children: d.map((e) => /* @__PURE__ */ u("option", {
|
|
2796
3003
|
value: e.revision,
|
|
@@ -2799,8 +3006,8 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2799
3006
|
}),
|
|
2800
3007
|
/* @__PURE__ */ l("button", {
|
|
2801
3008
|
type: "button",
|
|
2802
|
-
onClick: () => void
|
|
2803
|
-
disabled: C || T === null ||
|
|
3009
|
+
onClick: () => void N(),
|
|
3010
|
+
disabled: C || T === null || D === null,
|
|
2804
3011
|
children: "diff"
|
|
2805
3012
|
})
|
|
2806
3013
|
]
|
|
@@ -2810,7 +3017,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2810
3017
|
children: C ? /* @__PURE__ */ l("p", {
|
|
2811
3018
|
className: "doc-empty-body",
|
|
2812
3019
|
children: "loading…"
|
|
2813
|
-
}) : _ === "diff" ? /* @__PURE__ */ l(
|
|
3020
|
+
}) : _ === "diff" ? /* @__PURE__ */ l(Vt, { text: k }) : _ === "version" ? /* @__PURE__ */ l("pre", {
|
|
2814
3021
|
className: "md-pre doc-hist-version",
|
|
2815
3022
|
children: /* @__PURE__ */ l("code", { children: x || "(empty)" })
|
|
2816
3023
|
}) : /* @__PURE__ */ l("p", {
|
|
@@ -2823,7 +3030,7 @@ function Nt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
|
2823
3030
|
})
|
|
2824
3031
|
});
|
|
2825
3032
|
}
|
|
2826
|
-
function
|
|
3033
|
+
function Vt({ text: e }) {
|
|
2827
3034
|
if (!e.trim()) return /* @__PURE__ */ l("p", {
|
|
2828
3035
|
className: "doc-empty-body",
|
|
2829
3036
|
children: "(no differences)"
|
|
@@ -2842,17 +3049,17 @@ function Pt({ text: e }) {
|
|
|
2842
3049
|
}
|
|
2843
3050
|
//#endregion
|
|
2844
3051
|
//#region src/components/Markdown.tsx
|
|
2845
|
-
function
|
|
3052
|
+
function Ht({ source: e }) {
|
|
2846
3053
|
return /* @__PURE__ */ l("div", {
|
|
2847
3054
|
className: "md",
|
|
2848
3055
|
children: /* @__PURE__ */ l(f, {
|
|
2849
3056
|
remarkPlugins: [p],
|
|
2850
|
-
components:
|
|
3057
|
+
components: Ut,
|
|
2851
3058
|
children: e
|
|
2852
3059
|
})
|
|
2853
3060
|
});
|
|
2854
3061
|
}
|
|
2855
|
-
var
|
|
3062
|
+
var Ut = {
|
|
2856
3063
|
a({ href: e, children: t }) {
|
|
2857
3064
|
let n = e ?? "", r = /^https?:\/\//i.test(n);
|
|
2858
3065
|
return /* @__PURE__ */ l("a", {
|
|
@@ -2867,7 +3074,7 @@ var It = {
|
|
|
2867
3074
|
},
|
|
2868
3075
|
code({ className: e, children: t }) {
|
|
2869
3076
|
let n = /language-(\w+)/.exec(e ?? "")?.[1], r = String(t ?? "");
|
|
2870
|
-
return n === "mermaid" ? /* @__PURE__ */ l(
|
|
3077
|
+
return n === "mermaid" ? /* @__PURE__ */ l(et, { code: r.replace(/\n$/, "") }) : n || r.includes("\n") ? /* @__PURE__ */ l("pre", {
|
|
2871
3078
|
className: "md-pre",
|
|
2872
3079
|
children: /* @__PURE__ */ l("code", {
|
|
2873
3080
|
className: e,
|
|
@@ -2878,67 +3085,67 @@ var It = {
|
|
|
2878
3085
|
};
|
|
2879
3086
|
//#endregion
|
|
2880
3087
|
//#region src/components/DocumentViewerBody.tsx
|
|
2881
|
-
function
|
|
3088
|
+
function Wt(e) {
|
|
2882
3089
|
let t = e.fields ?? {};
|
|
2883
3090
|
return typeof t.alt == "string" && t.alt.trim() !== "" ? t.alt : e.title || "image";
|
|
2884
3091
|
}
|
|
2885
|
-
function
|
|
2886
|
-
let b =
|
|
3092
|
+
function Gt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, renderAssistant: p, initialChunkId: m, onOpenDocument: h, onTitle: g, onChunkSelect: v, focusChunk: y }) {
|
|
3093
|
+
let b = M(), x = i(() => d && (d.scopeId || d.tenant) ? {
|
|
2887
3094
|
scopeId: d.scopeId,
|
|
2888
3095
|
tenant: d.tenant
|
|
2889
|
-
} : void 0, [d?.scopeId, d?.tenant]), [S, C] = o([]), [w, T] = o(void 0), [
|
|
2890
|
-
|
|
2891
|
-
let
|
|
2892
|
-
|
|
2893
|
-
let
|
|
2894
|
-
|
|
2895
|
-
w &&
|
|
2896
|
-
}, [w,
|
|
2897
|
-
let
|
|
3096
|
+
} : void 0, [d?.scopeId, d?.tenant]), [S, C] = o([]), [w, T] = o(void 0), [E, D] = o(null), [O, k] = o("chunks"), [A, j] = o(null), [N, P] = o(null), [F, ee] = o(null), te = a(null), [ne, re] = o(null), [ie, ae] = o(null), [I, L] = o(!1), [oe, se] = o(!1), [R, z] = o(null), [ce, le] = o(!1), [ue, B] = o(void 0), [de, V] = o(null), [fe, H] = o(0), [pe, me] = o(!1), [W, ge] = o(null), [G, ye] = o(!1), [K, Se] = o([]), [Ce, we] = o(!1), [q, Te] = o(0), [Ee, De] = o(0), [Oe, ke] = o(void 0), J = t(() => H((e) => e + 1), []), Ae = a(m);
|
|
3097
|
+
Ae.current = m;
|
|
3098
|
+
let je = a(g);
|
|
3099
|
+
je.current = g;
|
|
3100
|
+
let Me = i(() => qe(S), [S]), Ne = i(() => S.find((e) => !e.parent_id)?.title || s || "document", [S, s]), Y = i(() => !!E && !E.parent_id, [E]), X = i(() => xe(S, E?.id), [S, E]), Z = i(() => W?.root_chunk_id ?? S.find((e) => !e.parent_id)?.id, [W, S]), Le = a(v);
|
|
3101
|
+
Le.current = v, r(() => {
|
|
3102
|
+
w && Le.current?.(w === Z ? void 0 : w);
|
|
3103
|
+
}, [w, Z]);
|
|
3104
|
+
let Re = i(() => [...new Set(S.map((e) => e.status).filter((e) => !!e))], [S]), Q = !!W?.color_enabled, ze = i(() => {
|
|
2898
3105
|
let e = /* @__PURE__ */ new Set();
|
|
2899
3106
|
for (let t of K) e.add(t.from_id), e.add(t.to_id);
|
|
2900
3107
|
return e;
|
|
2901
|
-
}, [K]),
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
3108
|
+
}, [K]), He = i(() => Q ? We(Ve(W?.type, W?.status, Be(W?.color_scheme))) : void 0, [
|
|
3109
|
+
Q,
|
|
3110
|
+
W?.type,
|
|
3111
|
+
W?.status,
|
|
3112
|
+
W?.color_scheme
|
|
2906
3113
|
]);
|
|
2907
3114
|
r(() => {
|
|
2908
3115
|
let t = !1;
|
|
2909
|
-
return
|
|
3116
|
+
return le(!0), z(null), V(null), b.documentQueryChunks(e, n, x).then((r) => {
|
|
2910
3117
|
if (t) return;
|
|
2911
3118
|
let i = r.chunks ?? [];
|
|
2912
|
-
C(i),
|
|
3119
|
+
C(i), B(`${n}:${e}`), T((e) => e ?? U(i, Ae.current));
|
|
2913
3120
|
}).catch((e) => {
|
|
2914
|
-
t || (C([]),
|
|
2915
|
-
}).finally(() => !t &&
|
|
3121
|
+
t || (C([]), V(e instanceof Error ? e.message : String(e)));
|
|
3122
|
+
}).finally(() => !t && le(!1)), () => {
|
|
2916
3123
|
t = !0;
|
|
2917
3124
|
};
|
|
2918
3125
|
}, [
|
|
2919
3126
|
b,
|
|
2920
3127
|
e,
|
|
2921
3128
|
n,
|
|
2922
|
-
|
|
3129
|
+
fe,
|
|
2923
3130
|
x
|
|
2924
3131
|
]);
|
|
2925
|
-
let
|
|
3132
|
+
let Ue = !ce && (de !== null || ue === `${n}:${e}` && S.length === 0), Ge = i(() => S.find((t) => !t.parent_id && t.document_id === e)?.title, [S, e]);
|
|
2926
3133
|
r(() => {
|
|
2927
|
-
|
|
2928
|
-
}, [e,
|
|
3134
|
+
Ge && je.current?.(e, Ge);
|
|
3135
|
+
}, [e, Ge]), r(() => {
|
|
2929
3136
|
let t = !1;
|
|
2930
|
-
return b.documentGet(e, n, x).then((e) => !t &&
|
|
3137
|
+
return b.documentGet(e, n, x).then((e) => !t && ge(e)).catch(() => !t && ge(null)), () => {
|
|
2931
3138
|
t = !0;
|
|
2932
3139
|
};
|
|
2933
3140
|
}, [
|
|
2934
3141
|
b,
|
|
2935
3142
|
e,
|
|
2936
3143
|
n,
|
|
2937
|
-
|
|
3144
|
+
fe,
|
|
2938
3145
|
x
|
|
2939
3146
|
]), r(() => {
|
|
2940
3147
|
let t = !1;
|
|
2941
|
-
return
|
|
3148
|
+
return be(b, e, n, x).then((e) => {
|
|
2942
3149
|
t || (Se(e.edges), we(e.incomplete));
|
|
2943
3150
|
}).catch(() => {
|
|
2944
3151
|
t || (Se([]), we(!1));
|
|
@@ -2949,86 +3156,86 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
2949
3156
|
b,
|
|
2950
3157
|
e,
|
|
2951
3158
|
n,
|
|
2952
|
-
|
|
3159
|
+
fe,
|
|
2953
3160
|
x,
|
|
2954
|
-
|
|
3161
|
+
q
|
|
2955
3162
|
]), r(() => {
|
|
2956
|
-
if (!
|
|
2957
|
-
|
|
3163
|
+
if (!Z || !b.documentAcceptClassification) {
|
|
3164
|
+
ke(void 0);
|
|
2958
3165
|
return;
|
|
2959
3166
|
}
|
|
2960
3167
|
let t = !1;
|
|
2961
|
-
return b.documentGetChunk(
|
|
3168
|
+
return b.documentGetChunk(Z, n, x).then((n) => !t && ke(n.document_id === e ? n.fields : void 0)).catch(() => !t && ke(void 0)), () => {
|
|
2962
3169
|
t = !0;
|
|
2963
3170
|
};
|
|
2964
3171
|
}, [
|
|
2965
3172
|
b,
|
|
2966
3173
|
e,
|
|
2967
|
-
|
|
3174
|
+
Z,
|
|
2968
3175
|
n,
|
|
2969
|
-
|
|
3176
|
+
fe,
|
|
2970
3177
|
x
|
|
2971
3178
|
]);
|
|
2972
|
-
let
|
|
3179
|
+
let Je = i(() => {
|
|
2973
3180
|
if (b.documentAcceptStatement && b.documentRejectStatement) return async (e, t, r) => {
|
|
2974
|
-
t ? await b.documentAcceptStatement(e, n, x, r) : await b.documentRejectStatement(e, r ?? "", n, x),
|
|
3181
|
+
t ? await b.documentAcceptStatement(e, n, x, r) : await b.documentRejectStatement(e, r ?? "", n, x), Te((e) => e + 1);
|
|
2975
3182
|
};
|
|
2976
3183
|
}, [
|
|
2977
3184
|
b,
|
|
2978
3185
|
n,
|
|
2979
3186
|
x
|
|
2980
|
-
]),
|
|
2981
|
-
|
|
2982
|
-
|
|
3187
|
+
]), Xe = i(() => Pe(b, n), [b, n]), Ze = i(() => Fe(K, e), [K, e]), Qe = t(() => Te((e) => e + 1), []), $e = i(() => Ie(Xe, Ze, Ce, Qe), [
|
|
3188
|
+
Xe,
|
|
3189
|
+
Ze,
|
|
2983
3190
|
Ce,
|
|
2984
|
-
|
|
3191
|
+
Qe
|
|
2985
3192
|
]), rt = y?.seq, it = a(y);
|
|
2986
3193
|
it.current = y;
|
|
2987
|
-
let at = a(
|
|
2988
|
-
at.current =
|
|
3194
|
+
let at = a(Z);
|
|
3195
|
+
at.current = Z, r(() => {
|
|
2989
3196
|
if (rt === void 0) return;
|
|
2990
3197
|
let e = it.current?.chunkId ?? at.current;
|
|
2991
3198
|
e && T(e);
|
|
2992
3199
|
}, [rt]), r(() => {
|
|
2993
|
-
T(void 0),
|
|
3200
|
+
T(void 0), D(null), j(null), k("chunks"), ge(null), Se([]), we(!1), De(0), ke(void 0);
|
|
2994
3201
|
}, [e, n]), r(() => {
|
|
2995
3202
|
if (!w) {
|
|
2996
|
-
|
|
3203
|
+
D(null);
|
|
2997
3204
|
return;
|
|
2998
3205
|
}
|
|
2999
3206
|
let e = !1;
|
|
3000
|
-
return b.documentGetChunk(w, n, x).then((t) => !e &&
|
|
3207
|
+
return b.documentGetChunk(w, n, x).then((t) => !e && D(t)).catch((t) => !e && z(t instanceof Error ? t.message : String(t))), () => {
|
|
3001
3208
|
e = !0;
|
|
3002
3209
|
};
|
|
3003
3210
|
}, [
|
|
3004
3211
|
b,
|
|
3005
3212
|
w,
|
|
3006
3213
|
n,
|
|
3007
|
-
|
|
3214
|
+
fe,
|
|
3008
3215
|
x
|
|
3009
3216
|
]), r(() => {
|
|
3010
|
-
let e =
|
|
3011
|
-
if (!
|
|
3012
|
-
|
|
3217
|
+
let e = E?.type === "image" || !!E?.asset;
|
|
3218
|
+
if (!E || !e || !b.documentAssetObjectUrl) {
|
|
3219
|
+
P(null), ee(null);
|
|
3013
3220
|
return;
|
|
3014
3221
|
}
|
|
3015
3222
|
let t = !1, r = null;
|
|
3016
|
-
return
|
|
3017
|
-
t ? URL.revokeObjectURL(e) : (r = e,
|
|
3018
|
-
}).catch((e) => !t &&
|
|
3223
|
+
return ee(null), b.documentAssetObjectUrl(E.id, n, x).then((e) => {
|
|
3224
|
+
t ? URL.revokeObjectURL(e) : (r = e, P(e));
|
|
3225
|
+
}).catch((e) => !t && ee(e instanceof Error ? e.message : String(e))), () => {
|
|
3019
3226
|
t = !0, r && URL.revokeObjectURL(r);
|
|
3020
3227
|
};
|
|
3021
3228
|
}, [
|
|
3022
3229
|
b,
|
|
3023
|
-
|
|
3230
|
+
E,
|
|
3024
3231
|
n,
|
|
3025
3232
|
x
|
|
3026
3233
|
]), r(() => {
|
|
3027
|
-
if (
|
|
3028
|
-
|
|
3234
|
+
if (O !== "markdown" || !w) {
|
|
3235
|
+
j(null);
|
|
3029
3236
|
return;
|
|
3030
3237
|
}
|
|
3031
|
-
let e = $(
|
|
3238
|
+
let e = $(Me, w);
|
|
3032
3239
|
if (!e) return;
|
|
3033
3240
|
let t = !1, r = [], i = (e, t) => {
|
|
3034
3241
|
r.push({
|
|
@@ -3047,17 +3254,17 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3047
3254
|
}
|
|
3048
3255
|
return a + (i.body ? "\n\n" + i.body : "") + "\n";
|
|
3049
3256
|
}).join("\n");
|
|
3050
|
-
|
|
3051
|
-
}).catch((e) => !t &&
|
|
3257
|
+
j(n);
|
|
3258
|
+
}).catch((e) => !t && z(e instanceof Error ? e.message : String(e))), () => {
|
|
3052
3259
|
t = !0;
|
|
3053
3260
|
};
|
|
3054
3261
|
}, [
|
|
3055
3262
|
b,
|
|
3056
|
-
|
|
3263
|
+
O,
|
|
3057
3264
|
w,
|
|
3058
|
-
|
|
3265
|
+
Me,
|
|
3059
3266
|
n,
|
|
3060
|
-
|
|
3267
|
+
fe,
|
|
3061
3268
|
x
|
|
3062
3269
|
]);
|
|
3063
3270
|
let ot = t((e) => T(e.row.id), []), st = t((t, n, r) => h?.({
|
|
@@ -3067,50 +3274,50 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3067
3274
|
}, {
|
|
3068
3275
|
documentId: e,
|
|
3069
3276
|
chunkId: w,
|
|
3070
|
-
title:
|
|
3277
|
+
title: Ne
|
|
3071
3278
|
}), [
|
|
3072
3279
|
h,
|
|
3073
3280
|
e,
|
|
3074
3281
|
w,
|
|
3075
|
-
|
|
3282
|
+
Ne
|
|
3076
3283
|
]), ct = t(async () => {
|
|
3077
3284
|
try {
|
|
3078
3285
|
let t = await b.documentExportMd(e, n, !0, x), r = new Blob([t.markdown], { type: "text/markdown" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
3079
3286
|
a.href = i, a.download = (t.title || "document").replace(/[^\w.-]+/g, "_") + ".md", a.click(), URL.revokeObjectURL(i);
|
|
3080
3287
|
} catch (e) {
|
|
3081
|
-
|
|
3288
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3082
3289
|
}
|
|
3083
3290
|
}, [
|
|
3084
3291
|
b,
|
|
3085
3292
|
e,
|
|
3086
3293
|
n,
|
|
3087
3294
|
x
|
|
3088
|
-
]),
|
|
3295
|
+
]), lt = t(async () => {
|
|
3089
3296
|
try {
|
|
3090
3297
|
let t = await b.documentExportCanvas(e, n, x), r = new Blob([JSON.stringify(t.canvas, null, 2)], { type: "application/json" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
3091
|
-
a.href = i, a.download = (
|
|
3298
|
+
a.href = i, a.download = (Ne || "document").replace(/[^\w.-]+/g, "_") + ".canvas", a.click(), URL.revokeObjectURL(i);
|
|
3092
3299
|
} catch (e) {
|
|
3093
|
-
|
|
3300
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3094
3301
|
}
|
|
3095
3302
|
}, [
|
|
3096
3303
|
b,
|
|
3097
3304
|
e,
|
|
3098
3305
|
n,
|
|
3099
3306
|
x,
|
|
3100
|
-
|
|
3101
|
-
]),
|
|
3307
|
+
Ne
|
|
3308
|
+
]), ut = !!b.documentCreateChunk && !!Z, dt = t(async (t) => {
|
|
3102
3309
|
if (!b.documentCreateChunk || !b.documentSetAsset) return;
|
|
3103
|
-
let r = w ||
|
|
3310
|
+
let r = w || Z;
|
|
3104
3311
|
if (r) {
|
|
3105
|
-
|
|
3312
|
+
z(null);
|
|
3106
3313
|
try {
|
|
3107
|
-
let { mediaType: i, data: a } = await
|
|
3314
|
+
let { mediaType: i, data: a } = await _e(t), o = await b.documentCreateChunk(e, r, {
|
|
3108
3315
|
title: t.name || "image",
|
|
3109
3316
|
type: "image"
|
|
3110
3317
|
}, n, x);
|
|
3111
|
-
await b.documentSetAsset(o.id, i, a, t.name, n, x),
|
|
3318
|
+
await b.documentSetAsset(o.id, i, a, t.name, n, x), J(), T(o.id);
|
|
3112
3319
|
} catch (e) {
|
|
3113
|
-
|
|
3320
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3114
3321
|
}
|
|
3115
3322
|
}
|
|
3116
3323
|
}, [
|
|
@@ -3119,22 +3326,22 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3119
3326
|
n,
|
|
3120
3327
|
x,
|
|
3121
3328
|
w,
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
]),
|
|
3329
|
+
Z,
|
|
3330
|
+
J
|
|
3331
|
+
]), ft = t(async () => {
|
|
3125
3332
|
if (!b.documentCreateChunk) return;
|
|
3126
|
-
let t = w ||
|
|
3333
|
+
let t = w || Z;
|
|
3127
3334
|
if (t) {
|
|
3128
|
-
|
|
3335
|
+
z(null);
|
|
3129
3336
|
try {
|
|
3130
3337
|
let r = await b.documentCreateChunk(e, t, {
|
|
3131
3338
|
title: "Diagram",
|
|
3132
3339
|
type: "mermaid",
|
|
3133
3340
|
body: "graph TD\n A[Start] --> B[End]"
|
|
3134
3341
|
}, n, x);
|
|
3135
|
-
|
|
3342
|
+
J(), T(r.id), re(r);
|
|
3136
3343
|
} catch (e) {
|
|
3137
|
-
|
|
3344
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3138
3345
|
}
|
|
3139
3346
|
}
|
|
3140
3347
|
}, [
|
|
@@ -3143,21 +3350,21 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3143
3350
|
n,
|
|
3144
3351
|
x,
|
|
3145
3352
|
w,
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
]),
|
|
3353
|
+
Z,
|
|
3354
|
+
J
|
|
3355
|
+
]), pt = t(async () => {
|
|
3149
3356
|
if (!b.documentCreateChunk) return;
|
|
3150
|
-
let t = w && !
|
|
3357
|
+
let t = w && !Y ? w : void 0, r = w || Z;
|
|
3151
3358
|
if (r) {
|
|
3152
|
-
|
|
3359
|
+
z(null);
|
|
3153
3360
|
try {
|
|
3154
3361
|
let i = await b.documentCreateChunk(e, t ? "" : r, {
|
|
3155
3362
|
title: "Text",
|
|
3156
3363
|
body: ""
|
|
3157
3364
|
}, n, x, t);
|
|
3158
|
-
|
|
3365
|
+
J(), T(i.id), re(i);
|
|
3159
3366
|
} catch (e) {
|
|
3160
|
-
|
|
3367
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3161
3368
|
}
|
|
3162
3369
|
}
|
|
3163
3370
|
}, [
|
|
@@ -3166,20 +3373,20 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3166
3373
|
n,
|
|
3167
3374
|
x,
|
|
3168
3375
|
w,
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
]),
|
|
3376
|
+
Y,
|
|
3377
|
+
Z,
|
|
3378
|
+
J
|
|
3379
|
+
]), mt = t(async () => {
|
|
3173
3380
|
if (b.documentCreateChunk && w) {
|
|
3174
|
-
|
|
3381
|
+
z(null);
|
|
3175
3382
|
try {
|
|
3176
3383
|
let t = await b.documentCreateChunk(e, w, {
|
|
3177
3384
|
title: "Text",
|
|
3178
3385
|
body: ""
|
|
3179
3386
|
}, n, x);
|
|
3180
|
-
|
|
3387
|
+
J(), T(t.id), re(t);
|
|
3181
3388
|
} catch (e) {
|
|
3182
|
-
|
|
3389
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3183
3390
|
}
|
|
3184
3391
|
}
|
|
3185
3392
|
}, [
|
|
@@ -3188,28 +3395,28 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3188
3395
|
n,
|
|
3189
3396
|
x,
|
|
3190
3397
|
w,
|
|
3191
|
-
|
|
3192
|
-
]),
|
|
3193
|
-
if (!
|
|
3398
|
+
J
|
|
3399
|
+
]), ht = i(() => {
|
|
3400
|
+
if (!E || Y) return {
|
|
3194
3401
|
canUp: !1,
|
|
3195
3402
|
canDown: !1
|
|
3196
3403
|
};
|
|
3197
|
-
let e =
|
|
3404
|
+
let e = E.parent_id ?? "", t = S.filter((t) => (t.parent_id ?? "") === e).sort((e, t) => e.position - t.position || e.id.localeCompare(t.id)), n = t.findIndex((e) => e.id === E.id);
|
|
3198
3405
|
return {
|
|
3199
3406
|
canUp: n > 0,
|
|
3200
3407
|
canDown: n >= 0 && n < t.length - 1
|
|
3201
3408
|
};
|
|
3202
3409
|
}, [
|
|
3203
3410
|
S,
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
]),
|
|
3411
|
+
E,
|
|
3412
|
+
Y
|
|
3413
|
+
]), _t = t(async (e) => {
|
|
3207
3414
|
if (b.documentReorderChunk && w) {
|
|
3208
|
-
|
|
3415
|
+
z(null);
|
|
3209
3416
|
try {
|
|
3210
|
-
await b.documentReorderChunk(w, e, n, x),
|
|
3417
|
+
await b.documentReorderChunk(w, e, n, x), J();
|
|
3211
3418
|
} catch (e) {
|
|
3212
|
-
|
|
3419
|
+
z(e instanceof Error ? e.message : String(e));
|
|
3213
3420
|
}
|
|
3214
3421
|
}
|
|
3215
3422
|
}, [
|
|
@@ -3217,107 +3424,107 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3217
3424
|
w,
|
|
3218
3425
|
n,
|
|
3219
3426
|
x,
|
|
3220
|
-
|
|
3221
|
-
]),
|
|
3222
|
-
if (!b.documentDeleteChunk || !
|
|
3223
|
-
|
|
3224
|
-
let e =
|
|
3427
|
+
J
|
|
3428
|
+
]), vt = t(async () => {
|
|
3429
|
+
if (!b.documentDeleteChunk || !E) return;
|
|
3430
|
+
z(null);
|
|
3431
|
+
let e = E.parent_id;
|
|
3225
3432
|
try {
|
|
3226
|
-
await b.documentDeleteChunk(
|
|
3433
|
+
await b.documentDeleteChunk(E.id, n, x), se(!1), T(e || Z), J();
|
|
3227
3434
|
} catch (e) {
|
|
3228
|
-
|
|
3435
|
+
z(e instanceof Error ? e.message : String(e)), se(!1);
|
|
3229
3436
|
}
|
|
3230
3437
|
}, [
|
|
3231
3438
|
b,
|
|
3232
|
-
|
|
3439
|
+
E,
|
|
3233
3440
|
n,
|
|
3234
3441
|
x,
|
|
3235
|
-
|
|
3236
|
-
|
|
3442
|
+
Z,
|
|
3443
|
+
J
|
|
3237
3444
|
]);
|
|
3238
3445
|
return r(() => {
|
|
3239
|
-
if (!
|
|
3446
|
+
if (!ut) return;
|
|
3240
3447
|
let e = (e) => {
|
|
3241
|
-
if (
|
|
3448
|
+
if (ne || G) return;
|
|
3242
3449
|
let t = document.activeElement, n = t?.tagName;
|
|
3243
3450
|
if (n === "INPUT" || n === "TEXTAREA" || t?.isContentEditable) return;
|
|
3244
|
-
let r =
|
|
3245
|
-
r && (e.preventDefault(),
|
|
3451
|
+
let r = ve(e.clipboardData?.items);
|
|
3452
|
+
r && (e.preventDefault(), dt(r));
|
|
3246
3453
|
};
|
|
3247
3454
|
return window.addEventListener("paste", e), () => window.removeEventListener("paste", e);
|
|
3248
3455
|
}, [
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3456
|
+
ut,
|
|
3457
|
+
ne,
|
|
3458
|
+
G,
|
|
3459
|
+
dt
|
|
3253
3460
|
]), /* @__PURE__ */ u("div", {
|
|
3254
3461
|
className: "doc-viewer",
|
|
3255
3462
|
children: [
|
|
3256
3463
|
/* @__PURE__ */ l("input", {
|
|
3257
|
-
ref:
|
|
3464
|
+
ref: te,
|
|
3258
3465
|
type: "file",
|
|
3259
3466
|
accept: "image/png,image/jpeg,image/gif,image/webp",
|
|
3260
3467
|
style: { display: "none" },
|
|
3261
3468
|
onChange: (e) => {
|
|
3262
3469
|
let t = e.target.files?.[0];
|
|
3263
|
-
e.target.value = "", t &&
|
|
3470
|
+
e.target.value = "", t && dt(t);
|
|
3264
3471
|
}
|
|
3265
3472
|
}),
|
|
3266
3473
|
/* @__PURE__ */ u("div", {
|
|
3267
3474
|
className: "doc-toolbar",
|
|
3268
|
-
style:
|
|
3475
|
+
style: He,
|
|
3269
3476
|
children: [
|
|
3270
3477
|
/* @__PURE__ */ l("strong", {
|
|
3271
3478
|
className: "doc-title",
|
|
3272
|
-
title:
|
|
3273
|
-
children:
|
|
3479
|
+
title: Ne,
|
|
3480
|
+
children: Ne
|
|
3274
3481
|
}),
|
|
3275
|
-
/* @__PURE__ */ l(
|
|
3482
|
+
/* @__PURE__ */ l(Ke, {
|
|
3276
3483
|
value: e,
|
|
3277
3484
|
label: "doc"
|
|
3278
3485
|
}),
|
|
3279
3486
|
/* @__PURE__ */ u("div", {
|
|
3280
3487
|
className: "doc-toolbar-actions",
|
|
3281
3488
|
children: [
|
|
3282
|
-
|
|
3489
|
+
ut && /* @__PURE__ */ u(c, { children: [
|
|
3283
3490
|
/* @__PURE__ */ l("button", {
|
|
3284
3491
|
type: "button",
|
|
3285
|
-
onClick: () => void
|
|
3492
|
+
onClick: () => void pt(),
|
|
3286
3493
|
title: "Add a text chunk AFTER the selected chunk, at the same level",
|
|
3287
3494
|
children: "+ text"
|
|
3288
3495
|
}),
|
|
3289
3496
|
/* @__PURE__ */ l("button", {
|
|
3290
3497
|
type: "button",
|
|
3291
|
-
onClick: () => void
|
|
3498
|
+
onClick: () => void mt(),
|
|
3292
3499
|
disabled: !w,
|
|
3293
3500
|
title: w ? "Add a chunk NESTED UNDER the selected chunk (in the ontology, a child is a subclass)" : "Select a chunk first — this nests a new chunk under it",
|
|
3294
3501
|
children: "+ child"
|
|
3295
3502
|
}),
|
|
3296
3503
|
/* @__PURE__ */ l("button", {
|
|
3297
3504
|
type: "button",
|
|
3298
|
-
onClick: () =>
|
|
3505
|
+
onClick: () => te.current?.click(),
|
|
3299
3506
|
title: "Add an image chunk (upload — or paste a screenshot into the view)",
|
|
3300
3507
|
children: "+ image"
|
|
3301
3508
|
}),
|
|
3302
3509
|
/* @__PURE__ */ l("button", {
|
|
3303
3510
|
type: "button",
|
|
3304
|
-
onClick: () => void
|
|
3511
|
+
onClick: () => void ft(),
|
|
3305
3512
|
title: "Add a Mermaid diagram chunk",
|
|
3306
3513
|
children: "+ diagram"
|
|
3307
3514
|
})
|
|
3308
3515
|
] }),
|
|
3309
3516
|
/* @__PURE__ */ l("button", {
|
|
3310
3517
|
type: "button",
|
|
3311
|
-
className:
|
|
3312
|
-
onClick: () =>
|
|
3313
|
-
disabled: !
|
|
3518
|
+
className: Q ? "active" : "",
|
|
3519
|
+
onClick: () => ye(!0),
|
|
3520
|
+
disabled: !Z,
|
|
3314
3521
|
title: "Colors — tint chunk tiles + the Path tree by type/status",
|
|
3315
3522
|
children: "colors"
|
|
3316
3523
|
}),
|
|
3317
3524
|
b.documentClassify && /* @__PURE__ */ l("button", {
|
|
3318
3525
|
type: "button",
|
|
3319
|
-
className:
|
|
3320
|
-
onClick: () =>
|
|
3526
|
+
className: Ee > 0 ? "active" : "",
|
|
3527
|
+
onClick: () => De((e) => e > 0 ? 0 : 1),
|
|
3321
3528
|
title: "Classify — what this document is, by the confirmed ontology (a report first; nothing is written until Apply)",
|
|
3322
3529
|
children: "classify"
|
|
3323
3530
|
}),
|
|
@@ -3329,20 +3536,20 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3329
3536
|
}),
|
|
3330
3537
|
/* @__PURE__ */ l("button", {
|
|
3331
3538
|
type: "button",
|
|
3332
|
-
onClick: () => void
|
|
3539
|
+
onClick: () => void lt(),
|
|
3333
3540
|
title: "Download the whole document as a node/edge canvas graph (.canvas)",
|
|
3334
3541
|
children: "↓ .canvas"
|
|
3335
3542
|
}),
|
|
3336
3543
|
p && /* @__PURE__ */ l("button", {
|
|
3337
3544
|
type: "button",
|
|
3338
|
-
className:
|
|
3339
|
-
onClick: () =>
|
|
3545
|
+
className: pe ? "active" : "",
|
|
3546
|
+
onClick: () => me((e) => !e),
|
|
3340
3547
|
title: "Document Assistant — instruct an agent to restructure/import/link chunks",
|
|
3341
3548
|
children: "assistant"
|
|
3342
3549
|
}),
|
|
3343
3550
|
/* @__PURE__ */ l("button", {
|
|
3344
3551
|
type: "button",
|
|
3345
|
-
onClick:
|
|
3552
|
+
onClick: J,
|
|
3346
3553
|
title: "Reload",
|
|
3347
3554
|
children: "↻"
|
|
3348
3555
|
})
|
|
@@ -3350,24 +3557,24 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3350
3557
|
})
|
|
3351
3558
|
]
|
|
3352
3559
|
}),
|
|
3353
|
-
|
|
3560
|
+
R && /* @__PURE__ */ l("div", {
|
|
3354
3561
|
className: "paths-err",
|
|
3355
|
-
children:
|
|
3562
|
+
children: R
|
|
3356
3563
|
}),
|
|
3357
|
-
!
|
|
3564
|
+
!Ue && /* @__PURE__ */ l(gt, {
|
|
3358
3565
|
documentId: e,
|
|
3359
3566
|
scope: n,
|
|
3360
3567
|
browse: x,
|
|
3361
|
-
rootFields:
|
|
3362
|
-
requestKey:
|
|
3363
|
-
onClose: () =>
|
|
3364
|
-
onChanged:
|
|
3568
|
+
rootFields: Oe,
|
|
3569
|
+
requestKey: Ee,
|
|
3570
|
+
onClose: () => De(0),
|
|
3571
|
+
onChanged: J
|
|
3365
3572
|
}, `${n}:${e}`),
|
|
3366
|
-
|
|
3573
|
+
Ue ? /* @__PURE__ */ l(Rt, {
|
|
3367
3574
|
documentId: e,
|
|
3368
3575
|
scope: n,
|
|
3369
|
-
detail:
|
|
3370
|
-
}) : /* @__PURE__ */ u(
|
|
3576
|
+
detail: de ?? void 0
|
|
3577
|
+
}) : /* @__PURE__ */ u(he, {
|
|
3371
3578
|
className: "doc-split",
|
|
3372
3579
|
defaultLeftWidth: 320,
|
|
3373
3580
|
minLeftWidth: 160,
|
|
@@ -3375,35 +3582,35 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3375
3582
|
storageKey: "loomcycle.explorer.split.doc",
|
|
3376
3583
|
children: [/* @__PURE__ */ l("div", {
|
|
3377
3584
|
className: "doc-chunktree",
|
|
3378
|
-
children:
|
|
3585
|
+
children: ce && S.length === 0 ? /* @__PURE__ */ l("div", {
|
|
3379
3586
|
className: "empty",
|
|
3380
3587
|
children: /* @__PURE__ */ l("p", { children: "Loading…" })
|
|
3381
|
-
}) : /* @__PURE__ */ l(
|
|
3382
|
-
tree:
|
|
3588
|
+
}) : /* @__PURE__ */ l(Ye, {
|
|
3589
|
+
tree: Me,
|
|
3383
3590
|
selectedId: w,
|
|
3384
3591
|
onSelect: ot,
|
|
3385
|
-
colorEnabled:
|
|
3386
|
-
scheme:
|
|
3387
|
-
linkedIds:
|
|
3592
|
+
colorEnabled: Q,
|
|
3593
|
+
scheme: W?.color_scheme,
|
|
3594
|
+
linkedIds: ze
|
|
3388
3595
|
})
|
|
3389
3596
|
}), /* @__PURE__ */ l("div", {
|
|
3390
3597
|
className: "doc-content",
|
|
3391
|
-
children:
|
|
3598
|
+
children: E ? /* @__PURE__ */ u(c, { children: [
|
|
3392
3599
|
/* @__PURE__ */ u("div", {
|
|
3393
3600
|
className: "doc-content-head",
|
|
3394
3601
|
children: [
|
|
3395
|
-
|
|
3602
|
+
X.length > 0 && /* @__PURE__ */ u("nav", {
|
|
3396
3603
|
className: "chunk-ancestry",
|
|
3397
3604
|
"aria-label": "Chunks above this one",
|
|
3398
3605
|
children: [/* @__PURE__ */ l("button", {
|
|
3399
3606
|
type: "button",
|
|
3400
3607
|
className: "chunk-ancestry-up",
|
|
3401
|
-
onClick: () => T(
|
|
3402
|
-
title: `Up to ${
|
|
3608
|
+
onClick: () => T(X[X.length - 1].id),
|
|
3609
|
+
title: `Up to ${X[X.length - 1].title || "(untitled)"}`,
|
|
3403
3610
|
children: "↰ Up"
|
|
3404
3611
|
}), /* @__PURE__ */ u("ol", {
|
|
3405
3612
|
className: "doc-trail-list",
|
|
3406
|
-
children: [
|
|
3613
|
+
children: [X.map((e) => /* @__PURE__ */ l("li", {
|
|
3407
3614
|
className: "doc-trail-item",
|
|
3408
3615
|
children: /* @__PURE__ */ l("button", {
|
|
3409
3616
|
type: "button",
|
|
@@ -3417,34 +3624,34 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3417
3624
|
children: /* @__PURE__ */ l("span", {
|
|
3418
3625
|
className: "doc-trail-current",
|
|
3419
3626
|
"aria-current": "location",
|
|
3420
|
-
title:
|
|
3421
|
-
children:
|
|
3627
|
+
title: E.title || "(untitled)",
|
|
3628
|
+
children: E.title || "(untitled)"
|
|
3422
3629
|
})
|
|
3423
3630
|
})]
|
|
3424
3631
|
})]
|
|
3425
3632
|
}),
|
|
3426
|
-
/* @__PURE__ */ l("h3", { children:
|
|
3633
|
+
/* @__PURE__ */ l("h3", { children: E.title || "(untitled)" }),
|
|
3427
3634
|
/* @__PURE__ */ u("div", {
|
|
3428
3635
|
className: "doc-content-meta",
|
|
3429
3636
|
children: [
|
|
3430
|
-
|
|
3637
|
+
E.type && /* @__PURE__ */ l("span", {
|
|
3431
3638
|
className: "chunk-badge",
|
|
3432
|
-
children:
|
|
3639
|
+
children: E.type
|
|
3433
3640
|
}),
|
|
3434
|
-
|
|
3641
|
+
E.status && /* @__PURE__ */ l("span", {
|
|
3435
3642
|
className: "chunk-badge chunk-status",
|
|
3436
|
-
children:
|
|
3643
|
+
children: E.status
|
|
3437
3644
|
}),
|
|
3438
3645
|
/* @__PURE__ */ u("span", {
|
|
3439
3646
|
className: "chunk-rev",
|
|
3440
|
-
children: ["rev ",
|
|
3647
|
+
children: ["rev ", E.revision]
|
|
3441
3648
|
}),
|
|
3442
|
-
|
|
3649
|
+
E.tags?.map((e) => /* @__PURE__ */ l("span", {
|
|
3443
3650
|
className: "chunk-tag",
|
|
3444
3651
|
children: e
|
|
3445
3652
|
}, e)),
|
|
3446
|
-
/* @__PURE__ */ l(
|
|
3447
|
-
value:
|
|
3653
|
+
/* @__PURE__ */ l(Ke, {
|
|
3654
|
+
value: E.id,
|
|
3448
3655
|
label: "chunk"
|
|
3449
3656
|
})
|
|
3450
3657
|
]
|
|
@@ -3456,53 +3663,53 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3456
3663
|
className: "doc-mode-toggle",
|
|
3457
3664
|
children: [/* @__PURE__ */ l("button", {
|
|
3458
3665
|
type: "button",
|
|
3459
|
-
className:
|
|
3460
|
-
onClick: () =>
|
|
3666
|
+
className: O === "chunks" ? "active" : "",
|
|
3667
|
+
onClick: () => k("chunks"),
|
|
3461
3668
|
title: "This chunk's own content",
|
|
3462
3669
|
children: "chunk"
|
|
3463
3670
|
}), /* @__PURE__ */ l("button", {
|
|
3464
3671
|
type: "button",
|
|
3465
|
-
className:
|
|
3466
|
-
onClick: () =>
|
|
3467
|
-
title:
|
|
3672
|
+
className: O === "markdown" ? "active" : "",
|
|
3673
|
+
onClick: () => k("markdown"),
|
|
3674
|
+
title: Y ? "Whole document as Markdown" : "This chunk + its sub-chunks as Markdown",
|
|
3468
3675
|
children: "markdown"
|
|
3469
3676
|
})]
|
|
3470
3677
|
}),
|
|
3471
3678
|
/* @__PURE__ */ l("button", {
|
|
3472
3679
|
type: "button",
|
|
3473
3680
|
className: "chunk-edit",
|
|
3474
|
-
onClick: () =>
|
|
3681
|
+
onClick: () => re(E),
|
|
3475
3682
|
children: "edit"
|
|
3476
3683
|
}),
|
|
3477
|
-
b.documentEntityTypes && _(
|
|
3684
|
+
b.documentEntityTypes && _(E) && /* @__PURE__ */ l("button", {
|
|
3478
3685
|
type: "button",
|
|
3479
|
-
onClick: () =>
|
|
3686
|
+
onClick: () => ae(E),
|
|
3480
3687
|
title: "Change this subject's type to another type in force",
|
|
3481
3688
|
children: "change type"
|
|
3482
3689
|
}),
|
|
3483
3690
|
/* @__PURE__ */ l("button", {
|
|
3484
3691
|
type: "button",
|
|
3485
|
-
onClick: () =>
|
|
3692
|
+
onClick: () => L(!0),
|
|
3486
3693
|
title: "View this chunk's edit history + diffs",
|
|
3487
3694
|
children: "history"
|
|
3488
3695
|
}),
|
|
3489
|
-
!
|
|
3696
|
+
!Y && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("button", {
|
|
3490
3697
|
type: "button",
|
|
3491
|
-
onClick: () => void
|
|
3492
|
-
disabled: !
|
|
3698
|
+
onClick: () => void _t("up"),
|
|
3699
|
+
disabled: !ht.canUp,
|
|
3493
3700
|
title: "Move this chunk up within its level",
|
|
3494
3701
|
children: "↑"
|
|
3495
3702
|
}), /* @__PURE__ */ l("button", {
|
|
3496
3703
|
type: "button",
|
|
3497
|
-
onClick: () => void
|
|
3498
|
-
disabled: !
|
|
3704
|
+
onClick: () => void _t("down"),
|
|
3705
|
+
disabled: !ht.canDown,
|
|
3499
3706
|
title: "Move this chunk down within its level",
|
|
3500
3707
|
children: "↓"
|
|
3501
3708
|
})] }),
|
|
3502
|
-
!
|
|
3709
|
+
!Y && /* @__PURE__ */ l("button", {
|
|
3503
3710
|
type: "button",
|
|
3504
3711
|
className: "danger",
|
|
3505
|
-
onClick: () =>
|
|
3712
|
+
onClick: () => se(!0),
|
|
3506
3713
|
title: "Delete this chunk and its sub-chunks",
|
|
3507
3714
|
children: "delete"
|
|
3508
3715
|
})
|
|
@@ -3512,50 +3719,50 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3512
3719
|
}),
|
|
3513
3720
|
/* @__PURE__ */ l("div", {
|
|
3514
3721
|
className: "doc-content-body",
|
|
3515
|
-
children:
|
|
3722
|
+
children: E.type === "mermaid" ? E.body ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(et, { code: E.body }), O === "markdown" && /* @__PURE__ */ l("pre", {
|
|
3516
3723
|
className: "md-pre doc-mermaid-source",
|
|
3517
|
-
children: /* @__PURE__ */ l("code", { children:
|
|
3724
|
+
children: /* @__PURE__ */ l("code", { children: E.body })
|
|
3518
3725
|
})] }) : /* @__PURE__ */ l("p", {
|
|
3519
3726
|
className: "doc-empty-body",
|
|
3520
3727
|
children: "(empty diagram)"
|
|
3521
|
-
}) :
|
|
3728
|
+
}) : E.type === "image" || E.asset ? F ? /* @__PURE__ */ u("p", {
|
|
3522
3729
|
className: "doc-empty-body",
|
|
3523
|
-
children: ["Image failed to load: ",
|
|
3524
|
-
}) :
|
|
3730
|
+
children: ["Image failed to load: ", F]
|
|
3731
|
+
}) : N ? /* @__PURE__ */ u("figure", {
|
|
3525
3732
|
className: "doc-image",
|
|
3526
3733
|
children: [/* @__PURE__ */ l("img", {
|
|
3527
|
-
src:
|
|
3528
|
-
alt:
|
|
3529
|
-
}),
|
|
3734
|
+
src: N,
|
|
3735
|
+
alt: Wt(E)
|
|
3736
|
+
}), E.body && /* @__PURE__ */ l("figcaption", { children: E.body })]
|
|
3530
3737
|
}) : /* @__PURE__ */ l("p", {
|
|
3531
3738
|
className: "doc-empty-body",
|
|
3532
3739
|
children: "Loading image…"
|
|
3533
|
-
}) :
|
|
3740
|
+
}) : O === "markdown" ? A === null ? /* @__PURE__ */ l("p", {
|
|
3534
3741
|
className: "doc-empty-body",
|
|
3535
3742
|
children: "Assembling Markdown…"
|
|
3536
|
-
}) : /* @__PURE__ */ l(
|
|
3743
|
+
}) : /* @__PURE__ */ l(Ht, { source: A }) : E.body ? /* @__PURE__ */ l(Ht, { source: E.body }) : /* @__PURE__ */ l("p", {
|
|
3537
3744
|
className: "doc-empty-body",
|
|
3538
3745
|
children: "(empty chunk)"
|
|
3539
3746
|
})
|
|
3540
3747
|
}),
|
|
3541
|
-
/* @__PURE__ */ l(
|
|
3748
|
+
/* @__PURE__ */ l(Mt, {
|
|
3542
3749
|
edges: K,
|
|
3543
3750
|
incomplete: Ce,
|
|
3544
3751
|
documentId: e,
|
|
3545
3752
|
selectedId: w,
|
|
3546
3753
|
onSelectChunk: T,
|
|
3547
3754
|
onOpenDocument: h ? st : void 0,
|
|
3548
|
-
onRuleStatement:
|
|
3755
|
+
onRuleStatement: Je
|
|
3549
3756
|
}),
|
|
3550
|
-
/* @__PURE__ */ l(
|
|
3757
|
+
/* @__PURE__ */ l(At, {
|
|
3551
3758
|
documentId: e,
|
|
3552
3759
|
selectedId: w,
|
|
3553
3760
|
scope: n,
|
|
3554
3761
|
browse: x,
|
|
3555
3762
|
onSelectChunk: T,
|
|
3556
3763
|
onOpenDocument: h ? st : void 0,
|
|
3557
|
-
refreshKey:
|
|
3558
|
-
review:
|
|
3764
|
+
refreshKey: q,
|
|
3765
|
+
review: $e
|
|
3559
3766
|
})
|
|
3560
3767
|
] }) : /* @__PURE__ */ l("div", {
|
|
3561
3768
|
className: "empty",
|
|
@@ -3563,50 +3770,50 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3563
3770
|
})
|
|
3564
3771
|
})]
|
|
3565
3772
|
}),
|
|
3566
|
-
|
|
3773
|
+
pe && p && /* @__PURE__ */ l("div", {
|
|
3567
3774
|
className: "doc-assistant",
|
|
3568
3775
|
children: p({
|
|
3569
3776
|
documentId: e,
|
|
3570
3777
|
scope: n,
|
|
3571
3778
|
subject: f?.subject,
|
|
3572
|
-
onChanged:
|
|
3779
|
+
onChanged: J
|
|
3573
3780
|
})
|
|
3574
3781
|
}),
|
|
3575
|
-
|
|
3576
|
-
chunk:
|
|
3782
|
+
ne && /* @__PURE__ */ l(tt, {
|
|
3783
|
+
chunk: ne,
|
|
3577
3784
|
scope: n,
|
|
3578
3785
|
browse: x,
|
|
3579
|
-
onClose: () =>
|
|
3580
|
-
onSaved:
|
|
3786
|
+
onClose: () => re(null),
|
|
3787
|
+
onSaved: J
|
|
3581
3788
|
}),
|
|
3582
|
-
|
|
3583
|
-
chunk:
|
|
3789
|
+
ie && /* @__PURE__ */ l(nt, {
|
|
3790
|
+
chunk: ie,
|
|
3584
3791
|
scope: n,
|
|
3585
3792
|
browse: x,
|
|
3586
|
-
onClose: () =>
|
|
3587
|
-
onSaved:
|
|
3793
|
+
onClose: () => ae(null),
|
|
3794
|
+
onSaved: J
|
|
3588
3795
|
}),
|
|
3589
|
-
|
|
3590
|
-
chunkId:
|
|
3591
|
-
chunkTitle:
|
|
3796
|
+
I && E && /* @__PURE__ */ l(Bt, {
|
|
3797
|
+
chunkId: E.id,
|
|
3798
|
+
chunkTitle: E.title,
|
|
3592
3799
|
scope: n,
|
|
3593
3800
|
browse: x,
|
|
3594
|
-
onClose: () =>
|
|
3801
|
+
onClose: () => L(!1)
|
|
3595
3802
|
}),
|
|
3596
|
-
|
|
3803
|
+
G && Z && /* @__PURE__ */ l(yt, {
|
|
3597
3804
|
documentId: e,
|
|
3598
|
-
rootChunkId:
|
|
3599
|
-
docType:
|
|
3600
|
-
docStatus:
|
|
3601
|
-
chunkStatuses:
|
|
3805
|
+
rootChunkId: Z,
|
|
3806
|
+
docType: W?.type,
|
|
3807
|
+
docStatus: W?.status,
|
|
3808
|
+
chunkStatuses: Re,
|
|
3602
3809
|
scope: n,
|
|
3603
3810
|
browse: x,
|
|
3604
|
-
onClose: () =>
|
|
3605
|
-
onSaved:
|
|
3811
|
+
onClose: () => ye(!1),
|
|
3812
|
+
onSaved: J
|
|
3606
3813
|
}),
|
|
3607
|
-
|
|
3814
|
+
oe && E && /* @__PURE__ */ l("div", {
|
|
3608
3815
|
className: "modal-overlay",
|
|
3609
|
-
onClick: () =>
|
|
3816
|
+
onClick: () => se(!1),
|
|
3610
3817
|
children: /* @__PURE__ */ u("div", {
|
|
3611
3818
|
className: "modal chunk-delete-confirm",
|
|
3612
3819
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -3616,7 +3823,7 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3616
3823
|
className: "modal-context",
|
|
3617
3824
|
children: [
|
|
3618
3825
|
"Delete “",
|
|
3619
|
-
|
|
3826
|
+
E.title || "(untitled)",
|
|
3620
3827
|
"” and all of its sub-chunks? This cannot be undone."
|
|
3621
3828
|
]
|
|
3622
3829
|
}),
|
|
@@ -3624,12 +3831,12 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3624
3831
|
className: "modal-buttons",
|
|
3625
3832
|
children: [/* @__PURE__ */ l("button", {
|
|
3626
3833
|
type: "button",
|
|
3627
|
-
onClick: () =>
|
|
3834
|
+
onClick: () => se(!1),
|
|
3628
3835
|
children: "cancel"
|
|
3629
3836
|
}), /* @__PURE__ */ l("button", {
|
|
3630
3837
|
type: "button",
|
|
3631
3838
|
className: "danger",
|
|
3632
|
-
onClick: () => void
|
|
3839
|
+
onClick: () => void vt(),
|
|
3633
3840
|
children: "delete"
|
|
3634
3841
|
})]
|
|
3635
3842
|
})
|
|
@@ -3641,7 +3848,7 @@ function Rt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
|
|
|
3641
3848
|
}
|
|
3642
3849
|
//#endregion
|
|
3643
3850
|
//#region src/components/PathTree.tsx
|
|
3644
|
-
function
|
|
3851
|
+
function Kt(e, t = "") {
|
|
3645
3852
|
let n = e.get(t);
|
|
3646
3853
|
if (!n) return [];
|
|
3647
3854
|
let r = n.entries.map((n) => {
|
|
@@ -3652,7 +3859,7 @@ function zt(e, t = "") {
|
|
|
3652
3859
|
kind: n.kind,
|
|
3653
3860
|
resourceRef: n.resource_ref,
|
|
3654
3861
|
listing: r ? e.get(n.full_path) : void 0,
|
|
3655
|
-
children: r ?
|
|
3862
|
+
children: r ? Kt(e, n.full_path) : []
|
|
3656
3863
|
};
|
|
3657
3864
|
});
|
|
3658
3865
|
return r.sort((e, t) => {
|
|
@@ -3660,13 +3867,13 @@ function zt(e, t = "") {
|
|
|
3660
3867
|
return n === (t.kind === "directory") ? e.name.localeCompare(t.name) : n ? -1 : 1;
|
|
3661
3868
|
}), r;
|
|
3662
3869
|
}
|
|
3663
|
-
var
|
|
3870
|
+
var qt = {
|
|
3664
3871
|
directory: "📁",
|
|
3665
3872
|
document: "📄",
|
|
3666
3873
|
volume_mount: "💾",
|
|
3667
3874
|
memory_entry: "🧠"
|
|
3668
3875
|
};
|
|
3669
|
-
function
|
|
3876
|
+
function Jt(e) {
|
|
3670
3877
|
let { tree: t, root: n } = e;
|
|
3671
3878
|
return !n || !n.loaded && n.loading ? /* @__PURE__ */ l("div", {
|
|
3672
3879
|
className: "empty",
|
|
@@ -3676,17 +3883,17 @@ function Vt(e) {
|
|
|
3676
3883
|
children: /* @__PURE__ */ l("p", { children: "This tree is empty. Create a folder or document to begin." })
|
|
3677
3884
|
}) : /* @__PURE__ */ u("ul", {
|
|
3678
3885
|
className: "tree path-tree",
|
|
3679
|
-
children: [t.map((t) => /* @__PURE__ */ l(
|
|
3886
|
+
children: [t.map((t) => /* @__PURE__ */ l(Zt, {
|
|
3680
3887
|
node: t,
|
|
3681
3888
|
...e
|
|
3682
|
-
}, t.fullPath)), /* @__PURE__ */ l(
|
|
3889
|
+
}, t.fullPath)), /* @__PURE__ */ l(Yt, {
|
|
3683
3890
|
dir: "",
|
|
3684
3891
|
listing: n,
|
|
3685
3892
|
...e
|
|
3686
3893
|
})]
|
|
3687
3894
|
});
|
|
3688
3895
|
}
|
|
3689
|
-
function
|
|
3896
|
+
function Yt({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
|
|
3690
3897
|
let i = [];
|
|
3691
3898
|
return !t || t.loading && t.entries.length === 0 ? i.push(/* @__PURE__ */ l("li", {
|
|
3692
3899
|
className: "node path-status",
|
|
@@ -3726,13 +3933,13 @@ function Ht({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
|
|
|
3726
3933
|
})
|
|
3727
3934
|
}, "more")), /* @__PURE__ */ l(c, { children: i });
|
|
3728
3935
|
}
|
|
3729
|
-
function
|
|
3936
|
+
function Xt(e, t) {
|
|
3730
3937
|
if (e.kind !== "document" || !t) return;
|
|
3731
3938
|
let n = e.resourceRef;
|
|
3732
3939
|
return n?.document_id ? t.get(n.document_id) : void 0;
|
|
3733
3940
|
}
|
|
3734
|
-
function
|
|
3735
|
-
let { node: t, expanded: n, onToggle: r, selectedPath: i, onSelect: a, summaries: o } = e, s = t.kind === "directory", c = s && n.has(t.fullPath), d = i === t.fullPath, f =
|
|
3941
|
+
function Zt(e) {
|
|
3942
|
+
let { node: t, expanded: n, onToggle: r, selectedPath: i, onSelect: a, summaries: o } = e, s = t.kind === "directory", c = s && n.has(t.fullPath), d = i === t.fullPath, f = Xt(t, o), p = f && f.color_enabled ? We(Ve(f.type, f.status, Be(f.color_scheme))) : void 0;
|
|
3736
3943
|
return /* @__PURE__ */ u("li", {
|
|
3737
3944
|
className: `node path-node kind-${t.kind} ${d ? "selected" : ""}`,
|
|
3738
3945
|
children: [/* @__PURE__ */ u("div", {
|
|
@@ -3757,7 +3964,7 @@ function Wt(e) {
|
|
|
3757
3964
|
/* @__PURE__ */ l("span", {
|
|
3758
3965
|
className: "path-kind-icon",
|
|
3759
3966
|
"aria-hidden": !0,
|
|
3760
|
-
children:
|
|
3967
|
+
children: qt[t.kind] ?? "•"
|
|
3761
3968
|
}),
|
|
3762
3969
|
/* @__PURE__ */ l("span", {
|
|
3763
3970
|
className: "path-name",
|
|
@@ -3775,10 +3982,10 @@ function Wt(e) {
|
|
|
3775
3982
|
})]
|
|
3776
3983
|
}), c && /* @__PURE__ */ u("ul", {
|
|
3777
3984
|
className: "children path-children",
|
|
3778
|
-
children: [t.children.map((t) => /* @__PURE__ */ l(
|
|
3985
|
+
children: [t.children.map((t) => /* @__PURE__ */ l(Zt, {
|
|
3779
3986
|
...e,
|
|
3780
3987
|
node: t
|
|
3781
|
-
}, t.fullPath)), /* @__PURE__ */ l(
|
|
3988
|
+
}, t.fullPath)), /* @__PURE__ */ l(Yt, {
|
|
3782
3989
|
...e,
|
|
3783
3990
|
dir: t.fullPath,
|
|
3784
3991
|
listing: t.listing
|
|
@@ -3788,23 +3995,23 @@ function Wt(e) {
|
|
|
3788
3995
|
}
|
|
3789
3996
|
//#endregion
|
|
3790
3997
|
//#region src/PathExplorer.tsx
|
|
3791
|
-
var
|
|
3792
|
-
function
|
|
3998
|
+
var Qt = /^[A-Za-z0-9._-]+$/;
|
|
3999
|
+
function $t(e, t) {
|
|
3793
4000
|
return `${e}/${t}`;
|
|
3794
4001
|
}
|
|
3795
|
-
function
|
|
4002
|
+
function en(e, t) {
|
|
3796
4003
|
for (let n of e) {
|
|
3797
4004
|
if (n.fullPath === t) return n;
|
|
3798
|
-
let e =
|
|
4005
|
+
let e = en(n.children, t);
|
|
3799
4006
|
if (e) return e;
|
|
3800
4007
|
}
|
|
3801
4008
|
}
|
|
3802
|
-
function
|
|
3803
|
-
let { theme: t, defaultScope: n, path: r, onPathChange: i, browse: a, principal: o, renderAssistant: s, renderNavigator: c,
|
|
3804
|
-
return /* @__PURE__ */ l(
|
|
4009
|
+
function tn(e) {
|
|
4010
|
+
let { theme: t, defaultScope: n, path: r, onPathChange: i, browse: a, principal: o, renderAssistant: s, renderNavigator: c, navigator: u, onError: d } = e, f = R(e);
|
|
4011
|
+
return /* @__PURE__ */ l(z, {
|
|
3805
4012
|
theme: t,
|
|
3806
|
-
dataLayer:
|
|
3807
|
-
children: /* @__PURE__ */ l(
|
|
4013
|
+
dataLayer: f,
|
|
4014
|
+
children: /* @__PURE__ */ l(nn, {
|
|
3808
4015
|
defaultScope: n,
|
|
3809
4016
|
path: r,
|
|
3810
4017
|
onPathChange: i,
|
|
@@ -3812,47 +4019,52 @@ function Jt(e) {
|
|
|
3812
4019
|
principal: o,
|
|
3813
4020
|
renderAssistant: s,
|
|
3814
4021
|
renderNavigator: c,
|
|
3815
|
-
|
|
4022
|
+
navigator: u,
|
|
4023
|
+
onError: d
|
|
3816
4024
|
})
|
|
3817
4025
|
});
|
|
3818
4026
|
}
|
|
3819
|
-
function
|
|
3820
|
-
let
|
|
4027
|
+
function nn({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p, renderAssistant: m, renderNavigator: _, navigator: v, onError: y }) {
|
|
4028
|
+
let b = M(), [x, S] = o(e ?? "user"), [C, w] = o(void 0), [T, E] = o(null), [D, O] = o(null), [k, A] = o(null), [j, N] = o(() => /* @__PURE__ */ new Set()), P = n === void 0 ? C : n, te = a(d);
|
|
3821
4029
|
r(() => {
|
|
3822
|
-
|
|
4030
|
+
te.current = d;
|
|
3823
4031
|
}, [d]);
|
|
3824
|
-
let
|
|
4032
|
+
let ne = a(y);
|
|
3825
4033
|
r(() => {
|
|
3826
|
-
|
|
3827
|
-
}, [
|
|
3828
|
-
let [
|
|
3829
|
-
|
|
4034
|
+
ne.current = y;
|
|
4035
|
+
}, [y]);
|
|
4036
|
+
let [I, L] = o([]), oe = a(0), se = a(void 0), R = t((e) => {
|
|
4037
|
+
se.current = e, te.current?.(e), w(e);
|
|
3830
4038
|
}, []), z = t((e) => {
|
|
3831
|
-
|
|
4039
|
+
oe.current++, L((e) => e.length > 0 ? [] : e), R(e);
|
|
3832
4040
|
}, [R]);
|
|
3833
4041
|
r(() => {
|
|
3834
|
-
n !== void 0 && n !==
|
|
4042
|
+
n !== void 0 && n !== se.current && (oe.current++, L((e) => e.length > 0 ? [] : e));
|
|
3835
4043
|
}, [n]);
|
|
3836
4044
|
let B = i(() => f && (f.scopeId || f.tenant) ? {
|
|
3837
4045
|
scopeId: f.scopeId,
|
|
3838
4046
|
tenant: f.tenant
|
|
3839
|
-
} : void 0, [f?.scopeId, f?.tenant]), V = i(() => new
|
|
3840
|
-
y,
|
|
4047
|
+
} : void 0, [f?.scopeId, f?.tenant]), V = i(() => new re(b, x, B), [
|
|
3841
4048
|
b,
|
|
4049
|
+
x,
|
|
3842
4050
|
B
|
|
3843
4051
|
]), H = s(V.subscribe, V.getSnapshot), U = t((e) => {
|
|
3844
|
-
|
|
3845
|
-
}, []), [
|
|
3846
|
-
|
|
3847
|
-
}, []), [
|
|
3848
|
-
Te.current++, we.current = /* @__PURE__ */ new Set(), Ce(/* @__PURE__ */ new Map());
|
|
3849
|
-
}, []), De = a(!0);
|
|
4052
|
+
ne.current?.(e);
|
|
4053
|
+
}, []), [W, ge] = o(() => _ ? h(globalThis.localStorage) : "tree"), G = !!_ && W === "stars", _e = t((e) => {
|
|
4054
|
+
ge(e), g(globalThis.localStorage, e), e === "tree" && ye(!1);
|
|
4055
|
+
}, []), [ve, ye] = o(!1), [be, xe] = o(0);
|
|
3850
4056
|
r(() => {
|
|
3851
|
-
|
|
4057
|
+
_ && v && _e(v);
|
|
4058
|
+
}, [v]);
|
|
4059
|
+
let [K, Se] = o(), [Ce, we] = o(), q = t((e, t) => (xe((e) => e + 1), V.invalidate(e, t)), [V]), [Te, Ee] = o(() => /* @__PURE__ */ new Map()), De = a(/* @__PURE__ */ new Set()), Oe = a(0), ke = t(() => {
|
|
4060
|
+
Oe.current++, De.current = /* @__PURE__ */ new Set(), Ee(/* @__PURE__ */ new Map());
|
|
4061
|
+
}, []), J = a(!0);
|
|
4062
|
+
r(() => {
|
|
4063
|
+
J.current ? J.current = !1 : (z(void 0), E(null), N(/* @__PURE__ */ new Set()), ke()), V.loadDir("").catch(U);
|
|
3852
4064
|
}, [
|
|
3853
4065
|
V,
|
|
3854
4066
|
z,
|
|
3855
|
-
|
|
4067
|
+
ke,
|
|
3856
4068
|
U
|
|
3857
4069
|
]), r(() => {
|
|
3858
4070
|
for (let e of j) H.has(e) || V.loadDir(e).catch(U);
|
|
@@ -3862,74 +4074,74 @@ function Yt({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
|
|
|
3862
4074
|
H,
|
|
3863
4075
|
U
|
|
3864
4076
|
]);
|
|
3865
|
-
let
|
|
4077
|
+
let Ae = a(null);
|
|
3866
4078
|
r(() => {
|
|
3867
|
-
let e =
|
|
3868
|
-
if (
|
|
3869
|
-
let t =
|
|
3870
|
-
|
|
4079
|
+
let e = Ae.current !== null && Ae.current !== V;
|
|
4080
|
+
if (Ae.current = V, !P || e) return;
|
|
4081
|
+
let t = ee(P).filter((e) => e !== "");
|
|
4082
|
+
N((e) => {
|
|
3871
4083
|
if (t.every((t) => e.has(t))) return e;
|
|
3872
4084
|
let n = new Set(e);
|
|
3873
4085
|
return t.forEach((e) => n.add(e)), n;
|
|
3874
|
-
}), V.reveal(
|
|
4086
|
+
}), V.reveal(P).catch(U);
|
|
3875
4087
|
}, [
|
|
3876
4088
|
V,
|
|
3877
|
-
|
|
4089
|
+
P,
|
|
3878
4090
|
U
|
|
3879
4091
|
]), r(() => {
|
|
3880
|
-
if (
|
|
4092
|
+
if (x === "tenant") return;
|
|
3881
4093
|
let e = [];
|
|
3882
|
-
for (let t of H.values()) for (let n of
|
|
3883
|
-
let t =
|
|
3884
|
-
for (let n = 0; n < e.length; n += 500)
|
|
3885
|
-
|
|
4094
|
+
for (let t of H.values()) for (let n of ae(t.entries)) De.current.has(n) || (De.current.add(n), e.push(n));
|
|
4095
|
+
let t = Oe.current;
|
|
4096
|
+
for (let n = 0; n < e.length; n += 500) b.documentsSummary({ documentIds: e.slice(n, n + 500) }, x, B).then((e) => {
|
|
4097
|
+
Oe.current === t && Ee((t) => {
|
|
3886
4098
|
let n = new Map(t);
|
|
3887
4099
|
for (let t of e.documents ?? []) n.set(t.document_id, t);
|
|
3888
4100
|
return n;
|
|
3889
4101
|
});
|
|
3890
4102
|
}).catch(() => {});
|
|
3891
4103
|
}, [
|
|
3892
|
-
y,
|
|
3893
|
-
H,
|
|
3894
4104
|
b,
|
|
4105
|
+
H,
|
|
4106
|
+
x,
|
|
3895
4107
|
B
|
|
3896
4108
|
]);
|
|
3897
|
-
let
|
|
3898
|
-
|
|
4109
|
+
let je = i(() => Kt(H), [H]), Me = t(async () => {
|
|
4110
|
+
E(null), ke(), xe((e) => e + 1), await V.refresh(j).catch(U), P && await V.reveal(P).catch(U);
|
|
3899
4111
|
}, [
|
|
3900
4112
|
V,
|
|
3901
4113
|
j,
|
|
3902
|
-
|
|
3903
|
-
|
|
4114
|
+
P,
|
|
4115
|
+
ke,
|
|
3904
4116
|
U
|
|
3905
|
-
]),
|
|
3906
|
-
|
|
4117
|
+
]), Ne = t((e) => {
|
|
4118
|
+
N((t) => {
|
|
3907
4119
|
let n = new Set(t);
|
|
3908
4120
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
3909
4121
|
});
|
|
3910
|
-
}, []),
|
|
4122
|
+
}, []), Y = t((e) => V.loadMore(e).catch(U), [V, U]), X = t((e) => {
|
|
3911
4123
|
(V.getSnapshot().get(e)?.loaded ? V.loadMore(e) : V.loadDir(e)).catch(U);
|
|
3912
|
-
}, [V, U]),
|
|
4124
|
+
}, [V, U]), Z = i(() => P ? en(je, P) : void 0, [je, P]), Pe = H.get("")?.error, Fe = Z?.kind === "directory" ? Z.fullPath : void 0, [Ie, Le] = o(null);
|
|
3913
4125
|
r(() => {
|
|
3914
|
-
if (!
|
|
4126
|
+
if (!Fe || !b.pathIsStored) return;
|
|
3915
4127
|
let e = !1;
|
|
3916
|
-
return
|
|
3917
|
-
e ||
|
|
3918
|
-
path:
|
|
4128
|
+
return b.pathIsStored(Fe, x, B).then((t) => {
|
|
4129
|
+
e || Le({
|
|
4130
|
+
path: Fe,
|
|
3919
4131
|
explicit: t
|
|
3920
4132
|
});
|
|
3921
4133
|
}, () => {}), () => {
|
|
3922
4134
|
e = !0;
|
|
3923
4135
|
};
|
|
3924
4136
|
}, [
|
|
3925
|
-
y,
|
|
3926
|
-
Pe,
|
|
3927
4137
|
b,
|
|
4138
|
+
Fe,
|
|
4139
|
+
x,
|
|
3928
4140
|
B
|
|
3929
4141
|
]);
|
|
3930
|
-
let
|
|
4142
|
+
let Re = Z ? Z.kind === "directory" ? Ie?.path === Z.fullPath ? Ie.explicit ? "yes" : "implicit (no entry)" : void 0 : "yes" : void 0, Q = i(() => Z ? Z.kind === "directory" ? Z.fullPath : F(Z.fullPath) : "", [Z]), ze = Q || "/", Be = x !== "tenant", Ve = t(() => {
|
|
3931
4143
|
O({
|
|
3932
|
-
title: `New folder in ${
|
|
4144
|
+
title: `New folder in ${ze}`,
|
|
3933
4145
|
fields: [{
|
|
3934
4146
|
key: "name",
|
|
3935
4147
|
label: "Folder name",
|
|
@@ -3938,23 +4150,23 @@ function Yt({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
|
|
|
3938
4150
|
submitLabel: "Create",
|
|
3939
4151
|
onSubmit: async (e) => {
|
|
3940
4152
|
let t = e.name.trim();
|
|
3941
|
-
if (!
|
|
3942
|
-
let n =
|
|
3943
|
-
await
|
|
4153
|
+
if (!Qt.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
|
|
4154
|
+
let n = $t(Q, t);
|
|
4155
|
+
await b.pathMkdir(n, x, B), await q(n).catch(U), z(n);
|
|
3944
4156
|
}
|
|
3945
4157
|
});
|
|
3946
4158
|
}, [
|
|
3947
|
-
y,
|
|
3948
|
-
V,
|
|
3949
|
-
Le,
|
|
3950
|
-
X,
|
|
3951
4159
|
b,
|
|
4160
|
+
V,
|
|
4161
|
+
Q,
|
|
4162
|
+
ze,
|
|
4163
|
+
x,
|
|
3952
4164
|
B,
|
|
3953
4165
|
U,
|
|
3954
4166
|
z
|
|
3955
|
-
]),
|
|
4167
|
+
]), He = t(() => {
|
|
3956
4168
|
O({
|
|
3957
|
-
title: `New document in ${
|
|
4169
|
+
title: `New document in ${ze}`,
|
|
3958
4170
|
fields: [{
|
|
3959
4171
|
key: "name",
|
|
3960
4172
|
label: "Path name",
|
|
@@ -3967,70 +4179,70 @@ function Yt({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
|
|
|
3967
4179
|
submitLabel: "Create",
|
|
3968
4180
|
onSubmit: async (e) => {
|
|
3969
4181
|
let t = e.name.trim();
|
|
3970
|
-
if (!
|
|
3971
|
-
let n = e.title.trim() || t, r =
|
|
3972
|
-
await
|
|
4182
|
+
if (!Qt.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
|
|
4183
|
+
let n = e.title.trim() || t, r = $t(Q, t);
|
|
4184
|
+
await b.documentCreate(n, r, x, B), await q(r).catch(U), z(r);
|
|
3973
4185
|
}
|
|
3974
4186
|
});
|
|
3975
4187
|
}, [
|
|
3976
|
-
y,
|
|
3977
|
-
V,
|
|
3978
|
-
Le,
|
|
3979
|
-
X,
|
|
3980
4188
|
b,
|
|
4189
|
+
V,
|
|
4190
|
+
Q,
|
|
4191
|
+
ze,
|
|
4192
|
+
x,
|
|
3981
4193
|
B,
|
|
3982
4194
|
U,
|
|
3983
4195
|
z
|
|
3984
|
-
]),
|
|
3985
|
-
|
|
3986
|
-
title: `Rename / move ${
|
|
4196
|
+
]), Ue = t(() => {
|
|
4197
|
+
Z && O({
|
|
4198
|
+
title: `Rename / move ${Z.fullPath}`,
|
|
3987
4199
|
fields: [{
|
|
3988
4200
|
key: "to",
|
|
3989
4201
|
label: "New path",
|
|
3990
|
-
value:
|
|
4202
|
+
value: Z.fullPath
|
|
3991
4203
|
}],
|
|
3992
4204
|
submitLabel: "Move",
|
|
3993
4205
|
onSubmit: async (e) => {
|
|
3994
4206
|
let t = e.to.trim();
|
|
3995
4207
|
if (!t.startsWith("/")) throw Error("path must start with /");
|
|
3996
|
-
await
|
|
4208
|
+
await b.pathMv(Z.fullPath, t, x, B), await Promise.all([q(Z.fullPath, { dropSubtree: !0 }), q(t)]).catch(U), z(t);
|
|
3997
4209
|
}
|
|
3998
4210
|
});
|
|
3999
4211
|
}, [
|
|
4000
|
-
y,
|
|
4001
|
-
V,
|
|
4002
|
-
J,
|
|
4003
4212
|
b,
|
|
4213
|
+
V,
|
|
4214
|
+
Z,
|
|
4215
|
+
x,
|
|
4004
4216
|
B,
|
|
4005
4217
|
U,
|
|
4006
4218
|
z
|
|
4007
|
-
]),
|
|
4008
|
-
if (!
|
|
4009
|
-
if (
|
|
4010
|
-
let e =
|
|
4219
|
+
]), We = t(() => {
|
|
4220
|
+
if (!Z) return;
|
|
4221
|
+
if (Z.kind === "document") {
|
|
4222
|
+
let e = Z.resourceRef?.document_id;
|
|
4011
4223
|
O({
|
|
4012
|
-
title: `Delete document ${
|
|
4224
|
+
title: `Delete document ${Z.fullPath}`,
|
|
4013
4225
|
message: "This deletes the document, all its chunks, and its path entry. This cannot be undone.",
|
|
4014
4226
|
fields: [],
|
|
4015
4227
|
submitLabel: "Delete",
|
|
4016
4228
|
danger: !0,
|
|
4017
4229
|
onSubmit: async () => {
|
|
4018
4230
|
if (!e) throw Error("this document dirent has no document_id");
|
|
4019
|
-
await
|
|
4231
|
+
await b.documentDelete(e, x, B), await q(Z.fullPath).catch(U), z(void 0);
|
|
4020
4232
|
}
|
|
4021
4233
|
});
|
|
4022
4234
|
return;
|
|
4023
4235
|
}
|
|
4024
|
-
let e =
|
|
4025
|
-
|
|
4236
|
+
let e = Z;
|
|
4237
|
+
E(null), (async () => {
|
|
4026
4238
|
let t;
|
|
4027
4239
|
try {
|
|
4028
|
-
t = await
|
|
4240
|
+
t = await ie(b, e.fullPath, x, B);
|
|
4029
4241
|
} catch (t) {
|
|
4030
|
-
|
|
4242
|
+
E(`could not list ${e.fullPath} for delete: ${t instanceof Error ? t.message : String(t)}`);
|
|
4031
4243
|
return;
|
|
4032
4244
|
}
|
|
4033
|
-
let n =
|
|
4245
|
+
let n = x === "tenant" ? [] : ae(t);
|
|
4034
4246
|
O({
|
|
4035
4247
|
title: `Delete branch ${e.fullPath}`,
|
|
4036
4248
|
message: t.length === 0 ? "This removes the (empty) folder." : "This removes the folder and everything under it" + (n.length > 0 ? ` — including ${n.length} document(s), whose chunks are deleted.` : "."),
|
|
@@ -4038,54 +4250,78 @@ function Yt({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
|
|
|
4038
4250
|
submitLabel: "Delete",
|
|
4039
4251
|
danger: !0,
|
|
4040
4252
|
onSubmit: async () => {
|
|
4041
|
-
for (let e of n) await
|
|
4042
|
-
await
|
|
4253
|
+
for (let e of n) await b.documentDelete(e, x, B);
|
|
4254
|
+
await b.pathRm(e.fullPath, x, !0, B), await q(e.fullPath, { dropSubtree: !0 }).catch(U), z(void 0);
|
|
4043
4255
|
}
|
|
4044
4256
|
});
|
|
4045
4257
|
})();
|
|
4046
4258
|
}, [
|
|
4047
|
-
y,
|
|
4048
|
-
V,
|
|
4049
|
-
J,
|
|
4050
4259
|
b,
|
|
4260
|
+
V,
|
|
4261
|
+
Z,
|
|
4262
|
+
x,
|
|
4051
4263
|
B,
|
|
4052
4264
|
U,
|
|
4053
4265
|
z
|
|
4054
|
-
]),
|
|
4055
|
-
if (
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4266
|
+
]), Ge = Z && (Z.kind === "directory" || Z.kind === "document"), Ke = !!b.documentsTransfer && !!Ge, qe = t(() => {
|
|
4267
|
+
if (Z) {
|
|
4268
|
+
if (Z.kind === "document") {
|
|
4269
|
+
let e = Z.resourceRef?.document_id;
|
|
4270
|
+
if (!e) {
|
|
4271
|
+
E("this document entry has no document_id");
|
|
4272
|
+
return;
|
|
4273
|
+
}
|
|
4274
|
+
A({
|
|
4275
|
+
documentId: e,
|
|
4276
|
+
fromPath: Z.fullPath
|
|
4277
|
+
});
|
|
4278
|
+
} else A({
|
|
4279
|
+
underPath: Z.fullPath,
|
|
4280
|
+
fromPath: Z.fullPath
|
|
4281
|
+
});
|
|
4282
|
+
}
|
|
4283
|
+
}, [Z]), Je = t((e) => {
|
|
4284
|
+
e.op === "move" ? (q(e.from, { dropSubtree: !0 }).catch(U), L([]), z(void 0)) : e.toScope === x && q(e.to).catch(U);
|
|
4285
|
+
}, [
|
|
4286
|
+
q,
|
|
4287
|
+
U,
|
|
4288
|
+
x,
|
|
4289
|
+
z
|
|
4290
|
+
]), $ = i(() => {
|
|
4291
|
+
if (I.length > 0) return I[I.length - 1];
|
|
4292
|
+
if (Z?.kind === "document") return {
|
|
4293
|
+
documentId: Z.resourceRef?.document_id ?? "",
|
|
4294
|
+
path: Z.fullPath,
|
|
4295
|
+
title: Z.name
|
|
4060
4296
|
};
|
|
4061
|
-
}, [
|
|
4062
|
-
let n = ++
|
|
4063
|
-
|
|
4297
|
+
}, [I, Z]), Ye = t((e, t) => {
|
|
4298
|
+
let n = ++oe.current, r = fe(V.getSnapshot(), e.documentId);
|
|
4299
|
+
L(ce(I, {
|
|
4064
4300
|
...t,
|
|
4065
4301
|
path: $?.path
|
|
4066
4302
|
}, {
|
|
4067
4303
|
...e,
|
|
4068
4304
|
path: r
|
|
4069
|
-
})), R(r), !r &&
|
|
4070
|
-
t &&
|
|
4305
|
+
})), R(r), !r && b.documentPath && b.documentPath(e.documentId, x, B).then((t) => {
|
|
4306
|
+
t && oe.current === n && (L((n) => ue(n, e.documentId, { path: t })), R(t));
|
|
4071
4307
|
}, () => {});
|
|
4072
4308
|
}, [
|
|
4073
|
-
|
|
4309
|
+
b,
|
|
4074
4310
|
V,
|
|
4075
|
-
|
|
4311
|
+
I,
|
|
4076
4312
|
$?.path,
|
|
4077
|
-
|
|
4313
|
+
x,
|
|
4078
4314
|
B,
|
|
4079
4315
|
R
|
|
4080
|
-
]),
|
|
4081
|
-
let t =
|
|
4082
|
-
t !==
|
|
4083
|
-
}, [
|
|
4084
|
-
|
|
4316
|
+
]), Xe = t((e) => {
|
|
4317
|
+
let t = le(I, e);
|
|
4318
|
+
t !== I && (oe.current++, L(t), R(t[t.length - 1].path));
|
|
4319
|
+
}, [I, R]), Ze = t((e, t) => L((n) => ue(n, e, { title: t })), []), Qe = t((e) => {
|
|
4320
|
+
we((t) => ({
|
|
4085
4321
|
documentId: e.documentId,
|
|
4086
4322
|
chunkId: e.chunkId,
|
|
4087
4323
|
seq: (t?.seq ?? 0) + 1
|
|
4088
|
-
})), $?.documentId !== e.documentId && (e.path ? z(e.path) : (
|
|
4324
|
+
})), $?.documentId !== e.documentId && (e.path ? z(e.path) : (oe.current++, L([{
|
|
4089
4325
|
documentId: e.documentId,
|
|
4090
4326
|
chunkId: e.chunkId
|
|
4091
4327
|
}]), R(void 0)));
|
|
@@ -4093,242 +4329,273 @@ function Yt({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
|
|
|
4093
4329
|
$?.documentId,
|
|
4094
4330
|
z,
|
|
4095
4331
|
R
|
|
4096
|
-
]),
|
|
4097
|
-
scope:
|
|
4332
|
+
]), $e = i(() => ({
|
|
4333
|
+
scope: x,
|
|
4098
4334
|
browse: B,
|
|
4099
4335
|
selection: {
|
|
4100
4336
|
documentId: $?.documentId,
|
|
4101
|
-
chunkId:
|
|
4337
|
+
chunkId: K && K.documentId === $?.documentId ? K.chunkId : void 0,
|
|
4102
4338
|
path: $?.path
|
|
4103
4339
|
},
|
|
4104
|
-
onSelect:
|
|
4105
|
-
reloadToken:
|
|
4106
|
-
maximized:
|
|
4107
|
-
onToggleMaximize: () =>
|
|
4340
|
+
onSelect: Qe,
|
|
4341
|
+
reloadToken: be,
|
|
4342
|
+
maximized: ve,
|
|
4343
|
+
onToggleMaximize: () => ye((e) => !e),
|
|
4108
4344
|
subject: p?.subject
|
|
4109
4345
|
}), [
|
|
4110
|
-
|
|
4346
|
+
x,
|
|
4111
4347
|
B,
|
|
4112
4348
|
$?.documentId,
|
|
4113
4349
|
$?.path,
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4350
|
+
K,
|
|
4351
|
+
Qe,
|
|
4352
|
+
be,
|
|
4353
|
+
ve,
|
|
4118
4354
|
p?.subject
|
|
4119
|
-
]),
|
|
4120
|
-
return /* @__PURE__ */ u(c, { children: [
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4355
|
+
]), et = Ce && $ && Ce.documentId === $.documentId ? Ce : void 0, tt = !!$?.path && Z?.kind === "document" && Z.fullPath === $.path;
|
|
4356
|
+
return /* @__PURE__ */ u(c, { children: [
|
|
4357
|
+
/* @__PURE__ */ u(he, {
|
|
4358
|
+
className: G ? "paths-view paths-view--stars" : "paths-view",
|
|
4359
|
+
defaultLeftWidth: G ? 720 : 420,
|
|
4360
|
+
minLeftWidth: 280,
|
|
4361
|
+
minRightWidth: 300,
|
|
4362
|
+
storageKey: G ? "loomcycle.explorer.split.stars" : "loomcycle.explorer.split.paths",
|
|
4363
|
+
hideRight: G && ve,
|
|
4364
|
+
children: [/* @__PURE__ */ u("div", {
|
|
4365
|
+
className: "left",
|
|
4366
|
+
children: [
|
|
4367
|
+
/* @__PURE__ */ u("div", {
|
|
4368
|
+
className: "paths-toolbar",
|
|
4369
|
+
children: [
|
|
4370
|
+
/* @__PURE__ */ u("label", {
|
|
4371
|
+
className: "paths-scope",
|
|
4372
|
+
children: [/* @__PURE__ */ l("span", { children: "scope" }), /* @__PURE__ */ u("select", {
|
|
4373
|
+
value: x,
|
|
4374
|
+
onChange: (e) => S(e.target.value),
|
|
4375
|
+
children: [
|
|
4376
|
+
/* @__PURE__ */ l("option", {
|
|
4377
|
+
value: "user",
|
|
4378
|
+
children: "user"
|
|
4379
|
+
}),
|
|
4380
|
+
/* @__PURE__ */ l("option", {
|
|
4381
|
+
value: "agent",
|
|
4382
|
+
children: "agent"
|
|
4383
|
+
}),
|
|
4384
|
+
/* @__PURE__ */ l("option", {
|
|
4385
|
+
value: "tenant",
|
|
4386
|
+
children: "tenant"
|
|
4387
|
+
})
|
|
4388
|
+
]
|
|
4389
|
+
})]
|
|
4390
|
+
}),
|
|
4391
|
+
_ && /* @__PURE__ */ u("div", {
|
|
4392
|
+
className: "paths-nav-switch",
|
|
4393
|
+
role: "group",
|
|
4394
|
+
"aria-label": "Navigator",
|
|
4395
|
+
children: [/* @__PURE__ */ l("button", {
|
|
4396
|
+
type: "button",
|
|
4397
|
+
"aria-pressed": !G,
|
|
4398
|
+
className: G ? void 0 : "active",
|
|
4399
|
+
onClick: () => _e("tree"),
|
|
4400
|
+
title: "Browse the Path tree",
|
|
4401
|
+
children: "tree"
|
|
4402
|
+
}), /* @__PURE__ */ l("button", {
|
|
4403
|
+
type: "button",
|
|
4404
|
+
"aria-pressed": G,
|
|
4405
|
+
className: G ? "active" : void 0,
|
|
4406
|
+
onClick: () => _e("stars"),
|
|
4407
|
+
title: "Browse the scope as a 3D star map",
|
|
4408
|
+
children: "stars"
|
|
4409
|
+
})]
|
|
4410
|
+
}),
|
|
4411
|
+
/* @__PURE__ */ u("div", {
|
|
4412
|
+
className: "paths-toolbar-actions",
|
|
4413
|
+
children: [!G && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("button", {
|
|
4414
|
+
type: "button",
|
|
4415
|
+
onClick: Ve,
|
|
4416
|
+
title: `New folder in ${ze}`,
|
|
4417
|
+
children: "+ folder"
|
|
4418
|
+
}), /* @__PURE__ */ l("button", {
|
|
4419
|
+
type: "button",
|
|
4420
|
+
onClick: He,
|
|
4421
|
+
disabled: !Be,
|
|
4422
|
+
title: Be ? `New document in ${ze}` : "Documents are agent/user scope only",
|
|
4423
|
+
children: "+ document"
|
|
4424
|
+
})] }), /* @__PURE__ */ l("button", {
|
|
4425
|
+
type: "button",
|
|
4426
|
+
onClick: () => void Me(),
|
|
4427
|
+
title: "Reload the tree",
|
|
4428
|
+
children: "↻"
|
|
4429
|
+
})]
|
|
4430
|
+
})
|
|
4431
|
+
]
|
|
4432
|
+
}),
|
|
4433
|
+
!G && /* @__PURE__ */ u("p", {
|
|
4434
|
+
className: "paths-context",
|
|
4435
|
+
children: [
|
|
4436
|
+
"new items → ",
|
|
4437
|
+
/* @__PURE__ */ l("code", { children: ze }),
|
|
4438
|
+
B?.scopeId && /* @__PURE__ */ u(c, { children: [
|
|
4439
|
+
" · ",
|
|
4440
|
+
"subject ",
|
|
4441
|
+
/* @__PURE__ */ l("code", { children: B.scopeId })
|
|
4442
|
+
] }),
|
|
4443
|
+
B?.tenant && /* @__PURE__ */ u(c, { children: [
|
|
4444
|
+
" · ",
|
|
4445
|
+
"tenant ",
|
|
4446
|
+
/* @__PURE__ */ l("code", { children: B.tenant })
|
|
4447
|
+
] })
|
|
4448
|
+
]
|
|
4449
|
+
}),
|
|
4450
|
+
(T || Pe) && /* @__PURE__ */ l("div", {
|
|
4451
|
+
className: "paths-err",
|
|
4452
|
+
children: T || Pe
|
|
4453
|
+
}),
|
|
4454
|
+
G && _ ? /* @__PURE__ */ l("div", {
|
|
4455
|
+
className: "paths-navigator",
|
|
4456
|
+
children: _($e)
|
|
4457
|
+
}) : /* @__PURE__ */ l(Jt, {
|
|
4458
|
+
tree: je,
|
|
4459
|
+
root: H.get(""),
|
|
4460
|
+
expanded: j,
|
|
4461
|
+
onToggle: Ne,
|
|
4462
|
+
onLoadMore: Y,
|
|
4463
|
+
onRetry: X,
|
|
4464
|
+
selectedPath: P,
|
|
4465
|
+
onSelect: (e) => z(e.fullPath),
|
|
4466
|
+
summaries: Te
|
|
4467
|
+
})
|
|
4468
|
+
]
|
|
4469
|
+
}), /* @__PURE__ */ l("div", {
|
|
4470
|
+
className: "right",
|
|
4471
|
+
children: $ ? /* @__PURE__ */ u("div", {
|
|
4472
|
+
className: "paths-doc",
|
|
4132
4473
|
children: [
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4474
|
+
/* @__PURE__ */ l(pe, {
|
|
4475
|
+
trail: I,
|
|
4476
|
+
onJump: Xe
|
|
4477
|
+
}),
|
|
4478
|
+
/* @__PURE__ */ u("div", {
|
|
4479
|
+
className: "paths-doc-head",
|
|
4480
|
+
children: [$.path ? /* @__PURE__ */ l("code", {
|
|
4481
|
+
className: "paths-doc-path",
|
|
4482
|
+
children: $.path
|
|
4483
|
+
}) : /* @__PURE__ */ u("span", {
|
|
4484
|
+
className: "paths-doc-path paths-doc-unfiled",
|
|
4485
|
+
title: "Opened by id — no entry for this document was found in the Path tree",
|
|
4138
4486
|
children: [
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4487
|
+
de($),
|
|
4488
|
+
" ",
|
|
4489
|
+
/* @__PURE__ */ l("em", { children: "· opened by id, not in the tree" })
|
|
4490
|
+
]
|
|
4491
|
+
}), tt && /* @__PURE__ */ u("div", {
|
|
4492
|
+
className: "paths-detail-actions",
|
|
4493
|
+
children: [
|
|
4494
|
+
/* @__PURE__ */ l("button", {
|
|
4495
|
+
type: "button",
|
|
4496
|
+
onClick: Ue,
|
|
4497
|
+
children: "rename / move"
|
|
4142
4498
|
}),
|
|
4143
|
-
/* @__PURE__ */ l("
|
|
4144
|
-
|
|
4145
|
-
|
|
4499
|
+
Ke && /* @__PURE__ */ l("button", {
|
|
4500
|
+
type: "button",
|
|
4501
|
+
onClick: qe,
|
|
4502
|
+
title: "Copy or move to another scope",
|
|
4503
|
+
children: "copy / move to…"
|
|
4146
4504
|
}),
|
|
4147
|
-
/* @__PURE__ */ l("
|
|
4148
|
-
|
|
4149
|
-
|
|
4505
|
+
/* @__PURE__ */ l("button", {
|
|
4506
|
+
type: "button",
|
|
4507
|
+
className: "danger",
|
|
4508
|
+
onClick: We,
|
|
4509
|
+
children: "delete"
|
|
4150
4510
|
})
|
|
4151
4511
|
]
|
|
4152
4512
|
})]
|
|
4153
4513
|
}),
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
title: "Browse the scope as a 3D star map",
|
|
4171
|
-
children: "stars"
|
|
4172
|
-
})]
|
|
4173
|
-
}),
|
|
4174
|
-
/* @__PURE__ */ u("div", {
|
|
4175
|
-
className: "paths-toolbar-actions",
|
|
4176
|
-
children: [!W && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("button", {
|
|
4177
|
-
type: "button",
|
|
4178
|
-
onClick: Re,
|
|
4179
|
-
title: `New folder in ${X}`,
|
|
4180
|
-
children: "+ folder"
|
|
4181
|
-
}), /* @__PURE__ */ l("button", {
|
|
4182
|
-
type: "button",
|
|
4183
|
-
onClick: Q,
|
|
4184
|
-
disabled: !Z,
|
|
4185
|
-
title: Z ? `New document in ${X}` : "Documents are agent/user scope only",
|
|
4186
|
-
children: "+ document"
|
|
4187
|
-
})] }), /* @__PURE__ */ l("button", {
|
|
4188
|
-
type: "button",
|
|
4189
|
-
onClick: () => void Ae(),
|
|
4190
|
-
title: "Reload the tree",
|
|
4191
|
-
children: "↻"
|
|
4192
|
-
})]
|
|
4193
|
-
})
|
|
4514
|
+
/* @__PURE__ */ l(Gt, {
|
|
4515
|
+
documentId: $.documentId,
|
|
4516
|
+
scope: x,
|
|
4517
|
+
titleHint: $.title,
|
|
4518
|
+
browse: B,
|
|
4519
|
+
principal: p,
|
|
4520
|
+
renderAssistant: m,
|
|
4521
|
+
initialChunkId: $.chunkId ?? et?.chunkId,
|
|
4522
|
+
onOpenDocument: Ye,
|
|
4523
|
+
onTitle: Ze,
|
|
4524
|
+
onChunkSelect: (e) => Se({
|
|
4525
|
+
documentId: $.documentId,
|
|
4526
|
+
chunkId: e
|
|
4527
|
+
}),
|
|
4528
|
+
focusChunk: et
|
|
4529
|
+
}, I.length)
|
|
4194
4530
|
]
|
|
4195
|
-
}),
|
|
4196
|
-
|
|
4197
|
-
className: "paths-context",
|
|
4531
|
+
}) : Z ? /* @__PURE__ */ u("div", {
|
|
4532
|
+
className: "paths-detail",
|
|
4198
4533
|
children: [
|
|
4199
|
-
"
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
] }),
|
|
4206
|
-
B?.tenant && /* @__PURE__ */ u(c, { children: [
|
|
4207
|
-
" · ",
|
|
4208
|
-
"tenant ",
|
|
4209
|
-
/* @__PURE__ */ l("code", { children: B.tenant })
|
|
4210
|
-
] })
|
|
4211
|
-
]
|
|
4212
|
-
}),
|
|
4213
|
-
(w || Ne) && /* @__PURE__ */ l("div", {
|
|
4214
|
-
className: "paths-err",
|
|
4215
|
-
children: w || Ne
|
|
4216
|
-
}),
|
|
4217
|
-
W && _ ? /* @__PURE__ */ l("div", {
|
|
4218
|
-
className: "paths-navigator",
|
|
4219
|
-
children: _(Ke)
|
|
4220
|
-
}) : /* @__PURE__ */ l(Vt, {
|
|
4221
|
-
tree: ke,
|
|
4222
|
-
root: H.get(""),
|
|
4223
|
-
expanded: j,
|
|
4224
|
-
onToggle: q,
|
|
4225
|
-
onLoadMore: je,
|
|
4226
|
-
onRetry: Me,
|
|
4227
|
-
selectedPath: N,
|
|
4228
|
-
onSelect: (e) => z(e.fullPath),
|
|
4229
|
-
summaries: Se
|
|
4230
|
-
})
|
|
4231
|
-
]
|
|
4232
|
-
}), /* @__PURE__ */ l("div", {
|
|
4233
|
-
className: "right",
|
|
4234
|
-
children: $ ? /* @__PURE__ */ u("div", {
|
|
4235
|
-
className: "paths-doc",
|
|
4236
|
-
children: [
|
|
4237
|
-
/* @__PURE__ */ l(ue, {
|
|
4238
|
-
trail: P,
|
|
4239
|
-
onJump: Ue
|
|
4240
|
-
}),
|
|
4241
|
-
/* @__PURE__ */ u("div", {
|
|
4242
|
-
className: "paths-doc-head",
|
|
4243
|
-
children: [$.path ? /* @__PURE__ */ l("code", {
|
|
4244
|
-
className: "paths-doc-path",
|
|
4245
|
-
children: $.path
|
|
4246
|
-
}) : /* @__PURE__ */ u("span", {
|
|
4247
|
-
className: "paths-doc-path paths-doc-unfiled",
|
|
4248
|
-
title: "Opened by id — no entry for this document was found in the Path tree",
|
|
4534
|
+
/* @__PURE__ */ u("h2", { children: [/* @__PURE__ */ l("span", {
|
|
4535
|
+
className: "paths-detail-kind",
|
|
4536
|
+
children: Z.kind
|
|
4537
|
+
}), /* @__PURE__ */ l("code", { children: Z.fullPath })] }),
|
|
4538
|
+
/* @__PURE__ */ u("dl", {
|
|
4539
|
+
className: "paths-detail-meta",
|
|
4249
4540
|
children: [
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
/* @__PURE__ */ l("
|
|
4541
|
+
/* @__PURE__ */ l("dt", { children: "scope" }),
|
|
4542
|
+
/* @__PURE__ */ l("dd", { children: x }),
|
|
4543
|
+
Re && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("dt", { children: "stored" }), /* @__PURE__ */ l("dd", { children: Re })] })
|
|
4253
4544
|
]
|
|
4254
|
-
}), Je && /* @__PURE__ */ u("div", {
|
|
4255
|
-
className: "paths-detail-actions",
|
|
4256
|
-
children: [/* @__PURE__ */ l("button", {
|
|
4257
|
-
type: "button",
|
|
4258
|
-
onClick: ze,
|
|
4259
|
-
children: "rename / move"
|
|
4260
|
-
}), /* @__PURE__ */ l("button", {
|
|
4261
|
-
type: "button",
|
|
4262
|
-
className: "danger",
|
|
4263
|
-
onClick: Be,
|
|
4264
|
-
children: "delete"
|
|
4265
|
-
})]
|
|
4266
|
-
})]
|
|
4267
|
-
}),
|
|
4268
|
-
/* @__PURE__ */ l(Rt, {
|
|
4269
|
-
documentId: $.documentId,
|
|
4270
|
-
scope: b,
|
|
4271
|
-
titleHint: $.title,
|
|
4272
|
-
browse: B,
|
|
4273
|
-
principal: p,
|
|
4274
|
-
renderAssistant: m,
|
|
4275
|
-
initialChunkId: $.chunkId ?? qe?.chunkId,
|
|
4276
|
-
onOpenDocument: He,
|
|
4277
|
-
onTitle: We,
|
|
4278
|
-
onChunkSelect: (e) => ye({
|
|
4279
|
-
documentId: $.documentId,
|
|
4280
|
-
chunkId: e
|
|
4281
4545
|
}),
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
children:
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4546
|
+
Ge ? /* @__PURE__ */ u("div", {
|
|
4547
|
+
className: "paths-detail-actions",
|
|
4548
|
+
children: [
|
|
4549
|
+
/* @__PURE__ */ l("button", {
|
|
4550
|
+
type: "button",
|
|
4551
|
+
onClick: Ue,
|
|
4552
|
+
children: "rename / move"
|
|
4553
|
+
}),
|
|
4554
|
+
Ke && /* @__PURE__ */ l("button", {
|
|
4555
|
+
type: "button",
|
|
4556
|
+
onClick: qe,
|
|
4557
|
+
title: "Copy or move to another scope",
|
|
4558
|
+
children: "copy / move to…"
|
|
4559
|
+
}),
|
|
4560
|
+
/* @__PURE__ */ l("button", {
|
|
4561
|
+
type: "button",
|
|
4562
|
+
className: "danger",
|
|
4563
|
+
onClick: We,
|
|
4564
|
+
children: "delete"
|
|
4565
|
+
})
|
|
4566
|
+
]
|
|
4567
|
+
}) : /* @__PURE__ */ u("p", {
|
|
4568
|
+
className: "paths-readonly",
|
|
4569
|
+
children: [
|
|
4570
|
+
"Read-only — ",
|
|
4571
|
+
Z.kind,
|
|
4572
|
+
" entries are managed by their own tool."
|
|
4573
|
+
]
|
|
4574
|
+
})
|
|
4575
|
+
]
|
|
4576
|
+
}) : /* @__PURE__ */ l("div", {
|
|
4577
|
+
className: "empty",
|
|
4578
|
+
children: /* @__PURE__ */ l("p", { children: "Select a path on the left, or create a folder / document." })
|
|
4579
|
+
})
|
|
4580
|
+
})]
|
|
4581
|
+
}),
|
|
4582
|
+
D && /* @__PURE__ */ l(rn, {
|
|
4583
|
+
state: D,
|
|
4584
|
+
onClose: () => O(null)
|
|
4585
|
+
}),
|
|
4586
|
+
k && /* @__PURE__ */ l(me, {
|
|
4587
|
+
data: b,
|
|
4588
|
+
scope: x,
|
|
4589
|
+
browse: B,
|
|
4590
|
+
documentId: k.documentId,
|
|
4591
|
+
underPath: k.underPath,
|
|
4592
|
+
fromPath: k.fromPath,
|
|
4593
|
+
onClose: () => A(null),
|
|
4594
|
+
onDone: Je
|
|
4595
|
+
})
|
|
4596
|
+
] });
|
|
4330
4597
|
}
|
|
4331
|
-
function
|
|
4598
|
+
function rn({ state: e, onClose: t }) {
|
|
4332
4599
|
let [n, r] = o(() => Object.fromEntries(e.fields.map((e) => [e.key, e.value ?? ""]))), [i, a] = o(!1), [s, c] = o(null);
|
|
4333
4600
|
return /* @__PURE__ */ l("div", {
|
|
4334
4601
|
className: "modal-overlay",
|
|
@@ -4389,22 +4656,22 @@ function Xt({ state: e, onClose: t }) {
|
|
|
4389
4656
|
}
|
|
4390
4657
|
//#endregion
|
|
4391
4658
|
//#region src/DocumentViewer.tsx
|
|
4392
|
-
function
|
|
4393
|
-
let { documentId: t, scope: n, browse: r, theme: i } = e, a =
|
|
4394
|
-
return /* @__PURE__ */ l(
|
|
4659
|
+
function an(e) {
|
|
4660
|
+
let { documentId: t, scope: n, browse: r, theme: i } = e, a = R(e);
|
|
4661
|
+
return /* @__PURE__ */ l(z, {
|
|
4395
4662
|
theme: i,
|
|
4396
4663
|
dataLayer: a,
|
|
4397
|
-
children: /* @__PURE__ */ l(
|
|
4664
|
+
children: /* @__PURE__ */ l(on, { ...e }, `${n}:${t}:${r?.scopeId ?? ""}:${r?.tenant ?? ""}`)
|
|
4398
4665
|
});
|
|
4399
4666
|
}
|
|
4400
|
-
function
|
|
4667
|
+
function on({ documentId: e, scope: n, titleHint: r, browse: i, principal: a, renderAssistant: s, onOpenDocument: d }) {
|
|
4401
4668
|
let [f, p] = o([]), m = f[f.length - 1], h = t((e, t) => {
|
|
4402
|
-
d ? d(e, t) : p((n) =>
|
|
4403
|
-
}, [d]), g = t((e) => p((t) =>
|
|
4404
|
-
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(
|
|
4669
|
+
d ? d(e, t) : p((n) => ce(n, t, e));
|
|
4670
|
+
}, [d]), g = t((e) => p((t) => le(t, e)), []), _ = t((e, t) => p((n) => ue(n, e, { title: t })), []);
|
|
4671
|
+
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(pe, {
|
|
4405
4672
|
trail: f,
|
|
4406
4673
|
onJump: g
|
|
4407
|
-
}), /* @__PURE__ */ l(
|
|
4674
|
+
}), /* @__PURE__ */ l(Gt, {
|
|
4408
4675
|
documentId: m?.documentId ?? e,
|
|
4409
4676
|
scope: n,
|
|
4410
4677
|
titleHint: m ? m.title : r,
|
|
@@ -4417,6 +4684,6 @@ function Qt({ documentId: e, scope: n, titleHint: r, browse: i, principal: a, re
|
|
|
4417
4684
|
}, f.length)] });
|
|
4418
4685
|
}
|
|
4419
4686
|
//#endregion
|
|
4420
|
-
export {
|
|
4687
|
+
export { Q as DEFAULT_SCHEME, an as DocumentViewer, ye as EDGE_PAGE_CAP, tn as PathExplorer, Ae as QUEUE_CHANGED_RETRIES, J as RULING_CHUNK, oe as RequestError, L as assetFetchFromConnection, He as chunkColor, X as chunkCount, I as createLoomcycleClient, O as dataLayerFromClient, Ve as docColor, Be as effectiveScheme, Ue as hexToTint, Me as isQueueChanged, se as jsonPostFromConnection, be as loadDocumentEdges, Ne as runRuling, We as tintStyle, b as transferInput, Y as undoRulings };
|
|
4421
4688
|
|
|
4422
4689
|
//# sourceMappingURL=index.js.map
|