@declarion/react 0.48.2 → 0.50.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-lib/Check-DAfMbQIw.js +38 -0
- package/dist-lib/{DraggableChildrenTable-p2ZSdwzj.js → DraggableChildrenTable-Dar8C-Z9.js} +31 -31
- package/dist-lib/DynamicIcon-DW5krHuX.js +280 -0
- package/dist-lib/{Grid-CjLFAKMZ.js → Grid-BkHtfsty.js} +2 -2
- package/dist-lib/{LayoutRenderer-DCscqXsv.js → LayoutRenderer-Cic7IAop.js} +601 -598
- package/dist-lib/ListCardsBody-Dko91bLv.js +287 -0
- package/dist-lib/{MarkdownRenderer-Sb7zcvj0.js → MarkdownRenderer-CJrVG5HZ.js} +1 -1
- package/dist-lib/RefreshControl-BS8WWL8i.js +430 -0
- package/dist-lib/{SmartDetailPage.impl-BAW-Tx_H.js → SmartDetailPage.impl-DxRDo0p2.js} +521 -516
- package/dist-lib/SmartListPage.impl-CNdq5Vts.js +2849 -0
- package/dist-lib/{SmartRecordListPage.impl-DtSSlGrI.js → SmartRecordListPage.impl-3ct7f4rT.js} +244 -241
- package/dist-lib/SortHeaderMenu-NgjkW8QZ.js +106 -0
- package/dist-lib/action-dispatch-hVrm3Hrg.js +1984 -0
- package/dist-lib/api/batch.d.ts +5 -2
- package/dist-lib/api/data.d.ts +35 -4
- package/dist-lib/api/entities.d.ts +3 -3
- package/dist-lib/cardProjection-BR-fXPvJ.js +757 -0
- package/dist-lib/components/{shared → actions}/ObjectActionBar.d.ts +1 -1
- package/dist-lib/components/{shared → actions}/ResponsiveActionBar.d.ts +1 -1
- package/dist-lib/components/fields/cells/factories/date.d.ts +2 -0
- package/dist-lib/components/file-widgets/upload.d.ts +6 -1
- package/dist-lib/components/layout/Layout.d.ts +1 -1
- package/dist-lib/components/layout/TopBar.d.ts +1 -1
- package/dist-lib/components/pages/SmartListPage.d.ts +2 -12
- package/dist-lib/components/pages/SmartListPage.impl.d.ts +4 -0
- package/dist-lib/components/pages/list/ListCardRow.d.ts +40 -0
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +34 -0
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFooter.d.ts +26 -0
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/pages/list/ListNoRows.d.ts +32 -0
- package/dist-lib/components/pages/list/ListTable.d.ts +34 -0
- package/dist-lib/components/pages/list/ListTableRow.d.ts +18 -0
- package/dist-lib/components/pages/list/ListToolbar.d.ts +43 -0
- package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +14 -0
- package/dist-lib/components/pages/list/page-size.d.ts +3 -0
- package/dist-lib/components/pages/list/sortable-header.d.ts +2 -0
- package/dist-lib/components/pages/list/useListColumnLayout.d.ts +37 -0
- package/dist-lib/components/pages/list/useListQuery.d.ts +66 -0
- package/dist-lib/components/pages/list/useListRowInteraction.d.ts +61 -0
- package/dist-lib/components/pages/list/useListSelection.d.ts +31 -0
- package/dist-lib/components/pages/list/useListSort.d.ts +45 -0
- package/dist-lib/components/pages/list/useListViews.d.ts +46 -0
- package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
- package/dist-lib/components/primitives/Icons.d.ts +5 -0
- package/dist-lib/components/shared/RefreshControl.d.ts +17 -4
- package/dist-lib/field-classification-Bm0mgbwA.js +1134 -0
- package/dist-lib/format-count-BfRGwx2v.js +1551 -0
- package/dist-lib/hooks/useBrandingChrome.d.ts +17 -1
- package/dist-lib/hooks/useText.d.ts +3 -0
- package/dist-lib/hooks/useViews.d.ts +1 -1
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.d.ts +17 -15
- package/dist-lib/index.js +1784 -6288
- package/dist-lib/lib/messages.d.ts +7 -1
- package/dist-lib/lib/rowClickGesture.d.ts +12 -0
- package/dist-lib/lib/timestamp.d.ts +8 -3
- package/dist-lib/peekDraftStore-bb4WroTA.js +194 -0
- package/dist-lib/record-documents-key-8fdm7C10.js +27 -0
- package/dist-lib/registry-CgeGoWpW.js +1768 -0
- package/dist-lib/testing.d.ts +17 -2
- package/dist-lib/testing.js +72 -58
- package/dist-lib/types/api.d.ts +54 -12
- package/dist-lib/types/schema.d.ts +22 -6
- package/dist-lib/{useCurrentScreen-BshVTPVq.js → useCurrentScreen-D3XH5ptA.js} +1127 -1070
- package/dist-lib/useListQuery-CfuINl-0.js +87 -0
- package/dist-lib/useProperties-DNocaxBX.js +81 -0
- package/dist-lib/{useProperties-DrHFr0A1.js → useTabSearchMirror-d0BAUIcQ.js} +116 -194
- package/dist-lib/{value-B1O6QikE.js → value-D71J0sJq.js} +69 -69
- package/package.json +1 -1
- package/dist-lib/DynamicIcon-Dc2j-rg_.js +0 -275
- package/dist-lib/RefreshControl-Cnl9nE0x.js +0 -945
- package/dist-lib/registry-CCxnZW2b.js +0 -5281
- /package/dist-lib/components/{shared → actions}/ActionButton.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionDialog.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionResultDialog.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionRunner.d.ts +0 -0
- /package/dist-lib/components/{mass-edit → actions}/PropertyGridEditor.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/RowActionsKebab.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/AssociationTabs.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/AuditMetaStrip.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/Breadcrumbs.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/HighlightsStrip.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/PageHeader.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/RecordHeader.d.ts +0 -0
- /package/dist-lib/components/{shell → layout}/CommandPalette.d.ts +0 -0
- /package/dist-lib/components/{columns → list}/ColumnPicker.d.ts +0 -0
- /package/dist-lib/components/{views → list}/ViewSwitcher.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, s as t, t as n } from "./DynamicIcon-
|
|
1
|
+
import { c as e, s as t, t as n } from "./DynamicIcon-DW5krHuX.js";
|
|
2
2
|
import { Suspense as r, createContext as i, forwardRef as a, lazy as o, useCallback as s, useContext as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
3
3
|
import { useLocation as m, useNavigate as h } from "react-router";
|
|
4
4
|
import { useQuery as g, useQueryClient as _ } from "@tanstack/react-query";
|
|
@@ -445,29 +445,33 @@ function ge() {
|
|
|
445
445
|
touch: he()
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
|
-
function _e(e, t) {
|
|
448
|
+
function _e(e, t, n) {
|
|
449
449
|
if (typeof document > "u") return;
|
|
450
|
-
let
|
|
451
|
-
|
|
452
|
-
let
|
|
453
|
-
|
|
450
|
+
let r = document.documentElement;
|
|
451
|
+
r.style.setProperty("--app-viewport-width", `${Math.round(e.width)}px`), r.style.setProperty("--app-viewport-height", `${Math.round(e.height)}px`), r.style.setProperty("--app-height", `${Math.round(e.height)}px`);
|
|
452
|
+
let i = t === "phone" || e.height <= n.landscapePhoneMaxHeight;
|
|
453
|
+
r.style.setProperty("--control-height", i ? "38px" : "30px"), r.style.setProperty("--control-line-height", i ? "36px" : "28px"), r.style.setProperty("--control-font-size", i ? "16px" : "12.5px");
|
|
454
454
|
}
|
|
455
455
|
function ve({ children: e, breakpoints: t = ue, viewportOverride: n, viewport: r = "auto" }) {
|
|
456
456
|
let [i, a] = p(() => me(n ?? ge())), o = r === "auto" ? de(i, t) : r;
|
|
457
457
|
l(() => {
|
|
458
458
|
if (n) {
|
|
459
459
|
let e = me(n);
|
|
460
|
-
a(e), _e(e, o);
|
|
460
|
+
a(e), _e(e, o, t);
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
463
|
let e = () => {
|
|
464
464
|
let e = ge();
|
|
465
|
-
a(e), _e(e, o);
|
|
465
|
+
a(e), _e(e, o, t);
|
|
466
466
|
};
|
|
467
467
|
return e(), window.addEventListener("resize", e), window.addEventListener("orientationchange", e), window.visualViewport?.addEventListener("resize", e), window.visualViewport?.addEventListener("scroll", e), () => {
|
|
468
468
|
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e), window.visualViewport?.removeEventListener("resize", e), window.visualViewport?.removeEventListener("scroll", e);
|
|
469
469
|
};
|
|
470
|
-
}, [
|
|
470
|
+
}, [
|
|
471
|
+
n,
|
|
472
|
+
o,
|
|
473
|
+
t
|
|
474
|
+
]), l(() => {
|
|
471
475
|
ce(o);
|
|
472
476
|
}, [o]);
|
|
473
477
|
let s = d(() => ({
|
|
@@ -1397,37 +1401,41 @@ function R(e) {
|
|
|
1397
1401
|
function Be(e = /* @__PURE__ */ new Date()) {
|
|
1398
1402
|
return T(e);
|
|
1399
1403
|
}
|
|
1400
|
-
function Ve(e, t) {
|
|
1401
|
-
let
|
|
1402
|
-
if (isNaN(
|
|
1403
|
-
if (
|
|
1404
|
+
function Ve(e, t, n) {
|
|
1405
|
+
let r = e.match(/([+-]\d{2}:\d{2})$/), i = e.endsWith("Z"), a = new Date(e);
|
|
1406
|
+
if (isNaN(a.getTime())) return e;
|
|
1407
|
+
if (r || i) {
|
|
1404
1408
|
let e;
|
|
1405
|
-
if (
|
|
1406
|
-
else if (
|
|
1407
|
-
let t =
|
|
1408
|
-
parseInt(
|
|
1409
|
+
if (i) e = "UTC";
|
|
1410
|
+
else if (r) {
|
|
1411
|
+
let t = r[1].charAt(0), n = parseInt(r[1].substring(1, 3), 10);
|
|
1412
|
+
parseInt(r[1].substring(4, 6), 10) === 0 && (e = n === 0 ? "UTC" : `Etc/GMT${t === "+" ? "-" : "+"}${n}`);
|
|
1409
1413
|
}
|
|
1410
1414
|
if (e) try {
|
|
1411
|
-
return new Intl.DateTimeFormat(
|
|
1415
|
+
return new Intl.DateTimeFormat(n, {
|
|
1412
1416
|
...t,
|
|
1413
1417
|
timeZone: e
|
|
1414
|
-
}).format(
|
|
1418
|
+
}).format(a);
|
|
1415
1419
|
} catch {}
|
|
1416
|
-
if (
|
|
1417
|
-
let e =
|
|
1418
|
-
return new Intl.DateTimeFormat(
|
|
1420
|
+
if (r) {
|
|
1421
|
+
let e = r[1].charAt(0) === "+" ? 1 : -1, i = parseInt(r[1].substring(1, 3), 10), o = parseInt(r[1].substring(4, 6), 10), s = e * (i * 60 + o) * 60 * 1e3;
|
|
1422
|
+
return new Intl.DateTimeFormat(n, {
|
|
1419
1423
|
...t,
|
|
1420
1424
|
timeZone: "UTC"
|
|
1421
|
-
}).format(new Date(
|
|
1425
|
+
}).format(new Date(a.getTime() + s));
|
|
1422
1426
|
}
|
|
1423
1427
|
}
|
|
1424
|
-
return new Intl.DateTimeFormat(
|
|
1428
|
+
return new Intl.DateTimeFormat(n, t).format(a);
|
|
1425
1429
|
}
|
|
1426
1430
|
function He(e) {
|
|
1427
1431
|
return Ve(e, {
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1432
|
+
day: "2-digit",
|
|
1433
|
+
month: "2-digit",
|
|
1434
|
+
year: "numeric",
|
|
1435
|
+
hour: "2-digit",
|
|
1436
|
+
minute: "2-digit",
|
|
1437
|
+
hour12: !1
|
|
1438
|
+
}, "en-GB").replace(/\//g, "-").replace(",", "");
|
|
1431
1439
|
}
|
|
1432
1440
|
function Ue(e, t = /* @__PURE__ */ new Date()) {
|
|
1433
1441
|
if (e == null || e === "") return {
|
|
@@ -1475,16 +1483,16 @@ function Ge(e, t) {
|
|
|
1475
1483
|
}
|
|
1476
1484
|
return typeof i == "object" && !Array.isArray(i) ? z(i) || void 0 : R(i);
|
|
1477
1485
|
}
|
|
1478
|
-
function
|
|
1486
|
+
function Ke(e, t, n) {
|
|
1479
1487
|
if (!t) return n;
|
|
1480
1488
|
let r = e[t];
|
|
1481
1489
|
return r == null ? n : typeof r == "object" && !Array.isArray(r) ? z(r) || n : R(r);
|
|
1482
1490
|
}
|
|
1483
|
-
function
|
|
1491
|
+
function qe(e) {
|
|
1484
1492
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
1485
1493
|
return RegExp("^" + t.join("/") + "$");
|
|
1486
1494
|
}
|
|
1487
|
-
function
|
|
1495
|
+
function Je(e) {
|
|
1488
1496
|
let t = (() => {
|
|
1489
1497
|
try {
|
|
1490
1498
|
return decodeURIComponent(e);
|
|
@@ -1494,17 +1502,17 @@ function qe(e) {
|
|
|
1494
1502
|
})().split("-")[0];
|
|
1495
1503
|
return t.length > 8 ? t.slice(0, 8) : t;
|
|
1496
1504
|
}
|
|
1497
|
-
function
|
|
1505
|
+
function Ye(e, t, n) {
|
|
1498
1506
|
if (!t) return;
|
|
1499
1507
|
let r = e.replace(/\/+$/, "") || "/", i;
|
|
1500
1508
|
for (let e of Object.values(t)) {
|
|
1501
|
-
if (!e.route || !
|
|
1509
|
+
if (!e.route || !qe(e.route).test(r)) continue;
|
|
1502
1510
|
let t = e.route.includes("/:"), a = z(e.display?.name);
|
|
1503
1511
|
if (!a && t && n && e.entity) {
|
|
1504
1512
|
let t = z(n[e.entity]?.display?.name);
|
|
1505
1513
|
if (t) {
|
|
1506
1514
|
let e = r.slice(r.lastIndexOf("/") + 1);
|
|
1507
|
-
a = e ? `${t} ${
|
|
1515
|
+
a = e ? `${t} ${Je(e)}` : t;
|
|
1508
1516
|
}
|
|
1509
1517
|
}
|
|
1510
1518
|
if (!a) continue;
|
|
@@ -1517,7 +1525,7 @@ function Je(e, t, n) {
|
|
|
1517
1525
|
}
|
|
1518
1526
|
return i;
|
|
1519
1527
|
}
|
|
1520
|
-
function
|
|
1528
|
+
function Xe(e, t, n) {
|
|
1521
1529
|
let r = z(e.display?.name);
|
|
1522
1530
|
if (r) return r;
|
|
1523
1531
|
if (e.type === "ref" && e.ref?.entity && n) {
|
|
@@ -1529,10 +1537,10 @@ function Ye(e, t, n) {
|
|
|
1529
1537
|
}
|
|
1530
1538
|
return t;
|
|
1531
1539
|
}
|
|
1532
|
-
function
|
|
1540
|
+
function Ze(e) {
|
|
1533
1541
|
if (e != null) return typeof e == "string" ? { entity: e } : e;
|
|
1534
1542
|
}
|
|
1535
|
-
function
|
|
1543
|
+
function Qe(e, t) {
|
|
1536
1544
|
let n = e ?? [];
|
|
1537
1545
|
if (!t) return n;
|
|
1538
1546
|
switch (t.mode ?? "append") {
|
|
@@ -1541,7 +1549,7 @@ function Ze(e, t) {
|
|
|
1541
1549
|
default: return [...n, ...t.values ?? []];
|
|
1542
1550
|
}
|
|
1543
1551
|
}
|
|
1544
|
-
function
|
|
1552
|
+
function $e(e) {
|
|
1545
1553
|
let t = e.name, n = e.display ? {
|
|
1546
1554
|
...e.display,
|
|
1547
1555
|
name: e.display.name ?? t
|
|
@@ -1554,36 +1562,36 @@ function Qe(e) {
|
|
|
1554
1562
|
structure: e.structure
|
|
1555
1563
|
};
|
|
1556
1564
|
}
|
|
1557
|
-
function
|
|
1565
|
+
function et(e, t) {
|
|
1558
1566
|
return !e || e.readonly ? !1 : e.mutations?.[t] ?? !0;
|
|
1559
1567
|
}
|
|
1560
|
-
function
|
|
1568
|
+
function tt(e) {
|
|
1561
1569
|
return !e?.disable_defaults?.includes("__new");
|
|
1562
1570
|
}
|
|
1563
|
-
function
|
|
1571
|
+
function B(e) {
|
|
1564
1572
|
if (e.primary_key && e.primary_key.length > 0) return e.primary_key;
|
|
1565
1573
|
for (let [t, n] of e.fields) if (n.primary) return [t];
|
|
1566
1574
|
return ["id"];
|
|
1567
1575
|
}
|
|
1568
|
-
function
|
|
1569
|
-
let n =
|
|
1576
|
+
function nt(e, t) {
|
|
1577
|
+
let n = B(e), r = {};
|
|
1570
1578
|
for (let e of n) r[e] = R(t[e]);
|
|
1571
1579
|
return r;
|
|
1572
1580
|
}
|
|
1573
|
-
function nt(e) {
|
|
1574
|
-
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
1575
|
-
}
|
|
1576
1581
|
function rt(e) {
|
|
1577
|
-
return
|
|
1582
|
+
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
1578
1583
|
}
|
|
1579
|
-
function it(e
|
|
1580
|
-
return
|
|
1584
|
+
function it(e) {
|
|
1585
|
+
return rt(Object.values(e));
|
|
1581
1586
|
}
|
|
1582
1587
|
function at(e, t) {
|
|
1583
|
-
|
|
1584
|
-
if (n.length === 1) return { [n[0]]: t };
|
|
1588
|
+
return rt(B(e).map((e) => t[e] ?? ""));
|
|
1585
1589
|
}
|
|
1586
1590
|
function ot(e, t) {
|
|
1591
|
+
let n = B(e);
|
|
1592
|
+
if (n.length === 1) return { [n[0]]: t };
|
|
1593
|
+
}
|
|
1594
|
+
function st(e, t) {
|
|
1587
1595
|
if (t <= 1) return [e];
|
|
1588
1596
|
try {
|
|
1589
1597
|
let n = JSON.parse(e);
|
|
@@ -1593,71 +1601,98 @@ function ot(e, t) {
|
|
|
1593
1601
|
}
|
|
1594
1602
|
return null;
|
|
1595
1603
|
}
|
|
1596
|
-
function
|
|
1604
|
+
function ct(e, t, n) {
|
|
1597
1605
|
if (e?.detail_screen === "none") return null;
|
|
1598
1606
|
let r = e?.detail_screen ?? t?.detail_screen;
|
|
1599
1607
|
return r ? n?.[r]?.route ?? null : null;
|
|
1600
1608
|
}
|
|
1601
|
-
function
|
|
1609
|
+
function lt(e, t, n, r) {
|
|
1602
1610
|
if (!t) return null;
|
|
1603
|
-
let i =
|
|
1611
|
+
let i = ct(e, n, r);
|
|
1604
1612
|
return i ? i.replace(":id", encodeURIComponent(t)) : null;
|
|
1605
1613
|
}
|
|
1606
|
-
function lt(e, t, n, r) {
|
|
1607
|
-
return !t || V(t).some((e) => !r[e]) ? null : ct(e, it(t, r), t, n);
|
|
1608
|
-
}
|
|
1609
1614
|
function ut(e, t, n, r) {
|
|
1610
|
-
return t ? lt(e, t,
|
|
1615
|
+
return !t || B(t).some((e) => !r[e]) ? null : lt(e, at(t, r), t, n);
|
|
1616
|
+
}
|
|
1617
|
+
function dt(e, t, n, r) {
|
|
1618
|
+
return t ? ut(e, t, n, nt(t, r)) : null;
|
|
1611
1619
|
}
|
|
1612
|
-
function
|
|
1613
|
-
return
|
|
1620
|
+
function ft(e) {
|
|
1621
|
+
return B(e).length > 1;
|
|
1614
1622
|
}
|
|
1615
1623
|
//#endregion
|
|
1616
1624
|
//#region src/types/api.ts
|
|
1617
|
-
var
|
|
1625
|
+
var V = class extends Error {
|
|
1618
1626
|
status;
|
|
1619
1627
|
code;
|
|
1628
|
+
type;
|
|
1629
|
+
retryable;
|
|
1630
|
+
detail;
|
|
1620
1631
|
index;
|
|
1621
1632
|
raw;
|
|
1622
|
-
constructor(e, t, n
|
|
1623
|
-
super(t), this.name = "ApiError", this.status = e, this.code =
|
|
1633
|
+
constructor(e, t, n) {
|
|
1634
|
+
super(t.title || "Request failed"), this.name = "ApiError", this.status = t.status ?? e, this.type = t.type ?? "", this.code = pt(t.type), this.retryable = t.retryable ?? !1, this.detail = t.detail;
|
|
1635
|
+
let r = t.index;
|
|
1636
|
+
typeof r == "number" && (this.index = r), this.raw = n;
|
|
1637
|
+
}
|
|
1638
|
+
ext(e) {
|
|
1639
|
+
return this.raw?.[e];
|
|
1624
1640
|
}
|
|
1625
|
-
}
|
|
1641
|
+
};
|
|
1642
|
+
function pt(e) {
|
|
1643
|
+
if (!e || e === "about:blank") return "";
|
|
1644
|
+
let t = e.lastIndexOf("/");
|
|
1645
|
+
return t >= 0 ? e.slice(t + 1) : e;
|
|
1646
|
+
}
|
|
1626
1647
|
function mt(e) {
|
|
1627
|
-
return
|
|
1648
|
+
return typeof e == "object" && !!e && typeof e.type == "string";
|
|
1649
|
+
}
|
|
1650
|
+
var ht = "cursor.semantics_mismatch", gt = "cursor.locale_changed";
|
|
1651
|
+
function _t(e) {
|
|
1652
|
+
return e instanceof V && (e.code === "cursor.semantics_mismatch" || e.code === "cursor.locale_changed" || e.code === "cursor.archive_invalid");
|
|
1653
|
+
}
|
|
1654
|
+
async function vt(e) {
|
|
1655
|
+
let t;
|
|
1656
|
+
try {
|
|
1657
|
+
t = await e.json();
|
|
1658
|
+
} catch {}
|
|
1659
|
+
return {
|
|
1660
|
+
raw: t,
|
|
1661
|
+
body: mt(t) ? t : {}
|
|
1662
|
+
};
|
|
1628
1663
|
}
|
|
1629
1664
|
//#endregion
|
|
1630
1665
|
//#region src/api/auth-redirect.ts
|
|
1631
|
-
var
|
|
1632
|
-
function
|
|
1666
|
+
var H = "/", yt = "/login", bt = "/signup", xt = "https://declarion.local";
|
|
1667
|
+
function St(e) {
|
|
1633
1668
|
let t = e.split(/[?#]/, 1)[0];
|
|
1634
|
-
return t ===
|
|
1669
|
+
return t === yt || t.startsWith(`${yt}/`) || t === bt || t.startsWith(`${bt}/`);
|
|
1635
1670
|
}
|
|
1636
|
-
function
|
|
1637
|
-
if (!e) return
|
|
1671
|
+
function Ct(e) {
|
|
1672
|
+
if (!e) return H;
|
|
1638
1673
|
let t = e.toLowerCase();
|
|
1639
|
-
if (!e.startsWith("/") || e.startsWith("//") || e.includes("\\") || t.includes("%5c")) return
|
|
1674
|
+
if (!e.startsWith("/") || e.startsWith("//") || e.includes("\\") || t.includes("%5c")) return H;
|
|
1640
1675
|
try {
|
|
1641
|
-
let t = new URL(e,
|
|
1642
|
-
if (t.origin !==
|
|
1676
|
+
let t = new URL(e, xt);
|
|
1677
|
+
if (t.origin !== xt) return H;
|
|
1643
1678
|
let n = `${t.pathname}${t.search}${t.hash}`;
|
|
1644
|
-
return !n.startsWith("/") || n.startsWith("//") || n.includes("\\") ?
|
|
1679
|
+
return !n.startsWith("/") || n.startsWith("//") || n.includes("\\") ? H : n || H;
|
|
1645
1680
|
} catch {
|
|
1646
|
-
return
|
|
1681
|
+
return H;
|
|
1647
1682
|
}
|
|
1648
1683
|
}
|
|
1649
|
-
function
|
|
1650
|
-
let t =
|
|
1651
|
-
return t ===
|
|
1684
|
+
function wt(e) {
|
|
1685
|
+
let t = Ct(e);
|
|
1686
|
+
return t === H || St(t) ? yt : `${yt}?next=${encodeURIComponent(t)}`;
|
|
1652
1687
|
}
|
|
1653
|
-
function
|
|
1654
|
-
if (typeof window > "u") return
|
|
1688
|
+
function Tt() {
|
|
1689
|
+
if (typeof window > "u") return yt;
|
|
1655
1690
|
let { pathname: e, search: t, hash: n } = window.location;
|
|
1656
|
-
return
|
|
1691
|
+
return wt(`${e}${t}${n}`);
|
|
1657
1692
|
}
|
|
1658
1693
|
//#endregion
|
|
1659
1694
|
//#region src/embed/protocol.ts
|
|
1660
|
-
var
|
|
1695
|
+
var Et = "declarion-embed", Dt = {
|
|
1661
1696
|
ready: "ready",
|
|
1662
1697
|
setToken: "set-token",
|
|
1663
1698
|
tokenExpired: "token-expired",
|
|
@@ -1670,10 +1705,10 @@ var St = "declarion-embed", Ct = {
|
|
|
1670
1705
|
navigate: "navigate",
|
|
1671
1706
|
setTheme: "set-theme"
|
|
1672
1707
|
};
|
|
1673
|
-
function
|
|
1708
|
+
function Ot(e, t, n) {
|
|
1674
1709
|
if (!e || typeof window > "u" || window.parent === window) return !1;
|
|
1675
1710
|
let r = {
|
|
1676
|
-
source:
|
|
1711
|
+
source: Et,
|
|
1677
1712
|
protocol: 1,
|
|
1678
1713
|
type: t,
|
|
1679
1714
|
payload: n
|
|
@@ -1682,68 +1717,68 @@ function wt(e, t, n) {
|
|
|
1682
1717
|
}
|
|
1683
1718
|
//#endregion
|
|
1684
1719
|
//#region src/embed/token.ts
|
|
1685
|
-
var
|
|
1720
|
+
var kt = 15e3, At = 5e3, U = {
|
|
1686
1721
|
active: !1,
|
|
1687
1722
|
parentOrigin: null,
|
|
1688
1723
|
current: null,
|
|
1689
1724
|
pending: null
|
|
1690
1725
|
};
|
|
1691
|
-
function
|
|
1692
|
-
|
|
1726
|
+
function jt(e) {
|
|
1727
|
+
U.active = !0, U.parentOrigin = e;
|
|
1693
1728
|
}
|
|
1694
|
-
function
|
|
1695
|
-
return
|
|
1729
|
+
function Mt() {
|
|
1730
|
+
return U.active;
|
|
1696
1731
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return
|
|
1732
|
+
function Nt() {
|
|
1733
|
+
return U.current?.token ?? null;
|
|
1699
1734
|
}
|
|
1700
|
-
function
|
|
1701
|
-
return
|
|
1735
|
+
function Pt() {
|
|
1736
|
+
return U.parentOrigin;
|
|
1702
1737
|
}
|
|
1703
|
-
function
|
|
1704
|
-
return !
|
|
1738
|
+
function Ft() {
|
|
1739
|
+
return !U.current || Date.now() >= U.current.expiresAt - At;
|
|
1705
1740
|
}
|
|
1706
|
-
function
|
|
1741
|
+
function It(e) {
|
|
1707
1742
|
if (!e.token || typeof e.token != "string") return;
|
|
1708
1743
|
let t = Date.parse(e.expires_at);
|
|
1709
|
-
if (!Number.isNaN(t) && (
|
|
1744
|
+
if (!Number.isNaN(t) && (U.current = {
|
|
1710
1745
|
token: e.token,
|
|
1711
1746
|
expiresAt: t
|
|
1712
|
-
},
|
|
1713
|
-
let t =
|
|
1714
|
-
|
|
1747
|
+
}, U.pending)) {
|
|
1748
|
+
let t = U.pending;
|
|
1749
|
+
U.pending = null, clearTimeout(t.timer), t.resolve(e.token);
|
|
1715
1750
|
}
|
|
1716
1751
|
}
|
|
1717
|
-
function
|
|
1718
|
-
|
|
1752
|
+
function Lt() {
|
|
1753
|
+
U.current = null;
|
|
1719
1754
|
}
|
|
1720
|
-
function
|
|
1721
|
-
if (!
|
|
1722
|
-
if (
|
|
1755
|
+
function Rt() {
|
|
1756
|
+
if (!Ft() && U.current) return Promise.resolve(U.current.token);
|
|
1757
|
+
if (U.pending) return U.pending.promise;
|
|
1723
1758
|
let e, t, n = new Promise((n, r) => {
|
|
1724
1759
|
e = n, t = r;
|
|
1725
1760
|
}), r = setTimeout(() => {
|
|
1726
|
-
|
|
1727
|
-
},
|
|
1728
|
-
return
|
|
1761
|
+
U.pending && U.pending.promise === n && (U.pending = null), t(/* @__PURE__ */ Error(`embed token wait timed out after ${kt}ms`));
|
|
1762
|
+
}, kt);
|
|
1763
|
+
return U.pending = {
|
|
1729
1764
|
promise: n,
|
|
1730
1765
|
resolve: e,
|
|
1731
1766
|
reject: t,
|
|
1732
1767
|
timer: r
|
|
1733
|
-
},
|
|
1768
|
+
}, Ot(U.parentOrigin, Dt.tokenExpired, {}), n;
|
|
1734
1769
|
}
|
|
1735
1770
|
//#endregion
|
|
1736
1771
|
//#region src/lib/versionTracker.ts
|
|
1737
|
-
var
|
|
1738
|
-
function
|
|
1772
|
+
var zt = "X-Declarion-Version", Bt = "declarion-version";
|
|
1773
|
+
function Vt() {
|
|
1739
1774
|
if (typeof BroadcastChannel > "u") return null;
|
|
1740
1775
|
try {
|
|
1741
|
-
return new BroadcastChannel(
|
|
1776
|
+
return new BroadcastChannel(Bt);
|
|
1742
1777
|
} catch {
|
|
1743
1778
|
return null;
|
|
1744
1779
|
}
|
|
1745
1780
|
}
|
|
1746
|
-
var
|
|
1781
|
+
var W = {
|
|
1747
1782
|
firstSeen: null,
|
|
1748
1783
|
firstComponents: null,
|
|
1749
1784
|
hasReportedDrift: !1,
|
|
@@ -1751,46 +1786,46 @@ var G = {
|
|
|
1751
1786
|
listeners: /* @__PURE__ */ new Set(),
|
|
1752
1787
|
channel: null
|
|
1753
1788
|
};
|
|
1754
|
-
function
|
|
1755
|
-
|
|
1789
|
+
function Ht() {
|
|
1790
|
+
W.channel || typeof BroadcastChannel > "u" || (W.channel = Vt(), W.channel && W.channel.addEventListener("message", (e) => {
|
|
1756
1791
|
let t = e.data;
|
|
1757
|
-
if (!(!t || t.type !== "drift" || !t.delta) && !
|
|
1758
|
-
|
|
1759
|
-
for (let e of
|
|
1792
|
+
if (!(!t || t.type !== "drift" || !t.delta) && !W.hasReportedDrift) {
|
|
1793
|
+
W.hasReportedDrift = !0;
|
|
1794
|
+
for (let e of W.listeners) e(t.delta);
|
|
1760
1795
|
}
|
|
1761
1796
|
}));
|
|
1762
1797
|
}
|
|
1763
|
-
function
|
|
1764
|
-
if (
|
|
1765
|
-
let t = e.get(
|
|
1798
|
+
function Ut(e) {
|
|
1799
|
+
if (Ht(), !e) return;
|
|
1800
|
+
let t = e.get(zt);
|
|
1766
1801
|
if (t) {
|
|
1767
|
-
if (!
|
|
1768
|
-
|
|
1802
|
+
if (!W.firstSeen) {
|
|
1803
|
+
W.firstSeen = t;
|
|
1769
1804
|
return;
|
|
1770
1805
|
}
|
|
1771
|
-
t !==
|
|
1772
|
-
|
|
1806
|
+
t !== W.firstSeen && (W.hasReportedDrift || Wt().catch(() => {
|
|
1807
|
+
Kt({
|
|
1773
1808
|
kind: "unknown",
|
|
1774
1809
|
observed: t
|
|
1775
1810
|
});
|
|
1776
1811
|
}));
|
|
1777
1812
|
}
|
|
1778
1813
|
}
|
|
1779
|
-
async function
|
|
1780
|
-
|
|
1814
|
+
async function Wt() {
|
|
1815
|
+
Ht();
|
|
1781
1816
|
let e;
|
|
1782
1817
|
try {
|
|
1783
1818
|
let t = {};
|
|
1784
|
-
|
|
1819
|
+
W.firstSeen && (t["If-None-Match"] = `"${W.firstSeen}"`), e = await fetch("/api/version", {
|
|
1785
1820
|
method: "GET",
|
|
1786
|
-
credentials:
|
|
1821
|
+
credentials: Mt() ? "omit" : "include",
|
|
1787
1822
|
headers: t
|
|
1788
1823
|
});
|
|
1789
1824
|
} catch {
|
|
1790
1825
|
throw Error("version probe network error");
|
|
1791
1826
|
}
|
|
1792
1827
|
if (e.status === 304) return;
|
|
1793
|
-
if (!e.ok) throw Error(`version probe ${e.status}`);
|
|
1828
|
+
if (!e.ok) throw await vt(e), Error(`version probe ${e.status}`);
|
|
1794
1829
|
let t;
|
|
1795
1830
|
try {
|
|
1796
1831
|
t = await e.json();
|
|
@@ -1804,54 +1839,54 @@ async function Bt() {
|
|
|
1804
1839
|
asset: t.asset_fingerprint,
|
|
1805
1840
|
binary: t.binary_fingerprint
|
|
1806
1841
|
} : void 0;
|
|
1807
|
-
|
|
1808
|
-
kind:
|
|
1842
|
+
W.firstSeen ||= n, !W.firstComponents && r && n === W.firstSeen && (W.firstComponents = r), n !== W.firstSeen && Kt({
|
|
1843
|
+
kind: Gt(W.firstComponents, r),
|
|
1809
1844
|
observed: n,
|
|
1810
1845
|
components: r
|
|
1811
1846
|
});
|
|
1812
1847
|
}
|
|
1813
|
-
function
|
|
1848
|
+
function Gt(e, t) {
|
|
1814
1849
|
if (!e || !t) return "unknown";
|
|
1815
1850
|
let n = e.schema !== t.schema, r = e.asset !== t.asset, i = e.binary !== t.binary;
|
|
1816
1851
|
return n && !r && !i ? "schema-only" : r || i ? "asset-or-binary" : "unknown";
|
|
1817
1852
|
}
|
|
1818
|
-
function
|
|
1819
|
-
if (!
|
|
1820
|
-
|
|
1821
|
-
for (let t of
|
|
1822
|
-
if (
|
|
1823
|
-
|
|
1853
|
+
function Kt(e) {
|
|
1854
|
+
if (!W.hasReportedDrift) {
|
|
1855
|
+
W.hasReportedDrift = !0, e.kind !== "schema-only" && (W.pendingReload = e);
|
|
1856
|
+
for (let t of W.listeners) t(e);
|
|
1857
|
+
if (W.channel) try {
|
|
1858
|
+
W.channel.postMessage({
|
|
1824
1859
|
type: "drift",
|
|
1825
1860
|
delta: e
|
|
1826
1861
|
});
|
|
1827
1862
|
} catch {}
|
|
1828
|
-
|
|
1863
|
+
Mt() && e.kind !== "schema-only" && Ot(Pt(), Dt.reloadRequired, { reason: `version drift: ${e.kind}` });
|
|
1829
1864
|
}
|
|
1830
1865
|
}
|
|
1831
|
-
function
|
|
1832
|
-
return
|
|
1866
|
+
function qt() {
|
|
1867
|
+
return W.pendingReload;
|
|
1833
1868
|
}
|
|
1834
|
-
function
|
|
1835
|
-
return
|
|
1836
|
-
|
|
1869
|
+
function Jt(e) {
|
|
1870
|
+
return W.listeners.add(e), () => {
|
|
1871
|
+
W.listeners.delete(e);
|
|
1837
1872
|
};
|
|
1838
1873
|
}
|
|
1839
1874
|
//#endregion
|
|
1840
1875
|
//#region src/api/client.ts
|
|
1841
|
-
var
|
|
1842
|
-
function
|
|
1876
|
+
var Yt = (e) => JSON.stringify(e ?? {}), Xt = null, G = "declarion.auth.refresh.lock", Zt = "declarion.auth.refresh.result", Qt = "declarion.auth.refresh", $t = 3e4, en = 100, tn = typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1877
|
+
function nn() {
|
|
1843
1878
|
if (typeof window > "u") return !1;
|
|
1844
1879
|
try {
|
|
1845
|
-
let e = window.localStorage, t = `${
|
|
1880
|
+
let e = window.localStorage, t = `${G}.probe`;
|
|
1846
1881
|
return e.setItem(t, "1"), e.removeItem(t), !0;
|
|
1847
1882
|
} catch {
|
|
1848
1883
|
return !1;
|
|
1849
1884
|
}
|
|
1850
1885
|
}
|
|
1851
|
-
function
|
|
1886
|
+
function rn() {
|
|
1852
1887
|
return typeof navigator > "u" ? null : navigator.locks ?? null;
|
|
1853
1888
|
}
|
|
1854
|
-
function
|
|
1889
|
+
function an(e) {
|
|
1855
1890
|
if (!e) return null;
|
|
1856
1891
|
try {
|
|
1857
1892
|
let t = JSON.parse(e);
|
|
@@ -1863,7 +1898,7 @@ function en(e) {
|
|
|
1863
1898
|
return null;
|
|
1864
1899
|
}
|
|
1865
1900
|
}
|
|
1866
|
-
function
|
|
1901
|
+
function on(e) {
|
|
1867
1902
|
if (!e) return null;
|
|
1868
1903
|
try {
|
|
1869
1904
|
let t = JSON.parse(e);
|
|
@@ -1877,47 +1912,47 @@ function tn(e) {
|
|
|
1877
1912
|
return null;
|
|
1878
1913
|
}
|
|
1879
1914
|
}
|
|
1880
|
-
function
|
|
1881
|
-
if (!
|
|
1882
|
-
let t =
|
|
1915
|
+
function sn(e) {
|
|
1916
|
+
if (!nn()) return null;
|
|
1917
|
+
let t = on(window.localStorage.getItem(Zt));
|
|
1883
1918
|
return !t || t.updated_at < e ? null : t;
|
|
1884
1919
|
}
|
|
1885
|
-
function
|
|
1886
|
-
if (!e.ok) throw new
|
|
1920
|
+
function cn(e) {
|
|
1921
|
+
if (!e.ok) throw new K(e.status ?? 401);
|
|
1887
1922
|
}
|
|
1888
|
-
function
|
|
1889
|
-
let t =
|
|
1890
|
-
if (t && t.expires_at > e && t.owner !==
|
|
1923
|
+
function ln(e = Date.now()) {
|
|
1924
|
+
let t = an(window.localStorage.getItem(G));
|
|
1925
|
+
if (t && t.expires_at > e && t.owner !== tn) return !1;
|
|
1891
1926
|
let n = {
|
|
1892
|
-
owner:
|
|
1893
|
-
expires_at: e +
|
|
1927
|
+
owner: tn,
|
|
1928
|
+
expires_at: e + $t
|
|
1894
1929
|
};
|
|
1895
|
-
return window.localStorage.setItem(
|
|
1930
|
+
return window.localStorage.setItem(G, JSON.stringify(n)), an(window.localStorage.getItem(G))?.owner === tn;
|
|
1896
1931
|
}
|
|
1897
|
-
function
|
|
1898
|
-
|
|
1932
|
+
function un() {
|
|
1933
|
+
an(window.localStorage.getItem(G))?.owner === tn && window.localStorage.removeItem(G);
|
|
1899
1934
|
}
|
|
1900
|
-
function
|
|
1935
|
+
function dn(e) {
|
|
1901
1936
|
let t = {
|
|
1902
|
-
owner:
|
|
1937
|
+
owner: tn,
|
|
1903
1938
|
updated_at: Date.now(),
|
|
1904
1939
|
...e
|
|
1905
1940
|
};
|
|
1906
|
-
window.localStorage.setItem(
|
|
1941
|
+
window.localStorage.setItem(Zt, JSON.stringify(t));
|
|
1907
1942
|
}
|
|
1908
|
-
async function
|
|
1943
|
+
async function fn(e) {
|
|
1909
1944
|
return new Promise((t, n) => {
|
|
1910
1945
|
let r = !1, i = null, a = (e) => {
|
|
1911
1946
|
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), t(e));
|
|
1912
1947
|
}, o = (e) => {
|
|
1913
|
-
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), n(new
|
|
1948
|
+
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), n(new K(e)));
|
|
1914
1949
|
}, s = () => {
|
|
1915
|
-
let t =
|
|
1950
|
+
let t = on(window.localStorage.getItem(Zt));
|
|
1916
1951
|
if (t && t.updated_at >= e) {
|
|
1917
1952
|
t.ok ? a("complete") : o(t.status ?? 401);
|
|
1918
1953
|
return;
|
|
1919
1954
|
}
|
|
1920
|
-
let n =
|
|
1955
|
+
let n = an(window.localStorage.getItem(G));
|
|
1921
1956
|
if (!n) {
|
|
1922
1957
|
a("complete");
|
|
1923
1958
|
return;
|
|
@@ -1926,185 +1961,181 @@ async function cn(e) {
|
|
|
1926
1961
|
a("expired");
|
|
1927
1962
|
return;
|
|
1928
1963
|
}
|
|
1929
|
-
i = setTimeout(s,
|
|
1964
|
+
i = setTimeout(s, en);
|
|
1930
1965
|
}, c = (e) => {
|
|
1931
|
-
(e.key ===
|
|
1966
|
+
(e.key === G || e.key === Zt) && (i && clearTimeout(i), s());
|
|
1932
1967
|
};
|
|
1933
1968
|
window.addEventListener("storage", c), s();
|
|
1934
1969
|
});
|
|
1935
1970
|
}
|
|
1936
|
-
async function
|
|
1937
|
-
let t =
|
|
1938
|
-
return t ? (await t.request(
|
|
1939
|
-
let t =
|
|
1971
|
+
async function pn(e) {
|
|
1972
|
+
let t = rn();
|
|
1973
|
+
return t ? (await t.request(Qt, { mode: "exclusive" }, async () => {
|
|
1974
|
+
let t = sn(e);
|
|
1940
1975
|
if (t) {
|
|
1941
|
-
|
|
1976
|
+
cn(t);
|
|
1942
1977
|
return;
|
|
1943
1978
|
}
|
|
1944
1979
|
try {
|
|
1945
|
-
await
|
|
1980
|
+
await Cn(), nn() && dn({ ok: !0 });
|
|
1946
1981
|
} catch (e) {
|
|
1947
|
-
throw e instanceof
|
|
1982
|
+
throw e instanceof K && nn() && dn({
|
|
1948
1983
|
ok: !1,
|
|
1949
1984
|
status: e.status
|
|
1950
1985
|
}), e;
|
|
1951
1986
|
}
|
|
1952
1987
|
}), !0) : !1;
|
|
1953
1988
|
}
|
|
1954
|
-
async function
|
|
1989
|
+
async function mn() {
|
|
1955
1990
|
let e = Date.now();
|
|
1956
|
-
if (!await
|
|
1957
|
-
if (!
|
|
1958
|
-
await
|
|
1991
|
+
if (!await pn(e)) {
|
|
1992
|
+
if (!nn()) {
|
|
1993
|
+
await Cn();
|
|
1959
1994
|
return;
|
|
1960
1995
|
}
|
|
1961
|
-
if (
|
|
1962
|
-
await
|
|
1996
|
+
if (ln(e)) try {
|
|
1997
|
+
await Cn(), dn({ ok: !0 });
|
|
1963
1998
|
return;
|
|
1964
1999
|
} catch (e) {
|
|
1965
|
-
throw e instanceof
|
|
2000
|
+
throw e instanceof K && dn({
|
|
1966
2001
|
ok: !1,
|
|
1967
2002
|
status: e.status
|
|
1968
2003
|
}), e;
|
|
1969
2004
|
} finally {
|
|
1970
|
-
|
|
2005
|
+
un();
|
|
1971
2006
|
}
|
|
1972
|
-
await
|
|
2007
|
+
await fn(e) === "expired" && await mn();
|
|
1973
2008
|
}
|
|
1974
2009
|
}
|
|
1975
|
-
var
|
|
2010
|
+
var K = class extends Error {
|
|
1976
2011
|
status;
|
|
1977
2012
|
constructor(e) {
|
|
1978
2013
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
1979
2014
|
}
|
|
1980
|
-
},
|
|
1981
|
-
function
|
|
1982
|
-
|
|
1983
|
-
e instanceof
|
|
2015
|
+
}, hn = null, gn = null, _n = 3e4, vn = 5e3;
|
|
2016
|
+
function yn() {
|
|
2017
|
+
Tn().catch((e) => {
|
|
2018
|
+
e instanceof K && q();
|
|
1984
2019
|
});
|
|
1985
2020
|
}
|
|
1986
|
-
function
|
|
1987
|
-
if (
|
|
2021
|
+
function bn(e) {
|
|
2022
|
+
if (wn = null, hn &&= (clearTimeout(hn), null), gn = null, !e || typeof window > "u") return;
|
|
1988
2023
|
let t = Date.parse(e);
|
|
1989
2024
|
if (Number.isNaN(t)) return;
|
|
1990
|
-
|
|
1991
|
-
let n = Math.max(t - Date.now() -
|
|
1992
|
-
|
|
1993
|
-
|
|
2025
|
+
gn = t;
|
|
2026
|
+
let n = Math.max(t - Date.now() - _n, vn);
|
|
2027
|
+
hn = setTimeout(() => {
|
|
2028
|
+
hn = null, yn();
|
|
1994
2029
|
}, n);
|
|
1995
2030
|
}
|
|
1996
|
-
function
|
|
1997
|
-
|
|
2031
|
+
function xn() {
|
|
2032
|
+
hn &&= (clearTimeout(hn), null), gn = null;
|
|
1998
2033
|
}
|
|
1999
2034
|
typeof document < "u" && document.addEventListener("visibilitychange", () => {
|
|
2000
|
-
document.visibilityState === "visible" &&
|
|
2035
|
+
document.visibilityState === "visible" && gn !== null && Date.now() >= gn - _n && yn();
|
|
2001
2036
|
});
|
|
2002
|
-
async function
|
|
2037
|
+
async function Sn(e) {
|
|
2003
2038
|
try {
|
|
2004
2039
|
let t = await e.json();
|
|
2005
|
-
|
|
2040
|
+
bn(t?.result?.expires_at ?? t?.expires_at);
|
|
2006
2041
|
} catch {}
|
|
2007
2042
|
}
|
|
2008
|
-
async function
|
|
2043
|
+
async function Cn() {
|
|
2009
2044
|
let e = {
|
|
2010
2045
|
method: "POST",
|
|
2011
2046
|
credentials: "include",
|
|
2012
2047
|
headers: { "Content-Type": "application/json" },
|
|
2013
|
-
body:
|
|
2048
|
+
body: Yt({})
|
|
2014
2049
|
}, t = await fetch("/api/actions/auth.refresh", e);
|
|
2015
2050
|
if (t.status === 429) {
|
|
2016
2051
|
let n = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
2017
2052
|
await new Promise((e) => setTimeout(e, n * 1e3));
|
|
2018
2053
|
let r = await fetch("/api/actions/auth.refresh", e);
|
|
2019
|
-
if (!r.ok) throw new
|
|
2020
|
-
await
|
|
2054
|
+
if (!r.ok) throw await vt(r), new K(r.status);
|
|
2055
|
+
await Sn(r);
|
|
2021
2056
|
return;
|
|
2022
2057
|
}
|
|
2023
|
-
if (!t.ok) throw new
|
|
2024
|
-
await
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2058
|
+
if (!t.ok) throw await vt(t), new K(t.status);
|
|
2059
|
+
await Sn(t);
|
|
2060
|
+
}
|
|
2061
|
+
var wn = null;
|
|
2062
|
+
async function Tn() {
|
|
2063
|
+
if (wn !== null) throw new K(wn);
|
|
2064
|
+
return Xt || (Xt = mn().catch((e) => {
|
|
2065
|
+
throw e instanceof K && (wn = e.status), e;
|
|
2066
|
+
}).finally(() => {
|
|
2067
|
+
Xt = null;
|
|
2068
|
+
}), Xt);
|
|
2069
|
+
}
|
|
2070
|
+
var q = () => {
|
|
2032
2071
|
if (typeof window > "u") return;
|
|
2033
2072
|
let { pathname: e } = window.location;
|
|
2034
|
-
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href =
|
|
2073
|
+
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = Tt());
|
|
2035
2074
|
};
|
|
2036
|
-
function
|
|
2037
|
-
let t =
|
|
2038
|
-
return
|
|
2075
|
+
function En(e) {
|
|
2076
|
+
let t = q;
|
|
2077
|
+
return q = e, t;
|
|
2039
2078
|
}
|
|
2040
|
-
function
|
|
2041
|
-
return
|
|
2079
|
+
function Dn() {
|
|
2080
|
+
return q;
|
|
2042
2081
|
}
|
|
2043
|
-
var
|
|
2082
|
+
var On = ({ status: e, code: t, message: n }) => {
|
|
2044
2083
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
2045
2084
|
};
|
|
2046
|
-
function
|
|
2085
|
+
function kn(e, t, n, r) {
|
|
2047
2086
|
let i = new Headers(e);
|
|
2048
2087
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
2049
2088
|
}
|
|
2050
|
-
async function
|
|
2051
|
-
let i =
|
|
2089
|
+
async function An(e, t, n, r) {
|
|
2090
|
+
let i = Mt(), a = i ? "omit" : "include", o = kn(t.headers, !!t.body, n, i ? Nt() : null), s = await fetch(e, {
|
|
2052
2091
|
...t,
|
|
2053
2092
|
headers: o,
|
|
2054
2093
|
credentials: a
|
|
2055
2094
|
});
|
|
2056
|
-
if (
|
|
2057
|
-
let
|
|
2058
|
-
try {
|
|
2059
|
-
u = await s.json();
|
|
2060
|
-
let e = u;
|
|
2061
|
-
e && e.error && (o = e.error.message, c = e.error.code, e.index != null && (l = e.index));
|
|
2062
|
-
} catch {}
|
|
2063
|
-
if (s.status === 401 && (c === "TOKEN_REFRESH_NEEDED" || c === "UNAUTHORIZED")) try {
|
|
2095
|
+
if (Ut(s.headers), !s.ok) {
|
|
2096
|
+
let { raw: o, body: c } = await vt(s), l = pt(c.type), u = c.title || "Request failed";
|
|
2097
|
+
if (s.status === 401 && (l === "auth.token_refresh_needed" || l === "auth.unauthorized")) try {
|
|
2064
2098
|
let o = null;
|
|
2065
|
-
i ? (
|
|
2066
|
-
let s =
|
|
2099
|
+
i ? (Lt(), o = await Rt()) : await Tn();
|
|
2100
|
+
let s = kn(t.headers, !!t.body, n, o), c = await fetch(e, {
|
|
2067
2101
|
...t,
|
|
2068
2102
|
headers: s,
|
|
2069
2103
|
credentials: a
|
|
2070
2104
|
});
|
|
2071
2105
|
if (!c.ok) {
|
|
2072
|
-
|
|
2073
|
-
let e = await c
|
|
2074
|
-
|
|
2075
|
-
code: "UNKNOWN"
|
|
2076
|
-
} }));
|
|
2077
|
-
throw new H(c.status, e.error.message, e.error.code, e.index);
|
|
2106
|
+
q();
|
|
2107
|
+
let e = await vt(c);
|
|
2108
|
+
throw new V(c.status, e.body, e.raw);
|
|
2078
2109
|
}
|
|
2079
2110
|
return r(c);
|
|
2080
2111
|
} catch (e) {
|
|
2081
|
-
throw e instanceof
|
|
2112
|
+
throw e instanceof V ? e : (q(), new V(401, c, o));
|
|
2082
2113
|
}
|
|
2083
|
-
throw s.status === 401 &&
|
|
2114
|
+
throw s.status === 401 && q(), On({
|
|
2084
2115
|
status: s.status,
|
|
2085
|
-
code:
|
|
2086
|
-
message:
|
|
2087
|
-
}), new
|
|
2116
|
+
code: l,
|
|
2117
|
+
message: u
|
|
2118
|
+
}), new V(s.status, c, o);
|
|
2088
2119
|
}
|
|
2089
2120
|
return r(s);
|
|
2090
2121
|
}
|
|
2091
|
-
function
|
|
2122
|
+
function jn(e) {
|
|
2092
2123
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
2093
2124
|
}
|
|
2094
2125
|
async function J(e, t = {}) {
|
|
2095
|
-
return
|
|
2126
|
+
return An(e, t, { setAccept: !1 }, jn);
|
|
2096
2127
|
}
|
|
2097
|
-
async function
|
|
2128
|
+
async function Mn(e) {
|
|
2098
2129
|
return {
|
|
2099
2130
|
blob: await e.blob(),
|
|
2100
|
-
filename:
|
|
2131
|
+
filename: Pn(e.headers),
|
|
2101
2132
|
headers: e.headers
|
|
2102
2133
|
};
|
|
2103
2134
|
}
|
|
2104
|
-
async function
|
|
2105
|
-
return
|
|
2135
|
+
async function Nn(e, t = {}) {
|
|
2136
|
+
return An(e, t, { setAccept: !0 }, Mn);
|
|
2106
2137
|
}
|
|
2107
|
-
function
|
|
2138
|
+
function Pn(e) {
|
|
2108
2139
|
let t = e.get("Content-Disposition");
|
|
2109
2140
|
if (!t) return "";
|
|
2110
2141
|
let n = t.match(/filename\*\s*=\s*([^']*)'([^']*)'([^;]+)/i);
|
|
@@ -2117,28 +2148,28 @@ function An(e) {
|
|
|
2117
2148
|
async function Y(e, t = {}) {
|
|
2118
2149
|
return (await J(`/api/actions/${encodeURIComponent(e)}`, {
|
|
2119
2150
|
method: "POST",
|
|
2120
|
-
body:
|
|
2151
|
+
body: Yt(t)
|
|
2121
2152
|
})).result;
|
|
2122
2153
|
}
|
|
2123
2154
|
//#endregion
|
|
2124
2155
|
//#region src/api/schema.ts
|
|
2125
|
-
function
|
|
2156
|
+
function Fn(e) {
|
|
2126
2157
|
return {
|
|
2127
2158
|
...e,
|
|
2128
2159
|
params: e.params ? L.fromObject(e.params) : void 0
|
|
2129
2160
|
};
|
|
2130
2161
|
}
|
|
2131
|
-
function
|
|
2162
|
+
function In(e) {
|
|
2132
2163
|
return {
|
|
2133
2164
|
...e,
|
|
2134
2165
|
resolved_params: e.resolved_params ? L.fromObject(e.resolved_params) : void 0
|
|
2135
2166
|
};
|
|
2136
2167
|
}
|
|
2137
|
-
function
|
|
2168
|
+
function Ln(e) {
|
|
2138
2169
|
let t = {};
|
|
2139
|
-
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] =
|
|
2170
|
+
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] = Fn(r);
|
|
2140
2171
|
let n = {};
|
|
2141
|
-
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] =
|
|
2172
|
+
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] = In(r);
|
|
2142
2173
|
return {
|
|
2143
2174
|
...e,
|
|
2144
2175
|
fields: L.fromObject(e.fields),
|
|
@@ -2148,18 +2179,18 @@ function Nn(e) {
|
|
|
2148
2179
|
actions: e.actions ? n : void 0
|
|
2149
2180
|
};
|
|
2150
2181
|
}
|
|
2151
|
-
function
|
|
2182
|
+
function Rn(e) {
|
|
2152
2183
|
let t = {};
|
|
2153
|
-
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] =
|
|
2184
|
+
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] = Ln(r);
|
|
2154
2185
|
let n = {};
|
|
2155
2186
|
if (e.structures) for (let [t, r] of Object.entries(e.structures)) n[t] = {
|
|
2156
2187
|
...r,
|
|
2157
2188
|
fields: L.fromObject(r.fields)
|
|
2158
2189
|
};
|
|
2159
2190
|
let r = {};
|
|
2160
|
-
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] =
|
|
2191
|
+
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] = Fn(n);
|
|
2161
2192
|
let i = {};
|
|
2162
|
-
if (e.actions) for (let [t, n] of Object.entries(e.actions)) i[t] =
|
|
2193
|
+
if (e.actions) for (let [t, n] of Object.entries(e.actions)) i[t] = In(n);
|
|
2163
2194
|
let a = { ...e.screens };
|
|
2164
2195
|
for (let [e, t] of Object.entries(a)) {
|
|
2165
2196
|
let n = t;
|
|
@@ -2177,66 +2208,66 @@ function Pn(e) {
|
|
|
2177
2208
|
screens: a
|
|
2178
2209
|
};
|
|
2179
2210
|
}
|
|
2180
|
-
async function
|
|
2181
|
-
return
|
|
2211
|
+
async function zn() {
|
|
2212
|
+
return Rn(await J("/api/schema"));
|
|
2182
2213
|
}
|
|
2183
2214
|
//#endregion
|
|
2184
2215
|
//#region src/api/auth.ts
|
|
2185
|
-
async function
|
|
2216
|
+
async function Bn() {
|
|
2186
2217
|
return Y("auth.check_setup");
|
|
2187
2218
|
}
|
|
2188
|
-
async function
|
|
2219
|
+
async function Vn(e, t, n = !0) {
|
|
2189
2220
|
let r = await Y("auth.login", {
|
|
2190
2221
|
email: e,
|
|
2191
2222
|
password: t,
|
|
2192
2223
|
remember: n
|
|
2193
2224
|
});
|
|
2194
|
-
return
|
|
2225
|
+
return bn(r.expires_at), r;
|
|
2195
2226
|
}
|
|
2196
|
-
async function
|
|
2227
|
+
async function Hn(e, t, n) {
|
|
2197
2228
|
let r = await Y("auth.signup", {
|
|
2198
2229
|
email: e,
|
|
2199
2230
|
password: t,
|
|
2200
2231
|
display_name: n
|
|
2201
2232
|
});
|
|
2202
|
-
return
|
|
2233
|
+
return bn(r.expires_at), r;
|
|
2203
2234
|
}
|
|
2204
|
-
async function
|
|
2235
|
+
async function Un() {
|
|
2205
2236
|
return Y("auth.me");
|
|
2206
2237
|
}
|
|
2207
|
-
async function
|
|
2238
|
+
async function Wn() {
|
|
2208
2239
|
return (await Y("auth.list_tenants")).tenants;
|
|
2209
2240
|
}
|
|
2210
|
-
async function
|
|
2241
|
+
async function Gn(e) {
|
|
2211
2242
|
let t = await Y("auth.switch_tenant", { tenant_id: e });
|
|
2212
|
-
return
|
|
2243
|
+
return bn(t.expires_at), t;
|
|
2213
2244
|
}
|
|
2214
|
-
async function
|
|
2245
|
+
async function Kn() {
|
|
2215
2246
|
await Y("auth.logout");
|
|
2216
2247
|
}
|
|
2217
|
-
async function
|
|
2248
|
+
async function qn(e) {
|
|
2218
2249
|
return (await Y("sso_provider.list", e ? { tenant_code: e } : {})).providers;
|
|
2219
2250
|
}
|
|
2220
|
-
function
|
|
2251
|
+
function Jn(e, t, n) {
|
|
2221
2252
|
let r = new URLSearchParams();
|
|
2222
2253
|
t && r.set("tenant", t), n && r.set("redirect", n);
|
|
2223
2254
|
let i = r.toString();
|
|
2224
2255
|
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
|
|
2225
2256
|
}
|
|
2226
|
-
async function
|
|
2257
|
+
async function Yn(e, t, n) {
|
|
2227
2258
|
let r = {
|
|
2228
2259
|
target_user_id: e,
|
|
2229
2260
|
reason: t
|
|
2230
2261
|
};
|
|
2231
2262
|
return n != null && (r.duration_minutes = n), Y("impersonation.start", r);
|
|
2232
2263
|
}
|
|
2233
|
-
async function
|
|
2264
|
+
async function Xn() {
|
|
2234
2265
|
return Y("impersonation.stop");
|
|
2235
2266
|
}
|
|
2236
|
-
async function
|
|
2267
|
+
async function Zn(e) {
|
|
2237
2268
|
await Y("impersonation.revoke", { session_id: e });
|
|
2238
2269
|
}
|
|
2239
|
-
async function
|
|
2270
|
+
async function Qn(e, t) {
|
|
2240
2271
|
await Y("auth.change_password", {
|
|
2241
2272
|
current_password: e,
|
|
2242
2273
|
new_password: t
|
|
@@ -2244,7 +2275,7 @@ async function Jn(e, t) {
|
|
|
2244
2275
|
}
|
|
2245
2276
|
//#endregion
|
|
2246
2277
|
//#region src/stores/auth.ts
|
|
2247
|
-
var
|
|
2278
|
+
var $n = E((e) => ({
|
|
2248
2279
|
user: null,
|
|
2249
2280
|
isAuthenticated: !1,
|
|
2250
2281
|
isLoading: !0,
|
|
@@ -2252,9 +2283,9 @@ var Yn = E((e) => ({
|
|
|
2252
2283
|
tenants: [],
|
|
2253
2284
|
initialize: async () => {
|
|
2254
2285
|
try {
|
|
2255
|
-
let t = await
|
|
2286
|
+
let t = await Un(), n = t.tenant ?? null, r = [];
|
|
2256
2287
|
try {
|
|
2257
|
-
r = await
|
|
2288
|
+
r = await Wn();
|
|
2258
2289
|
} catch {}
|
|
2259
2290
|
e({
|
|
2260
2291
|
user: t,
|
|
@@ -2273,7 +2304,7 @@ var Yn = E((e) => ({
|
|
|
2273
2304
|
},
|
|
2274
2305
|
refreshMe: async () => {
|
|
2275
2306
|
try {
|
|
2276
|
-
let t = await
|
|
2307
|
+
let t = await Un();
|
|
2277
2308
|
e({
|
|
2278
2309
|
user: t,
|
|
2279
2310
|
activeTenant: t.tenant ?? null
|
|
@@ -2295,9 +2326,9 @@ var Yn = E((e) => ({
|
|
|
2295
2326
|
e({ activeTenant: t });
|
|
2296
2327
|
},
|
|
2297
2328
|
logout: async () => {
|
|
2298
|
-
|
|
2329
|
+
xn();
|
|
2299
2330
|
try {
|
|
2300
|
-
await
|
|
2331
|
+
await Kn();
|
|
2301
2332
|
} catch {}
|
|
2302
2333
|
e({
|
|
2303
2334
|
user: null,
|
|
@@ -2310,31 +2341,31 @@ var Yn = E((e) => ({
|
|
|
2310
2341
|
//#endregion
|
|
2311
2342
|
//#region src/hooks/useSchema.ts
|
|
2312
2343
|
function X() {
|
|
2313
|
-
let e =
|
|
2344
|
+
let e = $n((e) => e.isAuthenticated);
|
|
2314
2345
|
return g({
|
|
2315
2346
|
queryKey: ["schema", e],
|
|
2316
|
-
queryFn:
|
|
2347
|
+
queryFn: zn,
|
|
2317
2348
|
staleTime: Infinity,
|
|
2318
2349
|
enabled: e
|
|
2319
2350
|
});
|
|
2320
2351
|
}
|
|
2321
2352
|
//#endregion
|
|
2322
2353
|
//#region src/api/data.ts
|
|
2323
|
-
function
|
|
2354
|
+
function er(e, t) {
|
|
2324
2355
|
let n = new URL(`/api/data/${e}`, window.location.origin);
|
|
2325
2356
|
if (t.page && n.searchParams.set("page", String(t.page)), t.per_page && n.searchParams.set("per_page", String(t.per_page)), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.expand) for (let e of t.expand) n.searchParams.append("expand", e);
|
|
2326
2357
|
return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.count && n.searchParams.set("count", t.count), n.pathname + n.search;
|
|
2327
2358
|
}
|
|
2328
|
-
async function
|
|
2329
|
-
if (
|
|
2330
|
-
let n =
|
|
2359
|
+
async function tr(e, t = {}, n = {}) {
|
|
2360
|
+
if (hr) {
|
|
2361
|
+
let n = hr(e, t);
|
|
2331
2362
|
if (n !== void 0) return n;
|
|
2332
2363
|
}
|
|
2333
|
-
return J(
|
|
2364
|
+
return J(er(e, t), { signal: n.signal });
|
|
2334
2365
|
}
|
|
2335
|
-
async function
|
|
2336
|
-
if (
|
|
2337
|
-
let n =
|
|
2366
|
+
async function nr(e, t) {
|
|
2367
|
+
if (gr) {
|
|
2368
|
+
let n = gr(e, t);
|
|
2338
2369
|
if (n !== void 0) return n;
|
|
2339
2370
|
}
|
|
2340
2371
|
let n = new URLSearchParams();
|
|
@@ -2342,40 +2373,40 @@ async function Qn(e, t) {
|
|
|
2342
2373
|
else for (let [e, r] of Object.entries(t)) n.set(e, r);
|
|
2343
2374
|
return J(`/api/data/${e}?${n.toString()}`);
|
|
2344
2375
|
}
|
|
2345
|
-
async function
|
|
2346
|
-
return { data: ((await
|
|
2376
|
+
async function rr(e, t) {
|
|
2377
|
+
return { data: ((await yr(`${e}.__create`, {
|
|
2347
2378
|
entity: e,
|
|
2348
2379
|
fields: t
|
|
2349
2380
|
})).result?.rows ?? [])[0] };
|
|
2350
2381
|
}
|
|
2351
|
-
async function
|
|
2352
|
-
let r = typeof t == "string" ? t :
|
|
2353
|
-
return { data: ((await
|
|
2382
|
+
async function ir(e, t, n) {
|
|
2383
|
+
let r = typeof t == "string" ? t : or(t);
|
|
2384
|
+
return { data: ((await yr(`${e}.__update`, {
|
|
2354
2385
|
object_ids: [r],
|
|
2355
2386
|
entity: e,
|
|
2356
2387
|
fields: n
|
|
2357
2388
|
})).result?.rows ?? [])[0] };
|
|
2358
2389
|
}
|
|
2359
|
-
async function
|
|
2360
|
-
let n = typeof t == "string" ? t :
|
|
2361
|
-
await
|
|
2390
|
+
async function ar(e, t) {
|
|
2391
|
+
let n = typeof t == "string" ? t : or(t);
|
|
2392
|
+
await yr(`${e}.__delete`, {
|
|
2362
2393
|
object_ids: [n],
|
|
2363
2394
|
entity: e
|
|
2364
2395
|
});
|
|
2365
2396
|
}
|
|
2366
|
-
function
|
|
2397
|
+
function or(e) {
|
|
2367
2398
|
let t = Object.values(e);
|
|
2368
2399
|
return t.length === 1 ? t[0] : t.join("");
|
|
2369
2400
|
}
|
|
2370
|
-
async function
|
|
2371
|
-
let n = typeof t == "string" ? t :
|
|
2372
|
-
await
|
|
2401
|
+
async function sr(e, t) {
|
|
2402
|
+
let n = typeof t == "string" ? t : or(t);
|
|
2403
|
+
await yr(`${e}.__restore`, {
|
|
2373
2404
|
object_ids: [n],
|
|
2374
2405
|
entity: e
|
|
2375
2406
|
});
|
|
2376
2407
|
}
|
|
2377
|
-
async function
|
|
2378
|
-
let n = await
|
|
2408
|
+
async function cr(e, t) {
|
|
2409
|
+
let n = await Nn(`/api/data/${e}/export`, {
|
|
2379
2410
|
method: "POST",
|
|
2380
2411
|
body: JSON.stringify(t)
|
|
2381
2412
|
});
|
|
@@ -2384,63 +2415,66 @@ async function ir(e, t) {
|
|
|
2384
2415
|
filename: n.filename
|
|
2385
2416
|
};
|
|
2386
2417
|
}
|
|
2387
|
-
|
|
2418
|
+
function lr(e) {
|
|
2419
|
+
return !!e && ((e.failed_count ?? 0) > 0 || (e.timed_out_count ?? 0) > 0);
|
|
2420
|
+
}
|
|
2421
|
+
var ur = class extends Error {
|
|
2388
2422
|
status;
|
|
2389
2423
|
response;
|
|
2390
2424
|
constructor(e, t) {
|
|
2391
|
-
let n = t.errors
|
|
2425
|
+
let n = t.errors?.[0]?.error?.title;
|
|
2392
2426
|
super(n || "Action failed"), this.name = "ActionBatchError", this.status = e, this.response = t;
|
|
2393
2427
|
}
|
|
2394
2428
|
};
|
|
2395
|
-
function
|
|
2429
|
+
function dr(e) {
|
|
2396
2430
|
if (!e || typeof e != "object") return !1;
|
|
2397
2431
|
let t = e;
|
|
2398
2432
|
return typeof t.status == "string" && Array.isArray(t.errors);
|
|
2399
2433
|
}
|
|
2400
|
-
function
|
|
2434
|
+
function fr(e, t) {
|
|
2401
2435
|
let n = { ...e ?? {} };
|
|
2402
2436
|
if ("object_ids" in n) throw Error("handler param \"object_ids\" collides with reserved key");
|
|
2403
2437
|
if ("_ids" in n) throw Error("handler param \"_ids\" is a removed legacy key; use object_ids");
|
|
2404
2438
|
return t !== void 0 && (n.object_ids = t), n;
|
|
2405
2439
|
}
|
|
2406
|
-
var
|
|
2407
|
-
function
|
|
2408
|
-
let t =
|
|
2409
|
-
return
|
|
2440
|
+
var pr = null;
|
|
2441
|
+
function mr(e) {
|
|
2442
|
+
let t = pr;
|
|
2443
|
+
return pr = e, t;
|
|
2410
2444
|
}
|
|
2411
|
-
var
|
|
2412
|
-
function
|
|
2413
|
-
let t =
|
|
2414
|
-
return
|
|
2445
|
+
var hr = null, gr = null;
|
|
2446
|
+
function _r(e) {
|
|
2447
|
+
let t = hr;
|
|
2448
|
+
return hr = e, t;
|
|
2415
2449
|
}
|
|
2416
|
-
function
|
|
2417
|
-
let t =
|
|
2418
|
-
return
|
|
2450
|
+
function vr(e) {
|
|
2451
|
+
let t = gr;
|
|
2452
|
+
return gr = e, t;
|
|
2419
2453
|
}
|
|
2420
|
-
async function
|
|
2421
|
-
if (
|
|
2454
|
+
async function yr(e, t) {
|
|
2455
|
+
if (pr) return pr(e, t);
|
|
2422
2456
|
try {
|
|
2423
2457
|
return await J(`/api/actions/${e}`, {
|
|
2424
2458
|
method: "POST",
|
|
2425
2459
|
body: JSON.stringify(t)
|
|
2426
2460
|
});
|
|
2427
2461
|
} catch (e) {
|
|
2428
|
-
throw e instanceof
|
|
2462
|
+
throw e instanceof V && dr(e.raw) ? new ur(e.status, e.raw) : e;
|
|
2429
2463
|
}
|
|
2430
2464
|
}
|
|
2431
|
-
async function
|
|
2465
|
+
async function br(e, t) {
|
|
2432
2466
|
let n = new URLSearchParams();
|
|
2433
2467
|
return n.set("ids", t.join(",")), J(`/api/associations/${e}?${n.toString()}`);
|
|
2434
2468
|
}
|
|
2435
2469
|
//#endregion
|
|
2436
2470
|
//#region src/embed/params.ts
|
|
2437
|
-
var
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2471
|
+
var xr = "self", Sr = "embed", Cr = "parent_origin", wr = "theme", Tr = [
|
|
2472
|
+
Sr,
|
|
2473
|
+
Cr,
|
|
2474
|
+
wr,
|
|
2441
2475
|
"nav"
|
|
2442
2476
|
];
|
|
2443
|
-
function
|
|
2477
|
+
function Er(e) {
|
|
2444
2478
|
if (!e) return null;
|
|
2445
2479
|
let t;
|
|
2446
2480
|
try {
|
|
@@ -2450,22 +2484,22 @@ function xr(e) {
|
|
|
2450
2484
|
}
|
|
2451
2485
|
return t.origin === "null" ? null : e === t.origin ? t.origin : null;
|
|
2452
2486
|
}
|
|
2453
|
-
function
|
|
2487
|
+
function Dr(e) {
|
|
2454
2488
|
return e === "light" || e === "dark" ? e : null;
|
|
2455
2489
|
}
|
|
2456
|
-
function
|
|
2457
|
-
return e === "delegated" ? "delegated" :
|
|
2490
|
+
function Or(e) {
|
|
2491
|
+
return e === "delegated" ? "delegated" : xr;
|
|
2458
2492
|
}
|
|
2459
|
-
function
|
|
2493
|
+
function kr(e) {
|
|
2460
2494
|
let t = typeof e == "string" ? new URLSearchParams(e) : e;
|
|
2461
2495
|
return {
|
|
2462
|
-
enabled: t.get(
|
|
2463
|
-
parentOrigin:
|
|
2464
|
-
theme:
|
|
2465
|
-
navigationMode:
|
|
2496
|
+
enabled: t.get(Sr) === "1",
|
|
2497
|
+
parentOrigin: Er(t.get(Cr)),
|
|
2498
|
+
theme: Dr(t.get(wr)),
|
|
2499
|
+
navigationMode: Or(t.get("nav"))
|
|
2466
2500
|
};
|
|
2467
2501
|
}
|
|
2468
|
-
function
|
|
2502
|
+
function Ar(e, t) {
|
|
2469
2503
|
if (!t.enabled) return e;
|
|
2470
2504
|
let n = /^[a-z][a-z0-9+.-]*:/i.test(e), r;
|
|
2471
2505
|
try {
|
|
@@ -2474,46 +2508,46 @@ function Tr(e, t) {
|
|
|
2474
2508
|
return e;
|
|
2475
2509
|
}
|
|
2476
2510
|
let i = r.searchParams;
|
|
2477
|
-
return t.enabled && i.set(
|
|
2511
|
+
return t.enabled && i.set(Sr, "1"), t.parentOrigin && i.set(Cr, t.parentOrigin), t.theme && i.set(wr, t.theme), i.set("nav", t.navigationMode), n ? r.toString() : `${r.pathname}${r.search}${r.hash}`;
|
|
2478
2512
|
}
|
|
2479
2513
|
//#endregion
|
|
2480
2514
|
//#region src/embed/EmbedContext.tsx
|
|
2481
|
-
var
|
|
2515
|
+
var jr = i({
|
|
2482
2516
|
enabled: !1,
|
|
2483
2517
|
parentOrigin: null,
|
|
2484
2518
|
theme: null,
|
|
2485
2519
|
navigationMode: "self",
|
|
2486
2520
|
appendEmbedParams: (e) => e
|
|
2487
2521
|
});
|
|
2488
|
-
function
|
|
2522
|
+
function Mr(e) {
|
|
2489
2523
|
return {
|
|
2490
2524
|
enabled: e.enabled,
|
|
2491
2525
|
parentOrigin: e.parentOrigin,
|
|
2492
2526
|
theme: e.theme,
|
|
2493
2527
|
navigationMode: e.navigationMode,
|
|
2494
|
-
appendEmbedParams: (t) =>
|
|
2528
|
+
appendEmbedParams: (t) => Ar(t, e)
|
|
2495
2529
|
};
|
|
2496
2530
|
}
|
|
2497
|
-
function
|
|
2498
|
-
let n = d(() =>
|
|
2531
|
+
function Nr({ children: e, query: t }) {
|
|
2532
|
+
let n = d(() => Mr(kr(t ?? (typeof window < "u" ? window.location.search : ""))), [t]);
|
|
2499
2533
|
return l(() => {
|
|
2500
2534
|
le(n.enabled);
|
|
2501
|
-
}, [n.enabled]), /* @__PURE__ */ b(
|
|
2535
|
+
}, [n.enabled]), /* @__PURE__ */ b(jr.Provider, {
|
|
2502
2536
|
value: n,
|
|
2503
2537
|
children: e
|
|
2504
2538
|
});
|
|
2505
2539
|
}
|
|
2506
|
-
function
|
|
2507
|
-
return c(
|
|
2540
|
+
function Pr() {
|
|
2541
|
+
return c(jr);
|
|
2508
2542
|
}
|
|
2509
2543
|
//#endregion
|
|
2510
2544
|
//#region src/embed/embed-dirty.ts
|
|
2511
|
-
var
|
|
2545
|
+
var Fr = E((e) => ({
|
|
2512
2546
|
isDirty: !1,
|
|
2513
2547
|
setDirty: (t) => e((e) => e.isDirty === t ? e : { isDirty: t })
|
|
2514
2548
|
}));
|
|
2515
|
-
function
|
|
2516
|
-
let n =
|
|
2549
|
+
function Ir(e, t) {
|
|
2550
|
+
let n = Fr((e) => e.setDirty);
|
|
2517
2551
|
l(() => {
|
|
2518
2552
|
t && n(e);
|
|
2519
2553
|
}, [
|
|
@@ -2526,7 +2560,7 @@ function jr(e, t) {
|
|
|
2526
2560
|
}
|
|
2527
2561
|
//#endregion
|
|
2528
2562
|
//#region src/embed/embed-nav-guard.ts
|
|
2529
|
-
var
|
|
2563
|
+
var Lr = E((e, t) => ({
|
|
2530
2564
|
pendingNavigation: null,
|
|
2531
2565
|
requestNavigation: (t) => e({ pendingNavigation: t }),
|
|
2532
2566
|
confirmNavigation: () => {
|
|
@@ -2537,18 +2571,18 @@ var Mr = E((e, t) => ({
|
|
|
2537
2571
|
}));
|
|
2538
2572
|
//#endregion
|
|
2539
2573
|
//#region src/embed/screen-location.ts
|
|
2540
|
-
function
|
|
2574
|
+
function Rr(e) {
|
|
2541
2575
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2542
2576
|
return RegExp("^" + t.join("/") + "$");
|
|
2543
2577
|
}
|
|
2544
|
-
function
|
|
2578
|
+
function zr(e, t) {
|
|
2545
2579
|
let n = e.replace(/\/+$/, "") || "/";
|
|
2546
2580
|
if (!t) return {
|
|
2547
2581
|
matched: !1,
|
|
2548
2582
|
payload: { route: e }
|
|
2549
2583
|
};
|
|
2550
2584
|
let r, i, a, o;
|
|
2551
|
-
for (let [e, s] of Object.entries(t)) if (s.route &&
|
|
2585
|
+
for (let [e, s] of Object.entries(t)) if (s.route && Rr(s.route).test(n)) {
|
|
2552
2586
|
if (s.route.includes("/:")) a || (a = s, o = e);
|
|
2553
2587
|
else {
|
|
2554
2588
|
r = s, i = e;
|
|
@@ -2575,34 +2609,34 @@ function Pr(e, t) {
|
|
|
2575
2609
|
payload: l
|
|
2576
2610
|
};
|
|
2577
2611
|
}
|
|
2578
|
-
function
|
|
2579
|
-
return
|
|
2612
|
+
function Br(e, t) {
|
|
2613
|
+
return zr(e, t).payload;
|
|
2580
2614
|
}
|
|
2581
2615
|
//#endregion
|
|
2582
2616
|
//#region src/embed/useEmbedNavigate.ts
|
|
2583
|
-
function
|
|
2617
|
+
function Vr(e) {
|
|
2584
2618
|
let t = e.search(/[?#]/);
|
|
2585
2619
|
return t === -1 ? e : e.slice(0, t);
|
|
2586
2620
|
}
|
|
2587
|
-
function
|
|
2588
|
-
let e = h(), t = m(), n =
|
|
2621
|
+
function Hr() {
|
|
2622
|
+
let e = h(), t = m(), n = Pr(), { data: r } = X();
|
|
2589
2623
|
return s((i, a) => {
|
|
2590
2624
|
if (!n.enabled) return e(i, a), !0;
|
|
2591
|
-
let o = r?.screens, s =
|
|
2592
|
-
if (o && !s.matched) return
|
|
2593
|
-
route:
|
|
2625
|
+
let o = r?.screens, s = zr(Vr(i), o), c = Fr.getState().isDirty && Vr(i) !== t.pathname;
|
|
2626
|
+
if (o && !s.matched) return Ot(n.parentOrigin, Dt.navigationFailed, {
|
|
2627
|
+
route: Vr(i),
|
|
2594
2628
|
reason: "unresolved"
|
|
2595
2629
|
}), !1;
|
|
2596
2630
|
if (n.navigationMode === "delegated") {
|
|
2597
2631
|
let e = () => {
|
|
2598
|
-
|
|
2632
|
+
Ot(n.parentOrigin, Dt.navigationRequested, s.payload);
|
|
2599
2633
|
};
|
|
2600
|
-
return c ? (
|
|
2634
|
+
return c ? (Lr.getState().requestNavigation(e), !1) : (e(), !1);
|
|
2601
2635
|
}
|
|
2602
2636
|
let l = () => {
|
|
2603
2637
|
e(n.appendEmbedParams(i), a);
|
|
2604
2638
|
};
|
|
2605
|
-
return c ? (
|
|
2639
|
+
return c ? (Lr.getState().requestNavigation(l), !1) : (l(), !0);
|
|
2606
2640
|
}, [
|
|
2607
2641
|
e,
|
|
2608
2642
|
t.pathname,
|
|
@@ -2610,29 +2644,29 @@ function Lr() {
|
|
|
2610
2644
|
r?.screens
|
|
2611
2645
|
]);
|
|
2612
2646
|
}
|
|
2613
|
-
function
|
|
2614
|
-
let e =
|
|
2647
|
+
function Ur() {
|
|
2648
|
+
let e = Hr();
|
|
2615
2649
|
return s((t, n) => {
|
|
2616
2650
|
e(t, n);
|
|
2617
2651
|
}, [e]);
|
|
2618
2652
|
}
|
|
2619
|
-
function
|
|
2653
|
+
function Wr() {
|
|
2620
2654
|
let e = h();
|
|
2621
2655
|
return s(() => {
|
|
2622
2656
|
let t = () => {
|
|
2623
2657
|
e(-1);
|
|
2624
2658
|
};
|
|
2625
|
-
if (
|
|
2626
|
-
|
|
2659
|
+
if (Fr.getState().isDirty) {
|
|
2660
|
+
Lr.getState().requestNavigation(t);
|
|
2627
2661
|
return;
|
|
2628
2662
|
}
|
|
2629
2663
|
t();
|
|
2630
2664
|
}, [e]);
|
|
2631
2665
|
}
|
|
2632
|
-
function
|
|
2633
|
-
let e =
|
|
2666
|
+
function Gr() {
|
|
2667
|
+
let e = Pr();
|
|
2634
2668
|
return s((t, n) => {
|
|
2635
|
-
e.enabled &&
|
|
2669
|
+
e.enabled && Ot(e.parentOrigin, Dt.navigationFailed, {
|
|
2636
2670
|
route: t,
|
|
2637
2671
|
reason: n
|
|
2638
2672
|
});
|
|
@@ -2640,7 +2674,7 @@ function Br() {
|
|
|
2640
2674
|
}
|
|
2641
2675
|
//#endregion
|
|
2642
2676
|
//#region src/components/shared/toast/DeclarionToast.tsx
|
|
2643
|
-
var
|
|
2677
|
+
var Kr = {
|
|
2644
2678
|
success: {
|
|
2645
2679
|
tone: "success",
|
|
2646
2680
|
defaultTitle: "Success"
|
|
@@ -2661,8 +2695,8 @@ var Vr = {
|
|
|
2661
2695
|
tone: "info",
|
|
2662
2696
|
defaultTitle: "Working…"
|
|
2663
2697
|
}
|
|
2664
|
-
},
|
|
2665
|
-
function
|
|
2698
|
+
}, qr = 200;
|
|
2699
|
+
function Jr({ type: e }) {
|
|
2666
2700
|
let n = { display: "flex" };
|
|
2667
2701
|
if (e === "loading") return /* @__PURE__ */ b("span", {
|
|
2668
2702
|
style: {
|
|
@@ -2677,9 +2711,9 @@ function Ur({ type: e }) {
|
|
|
2677
2711
|
children: /* @__PURE__ */ b(r, { size: 11 })
|
|
2678
2712
|
});
|
|
2679
2713
|
}
|
|
2680
|
-
function
|
|
2681
|
-
let r =
|
|
2682
|
-
S.current || (S.current = !0, g(!0), window.setTimeout(n,
|
|
2714
|
+
function Yr({ model: e, onClose: n }) {
|
|
2715
|
+
let r = Kr[e.type] ?? Kr.info, i = r.tone, [a, o] = p(!1), [c, u] = p(!1), [d, m] = p(!1), [h, g] = p(!1), [_, v] = p(1), y = f(e.duration), S = f(!1), C = !e.sticky && e.duration > 0, w = s(() => {
|
|
2716
|
+
S.current || (S.current = !0, g(!0), window.setTimeout(n, qr));
|
|
2683
2717
|
}, [n]);
|
|
2684
2718
|
l(() => {
|
|
2685
2719
|
y.current = e.duration, v(1);
|
|
@@ -2728,7 +2762,7 @@ function Wr({ model: e, onClose: n }) {
|
|
|
2728
2762
|
boxShadow: "var(--shadow-toast)",
|
|
2729
2763
|
overflow: "hidden",
|
|
2730
2764
|
position: "relative",
|
|
2731
|
-
animation: h ? `dz-toast-out ${
|
|
2765
|
+
animation: h ? `dz-toast-out ${qr}ms ease-in forwards` : "dz-toast-in 0.24s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
2732
2766
|
},
|
|
2733
2767
|
children: [/* @__PURE__ */ x("div", {
|
|
2734
2768
|
style: {
|
|
@@ -2750,7 +2784,7 @@ function Wr({ model: e, onClose: n }) {
|
|
|
2750
2784
|
justifyContent: "center",
|
|
2751
2785
|
color: E("")
|
|
2752
2786
|
},
|
|
2753
|
-
children: /* @__PURE__ */ b(
|
|
2787
|
+
children: /* @__PURE__ */ b(Jr, { type: e.type })
|
|
2754
2788
|
}),
|
|
2755
2789
|
/* @__PURE__ */ x("div", {
|
|
2756
2790
|
style: {
|
|
@@ -2943,40 +2977,40 @@ function Wr({ model: e, onClose: n }) {
|
|
|
2943
2977
|
}
|
|
2944
2978
|
//#endregion
|
|
2945
2979
|
//#region src/lib/toast.tsx
|
|
2946
|
-
var
|
|
2980
|
+
var Xr = {
|
|
2947
2981
|
success: 4e3,
|
|
2948
2982
|
info: 6e3,
|
|
2949
2983
|
warning: 8e3,
|
|
2950
2984
|
error: 0,
|
|
2951
2985
|
loading: 0
|
|
2952
|
-
},
|
|
2953
|
-
function
|
|
2954
|
-
v.custom(() => /* @__PURE__ */ b(
|
|
2986
|
+
}, Zr = /* @__PURE__ */ new Map(), Qr = /* @__PURE__ */ new Map(), $r = 0, ei = () => `dz-${++$r}`;
|
|
2987
|
+
function ti(e) {
|
|
2988
|
+
v.custom(() => /* @__PURE__ */ b(Yr, {
|
|
2955
2989
|
model: e,
|
|
2956
2990
|
onClose: () => v.dismiss(e.id)
|
|
2957
2991
|
}), {
|
|
2958
2992
|
id: e.id,
|
|
2959
2993
|
duration: Infinity,
|
|
2960
2994
|
onDismiss: () => {
|
|
2961
|
-
|
|
2995
|
+
Zr.delete(String(e.id)), e.group && Qr.get(e.group) === e.id && Qr.delete(e.group);
|
|
2962
2996
|
}
|
|
2963
2997
|
});
|
|
2964
2998
|
}
|
|
2965
|
-
function
|
|
2999
|
+
function ni(e, t, n, r = {}) {
|
|
2966
3000
|
if (r.group) {
|
|
2967
|
-
let e =
|
|
2968
|
-
if (e &&
|
|
2969
|
-
let r =
|
|
3001
|
+
let e = Qr.get(r.group);
|
|
3002
|
+
if (e && Zr.has(e)) {
|
|
3003
|
+
let r = Zr.get(e), i = {
|
|
2970
3004
|
...r,
|
|
2971
3005
|
title: t,
|
|
2972
3006
|
message: n,
|
|
2973
3007
|
count: (r.count ?? 1) + 1,
|
|
2974
3008
|
createdAt: Date.now()
|
|
2975
3009
|
};
|
|
2976
|
-
return
|
|
3010
|
+
return Zr.set(e, i), ti(i), e;
|
|
2977
3011
|
}
|
|
2978
3012
|
}
|
|
2979
|
-
let i = r.id ??
|
|
3013
|
+
let i = r.id ?? ei(), a = r.duration ?? Xr[e], o = {
|
|
2980
3014
|
id: i,
|
|
2981
3015
|
type: e,
|
|
2982
3016
|
title: t,
|
|
@@ -2990,12 +3024,12 @@ function Zr(e, t, n, r = {}) {
|
|
|
2990
3024
|
createdAt: Date.now(),
|
|
2991
3025
|
group: r.group
|
|
2992
3026
|
};
|
|
2993
|
-
return
|
|
3027
|
+
return Zr.set(i, o), r.group && Qr.set(r.group, i), ti(o), i;
|
|
2994
3028
|
}
|
|
2995
|
-
function
|
|
2996
|
-
let n =
|
|
3029
|
+
function ri(e, t) {
|
|
3030
|
+
let n = Zr.get(e);
|
|
2997
3031
|
if (!n) return;
|
|
2998
|
-
let r = t.type ?? n.type, i = t.duration ?? (t.type ?
|
|
3032
|
+
let r = t.type ?? n.type, i = t.duration ?? (t.type ? Xr[r] : n.duration), a = {
|
|
2999
3033
|
...n,
|
|
3000
3034
|
...t,
|
|
3001
3035
|
type: r,
|
|
@@ -3003,48 +3037,48 @@ function Qr(e, t) {
|
|
|
3003
3037
|
sticky: t.sticky ?? i === 0,
|
|
3004
3038
|
createdAt: Date.now()
|
|
3005
3039
|
};
|
|
3006
|
-
|
|
3040
|
+
Zr.set(e, a), ti(a);
|
|
3007
3041
|
}
|
|
3008
3042
|
var Z = {
|
|
3009
|
-
success: (e, t, n) =>
|
|
3010
|
-
info: (e, t, n) =>
|
|
3011
|
-
warning: (e, t, n) =>
|
|
3012
|
-
error: (e, t, n) =>
|
|
3013
|
-
loading: (e, t, n) =>
|
|
3014
|
-
update:
|
|
3043
|
+
success: (e, t, n) => ni("success", e, t, n),
|
|
3044
|
+
info: (e, t, n) => ni("info", e, t, n),
|
|
3045
|
+
warning: (e, t, n) => ni("warning", e, t, n),
|
|
3046
|
+
error: (e, t, n) => ni("error", e, t, n),
|
|
3047
|
+
loading: (e, t, n) => ni("loading", e, t, n),
|
|
3048
|
+
update: ri,
|
|
3015
3049
|
dismiss: (e) => v.dismiss(e),
|
|
3016
3050
|
dismissAll: () => v.dismiss()
|
|
3017
|
-
},
|
|
3018
|
-
function
|
|
3051
|
+
}, ii = o(() => import("./MarkdownRenderer-CJrVG5HZ.js").then((e) => ({ default: e.MarkdownRenderer })));
|
|
3052
|
+
function ai() {
|
|
3019
3053
|
return /* @__PURE__ */ b("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
|
|
3020
3054
|
}
|
|
3021
|
-
function
|
|
3055
|
+
function oi(e) {
|
|
3022
3056
|
return /* @__PURE__ */ b(r, {
|
|
3023
|
-
fallback: /* @__PURE__ */ b(
|
|
3024
|
-
children: /* @__PURE__ */ b(
|
|
3057
|
+
fallback: /* @__PURE__ */ b(ai, {}),
|
|
3058
|
+
children: /* @__PURE__ */ b(ii, { ...e })
|
|
3025
3059
|
});
|
|
3026
3060
|
}
|
|
3027
3061
|
//#endregion
|
|
3028
3062
|
//#region src/lib/safe-url.ts
|
|
3029
|
-
var
|
|
3063
|
+
var si = [
|
|
3030
3064
|
"http:",
|
|
3031
3065
|
"https:",
|
|
3032
3066
|
"mailto:"
|
|
3033
|
-
],
|
|
3034
|
-
function
|
|
3067
|
+
], ci = /[\u0000-\u001f\u007f]/g;
|
|
3068
|
+
function li(e) {
|
|
3035
3069
|
if (!e) return;
|
|
3036
3070
|
let t = e.trim();
|
|
3037
3071
|
if (!t) return;
|
|
3038
|
-
let n = t.replace(
|
|
3072
|
+
let n = t.replace(ci, "");
|
|
3039
3073
|
if (!n || n.startsWith("//")) return;
|
|
3040
3074
|
let r = n.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);
|
|
3041
3075
|
if (r) {
|
|
3042
3076
|
let e = r[1].toLowerCase() + ":";
|
|
3043
|
-
if (!
|
|
3077
|
+
if (!si.includes(e)) return;
|
|
3044
3078
|
}
|
|
3045
3079
|
return n;
|
|
3046
3080
|
}
|
|
3047
|
-
function
|
|
3081
|
+
function ui(e) {
|
|
3048
3082
|
if (!e) return !1;
|
|
3049
3083
|
if (e.startsWith("//")) return !0;
|
|
3050
3084
|
let t = typeof window < "u" ? window.location.href : "http://localhost/", n;
|
|
@@ -3059,48 +3093,45 @@ function ai(e) {
|
|
|
3059
3093
|
}
|
|
3060
3094
|
//#endregion
|
|
3061
3095
|
//#region src/lib/download.ts
|
|
3062
|
-
var
|
|
3096
|
+
var di = class extends Error {
|
|
3063
3097
|
code;
|
|
3064
3098
|
constructor(e, t) {
|
|
3065
3099
|
super(e), this.code = t, this.name = "DownloadError";
|
|
3066
3100
|
}
|
|
3067
3101
|
};
|
|
3068
|
-
function
|
|
3069
|
-
return e instanceof
|
|
3102
|
+
function fi(e) {
|
|
3103
|
+
return e instanceof di && e.code === "file.not_found";
|
|
3070
3104
|
}
|
|
3071
|
-
async function
|
|
3072
|
-
let n =
|
|
3073
|
-
if (!n) throw new
|
|
3105
|
+
async function pi(e, t) {
|
|
3106
|
+
let n = li(e);
|
|
3107
|
+
if (!n) throw new di(`Refused to download from an unsafe URL: ${e}`);
|
|
3074
3108
|
let r = await fetch(n, { credentials: "same-origin" });
|
|
3075
3109
|
if (!r.ok) {
|
|
3076
|
-
let e = await
|
|
3077
|
-
throw new
|
|
3110
|
+
let e = await mi(r);
|
|
3111
|
+
throw new di(e.message || `Download failed (${r.status})`, e.code);
|
|
3078
3112
|
}
|
|
3079
3113
|
let i = await r.blob(), a = URL.createObjectURL(i), o = document.createElement("a");
|
|
3080
3114
|
o.href = a, t && (o.download = t), document.body.appendChild(o), o.click(), o.remove(), URL.revokeObjectURL(a);
|
|
3081
3115
|
}
|
|
3082
|
-
async function
|
|
3116
|
+
async function mi(e) {
|
|
3083
3117
|
let t = await e.text();
|
|
3084
3118
|
if (!t) return {};
|
|
3085
3119
|
try {
|
|
3086
3120
|
let e = JSON.parse(t);
|
|
3087
|
-
return
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
} : {
|
|
3091
|
-
code: e.error?.code ?? e.code,
|
|
3092
|
-
message: e.error?.message ?? e.message
|
|
3093
|
-
};
|
|
3121
|
+
return mt(e) ? {
|
|
3122
|
+
code: pt(e.type),
|
|
3123
|
+
message: e.title
|
|
3124
|
+
} : { message: t };
|
|
3094
3125
|
} catch {
|
|
3095
3126
|
return { message: t };
|
|
3096
3127
|
}
|
|
3097
3128
|
}
|
|
3098
3129
|
//#endregion
|
|
3099
3130
|
//#region src/types/fieldType.ts
|
|
3100
|
-
var
|
|
3131
|
+
var hi = /* @__PURE__ */ "bool.bytes.date.decimal.email.enum.float.int.int_array.json.multilang.multilang_text.password.phone.ref.rich_text.secret.string.string_array.structure.tags.text.time.timestamp.url.uuid.uuid_array".split(".");
|
|
3101
3132
|
//#endregion
|
|
3102
3133
|
//#region src/components/shared/CopyButton.tsx
|
|
3103
|
-
function
|
|
3134
|
+
function gi({ value: e, title: n, size: r = "icon" }) {
|
|
3104
3135
|
let [i, a] = p(!1), o = s(async (t) => {
|
|
3105
3136
|
t.stopPropagation(), t.preventDefault();
|
|
3106
3137
|
try {
|
|
@@ -3119,7 +3150,7 @@ function di({ value: e, title: n, size: r = "icon" }) {
|
|
|
3119
3150
|
}
|
|
3120
3151
|
//#endregion
|
|
3121
3152
|
//#region src/components/fields/StringField.tsx
|
|
3122
|
-
function
|
|
3153
|
+
function _i({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3123
3154
|
if (r === "display") {
|
|
3124
3155
|
let t = R(n);
|
|
3125
3156
|
return e.copyable && t ? /* @__PURE__ */ x("span", {
|
|
@@ -3131,7 +3162,7 @@ function fi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3131
3162
|
children: [/* @__PURE__ */ b("span", {
|
|
3132
3163
|
style: { fontSize: 12.5 },
|
|
3133
3164
|
children: t
|
|
3134
|
-
}), /* @__PURE__ */ b(
|
|
3165
|
+
}), /* @__PURE__ */ b(gi, {
|
|
3135
3166
|
value: t,
|
|
3136
3167
|
size: "sm"
|
|
3137
3168
|
})]
|
|
@@ -3153,7 +3184,7 @@ function fi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3153
3184
|
}
|
|
3154
3185
|
//#endregion
|
|
3155
3186
|
//#region src/components/fields/TextField.tsx
|
|
3156
|
-
function
|
|
3187
|
+
function vi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, compact: o, fieldId: s }) {
|
|
3157
3188
|
let c = e.display?.widget;
|
|
3158
3189
|
if (r === "display") {
|
|
3159
3190
|
let t = R(n);
|
|
@@ -3164,7 +3195,7 @@ function pi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
3164
3195
|
},
|
|
3165
3196
|
children: "—"
|
|
3166
3197
|
});
|
|
3167
|
-
let r = c === "markdown" ? /* @__PURE__ */ b(
|
|
3198
|
+
let r = c === "markdown" ? /* @__PURE__ */ b(oi, { content: t }) : c === "code" ? /* @__PURE__ */ b("pre", {
|
|
3168
3199
|
className: "mono",
|
|
3169
3200
|
style: {
|
|
3170
3201
|
fontSize: 12,
|
|
@@ -3196,7 +3227,7 @@ function pi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
3196
3227
|
top: 0,
|
|
3197
3228
|
right: 0
|
|
3198
3229
|
},
|
|
3199
|
-
children: /* @__PURE__ */ b(
|
|
3230
|
+
children: /* @__PURE__ */ b(gi, {
|
|
3200
3231
|
value: t,
|
|
3201
3232
|
size: "sm"
|
|
3202
3233
|
})
|
|
@@ -3223,8 +3254,8 @@ function pi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
3223
3254
|
}
|
|
3224
3255
|
//#endregion
|
|
3225
3256
|
//#region src/components/fields/EnumField.tsx
|
|
3226
|
-
var
|
|
3227
|
-
function
|
|
3257
|
+
var yi = "__declarion_enum_null__";
|
|
3258
|
+
function bi({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }) {
|
|
3228
3259
|
let o = e.values ?? [], s = o.find((e) => e.code === t);
|
|
3229
3260
|
if (n === "display") return s ? /* @__PURE__ */ b(A, {
|
|
3230
3261
|
tone: s.color ?? "slate",
|
|
@@ -3237,8 +3268,8 @@ function hi({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
3237
3268
|
},
|
|
3238
3269
|
children: "—"
|
|
3239
3270
|
});
|
|
3240
|
-
let c = !e.required, l = t != null && t !== "" ? R(t) :
|
|
3241
|
-
value:
|
|
3271
|
+
let c = !e.required, l = t != null && t !== "" ? R(t) : yi, u = [...c ? [{
|
|
3272
|
+
value: yi,
|
|
3242
3273
|
label: "— None —"
|
|
3243
3274
|
}] : [], ...o.map((e) => ({
|
|
3244
3275
|
value: e.code,
|
|
@@ -3250,13 +3281,13 @@ function hi({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
3250
3281
|
"aria-required": e.required || void 0,
|
|
3251
3282
|
value: l,
|
|
3252
3283
|
options: u,
|
|
3253
|
-
onChange: (e) => r?.(e ===
|
|
3284
|
+
onChange: (e) => r?.(e === yi ? null : e),
|
|
3254
3285
|
placeholder: "Select…"
|
|
3255
3286
|
});
|
|
3256
3287
|
}
|
|
3257
3288
|
//#endregion
|
|
3258
3289
|
//#region src/components/fields/EmailField.tsx
|
|
3259
|
-
function
|
|
3290
|
+
function xi({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3260
3291
|
return /* @__PURE__ */ b(F, {
|
|
3261
3292
|
id: i,
|
|
3262
3293
|
name: t,
|
|
@@ -3268,7 +3299,7 @@ function gi({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3268
3299
|
}
|
|
3269
3300
|
//#endregion
|
|
3270
3301
|
//#region src/components/fields/UrlField.tsx
|
|
3271
|
-
function
|
|
3302
|
+
function Si({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3272
3303
|
return /* @__PURE__ */ b(F, {
|
|
3273
3304
|
id: i,
|
|
3274
3305
|
name: t,
|
|
@@ -3281,7 +3312,7 @@ function _i({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3281
3312
|
}
|
|
3282
3313
|
//#endregion
|
|
3283
3314
|
//#region src/components/fields/PhoneField.tsx
|
|
3284
|
-
function
|
|
3315
|
+
function Ci({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3285
3316
|
return /* @__PURE__ */ b(F, {
|
|
3286
3317
|
id: i,
|
|
3287
3318
|
name: t,
|
|
@@ -3294,23 +3325,23 @@ function vi({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3294
3325
|
}
|
|
3295
3326
|
//#endregion
|
|
3296
3327
|
//#region src/components/fields/TimestampField.tsx
|
|
3297
|
-
var
|
|
3328
|
+
var wi = {
|
|
3298
3329
|
year: "numeric",
|
|
3299
3330
|
month: "short",
|
|
3300
3331
|
day: "numeric"
|
|
3301
|
-
},
|
|
3302
|
-
...
|
|
3332
|
+
}, Ti = {
|
|
3333
|
+
...wi,
|
|
3303
3334
|
hour: "2-digit",
|
|
3304
3335
|
minute: "2-digit"
|
|
3305
3336
|
};
|
|
3306
|
-
function
|
|
3337
|
+
function Ei(e, t) {
|
|
3307
3338
|
if (t) {
|
|
3308
3339
|
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
3309
|
-
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0,
|
|
3340
|
+
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0, wi).format(t);
|
|
3310
3341
|
}
|
|
3311
|
-
return Ve(e,
|
|
3342
|
+
return Ve(e, Ti);
|
|
3312
3343
|
}
|
|
3313
|
-
function
|
|
3344
|
+
function Di(e, t) {
|
|
3314
3345
|
if (t) {
|
|
3315
3346
|
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
3316
3347
|
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0, {
|
|
@@ -3328,14 +3359,14 @@ function Si(e, t) {
|
|
|
3328
3359
|
minute: "2-digit"
|
|
3329
3360
|
}).format(n);
|
|
3330
3361
|
}
|
|
3331
|
-
function
|
|
3362
|
+
function Oi(e) {
|
|
3332
3363
|
if (e.endsWith("Z")) return "UTC";
|
|
3333
3364
|
let t = e.match(/([+-]\d{2}:\d{2})$/);
|
|
3334
3365
|
if (!t) return null;
|
|
3335
3366
|
let n = t[1].charAt(0), r = parseInt(t[1].substring(1, 3), 10), i = parseInt(t[1].substring(4, 6), 10);
|
|
3336
3367
|
return r === 0 && i === 0 ? "UTC" : `UTC${n}${r}${i > 0 ? `:${String(i).padStart(2, "0")}` : ""}`;
|
|
3337
3368
|
}
|
|
3338
|
-
function
|
|
3369
|
+
function ki(e, t) {
|
|
3339
3370
|
let n = e.match(/([+-]\d{2}:\d{2})$/), r = e.endsWith("Z"), i = new Date(e);
|
|
3340
3371
|
if (isNaN(i.getTime())) return "";
|
|
3341
3372
|
if (r) {
|
|
@@ -3348,13 +3379,13 @@ function wi(e, t) {
|
|
|
3348
3379
|
}
|
|
3349
3380
|
return t ? e.slice(0, 10) : e.slice(0, 16);
|
|
3350
3381
|
}
|
|
3351
|
-
function
|
|
3382
|
+
function Ai(e, t) {
|
|
3352
3383
|
let n = new Date(e);
|
|
3353
3384
|
if (isNaN(n.getTime())) return "";
|
|
3354
3385
|
let r = n.getFullYear(), i = String(n.getMonth() + 1).padStart(2, "0"), a = String(n.getDate()).padStart(2, "0");
|
|
3355
3386
|
return t ? `${r}-${i}-${a}` : `${r}-${i}-${a}T${String(n.getHours()).padStart(2, "0")}:${String(n.getMinutes()).padStart(2, "0")}`;
|
|
3356
3387
|
}
|
|
3357
|
-
function
|
|
3388
|
+
function ji({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3358
3389
|
let o = e.type === "date", s = !!e.timezone;
|
|
3359
3390
|
if (r === "display") {
|
|
3360
3391
|
if (!n) return /* @__PURE__ */ b("span", {
|
|
@@ -3364,7 +3395,7 @@ function Ei({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3364
3395
|
},
|
|
3365
3396
|
children: "—"
|
|
3366
3397
|
});
|
|
3367
|
-
let e = R(n), t = s ?
|
|
3398
|
+
let e = R(n), t = s ? Ei(e, o) : Di(e, o), r = s && !o ? Oi(e) : null;
|
|
3368
3399
|
return /* @__PURE__ */ x("span", {
|
|
3369
3400
|
style: { fontSize: 12.5 },
|
|
3370
3401
|
children: [t, r && /* @__PURE__ */ b("span", {
|
|
@@ -3376,7 +3407,7 @@ function Ei({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3376
3407
|
})]
|
|
3377
3408
|
});
|
|
3378
3409
|
}
|
|
3379
|
-
let c = n ? s ?
|
|
3410
|
+
let c = n ? s ? ki(R(n), o) : Ai(R(n), o) : "";
|
|
3380
3411
|
return /* @__PURE__ */ b(F, {
|
|
3381
3412
|
id: a,
|
|
3382
3413
|
name: t,
|
|
@@ -3403,7 +3434,7 @@ function Ei({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3403
3434
|
}
|
|
3404
3435
|
//#endregion
|
|
3405
3436
|
//#region src/components/fields/BoolField.tsx
|
|
3406
|
-
function
|
|
3437
|
+
function Mi({ value: e, mode: t, onChange: n, fieldId: r, labelId: i }) {
|
|
3407
3438
|
let a = !!e;
|
|
3408
3439
|
return t === "display" ? /* @__PURE__ */ x("span", {
|
|
3409
3440
|
style: {
|
|
@@ -3428,7 +3459,7 @@ function Di({ value: e, mode: t, onChange: n, fieldId: r, labelId: i }) {
|
|
|
3428
3459
|
}
|
|
3429
3460
|
//#endregion
|
|
3430
3461
|
//#region src/components/fields/NumberField.tsx
|
|
3431
|
-
function
|
|
3462
|
+
function Ni(e) {
|
|
3432
3463
|
let t = e.trim();
|
|
3433
3464
|
if (t === "" || t === "-") return t;
|
|
3434
3465
|
let n = t.startsWith("-"), [r, i] = (n ? t.slice(1) : t).split("."), a;
|
|
@@ -3440,8 +3471,8 @@ function Oi(e) {
|
|
|
3440
3471
|
let o = n ? `-${a}` : a;
|
|
3441
3472
|
return i !== void 0 && (o += `.${i}`), o;
|
|
3442
3473
|
}
|
|
3443
|
-
var
|
|
3444
|
-
function
|
|
3474
|
+
var Pi = new Intl.NumberFormat();
|
|
3475
|
+
function Fi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a, fieldId: o }) {
|
|
3445
3476
|
let s = e.display?.widget === "money", c = e.type === "decimal" || s, l = a?.$units?.[t], u = !l && e.unit ? e.unit.display || e.unit.storage : void 0, d = l || (u && !u.startsWith("$") ? u : void 0);
|
|
3446
3477
|
if (r === "display") {
|
|
3447
3478
|
if (n == null) return /* @__PURE__ */ b("span", {
|
|
@@ -3452,10 +3483,10 @@ function Ai({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3452
3483
|
children: "—"
|
|
3453
3484
|
});
|
|
3454
3485
|
let e;
|
|
3455
|
-
if (c && typeof n == "string") e =
|
|
3486
|
+
if (c && typeof n == "string") e = Ni(n);
|
|
3456
3487
|
else {
|
|
3457
3488
|
let t = Number(n);
|
|
3458
|
-
e = isNaN(t) ? null :
|
|
3489
|
+
e = isNaN(t) ? null : Pi.format(t);
|
|
3459
3490
|
}
|
|
3460
3491
|
return e == null ? /* @__PURE__ */ b("span", {
|
|
3461
3492
|
style: { fontSize: 12.5 },
|
|
@@ -3500,7 +3531,7 @@ function Ai({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3500
3531
|
}
|
|
3501
3532
|
//#endregion
|
|
3502
3533
|
//#region src/hooks/useEntityData.ts
|
|
3503
|
-
function
|
|
3534
|
+
function Ii(e, t) {
|
|
3504
3535
|
return [
|
|
3505
3536
|
"entity-data",
|
|
3506
3537
|
e,
|
|
@@ -3510,16 +3541,16 @@ function ji(e, t) {
|
|
|
3510
3541
|
}
|
|
3511
3542
|
];
|
|
3512
3543
|
}
|
|
3513
|
-
function
|
|
3514
|
-
let r =
|
|
3544
|
+
function Li(e, t, n = !0) {
|
|
3545
|
+
let r = Ii(e, t), i = r[2];
|
|
3515
3546
|
return g({
|
|
3516
3547
|
queryKey: r,
|
|
3517
|
-
queryFn: ({ signal: t }) =>
|
|
3548
|
+
queryFn: ({ signal: t }) => tr(e, i, { signal: t }),
|
|
3518
3549
|
enabled: !!e && n,
|
|
3519
3550
|
placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
|
|
3520
3551
|
});
|
|
3521
3552
|
}
|
|
3522
|
-
function
|
|
3553
|
+
function Ri(e, t, n = !0) {
|
|
3523
3554
|
let r = {
|
|
3524
3555
|
...t,
|
|
3525
3556
|
count: "only",
|
|
@@ -3535,7 +3566,7 @@ function Ni(e, t, n = !0) {
|
|
|
3535
3566
|
e,
|
|
3536
3567
|
r
|
|
3537
3568
|
],
|
|
3538
|
-
queryFn: ({ signal: t }) =>
|
|
3569
|
+
queryFn: ({ signal: t }) => tr(e, r, { signal: t }),
|
|
3539
3570
|
enabled: !!e && n,
|
|
3540
3571
|
retry: 1,
|
|
3541
3572
|
staleTime: 3e4,
|
|
@@ -3544,7 +3575,7 @@ function Ni(e, t, n = !0) {
|
|
|
3544
3575
|
}
|
|
3545
3576
|
//#endregion
|
|
3546
3577
|
//#region src/hooks/useDebounce.ts
|
|
3547
|
-
function
|
|
3578
|
+
function zi(e, t) {
|
|
3548
3579
|
let [n, r] = p(e);
|
|
3549
3580
|
return l(() => {
|
|
3550
3581
|
let n = setTimeout(() => r(e), t);
|
|
@@ -3553,16 +3584,16 @@ function Pi(e, t) {
|
|
|
3553
3584
|
}
|
|
3554
3585
|
//#endregion
|
|
3555
3586
|
//#region src/hooks/useEntity.ts
|
|
3556
|
-
function
|
|
3587
|
+
function Bi(e) {
|
|
3557
3588
|
let { data: t } = X();
|
|
3558
3589
|
if (!(!t || !e)) return t.entities[e];
|
|
3559
3590
|
}
|
|
3560
3591
|
//#endregion
|
|
3561
3592
|
//#region src/components/fields/RefCombobox.tsx
|
|
3562
|
-
var
|
|
3563
|
-
function
|
|
3564
|
-
let m = e?.entity, h =
|
|
3565
|
-
per_page:
|
|
3593
|
+
var Vi = 200;
|
|
3594
|
+
function Hi({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, id: a, labelId: o, ariaLabel: s, required: c, placeholder: l = "Select…", specialValues: u }) {
|
|
3595
|
+
let m = e?.entity, h = Bi(m), g = i ?? e?.display?.field ?? h?.display?.display_field ?? "$display", _ = d(() => h ? B(h)[0] ?? "id" : "id", [h]), v = e?.field || _, [y, x] = p(""), S = zi(y, 300), { data: C, isLoading: w } = Li(m, {
|
|
3596
|
+
per_page: Vi,
|
|
3566
3597
|
sort: g ? `${g}:asc` : void 0,
|
|
3567
3598
|
search: S || void 0,
|
|
3568
3599
|
filters: e?.options_filter
|
|
@@ -3570,7 +3601,7 @@ function Li({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3570
3601
|
T,
|
|
3571
3602
|
v,
|
|
3572
3603
|
E
|
|
3573
|
-
]), O = r && m ? r[m]?.[E] : void 0, k = !!u?.some((e) => e.code === E), { data: A } =
|
|
3604
|
+
]), O = r && m ? r[m]?.[E] : void 0, k = !!u?.some((e) => e.code === E), { data: A } = Li(E && !D && !k && !O && !w ? m : void 0, {
|
|
3574
3605
|
per_page: 1,
|
|
3575
3606
|
filters: [{
|
|
3576
3607
|
field: v,
|
|
@@ -3580,13 +3611,13 @@ function Li({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3580
3611
|
}), j = f(null), M = d(() => {
|
|
3581
3612
|
if (!E) return "";
|
|
3582
3613
|
let e;
|
|
3583
|
-
if (O) e =
|
|
3614
|
+
if (O) e = Ke(O, g, E);
|
|
3584
3615
|
else {
|
|
3585
3616
|
let t = T.find((e) => String(e[v]) === E);
|
|
3586
|
-
if (t) e =
|
|
3617
|
+
if (t) e = Ke(t, g, E);
|
|
3587
3618
|
else {
|
|
3588
3619
|
let t = A?.data?.find((e) => String(e[v]) === E);
|
|
3589
|
-
t && (e =
|
|
3620
|
+
t && (e = Ke(t, g, E));
|
|
3590
3621
|
}
|
|
3591
3622
|
}
|
|
3592
3623
|
return e === void 0 ? j.current?.value === E ? j.current.label : E : (j.current = {
|
|
@@ -3608,7 +3639,7 @@ function Li({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3608
3639
|
let t = R(e[v]);
|
|
3609
3640
|
return {
|
|
3610
3641
|
value: t,
|
|
3611
|
-
label:
|
|
3642
|
+
label: Ke(e, g, t)
|
|
3612
3643
|
};
|
|
3613
3644
|
}), n = E && !D && !k ? [{
|
|
3614
3645
|
value: E,
|
|
@@ -3657,13 +3688,13 @@ function Li({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3657
3688
|
}
|
|
3658
3689
|
//#endregion
|
|
3659
3690
|
//#region src/components/fields/RefField.tsx
|
|
3660
|
-
function
|
|
3691
|
+
function Ui({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, labelId: o }) {
|
|
3661
3692
|
let s = e.ref?.entity, c = e.display?.ref_display_field || "$display", l = d(() => {
|
|
3662
3693
|
if (t == null) return "—";
|
|
3663
3694
|
let e = R(t);
|
|
3664
3695
|
if (i && s) {
|
|
3665
3696
|
let t = i[s]?.[e];
|
|
3666
|
-
if (t) return
|
|
3697
|
+
if (t) return Ke(t, c, e);
|
|
3667
3698
|
}
|
|
3668
3699
|
return e;
|
|
3669
3700
|
}, [
|
|
@@ -3675,7 +3706,7 @@ function Ri({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, lab
|
|
|
3675
3706
|
return n === "display" ? /* @__PURE__ */ b("span", {
|
|
3676
3707
|
style: { fontSize: 12.5 },
|
|
3677
3708
|
children: l
|
|
3678
|
-
}) : /* @__PURE__ */ b(
|
|
3709
|
+
}) : /* @__PURE__ */ b(Hi, {
|
|
3679
3710
|
ref: e.ref,
|
|
3680
3711
|
value: t,
|
|
3681
3712
|
onChange: (e) => r?.(e),
|
|
@@ -3688,29 +3719,29 @@ function Ri({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, lab
|
|
|
3688
3719
|
}
|
|
3689
3720
|
//#endregion
|
|
3690
3721
|
//#region src/components/fields/JsonField.tsx
|
|
3691
|
-
var
|
|
3692
|
-
function
|
|
3722
|
+
var Wi = o(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
3723
|
+
function Gi() {
|
|
3693
3724
|
return /* @__PURE__ */ b("div", { className: "h-20 rounded-md border border-border bg-muted animate-pulse" });
|
|
3694
3725
|
}
|
|
3695
|
-
function
|
|
3726
|
+
function Ki(e) {
|
|
3696
3727
|
return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
|
|
3697
3728
|
}
|
|
3698
|
-
function
|
|
3699
|
-
return t === "display" ?
|
|
3729
|
+
function qi({ value: e, mode: t, onChange: n, fieldId: i }) {
|
|
3730
|
+
return t === "display" ? Ki(e) ? /* @__PURE__ */ b("span", {
|
|
3700
3731
|
style: {
|
|
3701
3732
|
fontSize: 12.5,
|
|
3702
3733
|
color: "var(--text-4)"
|
|
3703
3734
|
},
|
|
3704
3735
|
children: "—"
|
|
3705
3736
|
}) : /* @__PURE__ */ b(r, {
|
|
3706
|
-
fallback: /* @__PURE__ */ b(
|
|
3707
|
-
children: /* @__PURE__ */ b(
|
|
3737
|
+
fallback: /* @__PURE__ */ b(Gi, {}),
|
|
3738
|
+
children: /* @__PURE__ */ b(Wi, {
|
|
3708
3739
|
value: e,
|
|
3709
3740
|
readOnly: !0
|
|
3710
3741
|
})
|
|
3711
3742
|
}) : /* @__PURE__ */ b(r, {
|
|
3712
|
-
fallback: /* @__PURE__ */ b(
|
|
3713
|
-
children: /* @__PURE__ */ b(
|
|
3743
|
+
fallback: /* @__PURE__ */ b(Gi, {}),
|
|
3744
|
+
children: /* @__PURE__ */ b(Wi, {
|
|
3714
3745
|
value: e,
|
|
3715
3746
|
onChange: n,
|
|
3716
3747
|
id: i
|
|
@@ -3719,14 +3750,14 @@ function Hi({ value: e, mode: t, onChange: n, fieldId: i }) {
|
|
|
3719
3750
|
}
|
|
3720
3751
|
//#endregion
|
|
3721
3752
|
//#region src/components/fields/MultilangField.tsx
|
|
3722
|
-
function
|
|
3753
|
+
function Ji(e) {
|
|
3723
3754
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
3724
3755
|
}
|
|
3725
|
-
function
|
|
3756
|
+
function Yi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3726
3757
|
let { data: o } = X(), s = o?.languages?.length ? o.languages : [{
|
|
3727
3758
|
code: "en",
|
|
3728
3759
|
name: { en: "English" }
|
|
3729
|
-
}], c =
|
|
3760
|
+
}], c = Ji(n);
|
|
3730
3761
|
if (r === "display") {
|
|
3731
3762
|
let e = Object.values(c)[0] ?? "—";
|
|
3732
3763
|
return /* @__PURE__ */ b("span", {
|
|
@@ -3785,14 +3816,14 @@ function Wi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3785
3816
|
}
|
|
3786
3817
|
//#endregion
|
|
3787
3818
|
//#region src/components/fields/MultilangTextField.tsx
|
|
3788
|
-
function
|
|
3819
|
+
function Xi(e) {
|
|
3789
3820
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
3790
3821
|
}
|
|
3791
|
-
function
|
|
3822
|
+
function Zi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3792
3823
|
let { data: o } = X(), s = o?.languages?.length ? o.languages : [{
|
|
3793
3824
|
code: "en",
|
|
3794
3825
|
name: { en: "English" }
|
|
3795
|
-
}], c =
|
|
3826
|
+
}], c = Xi(n);
|
|
3796
3827
|
if (r === "display") {
|
|
3797
3828
|
let e = Object.values(c)[0] ?? "—";
|
|
3798
3829
|
return /* @__PURE__ */ b("p", {
|
|
@@ -3851,25 +3882,25 @@ function Ki({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3851
3882
|
}
|
|
3852
3883
|
//#endregion
|
|
3853
3884
|
//#region src/components/fields/StructureField.tsx
|
|
3854
|
-
function
|
|
3885
|
+
function Qi(e) {
|
|
3855
3886
|
let { field: t, value: n, mode: r, onChange: i, locale: a, fieldId: o } = e, { data: s } = X(), c = t.structure ? s?.structures?.[t.structure] : void 0;
|
|
3856
|
-
return c ? t.array ? /* @__PURE__ */ b(
|
|
3887
|
+
return c ? t.array ? /* @__PURE__ */ b(ea, {
|
|
3857
3888
|
structDef: c,
|
|
3858
3889
|
value: n,
|
|
3859
3890
|
mode: r,
|
|
3860
3891
|
onChange: i,
|
|
3861
3892
|
locale: a,
|
|
3862
3893
|
fieldId: o
|
|
3863
|
-
}) : /* @__PURE__ */ b(
|
|
3894
|
+
}) : /* @__PURE__ */ b($i, {
|
|
3864
3895
|
structDef: c,
|
|
3865
3896
|
value: n,
|
|
3866
3897
|
mode: r,
|
|
3867
3898
|
onChange: i,
|
|
3868
3899
|
locale: a,
|
|
3869
3900
|
fieldId: o
|
|
3870
|
-
}) : /* @__PURE__ */ b(
|
|
3901
|
+
}) : /* @__PURE__ */ b(qi, { ...e });
|
|
3871
3902
|
}
|
|
3872
|
-
function
|
|
3903
|
+
function $i({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId: a }) {
|
|
3873
3904
|
let o = typeof t == "object" && t && !Array.isArray(t) ? t : {}, s = e.fields.names(), c = {
|
|
3874
3905
|
display: "flex",
|
|
3875
3906
|
flexDirection: "column",
|
|
@@ -3905,13 +3936,13 @@ function Ji({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3905
3936
|
minWidth: 0,
|
|
3906
3937
|
flex: 1
|
|
3907
3938
|
},
|
|
3908
|
-
children: n.type === "structure" && n.structure ? /* @__PURE__ */ b(
|
|
3939
|
+
children: n.type === "structure" && n.structure ? /* @__PURE__ */ b(Qi, {
|
|
3909
3940
|
field: n,
|
|
3910
3941
|
fieldName: t,
|
|
3911
3942
|
value: r,
|
|
3912
3943
|
mode: "display",
|
|
3913
3944
|
locale: i
|
|
3914
|
-
}) :
|
|
3945
|
+
}) : Cs({
|
|
3915
3946
|
field: n,
|
|
3916
3947
|
fieldName: t,
|
|
3917
3948
|
value: r,
|
|
@@ -3949,14 +3980,14 @@ function Ji({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3949
3980
|
children: [/* @__PURE__ */ b(Ce, {
|
|
3950
3981
|
required: n.required,
|
|
3951
3982
|
children: n.display ? z(n.display.name) : t
|
|
3952
|
-
}), n.type === "structure" && n.structure ? /* @__PURE__ */ b(
|
|
3983
|
+
}), n.type === "structure" && n.structure ? /* @__PURE__ */ b(Qi, {
|
|
3953
3984
|
field: n,
|
|
3954
3985
|
fieldName: t,
|
|
3955
3986
|
value: o[t],
|
|
3956
3987
|
mode: "edit",
|
|
3957
3988
|
onChange: l(t),
|
|
3958
3989
|
locale: i
|
|
3959
|
-
}) :
|
|
3990
|
+
}) : Cs({
|
|
3960
3991
|
field: n,
|
|
3961
3992
|
fieldName: t,
|
|
3962
3993
|
value: o[t],
|
|
@@ -3968,7 +3999,7 @@ function Ji({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3968
3999
|
})
|
|
3969
4000
|
});
|
|
3970
4001
|
}
|
|
3971
|
-
function
|
|
4002
|
+
function ea({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId: o }) {
|
|
3972
4003
|
let s = Array.isArray(n) ? n : [];
|
|
3973
4004
|
if (r === "display") return s.length === 0 ? /* @__PURE__ */ b("span", {
|
|
3974
4005
|
style: {
|
|
@@ -3982,7 +4013,7 @@ function Yi({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId:
|
|
|
3982
4013
|
flexDirection: "column",
|
|
3983
4014
|
gap: 8
|
|
3984
4015
|
},
|
|
3985
|
-
children: s.map((t, n) => /* @__PURE__ */ b(
|
|
4016
|
+
children: s.map((t, n) => /* @__PURE__ */ b($i, {
|
|
3986
4017
|
structDef: e,
|
|
3987
4018
|
value: t,
|
|
3988
4019
|
mode: "display",
|
|
@@ -4008,7 +4039,7 @@ function Yi({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId:
|
|
|
4008
4039
|
role: "group",
|
|
4009
4040
|
children: [s.map((n, r) => /* @__PURE__ */ x("div", {
|
|
4010
4041
|
style: { position: "relative" },
|
|
4011
|
-
children: [/* @__PURE__ */ b(
|
|
4042
|
+
children: [/* @__PURE__ */ b($i, {
|
|
4012
4043
|
structDef: e,
|
|
4013
4044
|
value: n,
|
|
4014
4045
|
mode: "edit",
|
|
@@ -4036,16 +4067,16 @@ function Yi({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId:
|
|
|
4036
4067
|
}
|
|
4037
4068
|
//#endregion
|
|
4038
4069
|
//#region src/components/fields/SecretField.tsx
|
|
4039
|
-
var
|
|
4040
|
-
function
|
|
4041
|
-
let [s, c] = p(""), l = a !== void 0, u = n ===
|
|
4070
|
+
var ta = "[SET]";
|
|
4071
|
+
function na({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a, fieldId: o }) {
|
|
4072
|
+
let [s, c] = p(""), l = a !== void 0, u = n === ta || typeof n == "string" && n !== "";
|
|
4042
4073
|
return r === "display" ? u ? /* @__PURE__ */ b("span", {
|
|
4043
4074
|
className: "mono",
|
|
4044
4075
|
style: {
|
|
4045
4076
|
fontSize: 12.5,
|
|
4046
4077
|
color: "var(--text-3)"
|
|
4047
4078
|
},
|
|
4048
|
-
children:
|
|
4079
|
+
children: ta
|
|
4049
4080
|
}) : /* @__PURE__ */ b("span", {
|
|
4050
4081
|
style: {
|
|
4051
4082
|
fontSize: 12.5,
|
|
@@ -4059,23 +4090,23 @@ function Zi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
4059
4090
|
ariaRequired: e.required,
|
|
4060
4091
|
value: s,
|
|
4061
4092
|
onChange: (e) => {
|
|
4062
|
-
c(e), l && e === "" ? i?.(u ?
|
|
4093
|
+
c(e), l && e === "" ? i?.(u ? ta : "") : i?.(e);
|
|
4063
4094
|
},
|
|
4064
4095
|
placeholder: l ? "Leave blank to keep existing value" : "Enter value"
|
|
4065
4096
|
});
|
|
4066
4097
|
}
|
|
4067
4098
|
//#endregion
|
|
4068
4099
|
//#region src/components/fields/PasswordField.tsx
|
|
4069
|
-
var
|
|
4070
|
-
function
|
|
4071
|
-
let [s, c] = p(""), l = a !== void 0, u = n ===
|
|
4100
|
+
var ra = "[SET]";
|
|
4101
|
+
function ia({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a, fieldId: o }) {
|
|
4102
|
+
let [s, c] = p(""), l = a !== void 0, u = n === ra || typeof n == "string" && n !== "";
|
|
4072
4103
|
return r === "display" ? u ? /* @__PURE__ */ b("span", {
|
|
4073
4104
|
className: "mono",
|
|
4074
4105
|
style: {
|
|
4075
4106
|
fontSize: 12.5,
|
|
4076
4107
|
color: "var(--text-3)"
|
|
4077
4108
|
},
|
|
4078
|
-
children:
|
|
4109
|
+
children: ra
|
|
4079
4110
|
}) : /* @__PURE__ */ b("span", {
|
|
4080
4111
|
style: {
|
|
4081
4112
|
fontSize: 12.5,
|
|
@@ -4089,25 +4120,25 @@ function $i({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
4089
4120
|
ariaRequired: e.required,
|
|
4090
4121
|
value: s,
|
|
4091
4122
|
onChange: (e) => {
|
|
4092
|
-
c(e), l && e === "" ? i?.(u ?
|
|
4123
|
+
c(e), l && e === "" ? i?.(u ? ra : "") : i?.(e);
|
|
4093
4124
|
},
|
|
4094
4125
|
placeholder: l ? "Leave blank to keep existing value" : "Enter password"
|
|
4095
4126
|
});
|
|
4096
4127
|
}
|
|
4097
4128
|
//#endregion
|
|
4098
4129
|
//#region src/components/fields/StringArrayField.tsx
|
|
4099
|
-
function
|
|
4130
|
+
function aa(e) {
|
|
4100
4131
|
return Array.isArray(e) ? e.filter((e) => e != null).map(String) : [];
|
|
4101
4132
|
}
|
|
4102
|
-
function
|
|
4103
|
-
let o =
|
|
4104
|
-
return s.length > 0 ? /* @__PURE__ */ b(
|
|
4133
|
+
function oa({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
4134
|
+
let o = aa(n), s = e.values ?? [];
|
|
4135
|
+
return s.length > 0 ? /* @__PURE__ */ b(sa, {
|
|
4105
4136
|
values: s,
|
|
4106
4137
|
selected: o,
|
|
4107
4138
|
mode: r,
|
|
4108
4139
|
required: e.required,
|
|
4109
4140
|
onChange: i
|
|
4110
|
-
}) : /* @__PURE__ */ b(
|
|
4141
|
+
}) : /* @__PURE__ */ b(ca, {
|
|
4111
4142
|
items: o,
|
|
4112
4143
|
fieldName: t,
|
|
4113
4144
|
required: e.required,
|
|
@@ -4116,7 +4147,7 @@ function ta({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
4116
4147
|
fieldId: a
|
|
4117
4148
|
});
|
|
4118
4149
|
}
|
|
4119
|
-
function
|
|
4150
|
+
function sa({ values: e, selected: n, mode: r, required: i, onChange: a }) {
|
|
4120
4151
|
let o = new Set(n), s = (t) => {
|
|
4121
4152
|
let n = e.find((e) => e.code === t);
|
|
4122
4153
|
return n && z(n.name) || t;
|
|
@@ -4182,7 +4213,7 @@ function na({ values: e, selected: n, mode: r, required: i, onChange: a }) {
|
|
|
4182
4213
|
}, e))]
|
|
4183
4214
|
});
|
|
4184
4215
|
}
|
|
4185
|
-
function
|
|
4216
|
+
function ca({ items: e, fieldName: n, required: r, mode: i, onChange: a, fieldId: o }) {
|
|
4186
4217
|
let [s, c] = p("");
|
|
4187
4218
|
if (i === "display") return e.length === 0 ? /* @__PURE__ */ b("span", {
|
|
4188
4219
|
style: {
|
|
@@ -4252,11 +4283,11 @@ function ra({ items: e, fieldName: n, required: r, mode: i, onChange: a, fieldId
|
|
|
4252
4283
|
}
|
|
4253
4284
|
//#endregion
|
|
4254
4285
|
//#region src/components/fields/IntArrayField.tsx
|
|
4255
|
-
function
|
|
4286
|
+
function la(e) {
|
|
4256
4287
|
return Array.isArray(e) ? e.filter((e) => e != null).map(Number).filter((e) => !isNaN(e)) : [];
|
|
4257
4288
|
}
|
|
4258
|
-
function
|
|
4259
|
-
let s =
|
|
4289
|
+
function ua({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o }) {
|
|
4290
|
+
let s = la(r), [c, l] = p("");
|
|
4260
4291
|
if (i === "display") return s.length === 0 ? /* @__PURE__ */ b("span", {
|
|
4261
4292
|
style: {
|
|
4262
4293
|
fontSize: 12.5,
|
|
@@ -4328,47 +4359,47 @@ function aa({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4328
4359
|
}
|
|
4329
4360
|
//#endregion
|
|
4330
4361
|
//#region src/lib/rich-text.ts
|
|
4331
|
-
var
|
|
4332
|
-
function
|
|
4333
|
-
return typeof e == "string" ? e :
|
|
4362
|
+
var da = /declarion:\/\/file\/([0-9a-fA-F-]{36})/g;
|
|
4363
|
+
function fa(e) {
|
|
4364
|
+
return typeof e == "string" ? e : ba(e) && typeof e.markdown == "string" ? e.markdown : "";
|
|
4334
4365
|
}
|
|
4335
|
-
function
|
|
4366
|
+
function pa(e, t) {
|
|
4336
4367
|
return {
|
|
4337
|
-
markdown:
|
|
4338
|
-
files:
|
|
4368
|
+
markdown: fa(e),
|
|
4369
|
+
files: ga(t)
|
|
4339
4370
|
};
|
|
4340
4371
|
}
|
|
4341
|
-
function
|
|
4342
|
-
let n =
|
|
4372
|
+
function ma(e, t) {
|
|
4373
|
+
let n = pa(e, null);
|
|
4343
4374
|
return n.files[t.id] = t, n;
|
|
4344
4375
|
}
|
|
4345
|
-
function
|
|
4346
|
-
let n =
|
|
4376
|
+
function ha(e, t) {
|
|
4377
|
+
let n = pa(e, null);
|
|
4347
4378
|
for (let e of t) delete n.files[e];
|
|
4348
4379
|
return n;
|
|
4349
4380
|
}
|
|
4350
|
-
function
|
|
4381
|
+
function ga(e) {
|
|
4351
4382
|
if (!Array.isArray(e)) return {};
|
|
4352
4383
|
let t = {};
|
|
4353
|
-
for (let n of e)
|
|
4384
|
+
for (let n of e) ba(n) && typeof n.id == "string" && (t[n.id] = n);
|
|
4354
4385
|
return t;
|
|
4355
4386
|
}
|
|
4356
|
-
function
|
|
4387
|
+
function _a(e) {
|
|
4357
4388
|
let t = /* @__PURE__ */ new Set(), n = [], r;
|
|
4358
|
-
for (
|
|
4389
|
+
for (da.lastIndex = 0; (r = da.exec(e)) !== null;) {
|
|
4359
4390
|
let e = r[1];
|
|
4360
4391
|
t.has(e) || (t.add(e), n.push(e));
|
|
4361
4392
|
}
|
|
4362
4393
|
return n;
|
|
4363
4394
|
}
|
|
4364
|
-
function
|
|
4395
|
+
function va(e) {
|
|
4365
4396
|
return e ? /^declarion:\/\/file\/([0-9a-fA-F-]{36})$/.exec(e)?.[1] ?? null : null;
|
|
4366
4397
|
}
|
|
4367
|
-
function
|
|
4398
|
+
function ya(e) {
|
|
4368
4399
|
let t = `declarion://file/${e.id}`;
|
|
4369
4400
|
return e.content_type.startsWith("image/") ? `` : `[${e.filename || e.id}](${t})`;
|
|
4370
4401
|
}
|
|
4371
|
-
function
|
|
4402
|
+
function ba(e) {
|
|
4372
4403
|
return typeof e == "object" && !!e;
|
|
4373
4404
|
}
|
|
4374
4405
|
//#endregion
|
|
@@ -4376,34 +4407,38 @@ function ha(e) {
|
|
|
4376
4407
|
var Q = class extends Error {
|
|
4377
4408
|
code;
|
|
4378
4409
|
status;
|
|
4379
|
-
|
|
4380
|
-
|
|
4410
|
+
raw;
|
|
4411
|
+
constructor(e, t, n, r) {
|
|
4412
|
+
super(n), this.code = t, this.status = e, this.raw = r;
|
|
4413
|
+
}
|
|
4414
|
+
ext(e) {
|
|
4415
|
+
return this.raw?.[e];
|
|
4381
4416
|
}
|
|
4382
4417
|
};
|
|
4383
|
-
async function
|
|
4384
|
-
let t =
|
|
4418
|
+
async function xa(e) {
|
|
4419
|
+
let t = Mt();
|
|
4385
4420
|
try {
|
|
4386
|
-
return await
|
|
4421
|
+
return await Sa(e, t ? await Rt() : null);
|
|
4387
4422
|
} catch (n) {
|
|
4388
|
-
if (!(n instanceof Q && n.status === 401 && (n.code === "
|
|
4423
|
+
if (!(n instanceof Q && n.status === 401 && (n.code === "auth.token_refresh_needed" || n.code === "auth.unauthorized"))) throw n;
|
|
4389
4424
|
let r = null;
|
|
4390
4425
|
try {
|
|
4391
|
-
t ? (
|
|
4426
|
+
t ? (Lt(), r = await Rt()) : await Tn();
|
|
4392
4427
|
} catch {
|
|
4393
|
-
throw
|
|
4428
|
+
throw Dn()(), n;
|
|
4394
4429
|
}
|
|
4395
4430
|
try {
|
|
4396
|
-
return await
|
|
4431
|
+
return await Sa(e, r);
|
|
4397
4432
|
} catch (e) {
|
|
4398
|
-
throw e instanceof Q && e.status === 401 &&
|
|
4433
|
+
throw e instanceof Q && e.status === 401 && Dn()(), e;
|
|
4399
4434
|
}
|
|
4400
4435
|
}
|
|
4401
4436
|
}
|
|
4402
|
-
function
|
|
4437
|
+
function Sa(e, t) {
|
|
4403
4438
|
let { file: n, entityCode: r, fieldCode: i, slotCode: a, onProgress: o, signal: s } = e;
|
|
4404
4439
|
return new Promise((e, c) => {
|
|
4405
4440
|
let l = new XMLHttpRequest();
|
|
4406
|
-
if (l.open("POST",
|
|
4441
|
+
if (l.open("POST", Ca(r, i, a)), l.withCredentials = t === null, t && l.setRequestHeader("Authorization", `Bearer ${t}`), l.upload.onprogress = (e) => {
|
|
4407
4442
|
if (!o) return;
|
|
4408
4443
|
let t = e.lengthComputable ? e.total : n.size, r = t > 0 ? Math.min(100, Math.round(e.loaded / t * 100)) : 0;
|
|
4409
4444
|
o({
|
|
@@ -4417,7 +4452,7 @@ function _a(e, t) {
|
|
|
4417
4452
|
n = t ? JSON.parse(t) : null;
|
|
4418
4453
|
} catch {}
|
|
4419
4454
|
if (l.status >= 200 && l.status < 300) {
|
|
4420
|
-
let t =
|
|
4455
|
+
let t = wa(n);
|
|
4421
4456
|
if (!t || !t.id) {
|
|
4422
4457
|
c(new Q(l.status, "BAD_RESPONSE", "Upload returned no file id"));
|
|
4423
4458
|
return;
|
|
@@ -4425,8 +4460,8 @@ function _a(e, t) {
|
|
|
4425
4460
|
e(t);
|
|
4426
4461
|
return;
|
|
4427
4462
|
}
|
|
4428
|
-
let r = n
|
|
4429
|
-
c(new Q(l.status, i,
|
|
4463
|
+
let r = mt(n) ? pt(n.type) : "", i = mt(n) ? n.title : `Upload failed (${l.status})`;
|
|
4464
|
+
c(new Q(l.status, r || "transport.upload_failed", i, n));
|
|
4430
4465
|
}, l.onerror = () => {
|
|
4431
4466
|
c(new Q(0, "NETWORK_ERROR", "Network error during upload"));
|
|
4432
4467
|
}, l.onabort = () => {
|
|
@@ -4442,56 +4477,56 @@ function _a(e, t) {
|
|
|
4442
4477
|
u.append("file", n, n.name), l.send(u);
|
|
4443
4478
|
});
|
|
4444
4479
|
}
|
|
4445
|
-
function
|
|
4480
|
+
function Ca(e, t, n) {
|
|
4446
4481
|
let r = new URLSearchParams();
|
|
4447
4482
|
e && t && (r.set("entity_code", e), r.set("field_code", t), n && r.set("slot_code", n));
|
|
4448
4483
|
let i = r.toString();
|
|
4449
4484
|
return i ? `/api/files/upload?${i}` : "/api/files/upload";
|
|
4450
4485
|
}
|
|
4451
|
-
function
|
|
4452
|
-
return
|
|
4486
|
+
function wa(e) {
|
|
4487
|
+
return Ea(e) ? Ea(e.result) ? wa(e.result) : Ea(e.file) ? Ta(e.file) : typeof e.id == "string" ? e : null : null;
|
|
4453
4488
|
}
|
|
4454
|
-
function
|
|
4455
|
-
let t =
|
|
4489
|
+
function Ta(e) {
|
|
4490
|
+
let t = Da(e.file_id);
|
|
4456
4491
|
return t ? {
|
|
4457
4492
|
id: t,
|
|
4458
|
-
filename:
|
|
4459
|
-
content_type:
|
|
4460
|
-
size_bytes:
|
|
4461
|
-
sha256:
|
|
4462
|
-
dedup:
|
|
4493
|
+
filename: Da(e.filename_original) ?? Da(e.filename_normalized) ?? t,
|
|
4494
|
+
content_type: Da(e.content_type) ?? "application/octet-stream",
|
|
4495
|
+
size_bytes: Oa(e.size_bytes) ?? 0,
|
|
4496
|
+
sha256: Da(e.sha256) ?? "",
|
|
4497
|
+
dedup: ka(e.dedup)
|
|
4463
4498
|
} : null;
|
|
4464
4499
|
}
|
|
4465
|
-
function
|
|
4500
|
+
function Ea(e) {
|
|
4466
4501
|
return typeof e == "object" && !!e;
|
|
4467
4502
|
}
|
|
4468
|
-
function
|
|
4503
|
+
function Da(e) {
|
|
4469
4504
|
return typeof e == "string" ? e : void 0;
|
|
4470
4505
|
}
|
|
4471
|
-
function
|
|
4506
|
+
function Oa(e) {
|
|
4472
4507
|
return typeof e == "number" ? e : void 0;
|
|
4473
4508
|
}
|
|
4474
|
-
function
|
|
4509
|
+
function ka(e) {
|
|
4475
4510
|
return typeof e == "boolean" ? e : void 0;
|
|
4476
4511
|
}
|
|
4477
|
-
async function
|
|
4512
|
+
async function Aa(e) {
|
|
4478
4513
|
await Y("files.discard", { file_id: e });
|
|
4479
4514
|
}
|
|
4480
|
-
function
|
|
4515
|
+
function ja(e, t, n) {
|
|
4481
4516
|
if (n && e.size > n) return {
|
|
4482
|
-
code: "
|
|
4483
|
-
message: `File is ${
|
|
4517
|
+
code: "file.too_large",
|
|
4518
|
+
message: `File is ${Na(e.size)}, max ${Na(n)}`
|
|
4484
4519
|
};
|
|
4485
4520
|
if (t && t.length > 0) {
|
|
4486
4521
|
let n = e.type || "application/octet-stream";
|
|
4487
|
-
if (!t.some((e) =>
|
|
4488
|
-
code: "
|
|
4522
|
+
if (!t.some((e) => Ma(e, n))) return {
|
|
4523
|
+
code: "file.mime_mismatch",
|
|
4489
4524
|
message: `File type ${n} is not accepted`
|
|
4490
4525
|
};
|
|
4491
4526
|
}
|
|
4492
4527
|
return null;
|
|
4493
4528
|
}
|
|
4494
|
-
function
|
|
4529
|
+
function Ma(e, t) {
|
|
4495
4530
|
if (e === "*/*" || e === "*") return !0;
|
|
4496
4531
|
if (e.endsWith("/*")) {
|
|
4497
4532
|
let n = e.slice(0, e.length - 1);
|
|
@@ -4499,7 +4534,7 @@ function Da(e, t) {
|
|
|
4499
4534
|
}
|
|
4500
4535
|
return e === t;
|
|
4501
4536
|
}
|
|
4502
|
-
function
|
|
4537
|
+
function Na(e) {
|
|
4503
4538
|
if (e < 1024) return `${e} B`;
|
|
4504
4539
|
let t = [
|
|
4505
4540
|
"KB",
|
|
@@ -4511,7 +4546,7 @@ function Oa(e) {
|
|
|
4511
4546
|
}
|
|
4512
4547
|
//#endregion
|
|
4513
4548
|
//#region src/components/file-widgets/draft-scope.tsx
|
|
4514
|
-
var
|
|
4549
|
+
var Pa = i({
|
|
4515
4550
|
registerDraft() {},
|
|
4516
4551
|
unregisterDraft() {},
|
|
4517
4552
|
hasDraft() {
|
|
@@ -4520,7 +4555,7 @@ var ka = i({
|
|
|
4520
4555
|
flushAllDrafts: async () => {},
|
|
4521
4556
|
markCommitted() {}
|
|
4522
4557
|
});
|
|
4523
|
-
function
|
|
4558
|
+
function Fa({ children: e }) {
|
|
4524
4559
|
let t = f(/* @__PURE__ */ new Map()), n = d(() => ({
|
|
4525
4560
|
registerDraft(e) {
|
|
4526
4561
|
t.current.set(e.fileId, e);
|
|
@@ -4539,16 +4574,16 @@ function Aa({ children: e }) {
|
|
|
4539
4574
|
t.current.clear(), await Promise.allSettled(e.map((e) => Promise.resolve(e.discard())));
|
|
4540
4575
|
}
|
|
4541
4576
|
}), []);
|
|
4542
|
-
return /* @__PURE__ */ b(
|
|
4577
|
+
return /* @__PURE__ */ b(Pa.Provider, {
|
|
4543
4578
|
value: n,
|
|
4544
4579
|
children: e
|
|
4545
4580
|
});
|
|
4546
4581
|
}
|
|
4547
|
-
function
|
|
4548
|
-
return c(
|
|
4582
|
+
function Ia() {
|
|
4583
|
+
return c(Pa);
|
|
4549
4584
|
}
|
|
4550
|
-
function
|
|
4551
|
-
let e =
|
|
4585
|
+
function La() {
|
|
4586
|
+
let e = Ia();
|
|
4552
4587
|
return {
|
|
4553
4588
|
register: s((t, n) => {
|
|
4554
4589
|
e.registerDraft({
|
|
@@ -4567,17 +4602,17 @@ function Ma() {
|
|
|
4567
4602
|
}
|
|
4568
4603
|
//#endregion
|
|
4569
4604
|
//#region src/components/fields/RichTextField.tsx
|
|
4570
|
-
function
|
|
4571
|
-
let { field: n, entityCode: r, fieldName: i, value: a, mode: o, onChange: s, record: c, compact: l, fieldId: u } = e, m = f(null), h = f(null), g = f(/* @__PURE__ */ new Map()), _ = f(/* @__PURE__ */ new Set()), [v, y] = p(0), [S, C] = p(null), { register: w, unregister: T } =
|
|
4572
|
-
let n = new Set(
|
|
4605
|
+
function Ra(e) {
|
|
4606
|
+
let { field: n, entityCode: r, fieldName: i, value: a, mode: o, onChange: s, record: c, compact: l, fieldId: u } = e, m = f(null), h = f(null), g = f(/* @__PURE__ */ new Map()), _ = f(/* @__PURE__ */ new Set()), [v, y] = p(0), [S, C] = p(null), { register: w, unregister: T } = La(), E = c?.$files?.[i], O = d(() => pa(a, E), [E, a]), k = O.markdown, A = n.files?.accepts, j = n.files?.max_size_bytes, M = (e, t = O.files) => {
|
|
4607
|
+
let n = new Set(_a(e)), r = [];
|
|
4573
4608
|
for (let e of _.current) n.has(e) || r.push(e);
|
|
4574
4609
|
if (r.length > 0) {
|
|
4575
4610
|
for (let e of r) {
|
|
4576
|
-
_.current.delete(e), T(e),
|
|
4611
|
+
_.current.delete(e), T(e), Aa(e).catch(() => {});
|
|
4577
4612
|
let t = g.current.get(e);
|
|
4578
4613
|
t && (URL.revokeObjectURL(t), g.current.delete(e));
|
|
4579
4614
|
}
|
|
4580
|
-
s?.(
|
|
4615
|
+
s?.(ha({
|
|
4581
4616
|
markdown: e,
|
|
4582
4617
|
files: t
|
|
4583
4618
|
}, r));
|
|
@@ -4588,7 +4623,7 @@ function Na(e) {
|
|
|
4588
4623
|
files: t
|
|
4589
4624
|
});
|
|
4590
4625
|
}, ee = (e, t, n) => {
|
|
4591
|
-
let r = m.current, i = r?.selectionStart ?? e.markdown.length, a = r?.selectionEnd ?? e.markdown.length, o = `${e.markdown.slice(0, i)}${t}${e.markdown.slice(a)}`, s = n ?
|
|
4626
|
+
let r = m.current, i = r?.selectionStart ?? e.markdown.length, a = r?.selectionEnd ?? e.markdown.length, o = `${e.markdown.slice(0, i)}${t}${e.markdown.slice(a)}`, s = n ? ma(e, n).files : e.files;
|
|
4592
4627
|
M(o, s), requestAnimationFrame(() => {
|
|
4593
4628
|
if (!r) return;
|
|
4594
4629
|
let e = i + t.length;
|
|
@@ -4604,28 +4639,28 @@ function Na(e) {
|
|
|
4604
4639
|
files: O.files
|
|
4605
4640
|
};
|
|
4606
4641
|
for (let e of t) {
|
|
4607
|
-
let n =
|
|
4642
|
+
let n = ja(e, A, j);
|
|
4608
4643
|
if (n) {
|
|
4609
4644
|
C(n.message), y((e) => e - 1);
|
|
4610
4645
|
continue;
|
|
4611
4646
|
}
|
|
4612
4647
|
try {
|
|
4613
|
-
let n = await
|
|
4648
|
+
let n = await xa({
|
|
4614
4649
|
file: e,
|
|
4615
4650
|
entityCode: r,
|
|
4616
4651
|
fieldCode: i
|
|
4617
4652
|
}), o = e.type.startsWith("image/") ? URL.createObjectURL(e) : void 0;
|
|
4618
4653
|
o && g.current.set(n.id, o);
|
|
4619
|
-
let s =
|
|
4620
|
-
if (w(n.id, () =>
|
|
4621
|
-
let e =
|
|
4622
|
-
ee(a, e, s), a =
|
|
4654
|
+
let s = Ba(n, o);
|
|
4655
|
+
if (w(n.id, () => Aa(n.id)), _.current.add(n.id), t.length === 1) {
|
|
4656
|
+
let e = za(a.markdown, ya(s));
|
|
4657
|
+
ee(a, e, s), a = ma({
|
|
4623
4658
|
markdown: `${a.markdown}${e}`,
|
|
4624
4659
|
files: a.files
|
|
4625
4660
|
}, s);
|
|
4626
4661
|
} else {
|
|
4627
|
-
let e =
|
|
4628
|
-
a =
|
|
4662
|
+
let e = za(a.markdown, ya(s));
|
|
4663
|
+
a = ma({
|
|
4629
4664
|
markdown: `${a.markdown}${e}`,
|
|
4630
4665
|
files: a.files
|
|
4631
4666
|
}, s), M(a.markdown, a.files);
|
|
@@ -4637,7 +4672,7 @@ function Na(e) {
|
|
|
4637
4672
|
}
|
|
4638
4673
|
}
|
|
4639
4674
|
};
|
|
4640
|
-
return o === "display" ? k ? /* @__PURE__ */ b(
|
|
4675
|
+
return o === "display" ? k ? /* @__PURE__ */ b(oi, {
|
|
4641
4676
|
content: k,
|
|
4642
4677
|
files: O.files
|
|
4643
4678
|
}) : /* @__PURE__ */ b("span", {
|
|
@@ -4753,7 +4788,7 @@ function Na(e) {
|
|
|
4753
4788
|
marginBottom: 8
|
|
4754
4789
|
},
|
|
4755
4790
|
children: "Preview"
|
|
4756
|
-
}), k ? /* @__PURE__ */ b(
|
|
4791
|
+
}), k ? /* @__PURE__ */ b(oi, {
|
|
4757
4792
|
content: k,
|
|
4758
4793
|
files: O.files
|
|
4759
4794
|
}) : /* @__PURE__ */ b("span", {
|
|
@@ -4767,10 +4802,10 @@ function Na(e) {
|
|
|
4767
4802
|
]
|
|
4768
4803
|
});
|
|
4769
4804
|
}
|
|
4770
|
-
function
|
|
4805
|
+
function za(e, t) {
|
|
4771
4806
|
return e ? e.endsWith("\n\n") ? t : e.endsWith("\n") ? `\n${t}` : `\n\n${t}` : `${t}\n`;
|
|
4772
4807
|
}
|
|
4773
|
-
function
|
|
4808
|
+
function Ba(e, t) {
|
|
4774
4809
|
return {
|
|
4775
4810
|
id: e.id,
|
|
4776
4811
|
filename: e.filename,
|
|
@@ -4785,8 +4820,8 @@ function Fa(e, t) {
|
|
|
4785
4820
|
}
|
|
4786
4821
|
//#endregion
|
|
4787
4822
|
//#region src/components/fields/cells/factories/text.ts
|
|
4788
|
-
var
|
|
4789
|
-
let { field: t, fieldName: n, locale: r = "en" } = e, i =
|
|
4823
|
+
var Va = () => (e) => e == null || e === "" ? "—" : R(e), Ha = (e) => {
|
|
4824
|
+
let { field: t, fieldName: n, locale: r = "en" } = e, i = Ua(t, n, r);
|
|
4790
4825
|
return (e) => {
|
|
4791
4826
|
if (e == null) return "—";
|
|
4792
4827
|
let t = !!e;
|
|
@@ -4797,7 +4832,7 @@ var Ia = () => (e) => e == null || e === "" ? "—" : R(e), La = (e) => {
|
|
|
4797
4832
|
});
|
|
4798
4833
|
};
|
|
4799
4834
|
};
|
|
4800
|
-
function
|
|
4835
|
+
function Ua(e, t, n) {
|
|
4801
4836
|
if (e.display?.bool_labels) return {
|
|
4802
4837
|
trueLabel: z(e.display.bool_labels.true, n) || "Yes",
|
|
4803
4838
|
falseLabel: z(e.display.bool_labels.false, n) || "No"
|
|
@@ -4818,14 +4853,14 @@ function Ra(e, t, n) {
|
|
|
4818
4853
|
};
|
|
4819
4854
|
}
|
|
4820
4855
|
if (t.startsWith("is_")) {
|
|
4821
|
-
let e =
|
|
4856
|
+
let e = Wa(t.slice(3));
|
|
4822
4857
|
return {
|
|
4823
4858
|
trueLabel: e,
|
|
4824
4859
|
falseLabel: `Not ${e}`
|
|
4825
4860
|
};
|
|
4826
4861
|
}
|
|
4827
4862
|
if (t.startsWith("has_")) {
|
|
4828
|
-
let e =
|
|
4863
|
+
let e = Wa(t.slice(4));
|
|
4829
4864
|
return {
|
|
4830
4865
|
trueLabel: e,
|
|
4831
4866
|
falseLabel: `No ${e}`
|
|
@@ -4836,12 +4871,12 @@ function Ra(e, t, n) {
|
|
|
4836
4871
|
falseLabel: "No"
|
|
4837
4872
|
};
|
|
4838
4873
|
}
|
|
4839
|
-
function
|
|
4874
|
+
function Wa(e) {
|
|
4840
4875
|
return e.split("_").map((e) => e && e[0].toUpperCase() + e.slice(1)).join(" ");
|
|
4841
4876
|
}
|
|
4842
4877
|
//#endregion
|
|
4843
4878
|
//#region src/components/fields/cells/factories/badge.tsx
|
|
4844
|
-
var
|
|
4879
|
+
var Ga = /* @__PURE__ */ new Set([
|
|
4845
4880
|
"indigo",
|
|
4846
4881
|
"emerald",
|
|
4847
4882
|
"amber",
|
|
@@ -4851,17 +4886,17 @@ var Ba = /* @__PURE__ */ new Set([
|
|
|
4851
4886
|
"slate",
|
|
4852
4887
|
"teal"
|
|
4853
4888
|
]);
|
|
4854
|
-
function
|
|
4855
|
-
return e &&
|
|
4889
|
+
function Ka(e) {
|
|
4890
|
+
return e && Ga.has(e) ? e : "slate";
|
|
4856
4891
|
}
|
|
4857
|
-
var
|
|
4892
|
+
var qa = (e) => {
|
|
4858
4893
|
let { field: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4859
4894
|
if (t.values) for (let e of t.values) r.set(e.code, {
|
|
4860
|
-
tone:
|
|
4895
|
+
tone: Ka(e.color),
|
|
4861
4896
|
label: z(e.name, n) || e.code
|
|
4862
4897
|
});
|
|
4863
4898
|
if (t.display?.value_map) for (let [e, i] of Object.entries(t.display.value_map)) {
|
|
4864
|
-
let t = r.get(e), a = i.color ?
|
|
4899
|
+
let t = r.get(e), a = i.color ? Ka(i.color) : t?.tone ?? "slate", o = (i.label ? z(i.label, n) : "") || t?.label || e;
|
|
4865
4900
|
r.set(e, {
|
|
4866
4901
|
tone: a,
|
|
4867
4902
|
label: o
|
|
@@ -4876,7 +4911,7 @@ var Ha = (e) => {
|
|
|
4876
4911
|
children: n?.label ?? t
|
|
4877
4912
|
});
|
|
4878
4913
|
};
|
|
4879
|
-
},
|
|
4914
|
+
}, Ja = /* @__PURE__ */ new Set([
|
|
4880
4915
|
"indigo",
|
|
4881
4916
|
"emerald",
|
|
4882
4917
|
"amber",
|
|
@@ -4886,13 +4921,13 @@ var Ha = (e) => {
|
|
|
4886
4921
|
"slate",
|
|
4887
4922
|
"teal"
|
|
4888
4923
|
]);
|
|
4889
|
-
function
|
|
4890
|
-
return e &&
|
|
4924
|
+
function Ya(e) {
|
|
4925
|
+
return e && Ja.has(e) ? e : "slate";
|
|
4891
4926
|
}
|
|
4892
|
-
var
|
|
4927
|
+
var Xa = (e) => {
|
|
4893
4928
|
let { entity: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4894
4929
|
if (t?.status_groups) for (let e of Object.values(t.status_groups)) for (let t of e.statuses) r.set(t.code, {
|
|
4895
|
-
tone:
|
|
4930
|
+
tone: Ya(t.color),
|
|
4896
4931
|
label: z(t.name, n) || t.code
|
|
4897
4932
|
});
|
|
4898
4933
|
return (e) => {
|
|
@@ -4904,7 +4939,7 @@ var Ga = (e) => {
|
|
|
4904
4939
|
children: n?.label ?? t
|
|
4905
4940
|
});
|
|
4906
4941
|
};
|
|
4907
|
-
},
|
|
4942
|
+
}, Za = /* @__PURE__ */ new Set([
|
|
4908
4943
|
"indigo",
|
|
4909
4944
|
"emerald",
|
|
4910
4945
|
"amber",
|
|
@@ -4914,14 +4949,14 @@ var Ga = (e) => {
|
|
|
4914
4949
|
"slate",
|
|
4915
4950
|
"teal"
|
|
4916
4951
|
]);
|
|
4917
|
-
function
|
|
4918
|
-
return e &&
|
|
4952
|
+
function Qa(e) {
|
|
4953
|
+
return e && Za.has(e) ? e : null;
|
|
4919
4954
|
}
|
|
4920
|
-
var
|
|
4955
|
+
var $a = (e) => {
|
|
4921
4956
|
let { field: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4922
4957
|
if (t.display?.value_map) for (let [e, i] of Object.entries(t.display.value_map)) r.set(e, {
|
|
4923
4958
|
label: i.label && z(i.label, n) || e,
|
|
4924
|
-
tone:
|
|
4959
|
+
tone: Qa(i.color)
|
|
4925
4960
|
});
|
|
4926
4961
|
return (e) => !Array.isArray(e) || e.length === 0 ? "—" : /* @__PURE__ */ b("span", {
|
|
4927
4962
|
style: {
|
|
@@ -4938,14 +4973,20 @@ var Ja = (e) => {
|
|
|
4938
4973
|
}, `${n}-${t}`) : /* @__PURE__ */ b(P, { children: i?.label ?? n }, `${n}-${t}`);
|
|
4939
4974
|
})
|
|
4940
4975
|
});
|
|
4941
|
-
},
|
|
4976
|
+
}, eo = () => (e) => {
|
|
4977
|
+
if (e == null || e === "") return "—";
|
|
4978
|
+
let t = typeof e == "string" ? e : R(e), n = /^(\d{4})-(\d{2})-(\d{2})/.exec(t);
|
|
4979
|
+
if (!n) return t;
|
|
4980
|
+
let [, r, i, a] = n;
|
|
4981
|
+
return `${a}-${i}-${r}`;
|
|
4982
|
+
}, to = () => (e) => {
|
|
4942
4983
|
if (e == null || e === "") return "—";
|
|
4943
4984
|
let { text: t, absolute: n } = Ue(typeof e == "string" ? e : R(e));
|
|
4944
4985
|
return /* @__PURE__ */ b("span", {
|
|
4945
4986
|
title: n,
|
|
4946
4987
|
children: t
|
|
4947
4988
|
});
|
|
4948
|
-
},
|
|
4989
|
+
}, no = () => (e) => e == null || e === "" ? "—" : He(typeof e == "string" ? e : R(e)), ro = 6e4, io = 3e5, ao = () => (e) => {
|
|
4949
4990
|
if (e == null || e === "") return "—";
|
|
4950
4991
|
let t = typeof e == "string" ? e : R(e), n = new Date(t);
|
|
4951
4992
|
if (isNaN(n.getTime())) return t;
|
|
@@ -4957,7 +4998,7 @@ var Ja = (e) => {
|
|
|
4957
4998
|
children: ["in ", e]
|
|
4958
4999
|
});
|
|
4959
5000
|
}
|
|
4960
|
-
if (i <=
|
|
5001
|
+
if (i <= ro) return /* @__PURE__ */ b("span", {
|
|
4961
5002
|
title: r,
|
|
4962
5003
|
children: /* @__PURE__ */ b(A, {
|
|
4963
5004
|
tone: "slate",
|
|
@@ -4969,13 +5010,13 @@ var Ja = (e) => {
|
|
|
4969
5010
|
return /* @__PURE__ */ b("span", {
|
|
4970
5011
|
title: r,
|
|
4971
5012
|
children: /* @__PURE__ */ x(A, {
|
|
4972
|
-
tone: i <=
|
|
5013
|
+
tone: i <= io ? "amber" : "rose",
|
|
4973
5014
|
size: "xs",
|
|
4974
5015
|
children: ["overdue ", a]
|
|
4975
5016
|
})
|
|
4976
5017
|
});
|
|
4977
|
-
},
|
|
4978
|
-
let { field: t, locale: n = "en" } = e, r = t.display?.currency || "USD", i = t.display?.currency_field, a =
|
|
5018
|
+
}, oo = (e) => {
|
|
5019
|
+
let { field: t, locale: n = "en" } = e, r = t.display?.currency || "USD", i = t.display?.currency_field, a = so(t.display?.currency_display), o = co(typeof t.scale == "number" ? t.scale : 2, 0, 6), s = /* @__PURE__ */ new Map();
|
|
4979
5020
|
return (e, t = {}) => {
|
|
4980
5021
|
if (e == null || e === "") return "—";
|
|
4981
5022
|
let c = typeof e == "number" ? e : Number(e);
|
|
@@ -4990,7 +5031,7 @@ var Ja = (e) => {
|
|
|
4990
5031
|
}), s.set(d, f)), f.format(c);
|
|
4991
5032
|
};
|
|
4992
5033
|
};
|
|
4993
|
-
function
|
|
5034
|
+
function so(e) {
|
|
4994
5035
|
switch (e) {
|
|
4995
5036
|
case "narrow_symbol": return "narrowSymbol";
|
|
4996
5037
|
case "code":
|
|
@@ -4999,16 +5040,16 @@ function to(e) {
|
|
|
4999
5040
|
default: return "symbol";
|
|
5000
5041
|
}
|
|
5001
5042
|
}
|
|
5002
|
-
function
|
|
5043
|
+
function co(e, t, n) {
|
|
5003
5044
|
return e < t ? t : e > n ? n : e;
|
|
5004
5045
|
}
|
|
5005
5046
|
//#endregion
|
|
5006
5047
|
//#region src/components/fields/cells/factories/refLink.tsx
|
|
5007
|
-
var
|
|
5048
|
+
var lo = (e) => {
|
|
5008
5049
|
let { field: t, entities: r, screens: i, refs: a, surface: o } = e, s = t.ref?.entity, c = s ? r?.[s] : void 0, l = typeof a == "function" ? a : () => a, u = o === "detail", d = c?.display?.icon, f = t.display?.ref_display_field || "$display", p = c?.detail_screen, m = (p ? i?.[p] : void 0)?.route;
|
|
5009
5050
|
return (e, t) => {
|
|
5010
5051
|
if (e == null || e === "") return "—";
|
|
5011
|
-
let r = R(e), i =
|
|
5052
|
+
let r = R(e), i = uo(r, s, l(), f), a = m ? m.replace(":id", encodeURIComponent(r)) : void 0;
|
|
5012
5053
|
if (u) {
|
|
5013
5054
|
let e = /* @__PURE__ */ x(y, { children: [d && /* @__PURE__ */ b("span", {
|
|
5014
5055
|
style: {
|
|
@@ -5050,29 +5091,29 @@ var ro = (e) => {
|
|
|
5050
5091
|
}) : i;
|
|
5051
5092
|
};
|
|
5052
5093
|
};
|
|
5053
|
-
function
|
|
5094
|
+
function uo(e, t, n, r) {
|
|
5054
5095
|
let i = t && n ? n[t]?.[e] : void 0;
|
|
5055
|
-
return i ?
|
|
5096
|
+
return i ? Ke(i, r, e) : e;
|
|
5056
5097
|
}
|
|
5057
5098
|
//#endregion
|
|
5058
5099
|
//#region src/components/fields/cells/factories/url-helpers.ts
|
|
5059
|
-
var
|
|
5060
|
-
function
|
|
5061
|
-
return /^[a-z]{2,3}$/i.test(e) ||
|
|
5100
|
+
var fo = /^(https?|ftps?|ssh|mailto|tel):/i, po = /^(info|name|tech|site|cloud|online|store|shop|blog|space|world|link|live|page|zone|life|team|work|host|land|news|wiki|mobi|coop|aero|asia)$/i;
|
|
5101
|
+
function mo(e) {
|
|
5102
|
+
return /^[a-z]{2,3}$/i.test(e) || po.test(e);
|
|
5062
5103
|
}
|
|
5063
|
-
function
|
|
5104
|
+
function ho(e) {
|
|
5064
5105
|
if (!e.includes(".")) return !1;
|
|
5065
5106
|
let t = e.split(".");
|
|
5066
5107
|
if (t.length < 3) return !0;
|
|
5067
5108
|
let n = t[0].toLowerCase();
|
|
5068
|
-
return /^(com|org|net|edu|gov)$/.test(n) ? !1 : !/^(io|app|dev)$/.test(n) ||
|
|
5109
|
+
return /^(com|org|net|edu|gov)$/.test(n) ? !1 : !/^(io|app|dev)$/.test(n) || mo(t[t.length - 1]);
|
|
5069
5110
|
}
|
|
5070
|
-
function
|
|
5071
|
-
if (
|
|
5111
|
+
function go(e) {
|
|
5112
|
+
if (fo.test(e)) return e;
|
|
5072
5113
|
let t = e.match(/^([a-z][a-z0-9+.-]*):/i);
|
|
5073
5114
|
if (t) {
|
|
5074
5115
|
let n = t[1], r = e.slice(t[0].length);
|
|
5075
|
-
if (/^\d+([/?#]|$)/.test(r) &&
|
|
5116
|
+
if (/^\d+([/?#]|$)/.test(r) && ho(n)) {
|
|
5076
5117
|
let t = parseInt(r, 10);
|
|
5077
5118
|
if (t >= 1 && t <= 65535) return `https://${e}`;
|
|
5078
5119
|
}
|
|
@@ -5080,14 +5121,14 @@ function lo(e) {
|
|
|
5080
5121
|
}
|
|
5081
5122
|
return `https://${e}`;
|
|
5082
5123
|
}
|
|
5083
|
-
function
|
|
5124
|
+
function _o(e) {
|
|
5084
5125
|
try {
|
|
5085
5126
|
return new URL(e).hostname.replace(/^www\./i, "") || null;
|
|
5086
5127
|
} catch {
|
|
5087
5128
|
return null;
|
|
5088
5129
|
}
|
|
5089
5130
|
}
|
|
5090
|
-
function
|
|
5131
|
+
function vo(e, t) {
|
|
5091
5132
|
if (t !== "linkedin.com") return null;
|
|
5092
5133
|
try {
|
|
5093
5134
|
let t = new URL(e).pathname.match(/^\/(in|company|school)\/([^/]+)/i);
|
|
@@ -5095,7 +5136,7 @@ function fo(e, t) {
|
|
|
5095
5136
|
} catch {}
|
|
5096
5137
|
return null;
|
|
5097
5138
|
}
|
|
5098
|
-
function
|
|
5139
|
+
function yo(e) {
|
|
5099
5140
|
try {
|
|
5100
5141
|
return new URL(e), !0;
|
|
5101
5142
|
} catch {
|
|
@@ -5104,7 +5145,7 @@ function po(e) {
|
|
|
5104
5145
|
}
|
|
5105
5146
|
//#endregion
|
|
5106
5147
|
//#region src/components/fields/cells/factories/host-icons.tsx
|
|
5107
|
-
function
|
|
5148
|
+
function bo(e, t = "0 0 24 24") {
|
|
5108
5149
|
return (n) => /* @__PURE__ */ b("svg", {
|
|
5109
5150
|
width: 16,
|
|
5110
5151
|
height: 16,
|
|
@@ -5120,17 +5161,17 @@ function mo(e, t = "0 0 24 24") {
|
|
|
5120
5161
|
children: e
|
|
5121
5162
|
});
|
|
5122
5163
|
}
|
|
5123
|
-
var
|
|
5164
|
+
var xo = bo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
5124
5165
|
cx: "12",
|
|
5125
5166
|
cy: "12",
|
|
5126
5167
|
r: "9"
|
|
5127
|
-
}), /* @__PURE__ */ b("path", { d: "M3 12h18M12 3c3 3 3 15 0 18-3-3-3-15 0-18" })] })),
|
|
5168
|
+
}), /* @__PURE__ */ b("path", { d: "M3 12h18M12 3c3 3 3 15 0 18-3-3-3-15 0-18" })] })), So = () => /* @__PURE__ */ b(e, {
|
|
5128
5169
|
size: 16,
|
|
5129
5170
|
style: {
|
|
5130
5171
|
flexShrink: 0,
|
|
5131
5172
|
color: "#0A66C2"
|
|
5132
5173
|
}
|
|
5133
|
-
}),
|
|
5174
|
+
}), Co = (e) => /* @__PURE__ */ b("svg", {
|
|
5134
5175
|
width: 16,
|
|
5135
5176
|
height: 16,
|
|
5136
5177
|
viewBox: "0 0 24 24",
|
|
@@ -5139,7 +5180,7 @@ var ho = mo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
5139
5180
|
style: { flexShrink: 0 },
|
|
5140
5181
|
...e,
|
|
5141
5182
|
children: /* @__PURE__ */ b("path", { d: "M12 .5a11.5 11.5 0 0 0-3.64 22.41c.58.1.79-.25.79-.56 0-.27-.01-1-.02-1.96-3.21.7-3.89-1.55-3.89-1.55-.52-1.34-1.28-1.7-1.28-1.7-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.2 1.77 1.2 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.26-1.28-5.26-5.71 0-1.26.45-2.3 1.19-3.11-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.19a11.05 11.05 0 0 1 5.79 0c2.21-1.5 3.18-1.19 3.18-1.19.63 1.59.23 2.76.11 3.05.74.81 1.19 1.85 1.19 3.11 0 4.44-2.71 5.42-5.29 5.7.41.36.78 1.07.78 2.16 0 1.56-.01 2.81-.01 3.19 0 .31.21.68.8.56A11.5 11.5 0 0 0 12 .5z" })
|
|
5142
|
-
}),
|
|
5183
|
+
}), wo = (e) => /* @__PURE__ */ b("svg", {
|
|
5143
5184
|
width: 16,
|
|
5144
5185
|
height: 16,
|
|
5145
5186
|
viewBox: "0 0 24 24",
|
|
@@ -5148,7 +5189,7 @@ var ho = mo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
5148
5189
|
style: { flexShrink: 0 },
|
|
5149
5190
|
...e,
|
|
5150
5191
|
children: /* @__PURE__ */ b("path", { d: "M18.244 2H21.5l-7.62 8.71L23 22h-7.05l-5.52-7.21L4.07 22H.81l8.18-9.34L1 2h7.22l5 6.59L18.244 2zm-2.47 18h1.95L7.32 4h-2.1l10.55 16z" })
|
|
5151
|
-
}),
|
|
5192
|
+
}), To = (e) => /* @__PURE__ */ b("svg", {
|
|
5152
5193
|
width: 16,
|
|
5153
5194
|
height: 16,
|
|
5154
5195
|
viewBox: "0 0 24 24",
|
|
@@ -5157,7 +5198,7 @@ var ho = mo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
5157
5198
|
style: { flexShrink: 0 },
|
|
5158
5199
|
...e,
|
|
5159
5200
|
children: /* @__PURE__ */ b("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8zM9.6 15.6V8.4l6.2 3.6-6.2 3.6z" })
|
|
5160
|
-
}),
|
|
5201
|
+
}), Eo = (e) => /* @__PURE__ */ b("svg", {
|
|
5161
5202
|
width: 16,
|
|
5162
5203
|
height: 16,
|
|
5163
5204
|
viewBox: "0 0 24 24",
|
|
@@ -5166,7 +5207,7 @@ var ho = mo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
5166
5207
|
style: { flexShrink: 0 },
|
|
5167
5208
|
...e,
|
|
5168
5209
|
children: /* @__PURE__ */ b("path", { d: "M24 5.45v13.1A1.45 1.45 0 0 1 22.55 20H19.5V9.27L12 14.7 4.5 9.27V20H1.45A1.45 1.45 0 0 1 0 18.55V5.45A1.45 1.45 0 0 1 1.45 4h.5l10.05 7.27L22.05 4h.5A1.45 1.45 0 0 1 24 5.45z" })
|
|
5169
|
-
}),
|
|
5210
|
+
}), Do = (e) => /* @__PURE__ */ x("svg", {
|
|
5170
5211
|
width: 16,
|
|
5171
5212
|
height: 16,
|
|
5172
5213
|
viewBox: "0 0 24 24",
|
|
@@ -5191,7 +5232,7 @@ var ho = mo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
5191
5232
|
d: "M15.17 18.96a2.52 2.52 0 1 1-2.52 2.52v-2.52h2.52zm0-1.27a2.52 2.52 0 1 1 0-5.04h6.31a2.52 2.52 0 1 1 0 5.04h-6.31z"
|
|
5192
5233
|
})
|
|
5193
5234
|
]
|
|
5194
|
-
}),
|
|
5235
|
+
}), Oo = (e) => /* @__PURE__ */ b("svg", {
|
|
5195
5236
|
width: 16,
|
|
5196
5237
|
height: 16,
|
|
5197
5238
|
viewBox: "0 0 24 24",
|
|
@@ -5200,39 +5241,39 @@ var ho = mo(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
5200
5241
|
style: { flexShrink: 0 },
|
|
5201
5242
|
...e,
|
|
5202
5243
|
children: /* @__PURE__ */ b("path", { d: "M4.46 3.83 14.94 3a3.7 3.7 0 0 1 2.5.62l3 2.16a1.4 1.4 0 0 1 .56 1.31v13.06a1.7 1.7 0 0 1-1.66 1.7l-12.5.78a2.4 2.4 0 0 1-1.85-.62L2.5 19.7a1.7 1.7 0 0 1-.5-1.2V5.16c0-.74.6-1.27 1.46-1.33l1-.01zm.46 1.86c-.31 0-.46.16-.46.47v12.25c0 .31.16.47.46.47l11.62-.7c.31 0 .46-.16.46-.47V6c0-.32-.16-.47-.46-.47L4.92 5.7zm5.57 2.32c.16 0 .31.16.31.31v.46l3.7.23c.31 0 .46.16.46.47v8.32c0 .31-.16.47-.46.47l-3.7.23c-.31 0-.46-.16-.46-.47V8.78c0-.16.15-.32.15-.46l-.04-.31z" })
|
|
5203
|
-
}),
|
|
5204
|
-
"linkedin.com":
|
|
5205
|
-
"github.com":
|
|
5206
|
-
"x.com":
|
|
5207
|
-
"twitter.com":
|
|
5208
|
-
"youtube.com":
|
|
5209
|
-
"youtu.be":
|
|
5210
|
-
"gmail.com":
|
|
5211
|
-
"mail.google.com":
|
|
5212
|
-
"slack.com":
|
|
5213
|
-
"notion.so":
|
|
5214
|
-
"notion.com":
|
|
5244
|
+
}), ko = {
|
|
5245
|
+
"linkedin.com": So,
|
|
5246
|
+
"github.com": Co,
|
|
5247
|
+
"x.com": wo,
|
|
5248
|
+
"twitter.com": wo,
|
|
5249
|
+
"youtube.com": To,
|
|
5250
|
+
"youtu.be": To,
|
|
5251
|
+
"gmail.com": Eo,
|
|
5252
|
+
"mail.google.com": Eo,
|
|
5253
|
+
"slack.com": Do,
|
|
5254
|
+
"notion.so": Oo,
|
|
5255
|
+
"notion.com": Oo
|
|
5215
5256
|
};
|
|
5216
|
-
function
|
|
5257
|
+
function Ao(e, t) {
|
|
5217
5258
|
return !e || t === "none" ? null : t === "google" ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=32` : `https://${e}/favicon.ico`;
|
|
5218
5259
|
}
|
|
5219
|
-
var
|
|
5260
|
+
var jo = {
|
|
5220
5261
|
width: 16,
|
|
5221
5262
|
height: 16,
|
|
5222
5263
|
flexShrink: 0,
|
|
5223
5264
|
objectFit: "contain"
|
|
5224
5265
|
};
|
|
5225
|
-
function
|
|
5226
|
-
let n = e ? e.toLowerCase() : "", r = n ?
|
|
5266
|
+
function Mo({ domain: e, source: t }) {
|
|
5267
|
+
let n = e ? e.toLowerCase() : "", r = n ? ko[n] : void 0;
|
|
5227
5268
|
if (r) return /* @__PURE__ */ b(r, {});
|
|
5228
|
-
let i =
|
|
5229
|
-
return i ? /* @__PURE__ */ b(
|
|
5269
|
+
let i = Ao(n, t);
|
|
5270
|
+
return i ? /* @__PURE__ */ b(No, { src: i }) : /* @__PURE__ */ b(xo, {});
|
|
5230
5271
|
}
|
|
5231
|
-
function
|
|
5272
|
+
function No({ src: e }) {
|
|
5232
5273
|
let [t, n] = p(!1);
|
|
5233
5274
|
return l(() => {
|
|
5234
5275
|
n(!1);
|
|
5235
|
-
}, [e]), t ? /* @__PURE__ */ b(
|
|
5276
|
+
}, [e]), t ? /* @__PURE__ */ b(xo, {}) : /* @__PURE__ */ b("img", {
|
|
5236
5277
|
src: e,
|
|
5237
5278
|
alt: "",
|
|
5238
5279
|
width: 16,
|
|
@@ -5240,7 +5281,7 @@ function Do({ src: e }) {
|
|
|
5240
5281
|
loading: "lazy",
|
|
5241
5282
|
decoding: "async",
|
|
5242
5283
|
referrerPolicy: "no-referrer",
|
|
5243
|
-
style:
|
|
5284
|
+
style: jo,
|
|
5244
5285
|
onError: () => n(!0)
|
|
5245
5286
|
});
|
|
5246
5287
|
}
|
|
@@ -5250,33 +5291,33 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
5250
5291
|
color: "var(--text-4)"
|
|
5251
5292
|
},
|
|
5252
5293
|
children: "—"
|
|
5253
|
-
}),
|
|
5294
|
+
}), Po = {
|
|
5254
5295
|
display: "inline-flex",
|
|
5255
5296
|
alignItems: "center",
|
|
5256
5297
|
gap: 4,
|
|
5257
5298
|
fontSize: 12.5,
|
|
5258
5299
|
color: "var(--accent)",
|
|
5259
5300
|
textDecoration: "none"
|
|
5260
|
-
},
|
|
5301
|
+
}, Fo = { fontSize: 12.5 }, Io = (e) => {
|
|
5261
5302
|
let n = e.field.display?.favicon_source ?? "google";
|
|
5262
5303
|
return (e) => {
|
|
5263
5304
|
let r = e == null ? "" : R(e);
|
|
5264
5305
|
if (!r) return $;
|
|
5265
|
-
let i =
|
|
5266
|
-
if (i == null || !
|
|
5267
|
-
style:
|
|
5306
|
+
let i = go(r);
|
|
5307
|
+
if (i == null || !yo(i)) return /* @__PURE__ */ b("span", {
|
|
5308
|
+
style: Fo,
|
|
5268
5309
|
children: r
|
|
5269
5310
|
});
|
|
5270
|
-
let a =
|
|
5311
|
+
let a = _o(i), o = vo(i, a ?? "") ?? a ?? r;
|
|
5271
5312
|
return /* @__PURE__ */ x("a", {
|
|
5272
5313
|
href: i,
|
|
5273
5314
|
target: "_blank",
|
|
5274
5315
|
rel: "noopener noreferrer",
|
|
5275
5316
|
title: r,
|
|
5276
5317
|
className: "mono",
|
|
5277
|
-
style:
|
|
5318
|
+
style: Po,
|
|
5278
5319
|
children: [
|
|
5279
|
-
/* @__PURE__ */ b(
|
|
5320
|
+
/* @__PURE__ */ b(Mo, {
|
|
5280
5321
|
domain: a,
|
|
5281
5322
|
source: n
|
|
5282
5323
|
}),
|
|
@@ -5285,45 +5326,45 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
5285
5326
|
]
|
|
5286
5327
|
});
|
|
5287
5328
|
};
|
|
5288
|
-
},
|
|
5329
|
+
}, Lo = {
|
|
5289
5330
|
fontSize: 12.5,
|
|
5290
5331
|
color: "var(--accent)",
|
|
5291
5332
|
textDecoration: "none"
|
|
5292
|
-
},
|
|
5333
|
+
}, Ro = () => (e) => {
|
|
5293
5334
|
let t = e == null ? "" : R(e);
|
|
5294
5335
|
return t ? /* @__PURE__ */ b("a", {
|
|
5295
5336
|
href: `mailto:${t}`,
|
|
5296
5337
|
className: "mono",
|
|
5297
|
-
style:
|
|
5338
|
+
style: Lo,
|
|
5298
5339
|
children: t
|
|
5299
5340
|
}) : $;
|
|
5300
|
-
},
|
|
5341
|
+
}, zo = {
|
|
5301
5342
|
fontSize: 12.5,
|
|
5302
5343
|
color: "var(--accent)",
|
|
5303
5344
|
textDecoration: "none"
|
|
5304
|
-
},
|
|
5345
|
+
}, Bo = { fontSize: 12.5 }, Vo = /^[+()\-.\s\d]+$/, Ho = () => (e) => {
|
|
5305
5346
|
let t = e == null ? "" : R(e);
|
|
5306
5347
|
if (!t) return $;
|
|
5307
5348
|
let n = t.trim();
|
|
5308
|
-
if (!
|
|
5309
|
-
style:
|
|
5349
|
+
if (!Vo.test(n)) return /* @__PURE__ */ b("span", {
|
|
5350
|
+
style: Bo,
|
|
5310
5351
|
children: t
|
|
5311
5352
|
});
|
|
5312
5353
|
let r = n.replace(/\s+/g, "");
|
|
5313
5354
|
return /* @__PURE__ */ b("a", {
|
|
5314
5355
|
href: `tel:${r}`,
|
|
5315
5356
|
className: "mono",
|
|
5316
|
-
style:
|
|
5357
|
+
style: zo,
|
|
5317
5358
|
children: t
|
|
5318
5359
|
});
|
|
5319
|
-
},
|
|
5360
|
+
}, Uo = {
|
|
5320
5361
|
fontSize: 12.5,
|
|
5321
5362
|
fontVariantNumeric: "tabular-nums"
|
|
5322
|
-
},
|
|
5363
|
+
}, Wo = {
|
|
5323
5364
|
color: "var(--text-3)",
|
|
5324
5365
|
marginLeft: 4
|
|
5325
|
-
},
|
|
5326
|
-
function
|
|
5366
|
+
}, Go = { fontSize: 12.5 };
|
|
5367
|
+
function Ko(e, t) {
|
|
5327
5368
|
let n = e.trim();
|
|
5328
5369
|
if (n === "" || n === "-") return n;
|
|
5329
5370
|
let r = n.startsWith("-"), [i, a] = (r ? n.slice(1) : n).split("."), o;
|
|
@@ -5335,45 +5376,45 @@ function Bo(e, t) {
|
|
|
5335
5376
|
let s = r ? `-${o}` : o;
|
|
5336
5377
|
return a !== void 0 && (s += `.${a}`), s;
|
|
5337
5378
|
}
|
|
5338
|
-
var
|
|
5379
|
+
var qo = (e) => {
|
|
5339
5380
|
let { field: t, fieldName: n, locale: r = "en" } = e, i = new Intl.NumberFormat(r), a = t.type === "decimal", o = t.unit ? t.unit.display || t.unit.storage : void 0;
|
|
5340
5381
|
return (e, t) => {
|
|
5341
5382
|
if (e == null) return $;
|
|
5342
5383
|
let r = t.$units?.[n] || (o && !o.startsWith("$") ? o : void 0), s;
|
|
5343
|
-
if (a && typeof e == "string") s =
|
|
5384
|
+
if (a && typeof e == "string") s = Ko(e, i);
|
|
5344
5385
|
else {
|
|
5345
5386
|
let t = typeof e == "number" ? e : Number(e);
|
|
5346
5387
|
s = Number.isFinite(t) ? i.format(t) : null;
|
|
5347
5388
|
}
|
|
5348
5389
|
return s == null ? /* @__PURE__ */ b("span", {
|
|
5349
|
-
style:
|
|
5390
|
+
style: Go,
|
|
5350
5391
|
children: "—"
|
|
5351
5392
|
}) : /* @__PURE__ */ x("span", {
|
|
5352
5393
|
className: "num",
|
|
5353
|
-
style:
|
|
5394
|
+
style: Uo,
|
|
5354
5395
|
children: [s, r && /* @__PURE__ */ b("span", {
|
|
5355
|
-
style:
|
|
5396
|
+
style: Wo,
|
|
5356
5397
|
children: r
|
|
5357
5398
|
})]
|
|
5358
5399
|
});
|
|
5359
5400
|
};
|
|
5360
|
-
},
|
|
5401
|
+
}, Jo = { fontSize: 12.5 }, Yo = () => (e) => e == null || e === "" ? $ : /* @__PURE__ */ b("code", {
|
|
5361
5402
|
className: "mono",
|
|
5362
|
-
style:
|
|
5403
|
+
style: Jo,
|
|
5363
5404
|
children: R(e)
|
|
5364
|
-
}),
|
|
5405
|
+
}), Xo = {
|
|
5365
5406
|
display: "inline-flex",
|
|
5366
5407
|
alignItems: "center",
|
|
5367
5408
|
gap: 4,
|
|
5368
5409
|
fontSize: 12.5,
|
|
5369
5410
|
color: "var(--accent)",
|
|
5370
5411
|
textDecoration: "none"
|
|
5371
|
-
},
|
|
5412
|
+
}, Zo = { fontSize: 12.5 }, Qo = () => (e) => {
|
|
5372
5413
|
let n = e == null ? "" : R(e);
|
|
5373
5414
|
if (!n) return $;
|
|
5374
|
-
let r =
|
|
5375
|
-
return r == null || !
|
|
5376
|
-
style:
|
|
5415
|
+
let r = go(n);
|
|
5416
|
+
return r == null || !yo(r) ? /* @__PURE__ */ b("span", {
|
|
5417
|
+
style: Zo,
|
|
5377
5418
|
children: n
|
|
5378
5419
|
}) : /* @__PURE__ */ x("a", {
|
|
5379
5420
|
href: r,
|
|
@@ -5381,21 +5422,21 @@ var Vo = (e) => {
|
|
|
5381
5422
|
rel: "noopener noreferrer",
|
|
5382
5423
|
title: n,
|
|
5383
5424
|
className: "mono",
|
|
5384
|
-
style:
|
|
5425
|
+
style: Xo,
|
|
5385
5426
|
children: [n, /* @__PURE__ */ b(t.external, { size: 11 })]
|
|
5386
5427
|
});
|
|
5387
|
-
},
|
|
5388
|
-
function
|
|
5389
|
-
return Math.max(1, Math.min(typeof e == "number" && Number.isFinite(e) ? Math.floor(e) :
|
|
5428
|
+
}, $o = 400, es = 2e3;
|
|
5429
|
+
function ts(e) {
|
|
5430
|
+
return Math.max(1, Math.min(typeof e == "number" && Number.isFinite(e) ? Math.floor(e) : $o, es));
|
|
5390
5431
|
}
|
|
5391
|
-
function
|
|
5432
|
+
function ns(e, t) {
|
|
5392
5433
|
return e.length <= t ? e : `${e.slice(0, t)}...`;
|
|
5393
5434
|
}
|
|
5394
|
-
function
|
|
5435
|
+
function rs(e, t, n, r = 0) {
|
|
5395
5436
|
if (e == null || e === "") return "";
|
|
5396
|
-
if (typeof e == "string") return
|
|
5437
|
+
if (typeof e == "string") return ns(e, t);
|
|
5397
5438
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
5398
|
-
if (typeof e != "object") return
|
|
5439
|
+
if (typeof e != "object") return ns(R(e), t);
|
|
5399
5440
|
if (n.has(e)) return "[Circular]";
|
|
5400
5441
|
if (r >= 3) return Array.isArray(e) ? "[...]" : "{...}";
|
|
5401
5442
|
n.add(e);
|
|
@@ -5406,30 +5447,30 @@ function Zo(e, t, n, r = 0) {
|
|
|
5406
5447
|
a.push(a.length > 1 ? ",..." : "...");
|
|
5407
5448
|
break;
|
|
5408
5449
|
}
|
|
5409
|
-
let f =
|
|
5450
|
+
let f = rs(c, d, n, r + 1);
|
|
5410
5451
|
if (a.push(u, f), a.join("").length >= t) {
|
|
5411
5452
|
a.push(",...");
|
|
5412
5453
|
break;
|
|
5413
5454
|
}
|
|
5414
5455
|
}
|
|
5415
|
-
return a.push(i), n.delete(e),
|
|
5456
|
+
return a.push(i), n.delete(e), ns(a.join(""), t);
|
|
5416
5457
|
}
|
|
5417
|
-
function
|
|
5418
|
-
return
|
|
5458
|
+
function is(e, t) {
|
|
5459
|
+
return rs(e, t, /* @__PURE__ */ new WeakSet());
|
|
5419
5460
|
}
|
|
5420
|
-
var
|
|
5421
|
-
let t = e.surface ?? "detail", n =
|
|
5461
|
+
var as = (e) => {
|
|
5462
|
+
let t = e.surface ?? "detail", n = ts(e.field.display?.list_preview?.max_chars);
|
|
5422
5463
|
return (r) => {
|
|
5423
|
-
if (
|
|
5464
|
+
if (Ki(r)) return $;
|
|
5424
5465
|
if (t === "list") {
|
|
5425
|
-
let e =
|
|
5466
|
+
let e = is(r, n);
|
|
5426
5467
|
return /* @__PURE__ */ b("span", {
|
|
5427
5468
|
className: "font-mono text-xs text-muted-foreground",
|
|
5428
5469
|
title: e,
|
|
5429
5470
|
children: e
|
|
5430
5471
|
});
|
|
5431
5472
|
}
|
|
5432
|
-
return /* @__PURE__ */ b(
|
|
5473
|
+
return /* @__PURE__ */ b(qi, {
|
|
5433
5474
|
field: e.field,
|
|
5434
5475
|
fieldName: e.fieldName,
|
|
5435
5476
|
value: r,
|
|
@@ -5437,7 +5478,7 @@ var $o = (e) => {
|
|
|
5437
5478
|
locale: e.locale
|
|
5438
5479
|
});
|
|
5439
5480
|
};
|
|
5440
|
-
},
|
|
5481
|
+
}, os = [
|
|
5441
5482
|
{
|
|
5442
5483
|
pattern: /```[^\n]*\n?([\s\S]*?)```/g,
|
|
5443
5484
|
replacement: "$1"
|
|
@@ -5500,13 +5541,13 @@ var $o = (e) => {
|
|
|
5500
5541
|
replacement: ""
|
|
5501
5542
|
}
|
|
5502
5543
|
];
|
|
5503
|
-
function
|
|
5544
|
+
function ss(e) {
|
|
5504
5545
|
if (!e) return {
|
|
5505
5546
|
text: "",
|
|
5506
5547
|
isPlain: !0
|
|
5507
5548
|
};
|
|
5508
5549
|
let t = e, n = !1;
|
|
5509
|
-
for (let e of
|
|
5550
|
+
for (let e of os) {
|
|
5510
5551
|
let r = t.replace(e.pattern, e.replacement);
|
|
5511
5552
|
r !== t && e.structural !== !1 && (n = !0), t = r;
|
|
5512
5553
|
}
|
|
@@ -5517,123 +5558,124 @@ function ts(e) {
|
|
|
5517
5558
|
}
|
|
5518
5559
|
//#endregion
|
|
5519
5560
|
//#region src/components/fields/cells/factories/markdown.tsx
|
|
5520
|
-
function
|
|
5521
|
-
return /* @__PURE__ */ b(
|
|
5561
|
+
function cs(e) {
|
|
5562
|
+
return /* @__PURE__ */ b(oi, { content: e });
|
|
5522
5563
|
}
|
|
5523
|
-
var
|
|
5564
|
+
var ls = (e) => {
|
|
5524
5565
|
let t = e.surface === "list";
|
|
5525
5566
|
return (e) => {
|
|
5526
5567
|
let n = e == null ? "" : R(e);
|
|
5527
5568
|
if (!n) return $;
|
|
5528
|
-
if (!t) return
|
|
5529
|
-
let { text: r, isPlain: i } =
|
|
5569
|
+
if (!t) return cs(n);
|
|
5570
|
+
let { text: r, isPlain: i } = ss(n);
|
|
5530
5571
|
return i ? /* @__PURE__ */ b("span", {
|
|
5531
5572
|
title: r,
|
|
5532
5573
|
children: r
|
|
5533
5574
|
}) : /* @__PURE__ */ b(se, {
|
|
5534
|
-
content:
|
|
5575
|
+
content: cs(n),
|
|
5535
5576
|
children: /* @__PURE__ */ b("span", {
|
|
5536
5577
|
title: r,
|
|
5537
5578
|
children: r
|
|
5538
5579
|
})
|
|
5539
5580
|
});
|
|
5540
5581
|
};
|
|
5541
|
-
},
|
|
5582
|
+
}, us = "[SET]", ds = {
|
|
5542
5583
|
fontSize: 12.5,
|
|
5543
5584
|
color: "var(--text-3)"
|
|
5544
|
-
},
|
|
5585
|
+
}, fs = {
|
|
5545
5586
|
fontSize: 12.5,
|
|
5546
5587
|
color: "var(--text-4)",
|
|
5547
5588
|
fontStyle: "italic"
|
|
5548
|
-
},
|
|
5589
|
+
}, ps = () => (e) => e === us || typeof e == "string" && e !== "" ? /* @__PURE__ */ b("span", {
|
|
5549
5590
|
className: "mono",
|
|
5550
|
-
style:
|
|
5551
|
-
children:
|
|
5591
|
+
style: ds,
|
|
5592
|
+
children: us
|
|
5552
5593
|
}) : /* @__PURE__ */ b("span", {
|
|
5553
|
-
style:
|
|
5594
|
+
style: fs,
|
|
5554
5595
|
children: "Not set"
|
|
5555
5596
|
});
|
|
5556
5597
|
//#endregion
|
|
5557
5598
|
//#region src/components/fields/cells/factories/richTextPreview.tsx
|
|
5558
|
-
function
|
|
5559
|
-
return /* @__PURE__ */ b(
|
|
5599
|
+
function ms(e, t) {
|
|
5600
|
+
return /* @__PURE__ */ b(oi, {
|
|
5560
5601
|
content: e,
|
|
5561
5602
|
files: t
|
|
5562
5603
|
});
|
|
5563
5604
|
}
|
|
5564
|
-
var
|
|
5605
|
+
var hs = (e) => {
|
|
5565
5606
|
let { fieldName: t } = e, n = e.surface === "list";
|
|
5566
5607
|
return (e, r) => {
|
|
5567
|
-
let i = r?.$files?.[t], a =
|
|
5608
|
+
let i = r?.$files?.[t], a = pa(e, i);
|
|
5568
5609
|
if (!a.markdown) return $;
|
|
5569
|
-
if (!n) return
|
|
5570
|
-
let { text: o, isPlain: s } =
|
|
5610
|
+
if (!n) return ms(a.markdown, a.files);
|
|
5611
|
+
let { text: o, isPlain: s } = ss(a.markdown);
|
|
5571
5612
|
return s ? /* @__PURE__ */ b("span", {
|
|
5572
5613
|
title: o,
|
|
5573
5614
|
children: o
|
|
5574
5615
|
}) : /* @__PURE__ */ b(se, {
|
|
5575
|
-
content:
|
|
5616
|
+
content: ms(a.markdown, a.files),
|
|
5576
5617
|
children: /* @__PURE__ */ b("span", {
|
|
5577
5618
|
title: o,
|
|
5578
5619
|
children: o
|
|
5579
5620
|
})
|
|
5580
5621
|
});
|
|
5581
5622
|
};
|
|
5582
|
-
},
|
|
5623
|
+
}, gs = { fontSize: 12.5 }, _s = {
|
|
5583
5624
|
fontSize: 12.5,
|
|
5584
5625
|
whiteSpace: "pre-wrap",
|
|
5585
5626
|
margin: 0
|
|
5586
5627
|
};
|
|
5587
|
-
function
|
|
5628
|
+
function vs(e) {
|
|
5588
5629
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
5589
5630
|
}
|
|
5590
|
-
function
|
|
5631
|
+
function ys(e, t) {
|
|
5591
5632
|
if (t && typeof e[t] == "string" && e[t] !== "") return [t, e[t]];
|
|
5592
5633
|
for (let [t, n] of Object.entries(e)) if (typeof n == "string" && n !== "") return [t, n];
|
|
5593
5634
|
return null;
|
|
5594
5635
|
}
|
|
5595
5636
|
//#endregion
|
|
5596
5637
|
//#region src/components/fields/cells/registry.ts
|
|
5597
|
-
var
|
|
5598
|
-
text:
|
|
5599
|
-
bool_pill:
|
|
5600
|
-
badge:
|
|
5601
|
-
status_pill:
|
|
5602
|
-
tag_list:
|
|
5603
|
-
time_ago:
|
|
5604
|
-
timestamp_full:
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5638
|
+
var bs = {
|
|
5639
|
+
text: Va,
|
|
5640
|
+
bool_pill: Ha,
|
|
5641
|
+
badge: qa,
|
|
5642
|
+
status_pill: Xa,
|
|
5643
|
+
tag_list: $a,
|
|
5644
|
+
time_ago: to,
|
|
5645
|
+
timestamp_full: no,
|
|
5646
|
+
date: eo,
|
|
5647
|
+
next_run: ao,
|
|
5648
|
+
money: oo,
|
|
5649
|
+
ref_link: lo,
|
|
5650
|
+
url: Io,
|
|
5651
|
+
email: Ro,
|
|
5652
|
+
phone: Ho,
|
|
5653
|
+
number: qo,
|
|
5654
|
+
code: Yo,
|
|
5655
|
+
link: Qo,
|
|
5656
|
+
json: as,
|
|
5657
|
+
markdown: ls,
|
|
5658
|
+
password_mask: ps,
|
|
5659
|
+
rich_text_preview: hs,
|
|
5618
5660
|
multilang_inline: (e) => {
|
|
5619
5661
|
let { field: t, locale: n } = e, r = t.type === "multilang_text";
|
|
5620
5662
|
return (e) => {
|
|
5621
|
-
let t =
|
|
5663
|
+
let t = ys(vs(e), n);
|
|
5622
5664
|
if (!t) return r ? /* @__PURE__ */ b("p", {
|
|
5623
|
-
style:
|
|
5665
|
+
style: _s,
|
|
5624
5666
|
children: "—"
|
|
5625
5667
|
}) : /* @__PURE__ */ b("span", {
|
|
5626
|
-
style:
|
|
5668
|
+
style: gs,
|
|
5627
5669
|
children: "—"
|
|
5628
5670
|
});
|
|
5629
5671
|
let [i, a] = t;
|
|
5630
5672
|
return r ? /* @__PURE__ */ b("p", {
|
|
5631
|
-
style:
|
|
5673
|
+
style: _s,
|
|
5632
5674
|
lang: i,
|
|
5633
5675
|
dir: "auto",
|
|
5634
5676
|
children: a
|
|
5635
5677
|
}) : /* @__PURE__ */ b("span", {
|
|
5636
|
-
style:
|
|
5678
|
+
style: gs,
|
|
5637
5679
|
lang: i,
|
|
5638
5680
|
dir: "auto",
|
|
5639
5681
|
children: a
|
|
@@ -5641,53 +5683,53 @@ var ms = {
|
|
|
5641
5683
|
};
|
|
5642
5684
|
}
|
|
5643
5685
|
};
|
|
5644
|
-
Object.keys(
|
|
5645
|
-
function
|
|
5646
|
-
let t = e.field.display?.widget ?? "text", n =
|
|
5686
|
+
Object.keys(bs).sort();
|
|
5687
|
+
function xs(e) {
|
|
5688
|
+
let t = e.field.display?.widget ?? "text", n = bs[t];
|
|
5647
5689
|
if (!n) throw Error(`resolveCellRenderer: no factory registered for widget "${t}" (field "${e.fieldName}"). The engine must stamp a smart default at YAML-load time; an unknown widget here indicates an out-of-sync allow-list.`);
|
|
5648
5690
|
return n(e);
|
|
5649
5691
|
}
|
|
5650
5692
|
//#endregion
|
|
5651
5693
|
//#region src/components/fields/index.tsx
|
|
5652
|
-
var
|
|
5653
|
-
string:
|
|
5654
|
-
text:
|
|
5655
|
-
rich_text:
|
|
5656
|
-
int:
|
|
5657
|
-
float:
|
|
5658
|
-
decimal:
|
|
5659
|
-
bool:
|
|
5660
|
-
timestamp:
|
|
5661
|
-
date:
|
|
5662
|
-
time:
|
|
5663
|
-
enum:
|
|
5664
|
-
email:
|
|
5665
|
-
url:
|
|
5666
|
-
phone:
|
|
5667
|
-
uuid:
|
|
5668
|
-
bytes:
|
|
5669
|
-
ref:
|
|
5670
|
-
json:
|
|
5671
|
-
tags:
|
|
5672
|
-
string_array:
|
|
5673
|
-
int_array:
|
|
5674
|
-
uuid_array:
|
|
5675
|
-
multilang:
|
|
5676
|
-
multilang_text:
|
|
5677
|
-
structure:
|
|
5678
|
-
secret:
|
|
5679
|
-
password:
|
|
5694
|
+
var Ss = {
|
|
5695
|
+
string: _i,
|
|
5696
|
+
text: vi,
|
|
5697
|
+
rich_text: Ra,
|
|
5698
|
+
int: Fi,
|
|
5699
|
+
float: Fi,
|
|
5700
|
+
decimal: Fi,
|
|
5701
|
+
bool: Mi,
|
|
5702
|
+
timestamp: ji,
|
|
5703
|
+
date: ji,
|
|
5704
|
+
time: ji,
|
|
5705
|
+
enum: bi,
|
|
5706
|
+
email: xi,
|
|
5707
|
+
url: Si,
|
|
5708
|
+
phone: Ci,
|
|
5709
|
+
uuid: _i,
|
|
5710
|
+
bytes: _i,
|
|
5711
|
+
ref: Ui,
|
|
5712
|
+
json: qi,
|
|
5713
|
+
tags: _i,
|
|
5714
|
+
string_array: oa,
|
|
5715
|
+
int_array: ua,
|
|
5716
|
+
uuid_array: oa,
|
|
5717
|
+
multilang: Yi,
|
|
5718
|
+
multilang_text: Zi,
|
|
5719
|
+
structure: Qi,
|
|
5720
|
+
secret: na,
|
|
5721
|
+
password: ia
|
|
5680
5722
|
};
|
|
5681
|
-
for (let e of
|
|
5682
|
-
function
|
|
5683
|
-
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ b(
|
|
5723
|
+
for (let e of hi) if (!Ss[e]) throw Error(`editRegistry: missing entry for FieldType "${e}". The TS union (types/fieldType.ts) and editRegistry must stay in sync with golang/internal/engine/types.go.`);
|
|
5724
|
+
function Cs(e) {
|
|
5725
|
+
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ b(Qi, { ...e });
|
|
5684
5726
|
if (e.mode === "edit") {
|
|
5685
|
-
let t =
|
|
5727
|
+
let t = Ss[e.field.type];
|
|
5686
5728
|
if (!t) throw Error(`renderField: no edit-mode renderer for FieldType "${e.field.type}" (field "${e.fieldName}"). editRegistry must be total over FieldType; check types/fieldType.ts and components/fields/index.tsx.`);
|
|
5687
5729
|
return /* @__PURE__ */ b(t, { ...e });
|
|
5688
5730
|
}
|
|
5689
5731
|
if (!e.field.display?.widget) throw Error(`renderField: display mode requires a non-empty field.display.widget (field "${e.fieldName}", type "${e.field.type}"). The engine must stamp a smart default; an empty widget here means the field bypassed ResolveDefaultWidgets.`);
|
|
5690
|
-
return
|
|
5732
|
+
return xs({
|
|
5691
5733
|
field: e.field,
|
|
5692
5734
|
fieldName: e.fieldName,
|
|
5693
5735
|
surface: e.surface ?? "detail",
|
|
@@ -5700,57 +5742,57 @@ function _s(e) {
|
|
|
5700
5742
|
}
|
|
5701
5743
|
//#endregion
|
|
5702
5744
|
//#region src/hooks/useUserLocale.ts
|
|
5703
|
-
var
|
|
5704
|
-
function
|
|
5745
|
+
var ws = "en";
|
|
5746
|
+
function Ts() {
|
|
5705
5747
|
if (typeof navigator > "u") return;
|
|
5706
5748
|
let e = navigator.language;
|
|
5707
5749
|
if (e) return e.split("-")[0] || void 0;
|
|
5708
5750
|
}
|
|
5709
|
-
function
|
|
5710
|
-
let e =
|
|
5751
|
+
function Es() {
|
|
5752
|
+
let e = $n((e) => e.user), { data: t } = X(), n = e?.language;
|
|
5711
5753
|
if (n && n.trim()) return n;
|
|
5712
5754
|
let r = t?.languages?.[0]?.code;
|
|
5713
|
-
return r && r.trim() ? r :
|
|
5755
|
+
return r && r.trim() ? r : Ts() || ws;
|
|
5714
5756
|
}
|
|
5715
5757
|
//#endregion
|
|
5716
5758
|
//#region src/lib/actions.ts
|
|
5717
|
-
var
|
|
5759
|
+
var Ds = {
|
|
5718
5760
|
__create: "create",
|
|
5719
5761
|
__edit: "update",
|
|
5720
5762
|
__delete: "delete",
|
|
5721
5763
|
__restore: "restore"
|
|
5722
|
-
},
|
|
5723
|
-
function
|
|
5764
|
+
}, Os = "__peek", ks = "__open";
|
|
5765
|
+
function As(e) {
|
|
5724
5766
|
return e === "__peek" || e === "__open";
|
|
5725
5767
|
}
|
|
5726
|
-
function
|
|
5768
|
+
function js(e, t) {
|
|
5727
5769
|
if (!e) return "";
|
|
5728
5770
|
if (t) try {
|
|
5729
|
-
return
|
|
5771
|
+
return at(t, nt(t, e));
|
|
5730
5772
|
} catch {}
|
|
5731
5773
|
let n = e.id;
|
|
5732
5774
|
return typeof n == "string" ? n : n == null ? "" : R(n);
|
|
5733
5775
|
}
|
|
5734
|
-
function
|
|
5776
|
+
function Ms(e, t) {
|
|
5735
5777
|
if (!e || e.length === 0) return !0;
|
|
5736
5778
|
for (let n of e) {
|
|
5737
5779
|
if (n.status && n.status.length > 0) {
|
|
5738
5780
|
let e = t.status;
|
|
5739
5781
|
if (typeof e != "string" || !n.status.includes(e)) return !1;
|
|
5740
5782
|
}
|
|
5741
|
-
if (n.field && !
|
|
5783
|
+
if (n.field && !Ns(n, t)) return !1;
|
|
5742
5784
|
}
|
|
5743
5785
|
return !0;
|
|
5744
5786
|
}
|
|
5745
|
-
function
|
|
5746
|
-
let n =
|
|
5787
|
+
function Ns(e, t) {
|
|
5788
|
+
let n = Ps(t, e.field), r = e.op || "eq";
|
|
5747
5789
|
if (r === "in" || r === "not_in") {
|
|
5748
5790
|
let t = Array.isArray(e.value) ? e.value : [e.value], i = R(n), a = t.some((e) => R(e) === i);
|
|
5749
5791
|
return r === "in" ? a : !a;
|
|
5750
5792
|
}
|
|
5751
|
-
return typeof e.value == "boolean" && r === "eq" ?
|
|
5793
|
+
return typeof e.value == "boolean" && r === "eq" ? Is(n) === e.value : typeof n == "number" && typeof e.value == "number" ? Ls(n, e.value, r) : Ls(R(n), R(e.value), r);
|
|
5752
5794
|
}
|
|
5753
|
-
function
|
|
5795
|
+
function Ps(e, t) {
|
|
5754
5796
|
if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
5755
5797
|
if (t.startsWith("$status.")) {
|
|
5756
5798
|
let n = t.slice(8), r = e.$statuses;
|
|
@@ -5761,27 +5803,27 @@ function Os(e, t) {
|
|
|
5761
5803
|
return Array.isArray(r) ? r.find((e) => !e || typeof e != "object" ? !1 : e.property_code === n)?.value : void 0;
|
|
5762
5804
|
}
|
|
5763
5805
|
}
|
|
5764
|
-
function
|
|
5806
|
+
function Fs(e) {
|
|
5765
5807
|
let t = null, n = (n, r) => {
|
|
5766
5808
|
Object.prototype.hasOwnProperty.call(e, n) || (t === null && (t = { ...e }), t[n] = r);
|
|
5767
5809
|
}, r = e.$statuses;
|
|
5768
5810
|
if (Array.isArray(r)) for (let t of r) {
|
|
5769
5811
|
if (!t || typeof t != "object") continue;
|
|
5770
5812
|
let r = t.group_code;
|
|
5771
|
-
typeof r == "string" && n(`$status.${r}`,
|
|
5813
|
+
typeof r == "string" && n(`$status.${r}`, Ps(e, `$status.${r}`));
|
|
5772
5814
|
}
|
|
5773
5815
|
let i = e.$properties;
|
|
5774
5816
|
if (Array.isArray(i)) for (let t of i) {
|
|
5775
5817
|
if (!t || typeof t != "object") continue;
|
|
5776
5818
|
let r = t.property_code;
|
|
5777
|
-
typeof r == "string" && n(`$property.${r}`,
|
|
5819
|
+
typeof r == "string" && n(`$property.${r}`, Ps(e, `$property.${r}`));
|
|
5778
5820
|
}
|
|
5779
5821
|
return t ?? e;
|
|
5780
5822
|
}
|
|
5781
|
-
function
|
|
5823
|
+
function Is(e) {
|
|
5782
5824
|
return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e != "number" || e !== 0;
|
|
5783
5825
|
}
|
|
5784
|
-
function
|
|
5826
|
+
function Ls(e, t, n) {
|
|
5785
5827
|
switch (n) {
|
|
5786
5828
|
case "eq": return e === t;
|
|
5787
5829
|
case "ne": return e !== t;
|
|
@@ -5794,14 +5836,14 @@ function js(e, t, n) {
|
|
|
5794
5836
|
default: return !1;
|
|
5795
5837
|
}
|
|
5796
5838
|
}
|
|
5797
|
-
function
|
|
5839
|
+
function Rs(e, t) {
|
|
5798
5840
|
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).map(([e, t]) => ({
|
|
5799
5841
|
code: e,
|
|
5800
5842
|
action: t
|
|
5801
5843
|
})) : [];
|
|
5802
5844
|
}
|
|
5803
|
-
function
|
|
5804
|
-
return !e && !r ? [] : t === void 0 ?
|
|
5845
|
+
function zs(e, t, n, r) {
|
|
5846
|
+
return !e && !r ? [] : t === void 0 ? Rs(e, n) : t.map((t) => {
|
|
5805
5847
|
let n = e?.[t] ?? r?.[t];
|
|
5806
5848
|
return n ? {
|
|
5807
5849
|
code: t,
|
|
@@ -5809,34 +5851,34 @@ function Ns(e, t, n, r) {
|
|
|
5809
5851
|
} : null;
|
|
5810
5852
|
}).filter((e) => e !== null);
|
|
5811
5853
|
}
|
|
5812
|
-
function
|
|
5854
|
+
function Bs(e, t) {
|
|
5813
5855
|
return e.filter(({ code: e }) => {
|
|
5814
|
-
let n =
|
|
5815
|
-
return !n ||
|
|
5856
|
+
let n = Ds[e];
|
|
5857
|
+
return !n || et(t, n);
|
|
5816
5858
|
});
|
|
5817
5859
|
}
|
|
5818
|
-
var
|
|
5860
|
+
var Vs = {
|
|
5819
5861
|
en: "This action cannot be undone.",
|
|
5820
5862
|
ru: "Это действие нельзя отменить."
|
|
5821
5863
|
};
|
|
5822
|
-
function
|
|
5864
|
+
function Hs(e) {
|
|
5823
5865
|
return !!e?.confirmation && Object.keys(e.confirmation).length > 0;
|
|
5824
5866
|
}
|
|
5825
|
-
function
|
|
5826
|
-
return
|
|
5867
|
+
function Us(e, t) {
|
|
5868
|
+
return Hs(e) ? z(e.confirmation, t) : e?.destructive ? z(Vs, t) : null;
|
|
5827
5869
|
}
|
|
5828
|
-
function
|
|
5829
|
-
return
|
|
5870
|
+
function Ws(e) {
|
|
5871
|
+
return Hs(e) || !!e?.destructive;
|
|
5830
5872
|
}
|
|
5831
|
-
function
|
|
5873
|
+
function Gs(e, t, n, r, i = !1) {
|
|
5832
5874
|
if (n && r) return r;
|
|
5833
5875
|
let a = z(e?.display?.description);
|
|
5834
5876
|
return a ? i || e?.display?.icon_only === !0 ? `${t}\n${a}` : a : t;
|
|
5835
5877
|
}
|
|
5836
|
-
function
|
|
5878
|
+
function Ks(e) {
|
|
5837
5879
|
return !!e.association;
|
|
5838
5880
|
}
|
|
5839
|
-
function
|
|
5881
|
+
function qs(e, t) {
|
|
5840
5882
|
if (e) {
|
|
5841
5883
|
for (let n of Object.values(e.screens)) if (n.entity === t && n.type === "list") {
|
|
5842
5884
|
let r = e.entities[t];
|
|
@@ -5847,21 +5889,21 @@ function Vs(e, t) {
|
|
|
5847
5889
|
}
|
|
5848
5890
|
}
|
|
5849
5891
|
}
|
|
5850
|
-
function
|
|
5892
|
+
function Js(e, t, n, r, i, a) {
|
|
5851
5893
|
let o = [];
|
|
5852
5894
|
for (let s of e) {
|
|
5853
|
-
let e =
|
|
5895
|
+
let e = Ys(s, t, n, r, i, a);
|
|
5854
5896
|
e !== null && o.push(e);
|
|
5855
5897
|
}
|
|
5856
5898
|
return o;
|
|
5857
5899
|
}
|
|
5858
|
-
function
|
|
5859
|
-
return e.kind === "group" ?
|
|
5900
|
+
function Ys(e, t, n, r, i, a) {
|
|
5901
|
+
return e.kind === "group" ? Xs(e, t, n, r, i, a) : Zs(e, t, n, r, i, a);
|
|
5860
5902
|
}
|
|
5861
|
-
function
|
|
5903
|
+
function Xs(e, t, n, r, i, a) {
|
|
5862
5904
|
let o = [];
|
|
5863
5905
|
for (let s of e.items) {
|
|
5864
|
-
let e =
|
|
5906
|
+
let e = Ys(s, t, n, r, i, a);
|
|
5865
5907
|
e !== null && o.push(e);
|
|
5866
5908
|
}
|
|
5867
5909
|
return o.length === 0 ? null : {
|
|
@@ -5869,32 +5911,32 @@ function Ws(e, t, n, r, i, a) {
|
|
|
5869
5911
|
items: o
|
|
5870
5912
|
};
|
|
5871
5913
|
}
|
|
5872
|
-
function
|
|
5914
|
+
function Zs(e, t, n, r, i, a) {
|
|
5873
5915
|
if (a && !e.code.startsWith("__") && !a.has(e.code)) return null;
|
|
5874
|
-
let o =
|
|
5916
|
+
let o = ec(e.code, t, n);
|
|
5875
5917
|
if (!o) return null;
|
|
5876
5918
|
if (i.length > 0) {
|
|
5877
|
-
let t =
|
|
5919
|
+
let t = Qs(o, i);
|
|
5878
5920
|
return t.visible ? {
|
|
5879
5921
|
...e,
|
|
5880
5922
|
enabled: t.enabled,
|
|
5881
5923
|
reason: t.reason
|
|
5882
5924
|
} : null;
|
|
5883
5925
|
}
|
|
5884
|
-
if (!
|
|
5885
|
-
let { enabled: s, reason: c } =
|
|
5926
|
+
if (!Ms(o.conditions, r) || !Ms(tc(o.visible_if), r)) return null;
|
|
5927
|
+
let { enabled: s, reason: c } = $s(o, r);
|
|
5886
5928
|
return {
|
|
5887
5929
|
...e,
|
|
5888
5930
|
enabled: s,
|
|
5889
5931
|
reason: c
|
|
5890
5932
|
};
|
|
5891
5933
|
}
|
|
5892
|
-
function
|
|
5893
|
-
let n =
|
|
5934
|
+
function Qs(e, t) {
|
|
5935
|
+
let n = tc(e.visible_if), r = tc(e.enabled_if), i = e.conditions, a = nc(e.enabled_if_reason), o = 0, s = 0;
|
|
5894
5936
|
for (let e of t) {
|
|
5895
|
-
let t =
|
|
5937
|
+
let t = Ms(n, e) && Ms(i, e);
|
|
5896
5938
|
t && o++;
|
|
5897
|
-
let a =
|
|
5939
|
+
let a = Ms(r, e);
|
|
5898
5940
|
(!t || !a) && s++;
|
|
5899
5941
|
}
|
|
5900
5942
|
if (o === 0) return {
|
|
@@ -5914,14 +5956,14 @@ function Ks(e, t) {
|
|
|
5914
5956
|
reason: a ? `${a} ${c}` : c
|
|
5915
5957
|
};
|
|
5916
5958
|
}
|
|
5917
|
-
function
|
|
5918
|
-
let n =
|
|
5959
|
+
function $s(e, t) {
|
|
5960
|
+
let n = tc(e.enabled_if);
|
|
5919
5961
|
if (!n || n.length === 0) return {
|
|
5920
5962
|
enabled: !0,
|
|
5921
5963
|
reason: null
|
|
5922
5964
|
};
|
|
5923
|
-
let r =
|
|
5924
|
-
return
|
|
5965
|
+
let r = nc(e.enabled_if_reason);
|
|
5966
|
+
return Ms(n, t) ? {
|
|
5925
5967
|
enabled: !0,
|
|
5926
5968
|
reason: null
|
|
5927
5969
|
} : {
|
|
@@ -5929,52 +5971,52 @@ function qs(e, t) {
|
|
|
5929
5971
|
reason: r
|
|
5930
5972
|
};
|
|
5931
5973
|
}
|
|
5932
|
-
function
|
|
5974
|
+
function ec(e, t, n) {
|
|
5933
5975
|
if (t && e in t) return t[e];
|
|
5934
5976
|
if (n && e in n) return n[e];
|
|
5935
5977
|
}
|
|
5936
|
-
function
|
|
5978
|
+
function tc(e) {
|
|
5937
5979
|
return e;
|
|
5938
5980
|
}
|
|
5939
|
-
function
|
|
5981
|
+
function nc(e) {
|
|
5940
5982
|
if (!e) return null;
|
|
5941
5983
|
if (e.en) return e.en;
|
|
5942
5984
|
let t = Object.values(e);
|
|
5943
5985
|
return t.length > 0 ? t[0] : null;
|
|
5944
5986
|
}
|
|
5945
|
-
function
|
|
5987
|
+
function rc(e, t, n, r, i) {
|
|
5946
5988
|
let a = [];
|
|
5947
5989
|
for (let o of e) {
|
|
5948
5990
|
if (o.kind === "group") {
|
|
5949
|
-
let e =
|
|
5991
|
+
let e = rc(o.items, t, n, r, i);
|
|
5950
5992
|
e.length > 0 && a.push({
|
|
5951
5993
|
...o,
|
|
5952
5994
|
items: e
|
|
5953
5995
|
});
|
|
5954
5996
|
continue;
|
|
5955
5997
|
}
|
|
5956
|
-
let e =
|
|
5998
|
+
let e = ec(o.code, t, n);
|
|
5957
5999
|
e && e.visibility?.includes(r) && (i?.bulkRequired === void 0 || (i.bulkRequiredPredicate ? i.bulkRequiredPredicate(e) : !1) === i.bulkRequired) && (i?.excludeIf && i.excludeIf(e) || a.push(o));
|
|
5958
6000
|
}
|
|
5959
6001
|
return a;
|
|
5960
6002
|
}
|
|
5961
|
-
function
|
|
6003
|
+
function ic(e, t, n, r, i, a) {
|
|
5962
6004
|
let o = e ?? t;
|
|
5963
|
-
return o ?
|
|
6005
|
+
return o ? rc(o, n, r, i, a) : cc(n, i);
|
|
5964
6006
|
}
|
|
5965
|
-
function
|
|
5966
|
-
return e.requires_selection === void 0 ?
|
|
6007
|
+
function ac(e) {
|
|
6008
|
+
return e.requires_selection === void 0 ? oc(e) : e.requires_selection;
|
|
5967
6009
|
}
|
|
5968
|
-
function
|
|
6010
|
+
function oc(e) {
|
|
5969
6011
|
return e.visibility?.includes("list_floatbar") ?? !1;
|
|
5970
6012
|
}
|
|
5971
|
-
function
|
|
6013
|
+
function sc(e, t, n, r, i) {
|
|
5972
6014
|
return e.map((e) => {
|
|
5973
6015
|
if (e.kind === "group") return {
|
|
5974
6016
|
...e,
|
|
5975
|
-
items:
|
|
6017
|
+
items: sc(e.items, t, n, r, i)
|
|
5976
6018
|
};
|
|
5977
|
-
let a =
|
|
6019
|
+
let a = ec(e.code, t, n);
|
|
5978
6020
|
return a && r(a) ? {
|
|
5979
6021
|
...e,
|
|
5980
6022
|
enabled: !1,
|
|
@@ -5982,7 +6024,7 @@ function tc(e, t, n, r, i) {
|
|
|
5982
6024
|
} : e;
|
|
5983
6025
|
});
|
|
5984
6026
|
}
|
|
5985
|
-
function
|
|
6027
|
+
function cc(e, t) {
|
|
5986
6028
|
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).sort(([e, t], [n, r]) => {
|
|
5987
6029
|
let i = t.position ?? 0, a = r.position ?? 0;
|
|
5988
6030
|
return i === a ? e < n ? -1 : +(e > n) : i - a;
|
|
@@ -5995,43 +6037,43 @@ function nc(e, t) {
|
|
|
5995
6037
|
}
|
|
5996
6038
|
//#endregion
|
|
5997
6039
|
//#region src/lib/field-regions.ts
|
|
5998
|
-
var
|
|
5999
|
-
function
|
|
6000
|
-
return
|
|
6001
|
-
|
|
6040
|
+
var lc = /* @__PURE__ */ new Map();
|
|
6041
|
+
function uc(e, t) {
|
|
6042
|
+
return lc.set(e, t), () => {
|
|
6043
|
+
lc.get(e) === t && lc.delete(e);
|
|
6002
6044
|
};
|
|
6003
6045
|
}
|
|
6004
|
-
function
|
|
6005
|
-
return
|
|
6046
|
+
function dc(e) {
|
|
6047
|
+
return lc.get(e);
|
|
6006
6048
|
}
|
|
6007
6049
|
//#endregion
|
|
6008
6050
|
//#region src/lib/anchor.ts
|
|
6009
|
-
var
|
|
6010
|
-
36500 *
|
|
6011
|
-
var
|
|
6051
|
+
var fc = 1, pc = 1e3 * fc, mc = 60 * pc, hc = 60 * mc, gc = 24 * hc, _c = 7 * gc;
|
|
6052
|
+
36500 * gc;
|
|
6053
|
+
var vc = {
|
|
6012
6054
|
ns: 1e-6,
|
|
6013
6055
|
us: .001,
|
|
6014
6056
|
µs: .001,
|
|
6015
|
-
ms:
|
|
6016
|
-
s:
|
|
6017
|
-
m:
|
|
6018
|
-
h:
|
|
6019
|
-
d:
|
|
6020
|
-
w:
|
|
6021
|
-
},
|
|
6022
|
-
function
|
|
6023
|
-
if (!e || e.trim() !== e || e[0] === "+" || e[0] === "-" ||
|
|
6057
|
+
ms: fc,
|
|
6058
|
+
s: pc,
|
|
6059
|
+
m: mc,
|
|
6060
|
+
h: hc,
|
|
6061
|
+
d: gc,
|
|
6062
|
+
w: _c
|
|
6063
|
+
}, yc = /^(\d+(?:\.\d+)?|\.\d+)(ns|us|µs|ms|s|m|h|d|w)/i, bc = /\d(?:mo|y)(?:[^a-zA-Z]|$)/i;
|
|
6064
|
+
function xc(e) {
|
|
6065
|
+
if (!e || e.trim() !== e || e[0] === "+" || e[0] === "-" || bc.test(e)) return null;
|
|
6024
6066
|
let t = 0, n = e;
|
|
6025
6067
|
for (; n.length > 0;) {
|
|
6026
|
-
let e =
|
|
6068
|
+
let e = yc.exec(n);
|
|
6027
6069
|
if (!e) return null;
|
|
6028
|
-
let r = Number(e[1]), i =
|
|
6070
|
+
let r = Number(e[1]), i = vc[e[2].toLowerCase()];
|
|
6029
6071
|
if (!Number.isFinite(r) || i === void 0 || (t += r * i, t > 31536e8)) return null;
|
|
6030
6072
|
n = n.slice(e[0].length);
|
|
6031
6073
|
}
|
|
6032
6074
|
return t;
|
|
6033
6075
|
}
|
|
6034
|
-
function
|
|
6076
|
+
function Sc(e) {
|
|
6035
6077
|
if (!e.startsWith("now")) return null;
|
|
6036
6078
|
let t = e.slice(3), n = 0;
|
|
6037
6079
|
for (let e = 0; t.length > 0; e++) {
|
|
@@ -6041,83 +6083,83 @@ function gc(e) {
|
|
|
6041
6083
|
t = t.slice(1);
|
|
6042
6084
|
let i = t, a = t.search(/[+-]/);
|
|
6043
6085
|
a >= 0 ? (i = t.slice(0, a), t = t.slice(a)) : t = "";
|
|
6044
|
-
let o =
|
|
6086
|
+
let o = xc(i);
|
|
6045
6087
|
if (o === null || (n += r * o, Math.abs(n) > 31536e8)) return null;
|
|
6046
6088
|
}
|
|
6047
6089
|
return n;
|
|
6048
6090
|
}
|
|
6049
6091
|
//#endregion
|
|
6050
6092
|
//#region src/lib/ui-actions.ts
|
|
6051
|
-
var
|
|
6052
|
-
function
|
|
6053
|
-
let n = e.match(
|
|
6093
|
+
var Cc = /\$\{\s*([^}]+?)\s*\}/g, wc = /^\s*\$\{\s*([^}]+?)\s*\}\s*$/, Tc = Symbol("unresolved");
|
|
6094
|
+
function Ec(e, t) {
|
|
6095
|
+
let n = e.match(wc);
|
|
6054
6096
|
if (n) {
|
|
6055
|
-
let r =
|
|
6056
|
-
return r ===
|
|
6097
|
+
let r = Dc(n[1], t);
|
|
6098
|
+
return r === Tc ? e : r;
|
|
6057
6099
|
}
|
|
6058
|
-
return e.replace(
|
|
6059
|
-
let r =
|
|
6060
|
-
return r ===
|
|
6100
|
+
return e.replace(Cc, (e, n) => {
|
|
6101
|
+
let r = Dc(n, t);
|
|
6102
|
+
return r === Tc ? e : R(r);
|
|
6061
6103
|
});
|
|
6062
6104
|
}
|
|
6063
|
-
function
|
|
6105
|
+
function Dc(e, t) {
|
|
6064
6106
|
if (e.startsWith("now")) {
|
|
6065
|
-
let t =
|
|
6066
|
-
return t === null ?
|
|
6107
|
+
let t = Sc(e);
|
|
6108
|
+
return t === null ? Tc : Be(new Date(Date.now() + t));
|
|
6067
6109
|
}
|
|
6068
6110
|
let [n, ...r] = e.split(".");
|
|
6069
|
-
if (n === "row") return !t.row || r.length === 0 ?
|
|
6111
|
+
if (n === "row") return !t.row || r.length === 0 ? Tc : Oc(t.row, r);
|
|
6070
6112
|
if (n === "field" && r.length >= 2) {
|
|
6071
|
-
let [e, t] = r, n =
|
|
6072
|
-
return n ? n.getField(t) :
|
|
6113
|
+
let [e, t] = r, n = dc(e);
|
|
6114
|
+
return n ? n.getField(t) : Tc;
|
|
6073
6115
|
}
|
|
6074
|
-
return n === "params" ? !t.params || r.length === 0 ?
|
|
6116
|
+
return n === "params" ? !t.params || r.length === 0 ? Tc : Oc(t.params, r) : Tc;
|
|
6075
6117
|
}
|
|
6076
|
-
function
|
|
6118
|
+
function Oc(e, t) {
|
|
6077
6119
|
return t.reduce((e, t) => {
|
|
6078
6120
|
if (e && typeof e == "object") return e[t];
|
|
6079
6121
|
}, e);
|
|
6080
6122
|
}
|
|
6081
|
-
async function
|
|
6123
|
+
async function kc(e, t) {
|
|
6082
6124
|
for (let n of e) try {
|
|
6083
|
-
await
|
|
6125
|
+
await Ac(n, t);
|
|
6084
6126
|
} catch (e) {
|
|
6085
6127
|
let t = e instanceof Error ? e.message : String(e);
|
|
6086
6128
|
Z.error(`ui_step failed: ${t}`);
|
|
6087
6129
|
return;
|
|
6088
6130
|
}
|
|
6089
6131
|
}
|
|
6090
|
-
async function
|
|
6132
|
+
async function Ac(e, t) {
|
|
6091
6133
|
if (e.copy_to_clipboard != null) {
|
|
6092
|
-
let n =
|
|
6134
|
+
let n = Mc(e.copy_to_clipboard, t);
|
|
6093
6135
|
await navigator.clipboard.writeText(n);
|
|
6094
6136
|
return;
|
|
6095
6137
|
}
|
|
6096
6138
|
if (e.set_field) {
|
|
6097
|
-
let { target: n, value: r } = e.set_field, { region: i, field: a } =
|
|
6139
|
+
let { target: n, value: r } = e.set_field, { region: i, field: a } = Nc(n), o = dc(i);
|
|
6098
6140
|
if (!o) throw Error(`region "${i}" not registered`);
|
|
6099
|
-
o.setField(a,
|
|
6141
|
+
o.setField(a, jc(r, t));
|
|
6100
6142
|
return;
|
|
6101
6143
|
}
|
|
6102
6144
|
if (e.focus_field) {
|
|
6103
|
-
let { region: t, field: n } =
|
|
6145
|
+
let { region: t, field: n } = Nc(e.focus_field), r = dc(t);
|
|
6104
6146
|
if (!r) throw Error(`region "${t}" not registered`);
|
|
6105
6147
|
r.focusField(n);
|
|
6106
6148
|
return;
|
|
6107
6149
|
}
|
|
6108
6150
|
if (e.show_toast) {
|
|
6109
|
-
let n =
|
|
6151
|
+
let n = Mc(e.show_toast.message, t), r = e.show_toast.kind ?? "info";
|
|
6110
6152
|
r === "success" ? Z.success(n) : r === "error" ? Z.error(n) : Z.info(n);
|
|
6111
6153
|
return;
|
|
6112
6154
|
}
|
|
6113
6155
|
}
|
|
6114
|
-
function
|
|
6115
|
-
return typeof e == "string" ?
|
|
6156
|
+
function jc(e, t) {
|
|
6157
|
+
return typeof e == "string" ? Ec(e, t) : e;
|
|
6116
6158
|
}
|
|
6117
|
-
function
|
|
6118
|
-
return R(
|
|
6159
|
+
function Mc(e, t) {
|
|
6160
|
+
return R(Ec(e, t));
|
|
6119
6161
|
}
|
|
6120
|
-
function
|
|
6162
|
+
function Nc(e) {
|
|
6121
6163
|
let t = e.indexOf(".");
|
|
6122
6164
|
if (t <= 0) throw Error(`invalid path "${e}" (expected "region.field")`);
|
|
6123
6165
|
return {
|
|
@@ -6125,12 +6167,12 @@ function Dc(e) {
|
|
|
6125
6167
|
field: e.slice(t + 1)
|
|
6126
6168
|
};
|
|
6127
6169
|
}
|
|
6128
|
-
function
|
|
6170
|
+
function Pc(e) {
|
|
6129
6171
|
return !e.handler && !!e.ui_steps && e.ui_steps.length > 0;
|
|
6130
6172
|
}
|
|
6131
6173
|
//#endregion
|
|
6132
6174
|
//#region src/lib/mass-edit.ts
|
|
6133
|
-
function
|
|
6175
|
+
function Fc(e) {
|
|
6134
6176
|
if (!e) return [];
|
|
6135
6177
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
6136
6178
|
for (let r of e.split(",")) {
|
|
@@ -6139,17 +6181,17 @@ function kc(e) {
|
|
|
6139
6181
|
}
|
|
6140
6182
|
return n;
|
|
6141
6183
|
}
|
|
6142
|
-
function
|
|
6143
|
-
if (!e ||
|
|
6144
|
-
let n = Array.isArray(t) ? t :
|
|
6184
|
+
function Ic(e, t) {
|
|
6185
|
+
if (!e || !et(e, "update")) return [];
|
|
6186
|
+
let n = Array.isArray(t) ? t : Fc(t), r = n.length > 0 ? new Set(n) : null, i = ft(e), a = new Set(B(e)), o = r ? n : Lc(e, i, a), s = [];
|
|
6145
6187
|
for (let t of o) {
|
|
6146
6188
|
if (r && !r.has(t)) continue;
|
|
6147
|
-
let n =
|
|
6189
|
+
let n = Rc(e, t, i, a);
|
|
6148
6190
|
n && s.push(n);
|
|
6149
6191
|
}
|
|
6150
6192
|
return s;
|
|
6151
6193
|
}
|
|
6152
|
-
function
|
|
6194
|
+
function Lc(e, t, n) {
|
|
6153
6195
|
let r = [];
|
|
6154
6196
|
for (let [t, i] of e.fields) n.has(t) || i.auto || r.push(t);
|
|
6155
6197
|
if (!t) {
|
|
@@ -6158,7 +6200,7 @@ function jc(e, t, n) {
|
|
|
6158
6200
|
}
|
|
6159
6201
|
return r;
|
|
6160
6202
|
}
|
|
6161
|
-
function
|
|
6203
|
+
function Rc(e, t, n, r) {
|
|
6162
6204
|
if (t.startsWith("$status.")) {
|
|
6163
6205
|
if (n) return null;
|
|
6164
6206
|
let r = t.slice(8), i = e.status_groups?.[r];
|
|
@@ -6166,7 +6208,7 @@ function Mc(e, t, n, r) {
|
|
|
6166
6208
|
code: t,
|
|
6167
6209
|
bare: r,
|
|
6168
6210
|
kind: "status",
|
|
6169
|
-
label:
|
|
6211
|
+
label: zc(i.name, r),
|
|
6170
6212
|
statusGroup: i
|
|
6171
6213
|
} : null;
|
|
6172
6214
|
}
|
|
@@ -6177,7 +6219,7 @@ function Mc(e, t, n, r) {
|
|
|
6177
6219
|
code: t,
|
|
6178
6220
|
bare: r,
|
|
6179
6221
|
kind: "property",
|
|
6180
|
-
label:
|
|
6222
|
+
label: zc(i.name, r),
|
|
6181
6223
|
property: i
|
|
6182
6224
|
} : null;
|
|
6183
6225
|
}
|
|
@@ -6187,18 +6229,18 @@ function Mc(e, t, n, r) {
|
|
|
6187
6229
|
code: t,
|
|
6188
6230
|
bare: t,
|
|
6189
6231
|
kind: "field",
|
|
6190
|
-
label:
|
|
6232
|
+
label: zc(i.display?.name, t),
|
|
6191
6233
|
field: i
|
|
6192
6234
|
};
|
|
6193
6235
|
}
|
|
6194
|
-
function
|
|
6236
|
+
function zc(e, t) {
|
|
6195
6237
|
return e && z(e) || t;
|
|
6196
6238
|
}
|
|
6197
6239
|
//#endregion
|
|
6198
|
-
//#region src/components/
|
|
6199
|
-
var
|
|
6200
|
-
function
|
|
6201
|
-
let a = d(() =>
|
|
6240
|
+
//#region src/components/actions/PropertyGridEditor.tsx
|
|
6241
|
+
var Bc = Symbol.for("declarion.mass-edit.multiple");
|
|
6242
|
+
function Vc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange: i }) {
|
|
6243
|
+
let a = d(() => Ic(e, t), [e, t]), o = d(() => Object.keys(r).map((e) => {
|
|
6202
6244
|
let t = a.find((t) => t.code === e);
|
|
6203
6245
|
return t ? {
|
|
6204
6246
|
target: t,
|
|
@@ -6208,8 +6250,8 @@ function Fc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
6208
6250
|
let e = new Set(o.map((e) => e.target.code));
|
|
6209
6251
|
return a.filter((t) => !e.has(t.code));
|
|
6210
6252
|
}, [o, a]), l = s((e) => {
|
|
6211
|
-
let t =
|
|
6212
|
-
a[e.code] = t ===
|
|
6253
|
+
let t = Kc(e, n), a = { ...r };
|
|
6254
|
+
a[e.code] = t === Bc ? void 0 : t, i(a);
|
|
6213
6255
|
}, [
|
|
6214
6256
|
r,
|
|
6215
6257
|
n,
|
|
@@ -6237,12 +6279,12 @@ function Fc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
6237
6279
|
},
|
|
6238
6280
|
children: "No targets selected. Add a field, status, or property to edit across all selected rows."
|
|
6239
6281
|
}),
|
|
6240
|
-
o.map((e) => /* @__PURE__ */ b(
|
|
6282
|
+
o.map((e) => /* @__PURE__ */ b(Hc, {
|
|
6241
6283
|
row: e,
|
|
6242
6284
|
onChange: (t) => u(e.target.code, t),
|
|
6243
6285
|
onRemove: () => f(e.target.code)
|
|
6244
6286
|
}, e.target.code)),
|
|
6245
|
-
/* @__PURE__ */ b(
|
|
6287
|
+
/* @__PURE__ */ b(Gc, {
|
|
6246
6288
|
targets: c,
|
|
6247
6289
|
onPick: l
|
|
6248
6290
|
})
|
|
@@ -6255,7 +6297,7 @@ function Fc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
6255
6297
|
children: "Entity schema unavailable. Mass edit requires an entity-bound action."
|
|
6256
6298
|
});
|
|
6257
6299
|
}
|
|
6258
|
-
function
|
|
6300
|
+
function Hc({ row: e, onChange: n, onRemove: r }) {
|
|
6259
6301
|
let { target: i } = e;
|
|
6260
6302
|
return /* @__PURE__ */ x("div", {
|
|
6261
6303
|
"data-testid": "mass-edit-row",
|
|
@@ -6274,7 +6316,7 @@ function Ic({ row: e, onChange: n, onRemove: r }) {
|
|
|
6274
6316
|
title: i.code,
|
|
6275
6317
|
children: i.label
|
|
6276
6318
|
}),
|
|
6277
|
-
/* @__PURE__ */ b(
|
|
6319
|
+
/* @__PURE__ */ b(Uc, {
|
|
6278
6320
|
row: e,
|
|
6279
6321
|
onChange: n
|
|
6280
6322
|
}),
|
|
@@ -6286,8 +6328,8 @@ function Ic({ row: e, onChange: n, onRemove: r }) {
|
|
|
6286
6328
|
]
|
|
6287
6329
|
});
|
|
6288
6330
|
}
|
|
6289
|
-
function
|
|
6290
|
-
let { target: n } = e, r =
|
|
6331
|
+
function Uc({ row: e, onChange: t }) {
|
|
6332
|
+
let { target: n } = e, r = Es(), i = e.value === Bc, a = i ? "<multiple values>" : void 0, o = i ? "" : e.value;
|
|
6291
6333
|
if (n.kind === "status" && n.statusGroup) {
|
|
6292
6334
|
let e = n.statusGroup.statuses.map((e) => ({
|
|
6293
6335
|
value: e.code,
|
|
@@ -6303,11 +6345,11 @@ function Lc({ row: e, onChange: t }) {
|
|
|
6303
6345
|
})
|
|
6304
6346
|
});
|
|
6305
6347
|
}
|
|
6306
|
-
let s =
|
|
6348
|
+
let s = Wc(n);
|
|
6307
6349
|
return /* @__PURE__ */ x("div", {
|
|
6308
6350
|
"data-testid": `value-${n.code}`,
|
|
6309
6351
|
style: { position: "relative" },
|
|
6310
|
-
children: [
|
|
6352
|
+
children: [Cs({
|
|
6311
6353
|
field: s,
|
|
6312
6354
|
fieldName: n.bare,
|
|
6313
6355
|
value: o ?? "",
|
|
@@ -6326,7 +6368,7 @@ function Lc({ row: e, onChange: t }) {
|
|
|
6326
6368
|
})]
|
|
6327
6369
|
});
|
|
6328
6370
|
}
|
|
6329
|
-
function
|
|
6371
|
+
function Wc(e) {
|
|
6330
6372
|
if (e.kind === "field" && e.field) return e.field;
|
|
6331
6373
|
if (e.kind === "property" && e.property) {
|
|
6332
6374
|
let t = e.property;
|
|
@@ -6341,7 +6383,7 @@ function Rc(e) {
|
|
|
6341
6383
|
}
|
|
6342
6384
|
return { type: "string" };
|
|
6343
6385
|
}
|
|
6344
|
-
function
|
|
6386
|
+
function Gc({ targets: e, onPick: n }) {
|
|
6345
6387
|
let [r, i] = p(!1);
|
|
6346
6388
|
return e.length === 0 ? null : r ? /* @__PURE__ */ b("div", {
|
|
6347
6389
|
"data-testid": "mass-edit-target-picker",
|
|
@@ -6368,7 +6410,7 @@ function zc({ targets: e, onPick: n }) {
|
|
|
6368
6410
|
children: [/* @__PURE__ */ b(t.plus, { size: 12 }), " Add target"]
|
|
6369
6411
|
});
|
|
6370
6412
|
}
|
|
6371
|
-
function
|
|
6413
|
+
function Kc(e, t) {
|
|
6372
6414
|
if (!t || t.length === 0 || e.kind !== "field") return;
|
|
6373
6415
|
let n, r = !1;
|
|
6374
6416
|
for (let i of t) {
|
|
@@ -6377,16 +6419,16 @@ function Bc(e, t) {
|
|
|
6377
6419
|
n = t, r = !0;
|
|
6378
6420
|
continue;
|
|
6379
6421
|
}
|
|
6380
|
-
if (n !== t) return
|
|
6422
|
+
if (n !== t) return Bc;
|
|
6381
6423
|
}
|
|
6382
6424
|
return n;
|
|
6383
6425
|
}
|
|
6384
6426
|
//#endregion
|
|
6385
|
-
//#region src/components/
|
|
6386
|
-
var
|
|
6387
|
-
function
|
|
6427
|
+
//#region src/components/actions/ActionDialog.tsx
|
|
6428
|
+
var qc = /^\$row\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
6429
|
+
function Jc(e, t) {
|
|
6388
6430
|
if (typeof e != "string") return e ?? "";
|
|
6389
|
-
let n = e.match(
|
|
6431
|
+
let n = e.match(qc);
|
|
6390
6432
|
if (n) {
|
|
6391
6433
|
let r = n[1].split("."), i = t;
|
|
6392
6434
|
for (let e of r) {
|
|
@@ -6398,9 +6440,9 @@ function Hc(e, t) {
|
|
|
6398
6440
|
}
|
|
6399
6441
|
return i === void 0 ? ((t == null || !(r[0] in t)) && typeof console < "u" && console.warn && console.warn(`ActionDialog: prefill template ${e} could not be resolved; row is missing field '${r[0]}'`), "") : i ?? "";
|
|
6400
6442
|
}
|
|
6401
|
-
return
|
|
6443
|
+
return Ec(e, { row: t });
|
|
6402
6444
|
}
|
|
6403
|
-
function
|
|
6445
|
+
function Yc(e) {
|
|
6404
6446
|
return {
|
|
6405
6447
|
type: e.type ?? "string",
|
|
6406
6448
|
required: e.required,
|
|
@@ -6411,21 +6453,21 @@ function Uc(e) {
|
|
|
6411
6453
|
enum: e.enum,
|
|
6412
6454
|
values: e.values,
|
|
6413
6455
|
structure: e.structure,
|
|
6414
|
-
ref:
|
|
6456
|
+
ref: Ze(e.ref)
|
|
6415
6457
|
};
|
|
6416
6458
|
}
|
|
6417
|
-
function
|
|
6459
|
+
function Xc(e, t) {
|
|
6418
6460
|
if (!e.includes("${")) return e;
|
|
6419
|
-
let n =
|
|
6461
|
+
let n = Ec(e, { params: t });
|
|
6420
6462
|
return n == null ? "" : R(n);
|
|
6421
6463
|
}
|
|
6422
|
-
var
|
|
6423
|
-
function
|
|
6464
|
+
var Zc = /\$\{\s*([^}]+?)\s*\}/g;
|
|
6465
|
+
function Qc(e, t) {
|
|
6424
6466
|
let n = `params.${t}`;
|
|
6425
|
-
for (let t of e.matchAll(
|
|
6467
|
+
for (let t of e.matchAll(Zc)) if (t[1] === n) return !0;
|
|
6426
6468
|
return !1;
|
|
6427
6469
|
}
|
|
6428
|
-
function
|
|
6470
|
+
function $c({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
6429
6471
|
let i = d(() => {
|
|
6430
6472
|
let t = r ? Object.entries(r) : [];
|
|
6431
6473
|
return [{
|
|
@@ -6443,12 +6485,12 @@ function qc({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
|
6443
6485
|
placeholder: "Select status group…"
|
|
6444
6486
|
});
|
|
6445
6487
|
}
|
|
6446
|
-
function
|
|
6488
|
+
function el({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
6447
6489
|
let a = d(() => {
|
|
6448
6490
|
if (!r) return [];
|
|
6449
6491
|
let t = e.filter?.status_group;
|
|
6450
6492
|
if (t) {
|
|
6451
|
-
let e =
|
|
6493
|
+
let e = Xc(t, i);
|
|
6452
6494
|
return e && r[e] ? r[e].statuses : [];
|
|
6453
6495
|
}
|
|
6454
6496
|
return Object.values(r).flatMap((e) => e.statuses);
|
|
@@ -6470,8 +6512,8 @@ function Jc({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
|
6470
6512
|
placeholder: "Select status…"
|
|
6471
6513
|
});
|
|
6472
6514
|
}
|
|
6473
|
-
function
|
|
6474
|
-
let { data: m } = X(), h =
|
|
6515
|
+
function tl({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, isPending: o, row: c, bulkSelection: u }) {
|
|
6516
|
+
let { data: m } = X(), h = Es(), g = r.resolved_params, _ = r.resolved_hidden_defaults ?? {}, v = !!r.destructive, S = Us(r, h), C = s(() => {
|
|
6475
6517
|
o || n(!1);
|
|
6476
6518
|
}, [o, n]), w = f(null);
|
|
6477
6519
|
l(() => {
|
|
@@ -6498,11 +6540,11 @@ function Yc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6498
6540
|
continue;
|
|
6499
6541
|
}
|
|
6500
6542
|
if (n.type === "bool") {
|
|
6501
|
-
let r =
|
|
6543
|
+
let r = Jc(n.default, c);
|
|
6502
6544
|
e[t] = r === !0 || r === "true";
|
|
6503
6545
|
continue;
|
|
6504
6546
|
}
|
|
6505
|
-
e[t] =
|
|
6547
|
+
e[t] = Jc(n.default, c);
|
|
6506
6548
|
}
|
|
6507
6549
|
return e;
|
|
6508
6550
|
}, [
|
|
@@ -6520,7 +6562,7 @@ function Yc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6520
6562
|
for (let [t, n] of g) {
|
|
6521
6563
|
if (n.type !== "status") continue;
|
|
6522
6564
|
let i = n.filter?.status_group;
|
|
6523
|
-
i &&
|
|
6565
|
+
i && Qc(i, e) && (r[t] = "");
|
|
6524
6566
|
}
|
|
6525
6567
|
return r;
|
|
6526
6568
|
});
|
|
@@ -6666,27 +6708,27 @@ function Yc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6666
6708
|
let r;
|
|
6667
6709
|
if (t.type === "entity_patch") {
|
|
6668
6710
|
let n = typeof t.filter?.targets == "string" ? t.filter.targets : void 0;
|
|
6669
|
-
r = /* @__PURE__ */ b(
|
|
6711
|
+
r = /* @__PURE__ */ b(Vc, {
|
|
6670
6712
|
entity: k,
|
|
6671
6713
|
filterTargets: n,
|
|
6672
6714
|
selectedRows: u,
|
|
6673
6715
|
value: M[e] ?? {},
|
|
6674
6716
|
onChange: (t) => N(e, t)
|
|
6675
6717
|
});
|
|
6676
|
-
} else r = t.type === "status_group" ? /* @__PURE__ */ b(
|
|
6718
|
+
} else r = t.type === "status_group" ? /* @__PURE__ */ b($c, {
|
|
6677
6719
|
param: t,
|
|
6678
6720
|
value: M[e],
|
|
6679
6721
|
onChange: (t) => N(e, t),
|
|
6680
6722
|
statusGroups: E,
|
|
6681
6723
|
formData: M
|
|
6682
|
-
}) : t.type === "status" ? /* @__PURE__ */ b(
|
|
6724
|
+
}) : t.type === "status" ? /* @__PURE__ */ b(el, {
|
|
6683
6725
|
param: t,
|
|
6684
6726
|
value: M[e],
|
|
6685
6727
|
onChange: (t) => N(e, t),
|
|
6686
6728
|
statusGroups: E,
|
|
6687
6729
|
formData: M
|
|
6688
|
-
}) :
|
|
6689
|
-
field:
|
|
6730
|
+
}) : Cs({
|
|
6731
|
+
field: Yc(t),
|
|
6690
6732
|
fieldName: e,
|
|
6691
6733
|
value: M[e],
|
|
6692
6734
|
mode: "edit",
|
|
@@ -6740,7 +6782,7 @@ function Yc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6740
6782
|
icon: b(o ? Se : v ? t.trash : t.bolt, { size: 13 }),
|
|
6741
6783
|
onClick: te,
|
|
6742
6784
|
disabled: o,
|
|
6743
|
-
children: o ? "
|
|
6785
|
+
children: o ? "Working…" : i || "Confirm"
|
|
6744
6786
|
})
|
|
6745
6787
|
]
|
|
6746
6788
|
})
|
|
@@ -6748,8 +6790,8 @@ function Yc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6748
6790
|
})] }) : null;
|
|
6749
6791
|
}
|
|
6750
6792
|
//#endregion
|
|
6751
|
-
//#region src/components/
|
|
6752
|
-
function
|
|
6793
|
+
//#region src/components/actions/ActionResultDialog.tsx
|
|
6794
|
+
function nl({ open: e, onClose: n, display: r }) {
|
|
6753
6795
|
let i = f(null);
|
|
6754
6796
|
return l(() => {
|
|
6755
6797
|
e && i.current?.focus();
|
|
@@ -6844,7 +6886,7 @@ function Xc({ open: e, onClose: n, display: r }) {
|
|
|
6844
6886
|
gap: 12,
|
|
6845
6887
|
overflowY: "auto"
|
|
6846
6888
|
},
|
|
6847
|
-
children: r.fields.map((e, t) => /* @__PURE__ */ b(
|
|
6889
|
+
children: r.fields.map((e, t) => /* @__PURE__ */ b(rl, {
|
|
6848
6890
|
field: e,
|
|
6849
6891
|
onNavigate: n
|
|
6850
6892
|
}, t))
|
|
@@ -6870,13 +6912,13 @@ function Xc({ open: e, onClose: n, display: r }) {
|
|
|
6870
6912
|
]
|
|
6871
6913
|
})] }) : null;
|
|
6872
6914
|
}
|
|
6873
|
-
function
|
|
6874
|
-
let r = e.href ?? e.download_url ?? e.value, i = e.type === "download", a = i || e.type === "link", o = r ?
|
|
6915
|
+
function rl({ field: e, onNavigate: n }) {
|
|
6916
|
+
let r = e.href ?? e.download_url ?? e.value, i = e.type === "download", a = i || e.type === "link", o = r ? li(r) : void 0, [s, c] = p(!1), [l, u] = p(null);
|
|
6875
6917
|
async function d() {
|
|
6876
6918
|
if (o) {
|
|
6877
6919
|
c(!0), u(null);
|
|
6878
6920
|
try {
|
|
6879
|
-
await
|
|
6921
|
+
await pi(o, e.filename);
|
|
6880
6922
|
} catch (e) {
|
|
6881
6923
|
u(e instanceof Error ? e.message : String(e));
|
|
6882
6924
|
} finally {
|
|
@@ -6901,7 +6943,7 @@ function Zc({ field: e, onNavigate: n }) {
|
|
|
6901
6943
|
fontWeight: 500,
|
|
6902
6944
|
textDecoration: "none",
|
|
6903
6945
|
whiteSpace: "nowrap"
|
|
6904
|
-
}, m = a && !i, h =
|
|
6946
|
+
}, m = a && !i, h = ui(o), g = {
|
|
6905
6947
|
flex: 1,
|
|
6906
6948
|
minWidth: 0,
|
|
6907
6949
|
display: "inline-flex",
|
|
@@ -6984,7 +7026,7 @@ function Zc({ field: e, onNavigate: n }) {
|
|
|
6984
7026
|
},
|
|
6985
7027
|
children: e.value
|
|
6986
7028
|
})]
|
|
6987
|
-
}), e.copyable && /* @__PURE__ */ b(
|
|
7029
|
+
}), e.copyable && /* @__PURE__ */ b(gi, { value: e.value })]
|
|
6988
7030
|
}) : /* @__PURE__ */ x("div", {
|
|
6989
7031
|
style: {
|
|
6990
7032
|
position: "relative",
|
|
@@ -7008,17 +7050,17 @@ function Zc({ field: e, onNavigate: n }) {
|
|
|
7008
7050
|
top: 4,
|
|
7009
7051
|
right: 4
|
|
7010
7052
|
},
|
|
7011
|
-
children: /* @__PURE__ */ b(
|
|
7053
|
+
children: /* @__PURE__ */ b(gi, { value: e.value })
|
|
7012
7054
|
})]
|
|
7013
7055
|
})
|
|
7014
7056
|
]
|
|
7015
7057
|
});
|
|
7016
7058
|
}
|
|
7017
7059
|
//#endregion
|
|
7018
|
-
//#region src/components/
|
|
7019
|
-
function
|
|
7060
|
+
//#region src/components/actions/ActionRunner.tsx
|
|
7061
|
+
function il(e) {
|
|
7020
7062
|
if (!e || typeof e != "object") return { kind: "success" };
|
|
7021
|
-
let t = e, n = t.status, r = t.success?.length ?? 0, i = t.errors?.length ?? 0, a = t.skipped?.length ?? 0, o = t.errors?.[0]?.error;
|
|
7063
|
+
let t = e, n = t.status, r = t.success?.length ?? 0, i = t.errors?.length ?? 0, a = t.skipped?.length ?? 0, o = t.errors?.[0]?.error?.title;
|
|
7022
7064
|
if (n === "partial") {
|
|
7023
7065
|
let e = `${r} of ${r + i + a} succeeded`;
|
|
7024
7066
|
return {
|
|
@@ -7026,74 +7068,84 @@ function Qc(e) {
|
|
|
7026
7068
|
detail: o ? `${e} · ${o}` : e
|
|
7027
7069
|
};
|
|
7028
7070
|
}
|
|
7029
|
-
|
|
7071
|
+
if (n === "skipped") return {
|
|
7030
7072
|
kind: "skipped",
|
|
7031
7073
|
detail: "No items matched"
|
|
7032
|
-
}
|
|
7074
|
+
};
|
|
7075
|
+
if (n === "accepted") return { kind: "accepted" };
|
|
7076
|
+
if (lr(t.events)) {
|
|
7077
|
+
let e = t.events?.failed_count ?? 0, n = t.events?.timed_out_count ?? 0, r = t.events?.failures_omitted ?? 0, i = [e ? `${e} follow-up step${e === 1 ? "" : "s"} failed` : "", n ? `${n} did not finish in time` : ""].filter(Boolean), a = t.events?.failures?.[0], o = a ? `${i.join(" · ")} · ${a.handler}` : i.join(" · ");
|
|
7078
|
+
return {
|
|
7079
|
+
kind: "partial",
|
|
7080
|
+
detail: r ? `${o} (+${r} more)` : o
|
|
7081
|
+
};
|
|
7082
|
+
}
|
|
7083
|
+
return { kind: "success" };
|
|
7033
7084
|
}
|
|
7034
|
-
function
|
|
7085
|
+
function al(e) {
|
|
7035
7086
|
if (!e || typeof e != "object") return null;
|
|
7036
7087
|
let t = e.result;
|
|
7037
7088
|
if (!t || typeof t != "object") return null;
|
|
7038
7089
|
let n = t.$display;
|
|
7039
7090
|
return !n || typeof n != "object" ? null : n;
|
|
7040
7091
|
}
|
|
7041
|
-
function
|
|
7042
|
-
let t =
|
|
7092
|
+
function ol(e) {
|
|
7093
|
+
let t = al(e)?.fields;
|
|
7043
7094
|
if (!Array.isArray(t)) return null;
|
|
7044
7095
|
for (let e of t) {
|
|
7045
7096
|
if (e?.type !== "download") continue;
|
|
7046
7097
|
let t = e.href ?? e.download_url ?? e.value;
|
|
7047
|
-
if (typeof t == "string" && t !== "" &&
|
|
7098
|
+
if (typeof t == "string" && t !== "" && li(t)) return {
|
|
7048
7099
|
url: t,
|
|
7049
7100
|
filename: typeof e.filename == "string" ? e.filename : void 0
|
|
7050
7101
|
};
|
|
7051
7102
|
}
|
|
7052
7103
|
return null;
|
|
7053
7104
|
}
|
|
7054
|
-
function
|
|
7105
|
+
function sl(e) {
|
|
7055
7106
|
if (!e || typeof e != "object") return;
|
|
7056
7107
|
let t = e.result;
|
|
7057
7108
|
!t || typeof t != "object" || "impersonation_session_id" in t && window.location.assign("/");
|
|
7058
7109
|
}
|
|
7059
|
-
function
|
|
7060
|
-
if (e instanceof
|
|
7061
|
-
let t = e.response.errors ?? [];
|
|
7062
|
-
|
|
7110
|
+
function cl(e) {
|
|
7111
|
+
if (e instanceof ur) {
|
|
7112
|
+
let t = e.response.errors ?? [], n = t[0]?.error?.title;
|
|
7113
|
+
return t.length === 1 ? {
|
|
7063
7114
|
kind: "error",
|
|
7064
|
-
detail:
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
return {
|
|
7115
|
+
detail: n ?? "",
|
|
7116
|
+
retryable: t[0]?.error?.retryable
|
|
7117
|
+
} : {
|
|
7068
7118
|
kind: "error",
|
|
7069
|
-
detail: n ? `${t.length} failed · ${n}` : `${t.length} failed
|
|
7119
|
+
detail: n ? `${t.length} failed · ${n}` : `${t.length} failed`,
|
|
7120
|
+
retryable: t.every((e) => e.error?.retryable)
|
|
7070
7121
|
};
|
|
7071
7122
|
}
|
|
7072
|
-
return e instanceof
|
|
7123
|
+
return e instanceof V ? {
|
|
7073
7124
|
kind: "error",
|
|
7074
|
-
detail: e.message
|
|
7125
|
+
detail: e.message,
|
|
7126
|
+
retryable: e.retryable
|
|
7075
7127
|
} : {
|
|
7076
7128
|
kind: "error",
|
|
7077
7129
|
detail: e instanceof Error ? e.message : String(e)
|
|
7078
7130
|
};
|
|
7079
7131
|
}
|
|
7080
|
-
var
|
|
7081
|
-
function
|
|
7082
|
-
let e = c(
|
|
7132
|
+
var ll = i(null);
|
|
7133
|
+
function ul() {
|
|
7134
|
+
let e = c(ll);
|
|
7083
7135
|
if (!e) throw Error("useActionRunner must be used within <ActionRunnerProvider>");
|
|
7084
7136
|
return e;
|
|
7085
7137
|
}
|
|
7086
|
-
function
|
|
7138
|
+
function dl(e) {
|
|
7087
7139
|
let t = {}, n = e.action?.resolved_hidden_defaults;
|
|
7088
7140
|
if (n) for (let [e, r] of Object.entries(n)) r !== void 0 && (t[e] = r);
|
|
7089
7141
|
return t;
|
|
7090
7142
|
}
|
|
7091
|
-
function
|
|
7092
|
-
let t =
|
|
7143
|
+
function fl({ children: e }) {
|
|
7144
|
+
let t = Ur(), { data: n } = X(), [r, i] = p(null), [a, o] = p(0), [c, l] = p(null), u = s((e) => {
|
|
7093
7145
|
if (e?.progress_screen) return n?.screens[e.progress_screen]?.route;
|
|
7094
|
-
}, [n?.screens]), f = s((e, n, r, i, a) => {
|
|
7095
|
-
let
|
|
7096
|
-
let n =
|
|
7146
|
+
}, [n?.screens]), f = s((e, n, r, i, a, o) => {
|
|
7147
|
+
let s = () => {
|
|
7148
|
+
let n = pl(a), i = u(r), o = n ? `Job ${n} queued` : "Running in background";
|
|
7097
7149
|
Z.success(`${e} started`, o, i ? { action: {
|
|
7098
7150
|
label: "View",
|
|
7099
7151
|
onClick: () => t(i)
|
|
@@ -7101,19 +7153,19 @@ function ol({ children: e }) {
|
|
|
7101
7153
|
};
|
|
7102
7154
|
switch (i.kind) {
|
|
7103
7155
|
case "success": {
|
|
7104
|
-
let t =
|
|
7156
|
+
let t = ol(a), r = t ? { action: {
|
|
7105
7157
|
label: "Download",
|
|
7106
7158
|
onClick: () => {
|
|
7107
|
-
|
|
7159
|
+
pi(t.url, t.filename).catch((e) => {
|
|
7108
7160
|
Z.error("Download failed", e instanceof Error ? e.message : String(e));
|
|
7109
7161
|
});
|
|
7110
7162
|
}
|
|
7111
7163
|
} } : void 0;
|
|
7112
|
-
n ?
|
|
7164
|
+
n ? s() : Z.success(`${e} complete`, void 0, r);
|
|
7113
7165
|
return;
|
|
7114
7166
|
}
|
|
7115
7167
|
case "accepted":
|
|
7116
|
-
|
|
7168
|
+
s();
|
|
7117
7169
|
return;
|
|
7118
7170
|
case "skipped":
|
|
7119
7171
|
Z.info(e, i.detail);
|
|
@@ -7122,7 +7174,10 @@ function ol({ children: e }) {
|
|
|
7122
7174
|
Z.warning(`${e} partially completed`, i.detail);
|
|
7123
7175
|
return;
|
|
7124
7176
|
case "error":
|
|
7125
|
-
Z.error(`${e} failed`, i.detail
|
|
7177
|
+
Z.error(`${e} failed`, i.detail, i.retryable && o ? { action: {
|
|
7178
|
+
label: "Retry",
|
|
7179
|
+
onClick: o
|
|
7180
|
+
} } : void 0);
|
|
7126
7181
|
return;
|
|
7127
7182
|
}
|
|
7128
7183
|
}, [t, u]), m = _(), h = s((e, t, n) => {
|
|
@@ -7136,16 +7191,18 @@ function ol({ children: e }) {
|
|
|
7136
7191
|
}
|
|
7137
7192
|
if (t.kind !== "success" && t.kind !== "accepted") return;
|
|
7138
7193
|
e.onSuccess?.(n);
|
|
7139
|
-
let r =
|
|
7140
|
-
r && l(r),
|
|
7194
|
+
let r = al(n);
|
|
7195
|
+
r && l(r), sl(n);
|
|
7141
7196
|
}, [m]), g = s((e) => {
|
|
7142
7197
|
let t = e.action, n = e.longRunning ?? t?.long_running ?? !1, r = e.title || z(t?.display?.name) || "Action", a = async (i) => {
|
|
7143
7198
|
o((e) => e + 1);
|
|
7144
7199
|
try {
|
|
7145
|
-
let a = await e.execute(i), o =
|
|
7200
|
+
let a = await e.execute(i), o = il(a);
|
|
7146
7201
|
f(r, n, t, o, a), h(e, o, a);
|
|
7147
7202
|
} catch (e) {
|
|
7148
|
-
f(r, n, t,
|
|
7203
|
+
f(r, n, t, cl(e), void 0, () => {
|
|
7204
|
+
a(i);
|
|
7205
|
+
});
|
|
7149
7206
|
} finally {
|
|
7150
7207
|
o((e) => Math.max(0, e - 1));
|
|
7151
7208
|
}
|
|
@@ -7155,14 +7212,14 @@ function ol({ children: e }) {
|
|
|
7155
7212
|
icon: ""
|
|
7156
7213
|
},
|
|
7157
7214
|
destructive: !0
|
|
7158
|
-
} : void 0), c = !!(t?.resolved_params && t.resolved_params.length > 0), l =
|
|
7215
|
+
} : void 0), c = !!(t?.resolved_params && t.resolved_params.length > 0), l = Ws(s);
|
|
7159
7216
|
return s && (c || l) ? (i({
|
|
7160
7217
|
id: Symbol(),
|
|
7161
7218
|
opts: e,
|
|
7162
7219
|
title: r,
|
|
7163
7220
|
action: s,
|
|
7164
7221
|
pending: !1
|
|
7165
|
-
}), Promise.resolve()) : a(
|
|
7222
|
+
}), Promise.resolve()) : a(dl(e));
|
|
7166
7223
|
}, [f, h]), v = a > 0 || !!r?.pending, y = d(() => ({
|
|
7167
7224
|
run: g,
|
|
7168
7225
|
isRunning: v
|
|
@@ -7174,10 +7231,10 @@ function ol({ children: e }) {
|
|
|
7174
7231
|
pending: !0
|
|
7175
7232
|
} : e), o((e) => e + 1);
|
|
7176
7233
|
try {
|
|
7177
|
-
let r = await n.opts.execute(e), o =
|
|
7234
|
+
let r = await n.opts.execute(e), o = il(r);
|
|
7178
7235
|
f(n.title, s, a, o, r), h(n.opts, o, r), o.kind !== "partial" && i((e) => e?.id === t ? null : e);
|
|
7179
7236
|
} catch (e) {
|
|
7180
|
-
f(n.title, s, a,
|
|
7237
|
+
f(n.title, s, a, cl(e));
|
|
7181
7238
|
} finally {
|
|
7182
7239
|
o((e) => Math.max(0, e - 1)), i((e) => e?.id === t ? {
|
|
7183
7240
|
...e,
|
|
@@ -7189,16 +7246,16 @@ function ol({ children: e }) {
|
|
|
7189
7246
|
f,
|
|
7190
7247
|
h
|
|
7191
7248
|
]);
|
|
7192
|
-
return /* @__PURE__ */ x(
|
|
7249
|
+
return /* @__PURE__ */ x(ll.Provider, {
|
|
7193
7250
|
value: y,
|
|
7194
7251
|
children: [
|
|
7195
7252
|
e,
|
|
7196
|
-
c && /* @__PURE__ */ b(
|
|
7253
|
+
c && /* @__PURE__ */ b(nl, {
|
|
7197
7254
|
open: !0,
|
|
7198
7255
|
onClose: () => l(null),
|
|
7199
7256
|
display: c
|
|
7200
7257
|
}),
|
|
7201
|
-
r && S && /* @__PURE__ */ b(
|
|
7258
|
+
r && S && /* @__PURE__ */ b(tl, {
|
|
7202
7259
|
open: !0,
|
|
7203
7260
|
onOpenChange: (e) => {
|
|
7204
7261
|
e || i(null);
|
|
@@ -7213,29 +7270,29 @@ function ol({ children: e }) {
|
|
|
7213
7270
|
]
|
|
7214
7271
|
});
|
|
7215
7272
|
}
|
|
7216
|
-
function
|
|
7217
|
-
return
|
|
7273
|
+
function pl(e) {
|
|
7274
|
+
return ml(e) ?? ml(e?.result);
|
|
7218
7275
|
}
|
|
7219
|
-
function
|
|
7276
|
+
function ml(e) {
|
|
7220
7277
|
if (!e || typeof e != "object") return;
|
|
7221
7278
|
let t = e, n = t.job_id ?? t.id;
|
|
7222
7279
|
return typeof n == "string" ? n : void 0;
|
|
7223
7280
|
}
|
|
7224
7281
|
//#endregion
|
|
7225
7282
|
//#region src/hooks/useCurrentScreen.tsx
|
|
7226
|
-
var
|
|
7227
|
-
function
|
|
7283
|
+
var hl = i(void 0);
|
|
7284
|
+
function gl({ code: e, children: t }) {
|
|
7228
7285
|
let { data: n } = X(), r = d(() => ({
|
|
7229
7286
|
code: e,
|
|
7230
7287
|
screen: n?.screens[e]
|
|
7231
7288
|
}), [e, n]);
|
|
7232
|
-
return /* @__PURE__ */ b(
|
|
7289
|
+
return /* @__PURE__ */ b(hl.Provider, {
|
|
7233
7290
|
value: r,
|
|
7234
7291
|
children: t
|
|
7235
7292
|
});
|
|
7236
7293
|
}
|
|
7237
|
-
function
|
|
7238
|
-
return c(
|
|
7294
|
+
function _l() {
|
|
7295
|
+
return c(hl);
|
|
7239
7296
|
}
|
|
7240
7297
|
//#endregion
|
|
7241
|
-
export {
|
|
7298
|
+
export { fi as $, Se as $n, Rt as $t, Es as A, at as An, X as At, ja as B, L as Bn, Vn as Bt, qs as C, nt as Cn, tr as Ct, ic as D, z as Dn, vr as Dt, As as E, B as En, mr as Et, Ia as F, Ye as Fn, Zn as Ft, Hi as G, Pe as Gn, J as Gt, va as H, Ce as Hn, Jn as Ht, Q as I, ot as In, Yn as It, Ii as J, I as Jn, Dn as Jt, Bi as K, ze as Kn, Y as Kt, Aa as L, He as Ln, Xn as Lt, xs as M, $e as Mn, Qn as Mt, Fa as N, ct as Nn, Bn as Nt, js as O, rt as On, _r as Ot, La as P, Ke as Pn, Un as Pt, pi as Q, Re as Qn, Jt as Qt, Na as R, Be as Rn, qn as Rt, Bs as S, et as Sn, nr as St, Ks as T, Ge as Tn, sr as Tt, _a as U, Ie as Un, Gn as Ut, pa as V, Ae as Vn, Hn as Vt, fa as W, ke as Wn, K as Wt, Li as X, Te as Xn, Wt as Xt, Ri as Y, Fe as Yn, En as Yt, gi as Z, F as Zn, qt as Zt, Js as _, lt as _n, rr as _t, Bc as a, Et as an, de as ar, Gr as at, Ms as b, Qe as bn, yr as bt, Ic as c, wt as cn, M as cr, Br as ct, Pc as d, gt as dn, O as dr, Ir as dt, Lt as en, xe as er, ui as et, uc as f, ht as fn, D as fr, Nr as ft, Gs as g, We as gn, fr as gt, ac as h, vt as hn, ur as ht, ul as i, It as in, ue as ir, Ur as it, Cs as j, it as jn, $n as jt, Fs as k, st as kn, ir as kt, Fc as l, Ct as ln, j as lr, Lr as lt, Os as m, _t as mn, Tr as mt, _l as n, jt as nn, ve as nr, oi as nt, Vc as o, Dt as on, P as or, Wr as ot, ks as p, pt as pn, Pr as pt, zi as q, Le as qn, Tn as qt, fl as r, Mt as rn, ye as rr, Z as rt, Kc as s, Ot as sn, se as sr, Hr as st, gl as t, Nt as tn, be as tr, li as tt, kc as u, V as un, A as ur, Fr as ut, cc as v, ut as vn, ar as vt, zs as w, Xe as wn, br as wt, rc as x, tt as xn, cr as xt, sc as y, dt as yn, or as yt, xa as z, R as zn, Wn as zt };
|