@loomcycle/explorer 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1170,6 +1170,10 @@ var Z = {
1170
1170
  "doc.document.done": "#3aa06a",
1171
1171
  "doc.research.done": "#8a6ad6",
1172
1172
  "doc.publication.draft": "#c99a3a",
1173
+ "doc.*.draft": "#c99a3a",
1174
+ "doc.*.review": "#6a7bd6",
1175
+ "doc.*.confirmed": "#3a9ad6",
1176
+ "doc.*.done": "#3aa06a",
1173
1177
  "chunk.draft": "#c99a3a",
1174
1178
  "chunk.review": "#6a7bd6",
1175
1179
  "chunk.confirmed": "#3a9ad6",
@@ -1181,45 +1185,49 @@ var Z = {
1181
1185
  function Be(e) {
1182
1186
  return e && Object.keys(e).length > 0 ? e : Z;
1183
1187
  }
1184
- function Ve(e, t, n) {
1188
+ function Ve(e, t) {
1189
+ if (Object.prototype.hasOwnProperty.call(e, t) && e[t]) return e[t];
1190
+ let n = t.toLowerCase();
1191
+ for (let t of Object.keys(e)) if (t.toLowerCase() === n && e[t]) return e[t];
1192
+ }
1193
+ function He(e, t, n) {
1185
1194
  let r = e ?? "", i = t ?? "";
1186
- if (r && i && n[`doc.${r}.${i}`]) return n[`doc.${r}.${i}`];
1187
- if (r && n[`doc.${r}`]) return n[`doc.${r}`];
1195
+ return (r && i ? Ve(n, `doc.${r}.${i}`) : void 0) ?? (r ? Ve(n, `doc.${r}`) : void 0) ?? (i ? Ve(n, `doc.*.${i}`) : void 0) ?? Ve(n, "doc.*");
1188
1196
  }
1189
- function He(e, t) {
1197
+ function Ue(e, t) {
1190
1198
  let n = e ?? "";
1191
- return n ? t[`chunk.${n}`] : void 0;
1199
+ return n ? Ve(t, `chunk.${n}`) : void 0;
1192
1200
  }
1193
- function Ue(e) {
1201
+ function We(e) {
1194
1202
  let t = String(e["chunk.inherit"] ?? "").trim().toLowerCase();
1195
1203
  return t !== "false" && t !== "none" && t !== "off" && t !== "0";
1196
1204
  }
1197
- function We(e, t = Q) {
1205
+ function Ge(e, t = Q) {
1198
1206
  let n = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
1199
1207
  if (!n) return;
1200
1208
  let r = n[1];
1201
1209
  return r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]), `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
1202
1210
  }
1203
- function Ge(e) {
1211
+ function Ke(e) {
1204
1212
  if (!e) return;
1205
- let t = We(e);
1213
+ let t = Ge(e);
1206
1214
  if (t) return {
1207
1215
  background: t,
1208
1216
  borderLeft: `3px solid ${e}`
1209
1217
  };
1210
1218
  }
1211
- function Ke(e) {
1219
+ function qe(e) {
1212
1220
  if (!e) return;
1213
- let t = We(e, Q / 2);
1221
+ let t = Ge(e, Q / 2);
1214
1222
  return t ? { background: t } : void 0;
1215
1223
  }
1216
- function qe(e) {
1224
+ function $(e) {
1217
1225
  let { status: t, isRoot: n, documentColor: r, scheme: i } = e;
1218
- if (i) return n ? Ge(r) ?? Ge(He(t, i)) : Ge(He(t, i)) ?? (Ue(i) ? Ke(r) : void 0);
1226
+ if (i) return n ? Ke(r) ?? Ke(Ue(t, i)) : Ke(Ue(t, i)) ?? (We(i) ? qe(r) : void 0);
1219
1227
  }
1220
1228
  //#endregion
1221
1229
  //#region src/lib/clipboard.ts
1222
- async function $(e) {
1230
+ async function Je(e) {
1223
1231
  try {
1224
1232
  return typeof navigator > "u" || !navigator.clipboard ? !1 : (await navigator.clipboard.writeText(e), !0);
1225
1233
  } catch {
@@ -1228,10 +1236,10 @@ async function $(e) {
1228
1236
  }
1229
1237
  //#endregion
1230
1238
  //#region src/components/IdCopy.tsx
1231
- function Je({ value: e, label: t, compact: n, title: r }) {
1239
+ function Ye({ value: e, label: t, compact: n, title: r }) {
1232
1240
  let [i, a] = o("idle"), s = async (t) => {
1233
1241
  t.stopPropagation(), t.preventDefault();
1234
- let n = await $(e);
1242
+ let n = await Je(e);
1235
1243
  a(n ? "copied" : "error"), window.setTimeout(() => a("idle"), n ? 1200 : 1500);
1236
1244
  }, c = i === "copied" ? "✓" : i === "error" ? "✗" : "⎘", d = r ?? `Copy ${t ?? "id"}: ${e}`, f = /* @__PURE__ */ l("button", {
1237
1245
  type: "button",
@@ -1259,7 +1267,7 @@ function Je({ value: e, label: t, compact: n, title: r }) {
1259
1267
  }
1260
1268
  //#endregion
1261
1269
  //#region src/components/DocumentChunkTree.tsx
1262
- function Ye(e) {
1270
+ function Xe(e) {
1263
1271
  let t = /* @__PURE__ */ new Map();
1264
1272
  e.forEach((e) => t.set(e.id, {
1265
1273
  row: e,
@@ -1275,17 +1283,17 @@ function Ye(e) {
1275
1283
  };
1276
1284
  return r(n), n;
1277
1285
  }
1278
- function Xe(e) {
1286
+ function Ze(e) {
1279
1287
  return e === "image" ? "🖼" : e === "mermaid" ? "📊" : "";
1280
1288
  }
1281
- function Ze(e, t) {
1289
+ function Qe(e, t) {
1282
1290
  for (let n of e) {
1283
1291
  if (n.row.id === t) return n;
1284
- let e = Ze(n.children, t);
1292
+ let e = Qe(n.children, t);
1285
1293
  if (e) return e;
1286
1294
  }
1287
1295
  }
1288
- function Qe({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, documentColor: c, linkedIds: u }) {
1296
+ function $e({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, documentColor: c, linkedIds: u }) {
1289
1297
  let [d, f] = o(() => /* @__PURE__ */ new Map()), p = t((e) => {
1290
1298
  f((t) => {
1291
1299
  let n = new Map(t);
@@ -1294,7 +1302,7 @@ function Qe({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, d
1294
1302
  }, []);
1295
1303
  r(() => {
1296
1304
  if (!n) return;
1297
- let t = $e(e, n);
1305
+ let t = et(e, n);
1298
1306
  t.length !== 0 && f((e) => {
1299
1307
  let n = !1, r = new Map(e);
1300
1308
  for (let e of t) r.get(e) === !1 && (r.set(e, !0), n = !0);
@@ -1307,7 +1315,7 @@ function Qe({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, d
1307
1315
  children: /* @__PURE__ */ l("p", { children: "No chunks." })
1308
1316
  }) : /* @__PURE__ */ l("ul", {
1309
1317
  className: "tree chunk-tree",
1310
- children: e.map((e) => /* @__PURE__ */ l(et, {
1318
+ children: e.map((e) => /* @__PURE__ */ l(tt, {
1311
1319
  node: e,
1312
1320
  expanded: d,
1313
1321
  toggle: p,
@@ -1320,7 +1328,7 @@ function Qe({ tree: e, selectedId: n, onSelect: i, colorEnabled: a, scheme: s, d
1320
1328
  }, e.row.id))
1321
1329
  });
1322
1330
  }
1323
- function $e(e, t) {
1331
+ function et(e, t) {
1324
1332
  let n = [], r = (e, i) => {
1325
1333
  for (let a of e) {
1326
1334
  if (a.row.id === t) return n.push(...i), !0;
@@ -1330,8 +1338,8 @@ function $e(e, t) {
1330
1338
  };
1331
1339
  return r(e, []), n;
1332
1340
  }
1333
- function et({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintScheme: a, documentColor: o, isRoot: s = !1, linkedIds: c }) {
1334
- let d = e.children.length > 0, f = t.get(e.row.id) !== !1, p = r === e.row.id, m = qe({
1341
+ function tt({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintScheme: a, documentColor: o, isRoot: s = !1, linkedIds: c }) {
1342
+ let d = e.children.length > 0, f = t.get(e.row.id) !== !1, p = r === e.row.id, m = $({
1335
1343
  status: e.row.status,
1336
1344
  isRoot: s,
1337
1345
  documentColor: o,
@@ -1359,10 +1367,10 @@ function et({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
1359
1367
  onClick: () => i(e),
1360
1368
  title: e.row.title,
1361
1369
  children: [
1362
- Xe(e.row.type) && /* @__PURE__ */ l("span", {
1370
+ Ze(e.row.type) && /* @__PURE__ */ l("span", {
1363
1371
  className: "chunk-type-icon",
1364
1372
  "aria-hidden": !0,
1365
- children: Xe(e.row.type)
1373
+ children: Ze(e.row.type)
1366
1374
  }),
1367
1375
  /* @__PURE__ */ l("span", {
1368
1376
  className: "chunk-title",
@@ -1384,7 +1392,7 @@ function et({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
1384
1392
  })
1385
1393
  ]
1386
1394
  }),
1387
- /* @__PURE__ */ l(Je, {
1395
+ /* @__PURE__ */ l(Ye, {
1388
1396
  value: e.row.id,
1389
1397
  compact: !0,
1390
1398
  title: `Copy chunk id: ${e.row.id}`
@@ -1392,7 +1400,7 @@ function et({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
1392
1400
  ]
1393
1401
  }), d && f && /* @__PURE__ */ l("ul", {
1394
1402
  className: "children chunk-children",
1395
- children: e.children.map((e) => /* @__PURE__ */ l(et, {
1403
+ children: e.children.map((e) => /* @__PURE__ */ l(tt, {
1396
1404
  node: e,
1397
1405
  expanded: t,
1398
1406
  toggle: n,
@@ -1407,12 +1415,12 @@ function et({ node: e, expanded: t, toggle: n, selectedId: r, onSelect: i, tintS
1407
1415
  }
1408
1416
  //#endregion
1409
1417
  //#region src/components/Mermaid.tsx
1410
- var tt = 0;
1411
- function nt(e) {
1418
+ var nt = 0;
1419
+ function rt(e) {
1412
1420
  let t = e?.closest("g.node");
1413
1421
  return t ? /flowchart-(.+)-\d+$/.exec(t.id)?.[1] : void 0;
1414
1422
  }
1415
- function rt({ code: e, onNodeClick: t }) {
1423
+ function it({ code: e, onNodeClick: t }) {
1416
1424
  let n = a(null), [i, s] = o({});
1417
1425
  return r(() => {
1418
1426
  let t = !1;
@@ -1424,7 +1432,7 @@ function rt({ code: e, onNodeClick: t }) {
1424
1432
  theme: a ? "dark" : "default",
1425
1433
  securityLevel: "strict"
1426
1434
  });
1427
- let { svg: o } = await r.render(`lc-mmd-${tt++}`, e);
1435
+ let { svg: o } = await r.render(`lc-mmd-${nt++}`, e);
1428
1436
  t || s({ svg: o });
1429
1437
  } catch {
1430
1438
  t || s({ err: !0 });
@@ -1440,7 +1448,7 @@ function rt({ code: e, onNodeClick: t }) {
1440
1448
  ref: n,
1441
1449
  className: t ? "md-mermaid md-mermaid-nav" : "md-mermaid",
1442
1450
  onClick: t && ((e) => {
1443
- let n = nt(e.target);
1451
+ let n = rt(e.target);
1444
1452
  n && t(n);
1445
1453
  }),
1446
1454
  dangerouslySetInnerHTML: { __html: i.svg }
@@ -1452,7 +1460,7 @@ function rt({ code: e, onNodeClick: t }) {
1452
1460
  }
1453
1461
  //#endregion
1454
1462
  //#region src/components/ChunkEditorModal.tsx
1455
- function it({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1463
+ function at({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1456
1464
  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);
1457
1465
  r(() => {
1458
1466
  if (!O) return;
@@ -1581,7 +1589,7 @@ function it({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1581
1589
  className: "path-field",
1582
1590
  children: [/* @__PURE__ */ l("span", { children: "Preview" }), /* @__PURE__ */ l("div", {
1583
1591
  className: "chunk-mermaid-preview",
1584
- children: A.trim() ? /* @__PURE__ */ l(rt, { code: A }) : /* @__PURE__ */ l("p", {
1592
+ children: A.trim() ? /* @__PURE__ */ l(it, { code: A }) : /* @__PURE__ */ l("p", {
1585
1593
  className: "doc-empty-body",
1586
1594
  children: "(enter Mermaid source above)"
1587
1595
  })
@@ -1603,7 +1611,7 @@ function it({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1603
1611
  }
1604
1612
  //#endregion
1605
1613
  //#region src/components/SubjectTypeModal.tsx
1606
- function at({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1614
+ function ot({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1607
1615
  let s = M(), [c, d] = o(null), [f, p] = o(e.type ?? ""), [m, h] = o(!1), [g, _] = o(null), [v, b] = o(null);
1608
1616
  r(() => {
1609
1617
  let e = !1;
@@ -1696,18 +1704,18 @@ function at({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
1696
1704
  }
1697
1705
  //#endregion
1698
1706
  //#region src/lib/classify.ts
1699
- function ot(e) {
1707
+ function st(e) {
1700
1708
  return Array.isArray(e) && e.every((e) => typeof e == "string");
1701
1709
  }
1702
- function st(e) {
1710
+ function ct(e) {
1703
1711
  if (!e || typeof e != "object") return;
1704
1712
  let t = e.classification;
1705
1713
  if (!t || typeof t != "object" || Array.isArray(t)) return;
1706
1714
  let n = t, r = {};
1707
- 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), ot(n.proposed_tags) && (r.proposed_tags = n.proposed_tags), ot(n.statements) && (r.statements = n.statements), r;
1715
+ 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), st(n.proposed_tags) && (r.proposed_tags = n.proposed_tags), st(n.statements) && (r.statements = n.statements), r;
1708
1716
  }
1709
- function ct(e) {
1710
- let t = st(e);
1717
+ function lt(e) {
1718
+ let t = ct(e);
1711
1719
  if (!t) return;
1712
1720
  let n = t.proposed_tags ?? [], r = t.statements?.length ?? 0;
1713
1721
  if (t.proposed_type || n.length !== 0 || r !== 0) return {
@@ -1716,7 +1724,7 @@ function ct(e) {
1716
1724
  statementCount: r
1717
1725
  };
1718
1726
  }
1719
- function lt(e) {
1727
+ function ut(e) {
1720
1728
  let t = e.write === "report";
1721
1729
  switch (e.result) {
1722
1730
  case "classified": return t ? "would be classified" : "classified";
@@ -1726,46 +1734,46 @@ function lt(e) {
1726
1734
  default: return String(e.result);
1727
1735
  }
1728
1736
  }
1729
- function ut(e) {
1737
+ function dt(e) {
1730
1738
  if (!e.class) return;
1731
1739
  if (e.result === "kept") return "not applied";
1732
1740
  let t = e.write === "report";
1733
1741
  return e.live ? t ? "would be applied" : "applied" : t ? "would be proposed" : "proposed";
1734
1742
  }
1735
- function dt(e) {
1743
+ function ft(e) {
1736
1744
  return e.write === "report" ? e.result === "classified" || e.result === "proposed" || (e.concepts?.length ?? 0) > 0 || (e.issued_by?.length ?? 0) > 0 : !1;
1737
1745
  }
1738
- function ft(e) {
1746
+ function pt(e) {
1739
1747
  return e == null || !Number.isFinite(e) ? "" : `${Math.round(e * 100)}%`;
1740
1748
  }
1741
- var pt = {
1749
+ var mt = {
1742
1750
  rules: "Rules",
1743
1751
  vote: "Neighbourhood vote",
1744
1752
  model: "Model"
1745
1753
  };
1746
- function mt(e) {
1747
- return pt[e] ?? e;
1748
- }
1749
1754
  function ht(e) {
1755
+ return mt[e] ?? e;
1756
+ }
1757
+ function gt(e) {
1750
1758
  let t = [];
1751
1759
  e.quote && t.push(e.from ? `“${e.quote}” (${e.from})` : `“${e.quote}”`), e.votes != null && t.push(`${e.votes} vote${e.votes === 1 ? "" : "s"}`);
1752
- let n = ft(e.share);
1760
+ let n = pt(e.share);
1753
1761
  return n && t.push(n), t.join(" · ");
1754
1762
  }
1755
- function gt(e) {
1763
+ function _t(e) {
1756
1764
  return {
1757
- label: mt(e.step),
1765
+ label: ht(e.step),
1758
1766
  ...e.chosen ? { chosen: e.chosen } : {},
1759
1767
  ...e.method ? { method: e.method } : {},
1760
1768
  ...e.neighbours ? { neighbours: e.neighbours } : {},
1761
1769
  ...e.reason ? { reason: e.reason } : {},
1762
1770
  candidates: (e.candidates ?? []).map((e) => ({
1763
1771
  class: e.class,
1764
- detail: ht(e)
1772
+ detail: gt(e)
1765
1773
  }))
1766
1774
  };
1767
1775
  }
1768
- function _t(e) {
1776
+ function vt(e) {
1769
1777
  let t = [];
1770
1778
  e.type && t.push(`type ${e.type}`);
1771
1779
  let n = e.accepted_statements?.length ?? 0;
@@ -1778,18 +1786,18 @@ function _t(e) {
1778
1786
  notices: r
1779
1787
  };
1780
1788
  }
1781
- function vt(e) {
1789
+ function yt(e) {
1782
1790
  let t = e instanceof Error ? e.message : String(e);
1783
1791
  return t.includes("nothing_pending") ? "Nothing is pending for this document — it may already have been accepted." : t;
1784
1792
  }
1785
1793
  //#endregion
1786
1794
  //#region src/components/Classification.tsx
1787
- function yt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s, onClose: c, onChanged: d }) {
1788
- 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 ? ct(a) : void 0, [f, a]);
1795
+ function bt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s, onClose: c, onChanged: d }) {
1796
+ 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 ? lt(a) : void 0, [f, a]);
1789
1797
  r(() => {
1790
1798
  if (s === 0 || !f.documentClassify) return;
1791
1799
  let r = !1;
1792
- return g(!0), v(null), m(null), f.documentClassify(e, "report", t, n).then((e) => !r && m(e)).catch((e) => !r && v(vt(e))).finally(() => !r && g(!1)), () => {
1800
+ return g(!0), v(null), m(null), f.documentClassify(e, "report", t, n).then((e) => !r && m(e)).catch((e) => !r && v(yt(e))).finally(() => !r && g(!1)), () => {
1793
1801
  r = !0;
1794
1802
  };
1795
1803
  }, [
@@ -1805,7 +1813,7 @@ function yt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
1805
1813
  try {
1806
1814
  m(await f.documentClassify(e, "propose", t, n)), d();
1807
1815
  } catch (e) {
1808
- v(vt(e));
1816
+ v(yt(e));
1809
1817
  } finally {
1810
1818
  g(!1);
1811
1819
  }
@@ -1816,14 +1824,14 @@ function yt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
1816
1824
  try {
1817
1825
  w(await f.documentAcceptClassification(e, t, n)), d();
1818
1826
  } catch (e) {
1819
- S(vt(e));
1827
+ S(yt(e));
1820
1828
  } finally {
1821
1829
  b(!1);
1822
1830
  }
1823
1831
  }
1824
1832
  }, O = s > 0;
1825
1833
  if (!O && !T && !C && !x) return null;
1826
- let k = C ? _t(C) : void 0;
1834
+ let k = C ? vt(C) : void 0;
1827
1835
  return /* @__PURE__ */ u("div", {
1828
1836
  className: "doc-classify",
1829
1837
  children: [
@@ -1894,7 +1902,7 @@ function yt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
1894
1902
  /* @__PURE__ */ l("h4", { children: "Classify" }),
1895
1903
  p && /* @__PURE__ */ l("span", {
1896
1904
  className: `doc-classify-result ${p.result}`,
1897
- children: lt(p)
1905
+ children: ut(p)
1898
1906
  }),
1899
1907
  p?.write === "report" && /* @__PURE__ */ l("span", {
1900
1908
  className: "doc-classify-hint",
@@ -1918,8 +1926,8 @@ function yt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
1918
1926
  role: "alert",
1919
1927
  children: _
1920
1928
  }),
1921
- p && /* @__PURE__ */ l(bt, { answer: p }),
1922
- p && dt(p) && /* @__PURE__ */ l("div", {
1929
+ p && /* @__PURE__ */ l(xt, { answer: p }),
1930
+ p && ft(p) && /* @__PURE__ */ l("div", {
1923
1931
  className: "doc-classify-actions",
1924
1932
  children: /* @__PURE__ */ l("button", {
1925
1933
  type: "button",
@@ -1934,8 +1942,8 @@ function yt({ documentId: e, scope: t, browse: n, rootFields: a, requestKey: s,
1934
1942
  ]
1935
1943
  });
1936
1944
  }
1937
- function bt({ answer: e }) {
1938
- let t = ut(e), n = Object.entries(e.fields ?? {}), r = e.issued_by ?? [], i = e.concepts ?? [], a = (e.steps ?? []).map(gt), o = e.statements?.length ?? 0;
1945
+ function xt({ answer: e }) {
1946
+ let t = dt(e), n = Object.entries(e.fields ?? {}), r = e.issued_by ?? [], i = e.concepts ?? [], a = (e.steps ?? []).map(_t), o = e.statements?.length ?? 0;
1939
1947
  return /* @__PURE__ */ u(c, { children: [
1940
1948
  /* @__PURE__ */ u("dl", {
1941
1949
  className: "doc-classify-rows",
@@ -1973,7 +1981,7 @@ function bt({ answer: e }) {
1973
1981
  title: e.tag,
1974
1982
  children: [e.concept, /* @__PURE__ */ u("span", {
1975
1983
  className: "doc-classify-hint",
1976
- children: [" ", ft(e.share)]
1984
+ children: [" ", pt(e.share)]
1977
1985
  })]
1978
1986
  }, e.tag)) })] }),
1979
1987
  o > 0 && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("dt", { children: "statements" }), /* @__PURE__ */ u("dd", { children: [
@@ -2041,13 +2049,13 @@ function bt({ answer: e }) {
2041
2049
  }
2042
2050
  //#endregion
2043
2051
  //#region src/components/ColorSchemeEditor.tsx
2044
- function xt(e) {
2052
+ function St(e) {
2045
2053
  let t = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec((e ?? "").trim());
2046
2054
  if (!t) return "#888888";
2047
2055
  let n = t[1];
2048
2056
  return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), "#" + n.toLowerCase();
2049
2057
  }
2050
- function St({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStatuses: s, scope: d, browse: f, onClose: p, onSaved: m }) {
2058
+ function Ct({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStatuses: s, scope: d, browse: f, onClose: p, onSaved: m }) {
2051
2059
  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(() => {
2052
2060
  let e = new Set(Object.keys(Z));
2053
2061
  n && e.add(`doc.${n}.${a || "draft"}`);
@@ -2157,7 +2165,7 @@ function St({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
2157
2165
  }),
2158
2166
  /* @__PURE__ */ u("div", {
2159
2167
  className: "scheme-group",
2160
- children: [/* @__PURE__ */ l("h4", { children: "Document (type · status)" }), P.map((e) => /* @__PURE__ */ l(Ct, {
2168
+ children: [/* @__PURE__ */ l("h4", { children: "Document (type · status)" }), P.map((e) => /* @__PURE__ */ l(wt, {
2161
2169
  label: e.slice(4),
2162
2170
  value: b[e],
2163
2171
  onChange: (t) => k(e, t)
@@ -2165,7 +2173,7 @@ function St({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
2165
2173
  }),
2166
2174
  /* @__PURE__ */ u("div", {
2167
2175
  className: "scheme-group",
2168
- children: [/* @__PURE__ */ l("h4", { children: "Chunks (status)" }), F.map((e) => /* @__PURE__ */ l(Ct, {
2176
+ children: [/* @__PURE__ */ l("h4", { children: "Chunks (status)" }), F.map((e) => /* @__PURE__ */ l(wt, {
2169
2177
  label: e.slice(6),
2170
2178
  value: b[e],
2171
2179
  onChange: (t) => k(e, t)
@@ -2196,8 +2204,8 @@ function St({ documentId: e, rootChunkId: t, docType: n, docStatus: a, chunkStat
2196
2204
  })
2197
2205
  });
2198
2206
  }
2199
- function Ct({ label: e, value: t, onChange: n }) {
2200
- let r = xt(t);
2207
+ function wt({ label: e, value: t, onChange: n }) {
2208
+ let r = St(t);
2201
2209
  return /* @__PURE__ */ u("label", {
2202
2210
  className: "scheme-row",
2203
2211
  children: [
@@ -2219,7 +2227,7 @@ function Ct({ label: e, value: t, onChange: n }) {
2219
2227
  }
2220
2228
  //#endregion
2221
2229
  //#region src/components/ChunkTarget.tsx
2222
- function wt({ id: e, title: t, targetDocumentId: n, documentId: r, onSelectChunk: i, onOpenDocument: a }) {
2230
+ function Tt({ id: e, title: t, targetDocumentId: n, documentId: r, onSelectChunk: i, onOpenDocument: a }) {
2223
2231
  let o = t || e.slice(0, 8);
2224
2232
  return !n || n === r ? /* @__PURE__ */ l("button", {
2225
2233
  type: "button",
@@ -2240,7 +2248,7 @@ function wt({ id: e, title: t, targetDocumentId: n, documentId: r, onSelectChunk
2240
2248
  }
2241
2249
  //#endregion
2242
2250
  //#region src/components/Statement.tsx
2243
- function Tt({ statement: e }) {
2251
+ function Et({ statement: e }) {
2244
2252
  let t = Ce(e), n = we(e), r = De(e), i = Ee(e), { rows: a, more: o } = Oe(e);
2245
2253
  return /* @__PURE__ */ u(c, { children: [
2246
2254
  t && /* @__PURE__ */ l("span", {
@@ -2285,7 +2293,7 @@ function Tt({ statement: e }) {
2285
2293
  })
2286
2294
  ] });
2287
2295
  }
2288
- function Et({ id: e, onRule: t }) {
2296
+ function Dt({ id: e, onRule: t }) {
2289
2297
  let [n, r] = o(!1), [i, a] = o(""), [s, d] = o(!1), [f, p] = o(null), m = async (n) => {
2290
2298
  d(!0), p(null);
2291
2299
  try {
@@ -2343,8 +2351,8 @@ function Et({ id: e, onRule: t }) {
2343
2351
  }
2344
2352
  //#endregion
2345
2353
  //#region src/components/ProposalReview.tsx
2346
- var Dt = 3;
2347
- function Ot({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, onChanged: s, onSelectChunk: c, onOpenDocument: d }) {
2354
+ var Ot = 3;
2355
+ function kt({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, onChanged: s, onSelectChunk: c, onOpenDocument: d }) {
2348
2356
  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) => {
2349
2357
  b(null), S(null), e === "reject" ? g({
2350
2358
  kind: "reason",
@@ -2504,7 +2512,7 @@ function Ot({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
2504
2512
  className: "doc-conn-empty",
2505
2513
  children: "counting…"
2506
2514
  }),
2507
- h.kind === "confirm" && /* @__PURE__ */ l(kt, {
2515
+ h.kind === "confirm" && /* @__PURE__ */ l(At, {
2508
2516
  step: h,
2509
2517
  onAnswer: k
2510
2518
  }),
@@ -2541,7 +2549,7 @@ function Ot({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
2541
2549
  disabled: E,
2542
2550
  onChange: () => j(t.id)
2543
2551
  }),
2544
- /* @__PURE__ */ l(wt, {
2552
+ /* @__PURE__ */ l(Tt, {
2545
2553
  id: t.from_id,
2546
2554
  title: t.from_title,
2547
2555
  targetDocumentId: t.from_document_id,
@@ -2553,7 +2561,7 @@ function Ot({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
2553
2561
  className: "doc-ref-kind",
2554
2562
  children: t.kind
2555
2563
  }),
2556
- /* @__PURE__ */ l(wt, {
2564
+ /* @__PURE__ */ l(Tt, {
2557
2565
  id: t.to_id,
2558
2566
  title: t.to_title,
2559
2567
  targetDocumentId: t.to_document_id,
@@ -2561,14 +2569,14 @@ function Ot({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, o
2561
2569
  onSelectChunk: c,
2562
2570
  onOpenDocument: d
2563
2571
  }),
2564
- /* @__PURE__ */ l(Tt, { statement: t })
2572
+ /* @__PURE__ */ l(Et, { statement: t })
2565
2573
  ]
2566
2574
  }, t.id))
2567
2575
  })
2568
2576
  ]
2569
2577
  });
2570
2578
  }
2571
- function kt({ step: e, onAnswer: t }) {
2579
+ function At({ step: e, onAnswer: t }) {
2572
2580
  let { dry: n } = e, r = e.action === "accept" ? "Accept" : "Reject", i = Pe(n.matched);
2573
2581
  return /* @__PURE__ */ u("div", {
2574
2582
  className: "doc-bulk-step doc-bulk-confirm",
@@ -2590,7 +2598,7 @@ function kt({ step: e, onAnswer: t }) {
2590
2598
  ] }),
2591
2599
  (n.sample ?? []).length > 0 && /* @__PURE__ */ l("ul", {
2592
2600
  className: "doc-bulk-sample",
2593
- children: (n.sample ?? []).slice(0, Dt).map((e) => /* @__PURE__ */ u("li", { children: [
2601
+ children: (n.sample ?? []).slice(0, Ot).map((e) => /* @__PURE__ */ u("li", { children: [
2594
2602
  e.from_title || e.from_id,
2595
2603
  " ",
2596
2604
  /* @__PURE__ */ l("span", {
@@ -2621,26 +2629,26 @@ function kt({ step: e, onAnswer: t }) {
2621
2629
  }
2622
2630
  //#endregion
2623
2631
  //#region src/components/Connections.tsx
2624
- var At = 8, jt = 20;
2625
- function Mt(e) {
2632
+ var jt = 8, Mt = 20;
2633
+ function Nt(e) {
2626
2634
  return /embedder|embedding|vector|semantic|not configured/i.test(e);
2627
2635
  }
2628
- function Nt({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk: a, onOpenDocument: s, refreshKey: d, review: f }) {
2636
+ function Pt({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk: a, onOpenDocument: s, refreshKey: d, review: f }) {
2629
2637
  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);
2630
2638
  r(() => {
2631
2639
  if (!m || !t) return;
2632
2640
  let e = t, r = !1;
2633
2641
  return _(!0), Promise.allSettled([
2634
2642
  p.documentBacklinks(e, n, i),
2635
- p.documentRelated(e, n, i, At),
2636
- p.documentUnlinkedMentions(e, n, i, jt)
2643
+ p.documentRelated(e, n, i, jt),
2644
+ p.documentUnlinkedMentions(e, n, i, Mt)
2637
2645
  ]).then(([t, n, i]) => {
2638
2646
  if (!r) {
2639
2647
  if (x(t.status === "fulfilled" ? t.value.backlinks ?? [] : []), n.status === "fulfilled") C(n.value.related ?? []), T(null);
2640
2648
  else {
2641
2649
  C([]);
2642
2650
  let e = n.reason instanceof Error ? n.reason.message : String(n.reason);
2643
- T(Mt(e) ? "semantic search not configured" : e);
2651
+ T(Nt(e) ? "semantic search not configured" : e);
2644
2652
  }
2645
2653
  i.status === "fulfilled" ? (D(i.value.unlinked_mentions ?? []), k(!!i.value.truncated)) : (D([]), k(!1)), y(e), _(!1);
2646
2654
  }
@@ -2655,7 +2663,7 @@ function Nt({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
2655
2663
  i,
2656
2664
  d
2657
2665
  ]);
2658
- let A = (t, n, r) => /* @__PURE__ */ l(wt, {
2666
+ let A = (t, n, r) => /* @__PURE__ */ l(Tt, {
2659
2667
  id: t,
2660
2668
  title: n,
2661
2669
  targetDocumentId: r,
@@ -2672,7 +2680,7 @@ function Nt({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
2672
2680
  children: [m ? "▼" : "▶", " Connections"]
2673
2681
  }), m && /* @__PURE__ */ u("div", {
2674
2682
  className: "doc-conn-body",
2675
- children: [f && /* @__PURE__ */ l(Ot, {
2683
+ children: [f && /* @__PURE__ */ l(kt, {
2676
2684
  documentId: e,
2677
2685
  proposals: f.proposals,
2678
2686
  incomplete: f.incomplete,
@@ -2702,7 +2710,7 @@ function Nt({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
2702
2710
  title: "Auto-linked from a [[wikilink]]",
2703
2711
  children: "auto"
2704
2712
  }),
2705
- /* @__PURE__ */ l(Tt, { statement: e })
2713
+ /* @__PURE__ */ l(Et, { statement: e })
2706
2714
  ]
2707
2715
  }, `${e.from_id}-${e.kind}-${t}`))
2708
2716
  })]
@@ -2756,11 +2764,11 @@ function Nt({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk:
2756
2764
  }
2757
2765
  //#endregion
2758
2766
  //#region src/components/CrossReferences.tsx
2759
- var Pt = 24;
2760
- function Ft({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDocument: i, onRuleStatement: a, incomplete: s }) {
2767
+ var Ft = 24;
2768
+ function It({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDocument: i, onRuleStatement: a, incomplete: s }) {
2761
2769
  let [d, f] = o(!1), [p, m] = o(!1);
2762
2770
  if (e.length === 0) return null;
2763
- let h = n ? e.filter((e) => e.from_id === n || e.to_id === n) : [], g = p ? e : e.slice(0, Pt), _ = Lt(g);
2771
+ let h = n ? e.filter((e) => e.from_id === n || e.to_id === n) : [], g = p ? e : e.slice(0, Ft), _ = Rt(g);
2764
2772
  return /* @__PURE__ */ u("div", {
2765
2773
  className: "doc-refs",
2766
2774
  children: [
@@ -2779,7 +2787,7 @@ function Ft({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDo
2779
2787
  children: "This chunk has no links."
2780
2788
  }) : /* @__PURE__ */ l("ul", {
2781
2789
  className: "doc-refs-list",
2782
- children: h.map((e, o) => /* @__PURE__ */ l(It, {
2790
+ children: h.map((e, o) => /* @__PURE__ */ l(Lt, {
2783
2791
  edge: e,
2784
2792
  selectedId: n,
2785
2793
  documentId: t,
@@ -2801,23 +2809,23 @@ function Ft({ edges: e, documentId: t, selectedId: n, onSelectChunk: r, onOpenDo
2801
2809
  e.length,
2802
2810
  ")"
2803
2811
  ]
2804
- }), d && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(rt, {
2812
+ }), d && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(it, {
2805
2813
  code: _,
2806
2814
  onNodeClick: (e) => {
2807
- let n = Rt(g, e);
2815
+ let n = zt(g, e);
2808
2816
  n && (!n.documentId || n.documentId === t ? r(n.id) : i?.(n.documentId, n.id, n.title));
2809
2817
  }
2810
- }), e.length > Pt && /* @__PURE__ */ l("button", {
2818
+ }), e.length > Ft && /* @__PURE__ */ l("button", {
2811
2819
  type: "button",
2812
2820
  className: "doc-graph-more",
2813
2821
  onClick: () => m((e) => !e),
2814
- children: p ? `show top ${Pt}` : `show all ${e.length}`
2822
+ children: p ? `show top ${Ft}` : `show all ${e.length}`
2815
2823
  })] })]
2816
2824
  })
2817
2825
  ]
2818
2826
  });
2819
2827
  }
2820
- function It({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDocument: i, onRuleStatement: a }) {
2828
+ function Lt({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDocument: i, onRuleStatement: a }) {
2821
2829
  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;
2822
2830
  return /* @__PURE__ */ u("li", {
2823
2831
  className: "doc-ref",
@@ -2831,7 +2839,7 @@ function It({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDoc
2831
2839
  "aria-hidden": !0,
2832
2840
  children: o ? "→" : "←"
2833
2841
  }),
2834
- /* @__PURE__ */ l(wt, {
2842
+ /* @__PURE__ */ l(Tt, {
2835
2843
  id: s,
2836
2844
  title: c,
2837
2845
  targetDocumentId: d,
@@ -2839,51 +2847,51 @@ function It({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDoc
2839
2847
  onSelectChunk: r,
2840
2848
  onOpenDocument: i
2841
2849
  }),
2842
- /* @__PURE__ */ l(Tt, { statement: e }),
2843
- a && q(e) && /* @__PURE__ */ l(Et, {
2850
+ /* @__PURE__ */ l(Et, { statement: e }),
2851
+ a && q(e) && /* @__PURE__ */ l(Dt, {
2844
2852
  id: e.id,
2845
2853
  onRule: a
2846
2854
  })
2847
2855
  ]
2848
2856
  });
2849
2857
  }
2850
- function Lt(e) {
2858
+ function Rt(e) {
2851
2859
  let t = ["graph LR"];
2852
2860
  for (let n of e) {
2853
- let e = `${zt(n.from_id)}["${Bt(n.from_title, n.from_id)}"]`, r = `${zt(n.to_id)}["${Bt(n.to_title, n.to_id)}"]`, i = (n.kind || "link").replace(/[|"]/g, " "), a = n.status === "proposed" ? "-.->" : "-->";
2861
+ let e = `${Bt(n.from_id)}["${Vt(n.from_title, n.from_id)}"]`, r = `${Bt(n.to_id)}["${Vt(n.to_title, n.to_id)}"]`, i = (n.kind || "link").replace(/[|"]/g, " "), a = n.status === "proposed" ? "-.->" : "-->";
2854
2862
  t.push(` ${e} ${a}|${i}| ${r}`);
2855
2863
  }
2856
2864
  return t.join("\n");
2857
2865
  }
2858
- function Rt(e, t) {
2866
+ function zt(e, t) {
2859
2867
  for (let n of e) {
2860
- if (zt(n.from_id) === t) return {
2868
+ if (Bt(n.from_id) === t) return {
2861
2869
  id: n.from_id,
2862
2870
  documentId: n.from_document_id,
2863
2871
  title: n.from_title
2864
2872
  };
2865
- if (zt(n.to_id) === t) return {
2873
+ if (Bt(n.to_id) === t) return {
2866
2874
  id: n.to_id,
2867
2875
  documentId: n.to_document_id,
2868
2876
  title: n.to_title
2869
2877
  };
2870
2878
  }
2871
2879
  }
2872
- function zt(e) {
2880
+ function Bt(e) {
2873
2881
  return "n" + e.replace(/[^a-zA-Z0-9]/g, "");
2874
2882
  }
2875
- function Bt(e, t) {
2883
+ function Vt(e, t) {
2876
2884
  let n = (e ?? "").replace(/["[\]{}|<>]/g, " ").replace(/\s+/g, " ").trim() || t.slice(0, 6);
2877
2885
  return n.length > 30 ? n.slice(0, 29) + "…" : n;
2878
2886
  }
2879
2887
  //#endregion
2880
2888
  //#region src/components/StackSplitter.tsx
2881
- var Vt = 6;
2882
- function Ht(e, t, n, r) {
2883
- let i = Math.max(r, t - n - Vt);
2889
+ var Ht = 6;
2890
+ function Ut(e, t, n, r) {
2891
+ let i = Math.max(r, t - n - Ht);
2884
2892
  return Math.round(Math.max(r, Math.min(e, i)));
2885
2893
  }
2886
- function Ut({ children: e, defaultBottomHeight: n = 240, minTopHeight: i = 96, minBottomHeight: s = 48, storageKey: c, className: d }) {
2894
+ function Wt({ children: e, defaultBottomHeight: n = 240, minTopHeight: i = 96, minBottomHeight: s = 48, storageKey: c, className: d }) {
2887
2895
  let [f, p] = o(() => {
2888
2896
  if (c) try {
2889
2897
  let e = parseInt(localStorage.getItem(c) ?? "", 10);
@@ -2905,7 +2913,7 @@ function Ut({ children: e, defaultBottomHeight: n = 240, minTopHeight: i = 96, m
2905
2913
  }, []), v = t((e) => {
2906
2914
  if (!h || !m.current) return;
2907
2915
  let t = m.current.getBoundingClientRect();
2908
- p(Ht(t.bottom - e.clientY, t.height, i, s));
2916
+ p(Ut(t.bottom - e.clientY, t.height, i, s));
2909
2917
  }, [
2910
2918
  h,
2911
2919
  i,
@@ -2919,7 +2927,7 @@ function Ut({ children: e, defaultBottomHeight: n = 240, minTopHeight: i = 96, m
2919
2927
  return /* @__PURE__ */ u("div", {
2920
2928
  ref: m,
2921
2929
  className: `stack-splitter ${d ?? ""} ${h ? "dragging" : ""}`,
2922
- style: { gridTemplateRows: `minmax(${i}px, 1fr) ${Vt}px min(${f}px, calc(100% - ${i + Vt}px))` },
2930
+ style: { gridTemplateRows: `minmax(${i}px, 1fr) ${Ht}px min(${f}px, calc(100% - ${i + Ht}px))` },
2923
2931
  children: [
2924
2932
  /* @__PURE__ */ l("div", {
2925
2933
  className: "stack-splitter-pane stack-splitter-top",
@@ -2945,7 +2953,7 @@ function Ut({ children: e, defaultBottomHeight: n = 240, minTopHeight: i = 96, m
2945
2953
  }
2946
2954
  //#endregion
2947
2955
  //#region src/components/DocUnavailable.tsx
2948
- function Wt({ documentId: e, scope: t, detail: n }) {
2956
+ function Gt({ documentId: e, scope: t, detail: n }) {
2949
2957
  return /* @__PURE__ */ u("div", {
2950
2958
  className: "doc-unavailable",
2951
2959
  role: "alert",
@@ -2968,11 +2976,11 @@ function Wt({ documentId: e, scope: t, detail: n }) {
2968
2976
  }
2969
2977
  //#endregion
2970
2978
  //#region src/components/HistoryModal.tsx
2971
- function Gt(e) {
2979
+ function Kt(e) {
2972
2980
  let t = typeof e == "number" ? e / 1e6 : Date.parse(String(e));
2973
2981
  return !Number.isFinite(t) || t <= 0 ? String(e ?? "") : new Date(t).toLocaleString();
2974
2982
  }
2975
- function Kt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
2983
+ function qt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
2976
2984
  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("");
2977
2985
  r(() => {
2978
2986
  let t = !1;
@@ -3057,7 +3065,7 @@ function Kt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
3057
3065
  }),
3058
3066
  /* @__PURE__ */ l("span", {
3059
3067
  className: "doc-hist-rev-time",
3060
- children: Gt(e.created_at)
3068
+ children: Kt(e.created_at)
3061
3069
  }),
3062
3070
  /* @__PURE__ */ l("span", {
3063
3071
  className: "doc-hist-rev-actor",
@@ -3105,7 +3113,7 @@ function Kt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
3105
3113
  children: C ? /* @__PURE__ */ l("p", {
3106
3114
  className: "doc-empty-body",
3107
3115
  children: "loading…"
3108
- }) : _ === "diff" ? /* @__PURE__ */ l(qt, { text: k }) : _ === "version" ? /* @__PURE__ */ l("pre", {
3116
+ }) : _ === "diff" ? /* @__PURE__ */ l(Jt, { text: k }) : _ === "version" ? /* @__PURE__ */ l("pre", {
3109
3117
  className: "md-pre doc-hist-version",
3110
3118
  children: /* @__PURE__ */ l("code", { children: x || "(empty)" })
3111
3119
  }) : /* @__PURE__ */ l("p", {
@@ -3118,7 +3126,7 @@ function Kt({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
3118
3126
  })
3119
3127
  });
3120
3128
  }
3121
- function qt({ text: e }) {
3129
+ function Jt({ text: e }) {
3122
3130
  if (!e.trim()) return /* @__PURE__ */ l("p", {
3123
3131
  className: "doc-empty-body",
3124
3132
  children: "(no differences)"
@@ -3137,17 +3145,17 @@ function qt({ text: e }) {
3137
3145
  }
3138
3146
  //#endregion
3139
3147
  //#region src/components/Markdown.tsx
3140
- function Jt({ source: e }) {
3148
+ function Yt({ source: e }) {
3141
3149
  return /* @__PURE__ */ l("div", {
3142
3150
  className: "md",
3143
3151
  children: /* @__PURE__ */ l(f, {
3144
3152
  remarkPlugins: [p],
3145
- components: Yt,
3153
+ components: Xt,
3146
3154
  children: e
3147
3155
  })
3148
3156
  });
3149
3157
  }
3150
- var Yt = {
3158
+ var Xt = {
3151
3159
  a({ href: e, children: t }) {
3152
3160
  let n = e ?? "", r = /^https?:\/\//i.test(n);
3153
3161
  return /* @__PURE__ */ l("a", {
@@ -3162,7 +3170,7 @@ var Yt = {
3162
3170
  },
3163
3171
  code({ className: e, children: t }) {
3164
3172
  let n = /language-(\w+)/.exec(e ?? "")?.[1], r = String(t ?? "");
3165
- return n === "mermaid" ? /* @__PURE__ */ l(rt, { code: r.replace(/\n$/, "") }) : n || r.includes("\n") ? /* @__PURE__ */ l("pre", {
3173
+ return n === "mermaid" ? /* @__PURE__ */ l(it, { code: r.replace(/\n$/, "") }) : n || r.includes("\n") ? /* @__PURE__ */ l("pre", {
3166
3174
  className: "md-pre",
3167
3175
  children: /* @__PURE__ */ l("code", {
3168
3176
  className: e,
@@ -3173,11 +3181,11 @@ var Yt = {
3173
3181
  };
3174
3182
  //#endregion
3175
3183
  //#region src/components/DocumentViewerBody.tsx
3176
- function Xt(e) {
3184
+ function Zt(e) {
3177
3185
  let t = e.fields ?? {};
3178
3186
  return typeof t.alt == "string" && t.alt.trim() !== "" ? t.alt : e.title || "image";
3179
3187
  }
3180
- function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, renderAssistant: p, initialChunkId: m, onOpenDocument: h, onTitle: g, onChunkSelect: v, focusChunk: y }) {
3188
+ function Qt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, renderAssistant: p, initialChunkId: m, onOpenDocument: h, onTitle: g, onChunkSelect: v, focusChunk: y }) {
3181
3189
  let b = M(), x = i(() => d && (d.scopeId || d.tenant) ? {
3182
3190
  scopeId: d.scopeId,
3183
3191
  tenant: d.tenant
@@ -3185,7 +3193,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3185
3193
  Ae.current = m;
3186
3194
  let je = a(g);
3187
3195
  je.current = g;
3188
- let Me = i(() => Ye(S), [S]), Ne = i(() => S.find((e) => !e.parent_id)?.title || s || "document", [S, s]), Y = i(() => !!E && !E.parent_id, [E]), Pe = i(() => xe(S, E?.id), [S, E]), X = i(() => W?.root_chunk_id ?? S.find((e) => !e.parent_id)?.id, [W, S]), Re = a(v);
3196
+ let Me = i(() => Xe(S), [S]), Ne = i(() => S.find((e) => !e.parent_id)?.title || s || "document", [S, s]), Y = i(() => !!E && !E.parent_id, [E]), Pe = i(() => xe(S, E?.id), [S, E]), X = i(() => W?.root_chunk_id ?? S.find((e) => !e.parent_id)?.id, [W, S]), Re = a(v);
3189
3197
  Re.current = v, r(() => {
3190
3198
  w && Re.current?.(w === X ? void 0 : w);
3191
3199
  }, [w, X]);
@@ -3193,12 +3201,12 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3193
3201
  let e = /* @__PURE__ */ new Set();
3194
3202
  for (let t of K) e.add(t.from_id), e.add(t.to_id);
3195
3203
  return e;
3196
- }, [K]), He = i(() => Z ? Ve(W?.type, W?.status, Be(W?.color_scheme)) : void 0, [
3204
+ }, [K]), Ve = i(() => Z ? He(W?.type, W?.status, Be(W?.color_scheme)) : void 0, [
3197
3205
  Z,
3198
3206
  W?.type,
3199
3207
  W?.status,
3200
3208
  W?.color_scheme
3201
- ]), Ue = i(() => Ge(He), [He]);
3209
+ ]), Ue = i(() => Ke(Ve), [Ve]);
3202
3210
  r(() => {
3203
3211
  let t = !1;
3204
3212
  return le(!0), z(null), V(null), b.documentQueryChunks(e, n, x).then((r) => {
@@ -3217,10 +3225,10 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3217
3225
  fe,
3218
3226
  x
3219
3227
  ]);
3220
- let We = !ce && (de !== null || ue === `${n}:${e}` && S.length === 0), Ke = i(() => S.find((t) => !t.parent_id && t.document_id === e)?.title, [S, e]);
3228
+ let We = !ce && (de !== null || ue === `${n}:${e}` && S.length === 0), Ge = i(() => S.find((t) => !t.parent_id && t.document_id === e)?.title, [S, e]);
3221
3229
  r(() => {
3222
- Ke && je.current?.(e, Ke);
3223
- }, [e, Ke]), r(() => {
3230
+ Ge && je.current?.(e, Ge);
3231
+ }, [e, Ge]), r(() => {
3224
3232
  let t = !1;
3225
3233
  return b.documentGet(e, n, x).then((e) => !t && ge(e)).catch(() => !t && ge(null)), () => {
3226
3234
  t = !0;
@@ -3272,19 +3280,19 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3272
3280
  b,
3273
3281
  n,
3274
3282
  x
3275
- ]), $ = i(() => Fe(b, n), [b, n]), Xe = i(() => Ie(K, e), [K, e]), $e = t(() => Te((e) => e + 1), []), et = i(() => Le($, Xe, Ce, $e), [
3283
+ ]), $ = i(() => Fe(b, n), [b, n]), Je = i(() => Ie(K, e), [K, e]), Ze = t(() => Te((e) => e + 1), []), et = i(() => Le($, Je, Ce, Ze), [
3276
3284
  $,
3277
- Xe,
3285
+ Je,
3278
3286
  Ce,
3279
- $e
3287
+ Ze
3280
3288
  ]), tt = y?.seq, nt = a(y);
3281
3289
  nt.current = y;
3282
- let ot = a(X);
3283
- ot.current = X;
3290
+ let rt = a(X);
3291
+ rt.current = X;
3284
3292
  let st = a(S);
3285
3293
  st.current = S, r(() => {
3286
3294
  if (tt === void 0) return;
3287
- let e = nt.current?.chunkId, t = st.current.length > 0 ? U(st.current, e) : e ?? ot.current;
3295
+ let e = nt.current?.chunkId, t = st.current.length > 0 ? U(st.current, e) : e ?? rt.current;
3288
3296
  t && T(t);
3289
3297
  }, [tt]), r(() => {
3290
3298
  T(void 0), D(null), j(null), k("chunks"), ge(null), Se([]), we(!1), De(0), ke(void 0);
@@ -3325,7 +3333,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3325
3333
  j(null);
3326
3334
  return;
3327
3335
  }
3328
- let e = Ze(Me, w);
3336
+ let e = Qe(Me, w);
3329
3337
  if (!e) return;
3330
3338
  let t = !1, r = [], i = (e, t) => {
3331
3339
  r.push({
@@ -3515,7 +3523,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3515
3523
  n,
3516
3524
  x,
3517
3525
  J
3518
- ]), bt = t(async () => {
3526
+ ]), yt = t(async () => {
3519
3527
  if (!b.documentDeleteChunk || !E) return;
3520
3528
  z(null);
3521
3529
  let e = E.parent_id;
@@ -3569,7 +3577,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3569
3577
  title: Ne,
3570
3578
  children: Ne
3571
3579
  }),
3572
- /* @__PURE__ */ l(Je, {
3580
+ /* @__PURE__ */ l(Ye, {
3573
3581
  value: e,
3574
3582
  label: "doc"
3575
3583
  }),
@@ -3651,7 +3659,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3651
3659
  className: "paths-err",
3652
3660
  children: R
3653
3661
  }),
3654
- !We && /* @__PURE__ */ l(yt, {
3662
+ !We && /* @__PURE__ */ l(bt, {
3655
3663
  documentId: e,
3656
3664
  scope: n,
3657
3665
  browse: x,
@@ -3660,7 +3668,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3660
3668
  onClose: () => De(0),
3661
3669
  onChanged: J
3662
3670
  }, `${n}:${e}`),
3663
- We ? /* @__PURE__ */ l(Wt, {
3671
+ We ? /* @__PURE__ */ l(Gt, {
3664
3672
  documentId: e,
3665
3673
  scope: n,
3666
3674
  detail: de ?? void 0
@@ -3675,13 +3683,13 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3675
3683
  children: ce && S.length === 0 ? /* @__PURE__ */ l("div", {
3676
3684
  className: "empty",
3677
3685
  children: /* @__PURE__ */ l("p", { children: "Loading…" })
3678
- }) : /* @__PURE__ */ l(Qe, {
3686
+ }) : /* @__PURE__ */ l($e, {
3679
3687
  tree: Me,
3680
3688
  selectedId: w,
3681
3689
  onSelect: ct,
3682
3690
  colorEnabled: Z,
3683
3691
  scheme: W?.color_scheme,
3684
- documentColor: He,
3692
+ documentColor: Ve,
3685
3693
  linkedIds: Q
3686
3694
  })
3687
3695
  }), /* @__PURE__ */ l("div", {
@@ -3740,7 +3748,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3740
3748
  className: "chunk-tag",
3741
3749
  children: e
3742
3750
  }, e)),
3743
- /* @__PURE__ */ l(Je, {
3751
+ /* @__PURE__ */ l(Ye, {
3744
3752
  value: E.id,
3745
3753
  label: "chunk"
3746
3754
  })
@@ -3806,12 +3814,12 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3806
3814
  ]
3807
3815
  })
3808
3816
  ]
3809
- }), /* @__PURE__ */ u(Ut, {
3817
+ }), /* @__PURE__ */ u(Wt, {
3810
3818
  storageKey: "loomcycle.explorer.doc-links-height",
3811
3819
  className: "doc-content-split",
3812
3820
  children: [/* @__PURE__ */ l("div", {
3813
3821
  className: "doc-content-body",
3814
- children: E.type === "mermaid" ? E.body ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(rt, { code: E.body }), O === "markdown" && /* @__PURE__ */ l("pre", {
3822
+ children: E.type === "mermaid" ? E.body ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(it, { code: E.body }), O === "markdown" && /* @__PURE__ */ l("pre", {
3815
3823
  className: "md-pre doc-mermaid-source",
3816
3824
  children: /* @__PURE__ */ l("code", { children: E.body })
3817
3825
  })] }) : /* @__PURE__ */ l("p", {
@@ -3824,7 +3832,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3824
3832
  className: "doc-image",
3825
3833
  children: [/* @__PURE__ */ l("img", {
3826
3834
  src: N,
3827
- alt: Xt(E)
3835
+ alt: Zt(E)
3828
3836
  }), E.body && /* @__PURE__ */ l("figcaption", { children: E.body })]
3829
3837
  }) : /* @__PURE__ */ l("p", {
3830
3838
  className: "doc-empty-body",
@@ -3832,13 +3840,13 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3832
3840
  }) : O === "markdown" ? A === null ? /* @__PURE__ */ l("p", {
3833
3841
  className: "doc-empty-body",
3834
3842
  children: "Assembling Markdown…"
3835
- }) : /* @__PURE__ */ l(Jt, { source: A }) : E.body ? /* @__PURE__ */ l(Jt, { source: E.body }) : /* @__PURE__ */ l("p", {
3843
+ }) : /* @__PURE__ */ l(Yt, { source: A }) : E.body ? /* @__PURE__ */ l(Yt, { source: E.body }) : /* @__PURE__ */ l("p", {
3836
3844
  className: "doc-empty-body",
3837
3845
  children: "(empty chunk)"
3838
3846
  })
3839
3847
  }), /* @__PURE__ */ u("div", {
3840
3848
  className: "doc-links-pane",
3841
- children: [/* @__PURE__ */ l(Ft, {
3849
+ children: [/* @__PURE__ */ l(It, {
3842
3850
  edges: K,
3843
3851
  incomplete: Ce,
3844
3852
  documentId: e,
@@ -3846,7 +3854,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3846
3854
  onSelectChunk: T,
3847
3855
  onOpenDocument: h ? lt : void 0,
3848
3856
  onRuleStatement: qe
3849
- }), /* @__PURE__ */ l(Nt, {
3857
+ }), /* @__PURE__ */ l(Pt, {
3850
3858
  documentId: e,
3851
3859
  selectedId: w,
3852
3860
  scope: n,
@@ -3872,28 +3880,28 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3872
3880
  onChanged: J
3873
3881
  })
3874
3882
  }),
3875
- ne && /* @__PURE__ */ l(it, {
3883
+ ne && /* @__PURE__ */ l(at, {
3876
3884
  chunk: ne,
3877
3885
  scope: n,
3878
3886
  browse: x,
3879
3887
  onClose: () => re(null),
3880
3888
  onSaved: J
3881
3889
  }),
3882
- ie && /* @__PURE__ */ l(at, {
3890
+ ie && /* @__PURE__ */ l(ot, {
3883
3891
  chunk: ie,
3884
3892
  scope: n,
3885
3893
  browse: x,
3886
3894
  onClose: () => ae(null),
3887
3895
  onSaved: J
3888
3896
  }),
3889
- I && E && /* @__PURE__ */ l(Kt, {
3897
+ I && E && /* @__PURE__ */ l(qt, {
3890
3898
  chunkId: E.id,
3891
3899
  chunkTitle: E.title,
3892
3900
  scope: n,
3893
3901
  browse: x,
3894
3902
  onClose: () => L(!1)
3895
3903
  }),
3896
- G && X && /* @__PURE__ */ l(St, {
3904
+ G && X && /* @__PURE__ */ l(Ct, {
3897
3905
  documentId: e,
3898
3906
  rootChunkId: X,
3899
3907
  docType: W?.type,
@@ -3929,7 +3937,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3929
3937
  }), /* @__PURE__ */ l("button", {
3930
3938
  type: "button",
3931
3939
  className: "danger",
3932
- onClick: () => void bt(),
3940
+ onClick: () => void yt(),
3933
3941
  children: "delete"
3934
3942
  })]
3935
3943
  })
@@ -3941,7 +3949,7 @@ function Zt({ documentId: e, scope: n, titleHint: s, browse: d, principal: f, re
3941
3949
  }
3942
3950
  //#endregion
3943
3951
  //#region src/components/PathTree.tsx
3944
- function Qt(e, t = "") {
3952
+ function $t(e, t = "") {
3945
3953
  let n = e.get(t);
3946
3954
  if (!n) return [];
3947
3955
  let r = n.entries.map((n) => {
@@ -3952,7 +3960,7 @@ function Qt(e, t = "") {
3952
3960
  kind: n.kind,
3953
3961
  resourceRef: n.resource_ref,
3954
3962
  listing: r ? e.get(n.full_path) : void 0,
3955
- children: r ? Qt(e, n.full_path) : []
3963
+ children: r ? $t(e, n.full_path) : []
3956
3964
  };
3957
3965
  });
3958
3966
  return r.sort((e, t) => {
@@ -3960,13 +3968,13 @@ function Qt(e, t = "") {
3960
3968
  return n === (t.kind === "directory") ? e.name.localeCompare(t.name) : n ? -1 : 1;
3961
3969
  }), r;
3962
3970
  }
3963
- var $t = {
3971
+ var en = {
3964
3972
  directory: "📁",
3965
3973
  document: "📄",
3966
3974
  volume_mount: "💾",
3967
3975
  memory_entry: "🧠"
3968
3976
  };
3969
- function en(e) {
3977
+ function tn(e) {
3970
3978
  let { tree: t, root: n } = e;
3971
3979
  return !n || !n.loaded && n.loading ? /* @__PURE__ */ l("div", {
3972
3980
  className: "empty",
@@ -3976,17 +3984,17 @@ function en(e) {
3976
3984
  children: /* @__PURE__ */ l("p", { children: "This tree is empty. Create a folder or document to begin." })
3977
3985
  }) : /* @__PURE__ */ u("ul", {
3978
3986
  className: "tree path-tree",
3979
- children: [t.map((t) => /* @__PURE__ */ l(rn, {
3987
+ children: [t.map((t) => /* @__PURE__ */ l(an, {
3980
3988
  node: t,
3981
3989
  ...e
3982
- }, t.fullPath)), /* @__PURE__ */ l(tn, {
3990
+ }, t.fullPath)), /* @__PURE__ */ l(nn, {
3983
3991
  dir: "",
3984
3992
  listing: n,
3985
3993
  ...e
3986
3994
  })]
3987
3995
  });
3988
3996
  }
3989
- function tn({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
3997
+ function nn({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
3990
3998
  let i = [];
3991
3999
  return !t || t.loading && t.entries.length === 0 ? i.push(/* @__PURE__ */ l("li", {
3992
4000
  className: "node path-status",
@@ -4026,13 +4034,13 @@ function tn({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
4026
4034
  })
4027
4035
  }, "more")), /* @__PURE__ */ l(c, { children: i });
4028
4036
  }
4029
- function nn(e, t) {
4037
+ function rn(e, t) {
4030
4038
  if (e.kind !== "document" || !t) return;
4031
4039
  let n = e.resourceRef;
4032
4040
  return n?.document_id ? t.get(n.document_id) : void 0;
4033
4041
  }
4034
- function rn(e) {
4035
- 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 = nn(t, o), p = f && f.color_enabled ? Ge(Ve(f.type, f.status, Be(f.color_scheme))) : void 0;
4042
+ function an(e) {
4043
+ 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 = rn(t, o), p = f && f.color_enabled ? Ke(He(f.type, f.status, Be(f.color_scheme))) : void 0;
4036
4044
  return /* @__PURE__ */ u("li", {
4037
4045
  className: `node path-node kind-${t.kind} ${d ? "selected" : ""}`,
4038
4046
  children: [/* @__PURE__ */ u("div", {
@@ -4057,7 +4065,7 @@ function rn(e) {
4057
4065
  /* @__PURE__ */ l("span", {
4058
4066
  className: "path-kind-icon",
4059
4067
  "aria-hidden": !0,
4060
- children: $t[t.kind] ?? "•"
4068
+ children: en[t.kind] ?? "•"
4061
4069
  }),
4062
4070
  /* @__PURE__ */ l("span", {
4063
4071
  className: "path-name",
@@ -4075,10 +4083,10 @@ function rn(e) {
4075
4083
  })]
4076
4084
  }), c && /* @__PURE__ */ u("ul", {
4077
4085
  className: "children path-children",
4078
- children: [t.children.map((t) => /* @__PURE__ */ l(rn, {
4086
+ children: [t.children.map((t) => /* @__PURE__ */ l(an, {
4079
4087
  ...e,
4080
4088
  node: t
4081
- }, t.fullPath)), /* @__PURE__ */ l(tn, {
4089
+ }, t.fullPath)), /* @__PURE__ */ l(nn, {
4082
4090
  ...e,
4083
4091
  dir: t.fullPath,
4084
4092
  listing: t.listing
@@ -4088,23 +4096,23 @@ function rn(e) {
4088
4096
  }
4089
4097
  //#endregion
4090
4098
  //#region src/PathExplorer.tsx
4091
- var an = /^[A-Za-z0-9._-]+$/;
4092
- function on(e, t) {
4099
+ var on = /^[A-Za-z0-9._-]+$/;
4100
+ function sn(e, t) {
4093
4101
  return `${e}/${t}`;
4094
4102
  }
4095
- function sn(e, t) {
4103
+ function cn(e, t) {
4096
4104
  for (let n of e) {
4097
4105
  if (n.fullPath === t) return n;
4098
- let e = sn(n.children, t);
4106
+ let e = cn(n.children, t);
4099
4107
  if (e) return e;
4100
4108
  }
4101
4109
  }
4102
- function cn(e) {
4110
+ function ln(e) {
4103
4111
  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);
4104
4112
  return /* @__PURE__ */ l(z, {
4105
4113
  theme: t,
4106
4114
  dataLayer: f,
4107
- children: /* @__PURE__ */ l(ln, {
4115
+ children: /* @__PURE__ */ l(un, {
4108
4116
  defaultScope: n,
4109
4117
  path: r,
4110
4118
  onPathChange: i,
@@ -4117,7 +4125,7 @@ function cn(e) {
4117
4125
  })
4118
4126
  });
4119
4127
  }
4120
- function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p, renderAssistant: m, renderNavigator: _, navigator: v, onError: y }) {
4128
+ function un({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p, renderAssistant: m, renderNavigator: _, navigator: v, onError: y }) {
4121
4129
  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);
4122
4130
  r(() => {
4123
4131
  te.current = d;
@@ -4198,7 +4206,7 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4198
4206
  x,
4199
4207
  B
4200
4208
  ]);
4201
- let je = i(() => Qt(H), [H]), Me = t(async () => {
4209
+ let je = i(() => $t(H), [H]), Me = t(async () => {
4202
4210
  E(null), ke(), xe((e) => e + 1), await V.refresh(j).catch(U), P && await V.reveal(P).catch(U);
4203
4211
  }, [
4204
4212
  V,
@@ -4213,7 +4221,7 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4213
4221
  });
4214
4222
  }, []), Y = t((e) => V.loadMore(e).catch(U), [V, U]), Pe = t((e) => {
4215
4223
  (V.getSnapshot().get(e)?.loaded ? V.loadMore(e) : V.loadDir(e)).catch(U);
4216
- }, [V, U]), X = i(() => P ? sn(je, P) : void 0, [je, P]), Fe = H.get("")?.error, Ie = X?.kind === "directory" ? X.fullPath : void 0, [Le, Re] = o(null);
4224
+ }, [V, U]), X = i(() => P ? cn(je, P) : void 0, [je, P]), Fe = H.get("")?.error, Ie = X?.kind === "directory" ? X.fullPath : void 0, [Le, Re] = o(null);
4217
4225
  r(() => {
4218
4226
  if (!Ie || !b.pathIsStored) return;
4219
4227
  let e = !1;
@@ -4242,8 +4250,8 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4242
4250
  submitLabel: "Create",
4243
4251
  onSubmit: async (e) => {
4244
4252
  let t = e.name.trim();
4245
- if (!an.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
4246
- let n = on(Z, t);
4253
+ if (!on.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
4254
+ let n = sn(Z, t);
4247
4255
  await b.pathMkdir(n, x, B), await q(n).catch(U), z(n);
4248
4256
  }
4249
4257
  });
@@ -4271,8 +4279,8 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4271
4279
  submitLabel: "Create",
4272
4280
  onSubmit: async (e) => {
4273
4281
  let t = e.name.trim();
4274
- if (!an.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
4275
- let n = e.title.trim() || t, r = on(Z, t);
4282
+ if (!on.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
4283
+ let n = e.title.trim() || t, r = sn(Z, t);
4276
4284
  await b.documentCreate(n, r, x, B), await q(r).catch(U), z(r);
4277
4285
  }
4278
4286
  });
@@ -4545,7 +4553,7 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4545
4553
  G && _ ? /* @__PURE__ */ l("div", {
4546
4554
  className: "paths-navigator",
4547
4555
  children: _(Qe)
4548
- }) : /* @__PURE__ */ l(en, {
4556
+ }) : /* @__PURE__ */ l(tn, {
4549
4557
  tree: je,
4550
4558
  root: H.get(""),
4551
4559
  expanded: j,
@@ -4602,7 +4610,7 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4602
4610
  ]
4603
4611
  })]
4604
4612
  }),
4605
- /* @__PURE__ */ l(Zt, {
4613
+ /* @__PURE__ */ l(Qt, {
4606
4614
  documentId: $.documentId,
4607
4615
  scope: x,
4608
4616
  titleHint: $.title,
@@ -4670,7 +4678,7 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4670
4678
  })
4671
4679
  })]
4672
4680
  }),
4673
- D && /* @__PURE__ */ l(un, {
4681
+ D && /* @__PURE__ */ l(dn, {
4674
4682
  state: D,
4675
4683
  onClose: () => O(null)
4676
4684
  }),
@@ -4686,7 +4694,7 @@ function ln({ defaultScope: e, path: n, onPathChange: d, browse: f, principal: p
4686
4694
  })
4687
4695
  ] });
4688
4696
  }
4689
- function un({ state: e, onClose: t }) {
4697
+ function dn({ state: e, onClose: t }) {
4690
4698
  let [n, r] = o(() => Object.fromEntries(e.fields.map((e) => [e.key, e.value ?? ""]))), [i, a] = o(!1), [s, c] = o(null);
4691
4699
  return /* @__PURE__ */ l("div", {
4692
4700
  className: "modal-overlay",
@@ -4747,15 +4755,15 @@ function un({ state: e, onClose: t }) {
4747
4755
  }
4748
4756
  //#endregion
4749
4757
  //#region src/DocumentViewer.tsx
4750
- function dn(e) {
4758
+ function fn(e) {
4751
4759
  let { documentId: t, scope: n, browse: r, theme: i } = e, a = R(e);
4752
4760
  return /* @__PURE__ */ l(z, {
4753
4761
  theme: i,
4754
4762
  dataLayer: a,
4755
- children: /* @__PURE__ */ l(fn, { ...e }, `${n}:${t}:${r?.scopeId ?? ""}:${r?.tenant ?? ""}`)
4763
+ children: /* @__PURE__ */ l(pn, { ...e }, `${n}:${t}:${r?.scopeId ?? ""}:${r?.tenant ?? ""}`)
4756
4764
  });
4757
4765
  }
4758
- function fn({ documentId: e, chunkId: n, scope: i, titleHint: s, browse: d, principal: f, renderAssistant: p, onOpenDocument: m }) {
4766
+ function pn({ documentId: e, chunkId: n, scope: i, titleHint: s, browse: d, principal: f, renderAssistant: p, onOpenDocument: m }) {
4759
4767
  let [h, g] = o([]), _ = h[h.length - 1], [v, y] = o(), b = a(n);
4760
4768
  r(() => {
4761
4769
  n !== b.current && (b.current = n, h.length > 0 ? (y(void 0), g([])) : y((e) => ({
@@ -4769,7 +4777,7 @@ function fn({ documentId: e, chunkId: n, scope: i, titleHint: s, browse: d, prin
4769
4777
  return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(pe, {
4770
4778
  trail: h,
4771
4779
  onJump: S
4772
- }), /* @__PURE__ */ l(Zt, {
4780
+ }), /* @__PURE__ */ l(Qt, {
4773
4781
  documentId: _?.documentId ?? e,
4774
4782
  scope: i,
4775
4783
  titleHint: _ ? _.title : s,
@@ -4783,6 +4791,6 @@ function fn({ documentId: e, chunkId: n, scope: i, titleHint: s, browse: d, prin
4783
4791
  }, h.length)] });
4784
4792
  }
4785
4793
  //#endregion
4786
- export { Z as DEFAULT_SCHEME, dn as DocumentViewer, ye as EDGE_PAGE_CAP, cn as PathExplorer, Ae as QUEUE_CHANGED_RETRIES, J as RULING_CHUNK, oe as RequestError, L as assetFetchFromConnection, He as chunkColor, Pe as chunkCount, Ue as chunkInheritsDocColor, qe as chunkRowStyle, I as createLoomcycleClient, O as dataLayerFromClient, Ve as docColor, Be as effectiveScheme, We as hexToTint, Me as isQueueChanged, se as jsonPostFromConnection, be as loadDocumentEdges, Ne as runRuling, Ge as tintStyle, b as transferInput, Y as undoRulings, Ke as washStyle };
4794
+ export { Z as DEFAULT_SCHEME, fn as DocumentViewer, ye as EDGE_PAGE_CAP, ln as PathExplorer, Ae as QUEUE_CHANGED_RETRIES, J as RULING_CHUNK, oe as RequestError, L as assetFetchFromConnection, Ue as chunkColor, Pe as chunkCount, We as chunkInheritsDocColor, $ as chunkRowStyle, I as createLoomcycleClient, O as dataLayerFromClient, He as docColor, Be as effectiveScheme, Ge as hexToTint, Me as isQueueChanged, se as jsonPostFromConnection, be as loadDocumentEdges, Ne as runRuling, Ke as tintStyle, b as transferInput, Y as undoRulings, qe as washStyle };
4787
4795
 
4788
4796
  //# sourceMappingURL=index.js.map