@nivaro/react 0.3.115 → 0.3.116
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/shared/components/CollectionBrowserView.js +3795 -3564
- package/dist/shared/components/DataTable.js +611 -551
- package/dist/shared/components/OverflowRail.js +326 -0
- package/dist/shared/components/TipLayer.js +8 -8
- package/dist/shared/components/integrations/console/SignalCard.js +84 -77
- package/dist/shared/components/list/PhonePager.js +50 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +67 -68
- package/dist/shared/components/pipeline/PipelineEditorView.js +1357 -1333
- package/dist/shared/components/queue/OwnerAvatars.js +9 -9
- package/dist/shared/components/queue/QueueWorklist.js +2016 -1851
- package/dist/shared/components/queue/worklist-helpers.js +10 -6
- package/dist/shared/components/ui/popover.js +53 -29
- package/dist/shared/lib/keep-row-focus.js +43 -0
- package/dist/shared/lib/obligation-banner.js +17 -17
- package/dist/shared/lib/rail-menu-context.js +9 -0
- package/dist/shared/lib/row-surface.js +7 -0
- package/dist/shared/lib/table-pins.js +20 -18
- package/dist/shared/lib/upload-file.js +48 -19
- package/dist/shared/lib/upload-presence.js +33 -33
- package/dist/shared/lib/use-below-md.js +29 -0
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { choiceLabel as u } from "../../lib/utils.js";
|
|
2
|
-
function
|
|
2
|
+
function a(t, e) {
|
|
3
3
|
var n;
|
|
4
4
|
const r = (n = t == null ? void 0 : t.choices) == null ? void 0 : n.find((o) => o.value === e);
|
|
5
5
|
return r ? u(r.text) : e;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function l(t) {
|
|
8
8
|
const e = Object.entries(t ?? {}).filter(([, r]) => r > 0).sort((r, n) => n[1] - r[1] || r[0].localeCompare(n[0]));
|
|
9
9
|
return e.length === 0 ? null : e.map(([r, n]) => `${r} ${n.toLocaleString("en-US")}`).join(" · ");
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function f(t) {
|
|
12
12
|
if (!t || typeof t.tagName != "string") return !0;
|
|
13
13
|
const e = t;
|
|
14
14
|
return !!(e === document.body || e === document.documentElement || e.tagName === "TR" && e.hasAttribute("data-row-key"));
|
|
@@ -16,9 +16,13 @@ function c(t) {
|
|
|
16
16
|
function s(t) {
|
|
17
17
|
return (t ?? []).filter((e) => (e == null ? void 0 : e.key) && e.formula).map((e) => `formula.${e.key}`);
|
|
18
18
|
}
|
|
19
|
+
function c(t) {
|
|
20
|
+
return t === "__actions__" ? 3 : t === "state" ? 2 : t === "owners" ? 0 : 1;
|
|
21
|
+
}
|
|
19
22
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
l as atRiskBreakdown,
|
|
24
|
+
a as extraChoiceText,
|
|
22
25
|
s as formulaColumnKeys,
|
|
23
|
-
c as
|
|
26
|
+
c as queuePinKeepRank,
|
|
27
|
+
f as worklistKeyTarget
|
|
24
28
|
};
|
|
@@ -1,40 +1,64 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!
|
|
11
|
-
|
|
1
|
+
import { jsxs as p, Fragment as h, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "@radix-ui/react-popover";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import { useRailMenu as P, RailMenuContext as x } from "../../lib/rail-menu-context.js";
|
|
5
|
+
import { cn as b } from "../../lib/utils.js";
|
|
6
|
+
function w(o) {
|
|
7
|
+
let a = (o == null ? void 0 : o.parentElement) ?? null;
|
|
8
|
+
for (; a; ) {
|
|
9
|
+
const e = a.closest('[role="dialog"]');
|
|
10
|
+
if (!e) return;
|
|
11
|
+
if (!e.closest("[data-radix-popper-content-wrapper]")) return e;
|
|
12
|
+
a = e.parentElement;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
function y({ nested: o }) {
|
|
16
|
+
return i.useEffect(() => (o(1), () => o(-1)), [o]), null;
|
|
17
|
+
}
|
|
18
|
+
const N = r.Root, O = r.Trigger, z = r.Anchor, C = i.forwardRef(({ className: o, align: a = "center", sideOffset: e = 4, container: d, children: c, ...m }, u) => {
|
|
19
|
+
const [s, f] = i.useState(null), v = i.useMemo(() => d ?? w(s), [d, s]), t = P(), l = (t == null ? void 0 : t.boundary()) ?? void 0, g = t ? t.compact ? {
|
|
20
|
+
side: "bottom",
|
|
21
|
+
align: "start",
|
|
22
|
+
sideOffset: 6,
|
|
23
|
+
collisionPadding: 16,
|
|
24
|
+
avoidCollisions: !0
|
|
25
|
+
} : {
|
|
26
|
+
side: "left",
|
|
27
|
+
align: "start",
|
|
28
|
+
sideOffset: 10,
|
|
29
|
+
collisionPadding: 16,
|
|
30
|
+
avoidCollisions: !0,
|
|
31
|
+
...l ? { collisionBoundary: l } : {}
|
|
32
|
+
} : {};
|
|
33
|
+
return /* @__PURE__ */ p(h, { children: [
|
|
34
|
+
/* @__PURE__ */ n("span", { ref: f, hidden: !0, "data-nvr-popover-marker": "" }),
|
|
35
|
+
/* @__PURE__ */ n(r.Portal, { container: v, children: /* @__PURE__ */ p(
|
|
36
|
+
r.Content,
|
|
20
37
|
{
|
|
21
|
-
ref:
|
|
22
|
-
align:
|
|
23
|
-
sideOffset:
|
|
24
|
-
className:
|
|
38
|
+
ref: u,
|
|
39
|
+
align: a,
|
|
40
|
+
sideOffset: e,
|
|
41
|
+
className: b(
|
|
25
42
|
"z-[110] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",
|
|
26
|
-
|
|
43
|
+
t && "max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain",
|
|
44
|
+
o
|
|
27
45
|
),
|
|
28
|
-
...
|
|
46
|
+
...m,
|
|
47
|
+
...g,
|
|
48
|
+
"data-rail-popover": t ? "" : void 0,
|
|
49
|
+
children: [
|
|
50
|
+
t && /* @__PURE__ */ n(y, { nested: t.nested }),
|
|
51
|
+
/* @__PURE__ */ n(x.Provider, { value: null, children: c })
|
|
52
|
+
]
|
|
29
53
|
}
|
|
30
54
|
) })
|
|
31
55
|
] });
|
|
32
56
|
});
|
|
33
|
-
|
|
57
|
+
C.displayName = r.Content.displayName;
|
|
34
58
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
59
|
+
N as Popover,
|
|
60
|
+
z as PopoverAnchor,
|
|
61
|
+
C as PopoverContent,
|
|
62
|
+
O as PopoverTrigger,
|
|
63
|
+
w as modalHostOf
|
|
40
64
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useRef as l, useEffect as i, useLayoutEffect as f } from "react";
|
|
2
|
+
const s = 'input[type="checkbox"], [role="checkbox"]';
|
|
3
|
+
function d(e, n) {
|
|
4
|
+
if (!(e instanceof Element) || !n.contains(e) || !e.matches(s)) return null;
|
|
5
|
+
const t = e.closest("[data-row-key]");
|
|
6
|
+
return !t || !n.contains(t) ? null : t.getAttribute("data-row-key");
|
|
7
|
+
}
|
|
8
|
+
function m() {
|
|
9
|
+
const e = document.activeElement;
|
|
10
|
+
return !e || e === document.body || e === document.documentElement || !e.isConnected;
|
|
11
|
+
}
|
|
12
|
+
function a(e) {
|
|
13
|
+
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
14
|
+
}
|
|
15
|
+
function p(e, n) {
|
|
16
|
+
const t = e.querySelector(`[data-row-key="${a(n)}"]`), o = t == null ? void 0 : t.querySelector(s);
|
|
17
|
+
return o ? (o.focus({ preventScroll: !0 }), document.activeElement === o) : !1;
|
|
18
|
+
}
|
|
19
|
+
function E(e) {
|
|
20
|
+
const n = l(null);
|
|
21
|
+
i(() => {
|
|
22
|
+
if (typeof document > "u") return;
|
|
23
|
+
const t = (r) => {
|
|
24
|
+
const u = e.current, c = u ? d(r.target, u) : null;
|
|
25
|
+
n.current = c != null ? { key: c, el: r.target } : null;
|
|
26
|
+
}, o = (r) => {
|
|
27
|
+
const u = n.current;
|
|
28
|
+
!u || r.target !== u.el || r.relatedTarget || setTimeout(() => {
|
|
29
|
+
n.current === u && u.el.isConnected && (n.current = null);
|
|
30
|
+
}, 0);
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("focusin", t, !0), document.addEventListener("focusout", o, !0), () => {
|
|
33
|
+
document.removeEventListener("focusin", t, !0), document.removeEventListener("focusout", o, !0);
|
|
34
|
+
};
|
|
35
|
+
}, [e]), f(() => {
|
|
36
|
+
const t = n.current, o = e.current;
|
|
37
|
+
!t || !o || t.el.isConnected || !m() || p(o, t.key) || (n.current = null);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
p as restoreRowCheckboxFocus,
|
|
42
|
+
E as useKeepRowCheckboxFocus
|
|
43
|
+
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { toneForOutcome as
|
|
2
|
-
import { plainObligationReason as
|
|
3
|
-
import { partnerFailureText as
|
|
4
|
-
import { formatDate as
|
|
5
|
-
const
|
|
6
|
-
const t =
|
|
1
|
+
import { toneForOutcome as p } from "./obligation-filters.js";
|
|
2
|
+
import { plainObligationReason as g } from "./obligation-reason-text.js";
|
|
3
|
+
import { partnerFailureText as _ } from "./partner-failure.js";
|
|
4
|
+
import { formatDate as h, getDisplayTimezone as b } from "./utils.js";
|
|
5
|
+
const w = (o) => {
|
|
6
|
+
const t = b();
|
|
7
7
|
return new Intl.DateTimeFormat("en-US", {
|
|
8
8
|
hour: "numeric",
|
|
9
9
|
minute: "2-digit",
|
|
10
10
|
...t ? { timeZone: t } : {}
|
|
11
11
|
}).format(new Date(o));
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function D(o, t) {
|
|
14
14
|
const r = t.getTime() - new Date(o).getTime(), e = Math.floor(r / 6e4);
|
|
15
15
|
if (e < 1) return "just now";
|
|
16
16
|
if (e < 60) return `${e}m ago`;
|
|
17
17
|
const n = Math.floor(e / 60);
|
|
18
18
|
if (n < 24) return `${n}h ago`;
|
|
19
19
|
const i = Math.floor(n / 24);
|
|
20
|
-
return i < 7 ? `${i}d ago` :
|
|
20
|
+
return i < 7 ? `${i}d ago` : h(o);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function T(o) {
|
|
23
23
|
return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function x(o, t = /* @__PURE__ */ new Date()) {
|
|
26
26
|
const r = /* @__PURE__ */ new Map();
|
|
27
27
|
for (const e of o) {
|
|
28
28
|
if (e.outcome === "superseded") continue;
|
|
@@ -30,17 +30,17 @@ function k(o, t = /* @__PURE__ */ new Date()) {
|
|
|
30
30
|
(!n || e.id > n.id) && r.set(e.api, e);
|
|
31
31
|
}
|
|
32
32
|
return [...r.values()].map((e) => {
|
|
33
|
-
var
|
|
34
|
-
const n = e.resolved_at ?? e.due_at, i = `${
|
|
33
|
+
var d, f;
|
|
34
|
+
const n = e.resolved_at ?? e.due_at, i = `${D(n, t)} (${w(n)})`, u = e.reason ? g(e.reason) : "", c = e.reason ? ` — ${u !== e.reason.trim() ? u : _(e.reason) ?? u}` : "", m = ((d = e.label) == null ? void 0 : d.trim()) || (e.trigger === "transition" ? T(e.kind) : ""), l = (f = e.subject) == null ? void 0 : f.trim(), a = m ? ` · ${m}${l ? ` (${l})` : ""}` : l ? ` · ${l}` : "";
|
|
35
35
|
let s;
|
|
36
36
|
if (e.outcome === "sent") s = `told ${i}${a}`;
|
|
37
37
|
else if (e.outcome === "pending") {
|
|
38
|
-
const
|
|
39
|
-
s = `sent ${i}${a}, awaiting acknowledgement (${
|
|
40
|
-
} else e.outcome === "skipped" ? s = `should have been told ${i}${a}${
|
|
38
|
+
const $ = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
|
|
39
|
+
s = `sent ${i}${a}, awaiting acknowledgement (${$} min)`;
|
|
40
|
+
} else e.outcome === "skipped" ? s = `should have been told ${i}${a}${c}` : e.outcome === "failed" ? s = `send failed ${i}${a}${c}` : e.outcome === "missing" ? s = `never told${a}${c}` : s = `still not told${a}${c}`;
|
|
41
41
|
return {
|
|
42
42
|
api: e.api,
|
|
43
|
-
tone:
|
|
43
|
+
tone: p(e.outcome),
|
|
44
44
|
text: s,
|
|
45
45
|
obligation_id: e.id,
|
|
46
46
|
outcome: e.outcome,
|
|
@@ -54,5 +54,5 @@ function k(o, t = /* @__PURE__ */ new Date()) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
export {
|
|
57
|
-
|
|
57
|
+
x as bannerLines
|
|
58
58
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const r = "bg-card", o = "hover:bg-[color:color-mix(in_srgb,hsl(var(--card))_96%,rgb(var(--nvr-cyan-rgb)))] dark:hover:bg-[color:color-mix(in_srgb,hsl(var(--card))_92%,rgb(var(--nvr-cyan-rgb)))]", c = "bg-[color:color-mix(in_srgb,hsl(var(--card))_92%,rgb(var(--nvr-cyan-rgb)))] dark:bg-[color:color-mix(in_srgb,hsl(var(--card))_84%,rgb(var(--nvr-cyan-rgb)))]", a = "bg-inherit";
|
|
2
|
+
export {
|
|
3
|
+
a as PINNED_CELL_SURFACE,
|
|
4
|
+
r as ROW_SURFACE,
|
|
5
|
+
o as ROW_SURFACE_HOVER,
|
|
6
|
+
c as ROW_SURFACE_SELECTED
|
|
7
|
+
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (const t of f) {
|
|
8
|
-
const n = c(t);
|
|
9
|
-
if (s.length > 0 && o + n > r) break;
|
|
10
|
-
s.push(t), o += n;
|
|
11
|
-
}
|
|
1
|
+
const d = 0.6;
|
|
2
|
+
function N(s, r, f, k, o, n = {}) {
|
|
3
|
+
if (n.compact) return { left: s.slice(0, 1), right: [] };
|
|
4
|
+
if (o <= 0) return { left: s, right: r };
|
|
5
|
+
const u = o * 0.6;
|
|
6
|
+
let c = k;
|
|
12
7
|
const i = [];
|
|
13
|
-
for (
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
i.
|
|
8
|
+
for (const t of s) {
|
|
9
|
+
const e = f(t);
|
|
10
|
+
if (i.length > 0 && c + e > u) break;
|
|
11
|
+
i.push(t), c += e;
|
|
12
|
+
}
|
|
13
|
+
const I = n.rightShare != null ? o * n.rightShare : Number.POSITIVE_INFINITY, l = n.rank, a = l ? r.map((t, e) => ({ key: t, i: e, r: l(t) })).sort((t, e) => t.r - e.r || t.i - e.i).map((t) => t.key) : r, h = /* @__PURE__ */ new Set();
|
|
14
|
+
let g = 0;
|
|
15
|
+
for (let t = a.length - 1; t >= 0; t--) {
|
|
16
|
+
const e = f(a[t]);
|
|
17
|
+
if (c + e > u || g + e > I) break;
|
|
18
|
+
h.add(a[t]), c += e, g += e;
|
|
17
19
|
}
|
|
18
|
-
return { left:
|
|
20
|
+
return { left: i, right: r.filter((t) => h.has(t)) };
|
|
19
21
|
}
|
|
20
22
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
d as PIN_BUDGET,
|
|
24
|
+
N as fitPins
|
|
23
25
|
};
|
|
@@ -1,33 +1,62 @@
|
|
|
1
|
-
function
|
|
1
|
+
function p(o, n) {
|
|
2
2
|
if (o === 413) return "That file is too large to upload.";
|
|
3
3
|
try {
|
|
4
|
-
const
|
|
5
|
-
if (typeof
|
|
4
|
+
const t = JSON.parse(n).error;
|
|
5
|
+
if (typeof t == "string" && t && !/^(\d{3}\b|[A-Z_]{4,}$)/.test(t)) return t;
|
|
6
6
|
} catch {
|
|
7
7
|
}
|
|
8
8
|
return "Upload failed";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
function d() {
|
|
11
|
+
return typeof window > "u" ? !1 : window.__nvrViewAsFetch === !0;
|
|
12
|
+
}
|
|
13
|
+
function c(o, n, t) {
|
|
14
|
+
const e = new AbortController(), i = new FormData();
|
|
15
|
+
i.append("file", n), fetch(`${o.apiBase}/files/upload`, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: o.authHeaders,
|
|
18
|
+
credentials: o.credentials,
|
|
19
|
+
body: i,
|
|
20
|
+
signal: e.signal
|
|
21
|
+
}).then(async (a) => {
|
|
22
|
+
var u;
|
|
23
|
+
const s = await a.text().catch(() => "");
|
|
24
|
+
if (!a.ok) return t.onError(p(a.status, s));
|
|
25
|
+
try {
|
|
26
|
+
(u = t.onProgress) == null || u.call(t, 1), t.onDone(JSON.parse(s).data.id);
|
|
27
|
+
} catch {
|
|
28
|
+
t.onError("Upload failed");
|
|
29
|
+
}
|
|
30
|
+
}).catch(() => {
|
|
31
|
+
e.signal.aborted || t.onError("Upload failed");
|
|
32
|
+
});
|
|
33
|
+
const r = () => e.abort();
|
|
34
|
+
return { xhr: { abort: r }, abort: r };
|
|
35
|
+
}
|
|
36
|
+
function f(o, n, t) {
|
|
37
|
+
if (d() || typeof XMLHttpRequest > "u")
|
|
38
|
+
return c(o, n, t);
|
|
39
|
+
const e = new XMLHttpRequest();
|
|
40
|
+
e.upload.onprogress = (r) => {
|
|
13
41
|
var a;
|
|
14
|
-
r.lengthComputable && ((a =
|
|
15
|
-
},
|
|
16
|
-
if (
|
|
42
|
+
r.lengthComputable && ((a = t.onProgress) == null || a.call(t, r.loaded / r.total));
|
|
43
|
+
}, e.onload = () => {
|
|
44
|
+
if (e.status >= 200 && e.status < 300)
|
|
17
45
|
try {
|
|
18
|
-
|
|
46
|
+
t.onDone(JSON.parse(e.responseText).data.id);
|
|
19
47
|
} catch {
|
|
20
|
-
|
|
48
|
+
t.onError("Upload failed");
|
|
21
49
|
}
|
|
22
50
|
else
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
for (const [r, a] of Object.entries(o.authHeaders))
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
return
|
|
51
|
+
t.onError(p(e.status, e.responseText));
|
|
52
|
+
}, e.onerror = () => t.onError("Upload failed"), e.open("POST", `${o.apiBase}/files/upload`);
|
|
53
|
+
for (const [r, a] of Object.entries(o.authHeaders)) e.setRequestHeader(r, a);
|
|
54
|
+
e.withCredentials = o.credentials === "include";
|
|
55
|
+
const i = new FormData();
|
|
56
|
+
return i.append("file", n), e.send(i), { xhr: e, abort: () => e.abort() };
|
|
29
57
|
}
|
|
30
58
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
f as startFileUpload,
|
|
60
|
+
p as uploadFailureMessage,
|
|
61
|
+
d as viewAsFetchActive
|
|
33
62
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useEffect as U, useSyncExternalStore as
|
|
2
|
-
import { startFileUpload as b } from "./upload-file.js";
|
|
3
|
-
const
|
|
1
|
+
import { useEffect as U, useSyncExternalStore as v } from "react";
|
|
2
|
+
import { startFileUpload as b, viewAsFetchActive as M } from "./upload-file.js";
|
|
3
|
+
const R = "nvr:upload-state", _ = 500, k = 3e4;
|
|
4
4
|
let g = 0;
|
|
5
|
-
function
|
|
5
|
+
function A() {
|
|
6
6
|
return g = (g + 1) % 1e6, `u${Date.now().toString(36)}${g.toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
7
7
|
}
|
|
8
8
|
function h(e) {
|
|
@@ -11,14 +11,14 @@ function h(e) {
|
|
|
11
11
|
...e,
|
|
12
12
|
state: e.phase === "done" || e.phase === "cancel" ? "done" : "start"
|
|
13
13
|
};
|
|
14
|
-
window.dispatchEvent(new CustomEvent(
|
|
14
|
+
window.dispatchEvent(new CustomEvent(R, { detail: t }));
|
|
15
15
|
}
|
|
16
16
|
function D() {
|
|
17
|
-
return typeof window > "u" || typeof XMLHttpRequest > "u" ? !1 :
|
|
17
|
+
return typeof window > "u" || typeof XMLHttpRequest > "u" ? !1 : !M();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function x(e, t) {
|
|
20
20
|
const r = {
|
|
21
|
-
upload:
|
|
21
|
+
upload: A(),
|
|
22
22
|
name: e.name,
|
|
23
23
|
field: t.field,
|
|
24
24
|
collection: t.collection,
|
|
@@ -30,11 +30,11 @@ function N(e, t) {
|
|
|
30
30
|
return D() ? new Promise((l, p) => {
|
|
31
31
|
b(t.cfg, e, {
|
|
32
32
|
onProgress: (i) => {
|
|
33
|
-
var
|
|
33
|
+
var w;
|
|
34
34
|
const u = Math.max(0, Math.min(100, Math.round(i * 100)));
|
|
35
|
-
(
|
|
35
|
+
(w = t.onProgress) == null || w.call(t, u);
|
|
36
36
|
const m = Date.now();
|
|
37
|
-
m - o <
|
|
37
|
+
m - o < _ && u < 100 || (o = m, h({ ...r, phase: "progress", pct: u }));
|
|
38
38
|
},
|
|
39
39
|
onDone: (i) => {
|
|
40
40
|
a("done"), l({ id: i });
|
|
@@ -51,19 +51,19 @@ function N(e, t) {
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
let s = [];
|
|
54
|
-
const c = /* @__PURE__ */ new Map(),
|
|
54
|
+
const c = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set();
|
|
55
55
|
let d = null, y = { uploads: s };
|
|
56
56
|
const f = () => {
|
|
57
57
|
y = { uploads: s };
|
|
58
|
-
for (const e of
|
|
58
|
+
for (const e of S) e();
|
|
59
59
|
};
|
|
60
60
|
function P() {
|
|
61
61
|
d || typeof setInterval > "u" || (d = setInterval(() => {
|
|
62
|
-
const e = Date.now() -
|
|
62
|
+
const e = Date.now() - k, t = s.filter((n) => n.seen >= e);
|
|
63
63
|
t.length !== s.length && (s = t, f()), s.length === 0 && d && (clearInterval(d), d = null);
|
|
64
64
|
}, 5e3));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function L(e, t = Date.now()) {
|
|
67
67
|
if (!e || typeof e != "object") return;
|
|
68
68
|
const n = e;
|
|
69
69
|
if (n.collection == null || n.item == null) return;
|
|
@@ -87,17 +87,17 @@ function x(e, t = Date.now()) {
|
|
|
87
87
|
}
|
|
88
88
|
], P(), f();
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const F = (e) => (S.add(e), () => {
|
|
91
|
+
S.delete(e);
|
|
92
92
|
}), $ = () => y, E = (e, t, n) => `${e}\0${t}\0${n}`;
|
|
93
|
-
function
|
|
93
|
+
function T(e, t, n, r) {
|
|
94
94
|
return e.filter((o) => o.collection !== t || o.item !== String(n) ? !1 : r === void 0 ? !0 : r === "unclaimed" ? !o.field || !c.has(E(t, String(n), o.field)) : o.field === r);
|
|
95
95
|
}
|
|
96
|
-
function L(e, t, n) {
|
|
97
|
-
const { uploads: r } = _(A, $, $);
|
|
98
|
-
return !e || t == null ? [] : F(r, e, String(t), n);
|
|
99
|
-
}
|
|
100
96
|
function O(e, t, n) {
|
|
97
|
+
const { uploads: r } = v(F, $, $);
|
|
98
|
+
return !e || t == null ? [] : T(r, e, String(t), n);
|
|
99
|
+
}
|
|
100
|
+
function q(e, t, n) {
|
|
101
101
|
U(() => {
|
|
102
102
|
if (!e || t == null || !n) return;
|
|
103
103
|
const r = E(e, String(t), n);
|
|
@@ -107,21 +107,21 @@ function O(e, t, n) {
|
|
|
107
107
|
};
|
|
108
108
|
}, [e, t, n]);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function C(e) {
|
|
111
111
|
const t = e.name ? e.name.length > 40 ? `${e.name.slice(0, 39)}…` : e.name : null, n = t ? `“${t}”` : "a file", r = e.pct != null && e.pct > 0 && e.pct < 100 ? ` (${e.pct}%)` : "";
|
|
112
112
|
return `${e.user} is uploading ${n}${r}`;
|
|
113
113
|
}
|
|
114
114
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
_ as PROGRESS_REPORT_MS,
|
|
116
|
+
k as STALE_MS,
|
|
117
|
+
R as UPLOAD_STATE_EVENT,
|
|
118
|
+
L as applyRemoteUpload,
|
|
119
|
+
A as newUploadId,
|
|
120
120
|
D as progressUploadAllowed,
|
|
121
|
-
|
|
121
|
+
T as remoteUploadsFor,
|
|
122
122
|
h as reportUploadState,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
x as trackedUpload,
|
|
124
|
+
C as uploadSentence,
|
|
125
|
+
q as useClaimUploadField,
|
|
126
|
+
O as useRemoteUploads
|
|
127
127
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useSyncExternalStore as o } from "react";
|
|
2
|
+
const c = "(max-width: 767px)";
|
|
3
|
+
function i() {
|
|
4
|
+
try {
|
|
5
|
+
return typeof window > "u" || !window.matchMedia ? null : window.matchMedia(c);
|
|
6
|
+
} catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function s(n) {
|
|
11
|
+
var t;
|
|
12
|
+
const e = i();
|
|
13
|
+
return e ? ((t = e.addEventListener) == null || t.call(e, "change", n), () => {
|
|
14
|
+
var r;
|
|
15
|
+
return (r = e.removeEventListener) == null ? void 0 : r.call(e, "change", n);
|
|
16
|
+
}) : () => {
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const u = () => {
|
|
20
|
+
var n;
|
|
21
|
+
return ((n = i()) == null ? void 0 : n.matches) ?? !1;
|
|
22
|
+
};
|
|
23
|
+
function d() {
|
|
24
|
+
return o(s, u, () => !1);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
c as BELOW_MD_QUERY,
|
|
28
|
+
d as useBelowMd
|
|
29
|
+
};
|