@nice2dev/ui-science 1.1.10 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -6
- package/dist/index.cjs +12 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +782 -903
- package/dist/style.css +1 -0
- package/package.json +6 -3
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ var st = Object.defineProperty;
|
|
|
2
2
|
var at = (e, t, n) => t in e ? st(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var ve = (e, t, n) => at(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as o, jsxs as u, Fragment as Ae } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
5
|
+
import { useContext as Ue, useState as F, useCallback as q, useMemo as K, createContext as Ze, useRef as ze, useEffect as Xe } from "react";
|
|
6
6
|
class lt {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
ve(this, "config");
|
|
@@ -202,12 +202,12 @@ class lt {
|
|
|
202
202
|
return Buffer.from(r).toString("base64").substring(0, 32);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Gt(e) {
|
|
206
206
|
return new lt(e);
|
|
207
207
|
}
|
|
208
|
-
const Ke =
|
|
209
|
-
function
|
|
210
|
-
const e =
|
|
208
|
+
const Ke = /* @__PURE__ */ Ze(null);
|
|
209
|
+
function Oe() {
|
|
210
|
+
const e = Ue(Ke);
|
|
211
211
|
if (!e)
|
|
212
212
|
throw new Error("useLabNotebook must be used within LabNotebookProvider");
|
|
213
213
|
return e;
|
|
@@ -216,7 +216,7 @@ function ct({
|
|
|
216
216
|
service: e,
|
|
217
217
|
children: t
|
|
218
218
|
}) {
|
|
219
|
-
const [n, r] =
|
|
219
|
+
const [n, r] = F([]), [i, s] = F(null), [a, l] = F(null), c = q(async () => {
|
|
220
220
|
const $ = await e.listNotebooks();
|
|
221
221
|
r($);
|
|
222
222
|
}, [e]), h = K(
|
|
@@ -323,7 +323,7 @@ const P = {
|
|
|
323
323
|
report: "REP",
|
|
324
324
|
note: "NOTE"
|
|
325
325
|
};
|
|
326
|
-
function
|
|
326
|
+
function Qt({
|
|
327
327
|
service: e,
|
|
328
328
|
className: t,
|
|
329
329
|
style: n
|
|
@@ -334,7 +334,7 @@ function Jt({
|
|
|
334
334
|
] }) });
|
|
335
335
|
}
|
|
336
336
|
function dt() {
|
|
337
|
-
const { notebooks: e, currentNotebook: t, setCurrentNotebook: n, service: r, refresh: i } =
|
|
337
|
+
const { notebooks: e, currentNotebook: t, setCurrentNotebook: n, service: r, refresh: i } = Oe(), [s, a] = F(!1), [l, c] = F(""), h = async () => {
|
|
338
338
|
l.trim() && (await r.createNotebook({ name: l.trim() }), await i(), c(""), a(!1));
|
|
339
339
|
};
|
|
340
340
|
return /* @__PURE__ */ u("div", { style: P.sidebar, children: [
|
|
@@ -394,7 +394,7 @@ function dt() {
|
|
|
394
394
|
] });
|
|
395
395
|
}
|
|
396
396
|
function ut() {
|
|
397
|
-
const { currentNotebook: e, currentEntry: t, setCurrentEntry: n, service: r, refresh: i } =
|
|
397
|
+
const { currentNotebook: e, currentEntry: t, setCurrentEntry: n, service: r, refresh: i } = Oe(), [s, a] = F(!1);
|
|
398
398
|
if (!e)
|
|
399
399
|
return /* @__PURE__ */ o("div", { style: { ...P.main, justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ o("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)" }, children: /* @__PURE__ */ o("div", { style: { fontSize: "18px" }, children: "Select a notebook to get started" }) }) });
|
|
400
400
|
const l = async (c) => {
|
|
@@ -473,7 +473,7 @@ function ut() {
|
|
|
473
473
|
] });
|
|
474
474
|
}
|
|
475
475
|
function ht({ entry: e }) {
|
|
476
|
-
const { service: t, currentNotebook: n, refresh: r } =
|
|
476
|
+
const { service: t, currentNotebook: n, refresh: r } = Oe(), [i, s] = F(!1), [a, l] = F(e), c = e.status === "locked" || e.status === "signed", h = async () => {
|
|
477
477
|
n && (await t.updateEntry(n.id, e.id, a), await r(), s(!1));
|
|
478
478
|
}, p = async () => {
|
|
479
479
|
n && (await t.signEntry(n.id, e.id, {
|
|
@@ -672,7 +672,7 @@ function pt({
|
|
|
672
672
|
onSubmit: e,
|
|
673
673
|
onCancel: t
|
|
674
674
|
}) {
|
|
675
|
-
const [n, r] =
|
|
675
|
+
const [n, r] = F({
|
|
676
676
|
title: "",
|
|
677
677
|
type: "experiment",
|
|
678
678
|
objective: ""
|
|
@@ -738,179 +738,181 @@ function pt({
|
|
|
738
738
|
] })
|
|
739
739
|
] });
|
|
740
740
|
}
|
|
741
|
-
const $e = {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
741
|
+
const $e = /* @__PURE__ */ (function() {
|
|
742
|
+
return {
|
|
743
|
+
/** Calculate mean */
|
|
744
|
+
mean(e) {
|
|
745
|
+
return e.length === 0 ? NaN : e.reduce((t, n) => t + n, 0) / e.length;
|
|
746
|
+
},
|
|
747
|
+
/** Calculate median */
|
|
748
|
+
median(e) {
|
|
749
|
+
if (e.length === 0)
|
|
750
|
+
return NaN;
|
|
751
|
+
const t = [...e].sort((r, i) => r - i), n = Math.floor(t.length / 2);
|
|
752
|
+
return t.length % 2 !== 0 ? t[n] : (t[n - 1] + t[n]) / 2;
|
|
753
|
+
},
|
|
754
|
+
/** Calculate variance */
|
|
755
|
+
variance(e, t = !1) {
|
|
756
|
+
if (e.length === 0)
|
|
757
|
+
return NaN;
|
|
758
|
+
const n = this.mean(e), r = e.map((s) => Math.pow(s - n, 2)), i = t ? e.length : e.length - 1;
|
|
759
|
+
return r.reduce((s, a) => s + a, 0) / i;
|
|
760
|
+
},
|
|
761
|
+
/** Calculate standard deviation */
|
|
762
|
+
std(e, t = !1) {
|
|
763
|
+
return Math.sqrt(this.variance(e, t));
|
|
764
|
+
},
|
|
765
|
+
/** Calculate mode */
|
|
766
|
+
mode(e) {
|
|
767
|
+
const t = /* @__PURE__ */ new Map();
|
|
768
|
+
let n = 0, r = e[0];
|
|
769
|
+
for (const i of e) {
|
|
770
|
+
const s = (t.get(i) || 0) + 1;
|
|
771
|
+
t.set(i, s), s > n && (n = s, r = i);
|
|
772
|
+
}
|
|
773
|
+
return r;
|
|
774
|
+
},
|
|
775
|
+
/** Calculate percentile */
|
|
776
|
+
percentile(e, t) {
|
|
777
|
+
if (e.length === 0)
|
|
778
|
+
return NaN;
|
|
779
|
+
const n = [...e].sort((l, c) => l - c), r = t / 100 * (n.length - 1), i = Math.floor(r), s = Math.ceil(r), a = r - i;
|
|
780
|
+
return n[i] * (1 - a) + n[s] * a;
|
|
781
|
+
},
|
|
782
|
+
/** Calculate quartiles */
|
|
783
|
+
quartiles(e) {
|
|
784
|
+
return {
|
|
785
|
+
q1: this.percentile(e, 25),
|
|
786
|
+
q2: this.percentile(e, 50),
|
|
787
|
+
q3: this.percentile(e, 75)
|
|
788
|
+
};
|
|
789
|
+
},
|
|
790
|
+
/** Calculate skewness */
|
|
791
|
+
skewness(e) {
|
|
792
|
+
const t = e.length;
|
|
793
|
+
if (t < 3)
|
|
794
|
+
return NaN;
|
|
795
|
+
const n = this.mean(e), r = this.std(e), i = e.map((s) => Math.pow((s - n) / r, 3));
|
|
796
|
+
return t / ((t - 1) * (t - 2)) * i.reduce((s, a) => s + a, 0);
|
|
797
|
+
},
|
|
798
|
+
/** Calculate kurtosis */
|
|
799
|
+
kurtosis(e) {
|
|
800
|
+
const t = e.length;
|
|
801
|
+
if (t < 4)
|
|
802
|
+
return NaN;
|
|
803
|
+
const n = this.mean(e), r = this.std(e), s = e.map((a) => Math.pow((a - n) / r, 4)).reduce((a, l) => a + l, 0);
|
|
804
|
+
return t * (t + 1) / ((t - 1) * (t - 2) * (t - 3)) * s - 3 * Math.pow(t - 1, 2) / ((t - 2) * (t - 3));
|
|
805
|
+
},
|
|
806
|
+
/** Correlation coefficient (Pearson) */
|
|
807
|
+
correlation(e, t) {
|
|
808
|
+
if (e.length !== t.length || e.length < 2)
|
|
809
|
+
return NaN;
|
|
810
|
+
const n = e.length, r = this.mean(e), i = this.mean(t);
|
|
811
|
+
let s = 0, a = 0, l = 0;
|
|
812
|
+
for (let c = 0; c < n; c++) {
|
|
813
|
+
const h = e[c] - r, p = t[c] - i;
|
|
814
|
+
s += h * p, a += h * h, l += p * p;
|
|
815
|
+
}
|
|
816
|
+
return s / Math.sqrt(a * l);
|
|
817
|
+
},
|
|
818
|
+
/** Correlation matrix */
|
|
819
|
+
correlationMatrix(e) {
|
|
820
|
+
const t = Object.keys(e), n = {};
|
|
821
|
+
for (const r of t) {
|
|
822
|
+
n[r] = {};
|
|
823
|
+
for (const i of t)
|
|
824
|
+
n[r][i] = this.correlation(e[r], e[i]);
|
|
825
|
+
}
|
|
826
|
+
return n;
|
|
827
|
+
},
|
|
828
|
+
/** Covariance */
|
|
829
|
+
covariance(e, t, n = !1) {
|
|
830
|
+
if (e.length !== t.length || e.length < 2)
|
|
831
|
+
return NaN;
|
|
832
|
+
const r = e.length, i = this.mean(e), s = this.mean(t);
|
|
833
|
+
let a = 0;
|
|
834
|
+
for (let l = 0; l < r; l++)
|
|
835
|
+
a += (e[l] - i) * (t[l] - s);
|
|
836
|
+
return a / (n ? r : r - 1);
|
|
837
|
+
},
|
|
838
|
+
/** Simple linear regression */
|
|
839
|
+
linearRegression(e, t) {
|
|
840
|
+
if (e.length !== t.length || e.length < 2)
|
|
841
|
+
throw new Error("Invalid input arrays");
|
|
842
|
+
const n = e.length, r = this.mean(e), i = this.mean(t);
|
|
843
|
+
let s = 0, a = 0;
|
|
844
|
+
for (let $ = 0; $ < n; $++)
|
|
845
|
+
s += (e[$] - r) * (t[$] - i), a += Math.pow(e[$] - r, 2);
|
|
846
|
+
const l = s / a, c = i - l * r;
|
|
847
|
+
let h = 0, p = 0;
|
|
848
|
+
for (let $ = 0; $ < n; $++) {
|
|
849
|
+
const w = l * e[$] + c;
|
|
850
|
+
h += Math.pow(t[$] - i, 2), p += Math.pow(t[$] - w, 2);
|
|
851
|
+
}
|
|
852
|
+
const y = 1 - p / h, m = `y = ${l.toFixed(4)}x + ${c.toFixed(4)}`;
|
|
853
|
+
return { slope: l, intercept: c, r2: y, equation: m };
|
|
854
|
+
},
|
|
855
|
+
/** T-test (two-sample) */
|
|
856
|
+
tTest(e, t) {
|
|
857
|
+
const n = e.length, r = t.length, i = this.mean(e), s = this.mean(t), a = this.variance(e), l = this.variance(t), c = Math.sqrt(a / n + l / r), h = (i - s) / c, p = Math.pow(a / n + l / r, 2) / (Math.pow(a / n, 2) / (n - 1) + Math.pow(l / r, 2) / (r - 1)), y = 2 * (1 - this.normalCDF(Math.abs(h)));
|
|
858
|
+
return {
|
|
859
|
+
tStatistic: h,
|
|
860
|
+
pValue: y,
|
|
861
|
+
degreesOfFreedom: p,
|
|
862
|
+
meanDiff: i - s
|
|
863
|
+
};
|
|
864
|
+
},
|
|
865
|
+
/** Normal CDF approximation */
|
|
866
|
+
normalCDF(e) {
|
|
867
|
+
const t = 0.254829592, n = -0.284496736, r = 1.421413741, i = -1.453152027, s = 1.061405429, a = 0.3275911, l = e < 0 ? -1 : 1;
|
|
868
|
+
e = Math.abs(e) / Math.sqrt(2);
|
|
869
|
+
const c = 1 / (1 + a * e), h = 1 - ((((s * c + i) * c + r) * c + n) * c + t) * c * Math.exp(-e * e);
|
|
870
|
+
return 0.5 * (1 + l * h);
|
|
871
|
+
},
|
|
872
|
+
/** Chi-square test */
|
|
873
|
+
chiSquare(e, t) {
|
|
874
|
+
if (e.length !== t.length)
|
|
875
|
+
throw new Error("Arrays must have same length");
|
|
876
|
+
let n = 0;
|
|
877
|
+
for (let s = 0; s < e.length; s++)
|
|
878
|
+
n += Math.pow(e[s] - t[s], 2) / t[s];
|
|
879
|
+
const r = e.length - 1;
|
|
880
|
+
return {
|
|
881
|
+
chiSquare: n,
|
|
882
|
+
pValue: 0.05,
|
|
883
|
+
degreesOfFreedom: r
|
|
884
|
+
};
|
|
885
|
+
},
|
|
886
|
+
/** Z-score normalization */
|
|
887
|
+
zScore(e) {
|
|
888
|
+
const t = this.mean(e), n = this.std(e);
|
|
889
|
+
return e.map((r) => (r - t) / n);
|
|
890
|
+
},
|
|
891
|
+
/** Min-max normalization */
|
|
892
|
+
minMaxNormalize(e, t = 0, n = 1) {
|
|
893
|
+
const r = Math.min(...e), s = Math.max(...e) - r;
|
|
894
|
+
return e.map((a) => t + (a - r) / s * (n - t));
|
|
895
|
+
},
|
|
896
|
+
/** Describe dataset */
|
|
897
|
+
describe(e) {
|
|
898
|
+
const t = e.filter((r) => r != null && !isNaN(r)), n = this.quartiles(t);
|
|
899
|
+
return {
|
|
900
|
+
count: t.length,
|
|
901
|
+
mean: this.mean(t),
|
|
902
|
+
median: n.q2,
|
|
903
|
+
std: this.std(t),
|
|
904
|
+
min: Math.min(...t),
|
|
905
|
+
max: Math.max(...t),
|
|
906
|
+
q1: n.q1,
|
|
907
|
+
q3: n.q3,
|
|
908
|
+
skewness: this.skewness(t),
|
|
909
|
+
kurtosis: this.kurtosis(t),
|
|
910
|
+
mode: this.mode(t),
|
|
911
|
+
variance: this.variance(t)
|
|
912
|
+
};
|
|
850
913
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
},
|
|
854
|
-
/** T-test (two-sample) */
|
|
855
|
-
tTest(e, t) {
|
|
856
|
-
const n = e.length, r = t.length, i = this.mean(e), s = this.mean(t), a = this.variance(e), l = this.variance(t), c = Math.sqrt(a / n + l / r), h = (i - s) / c, p = Math.pow(a / n + l / r, 2) / (Math.pow(a / n, 2) / (n - 1) + Math.pow(l / r, 2) / (r - 1)), y = 2 * (1 - this.normalCDF(Math.abs(h)));
|
|
857
|
-
return {
|
|
858
|
-
tStatistic: h,
|
|
859
|
-
pValue: y,
|
|
860
|
-
degreesOfFreedom: p,
|
|
861
|
-
meanDiff: i - s
|
|
862
|
-
};
|
|
863
|
-
},
|
|
864
|
-
/** Normal CDF approximation */
|
|
865
|
-
normalCDF(e) {
|
|
866
|
-
const t = 0.254829592, n = -0.284496736, r = 1.421413741, i = -1.453152027, s = 1.061405429, a = 0.3275911, l = e < 0 ? -1 : 1;
|
|
867
|
-
e = Math.abs(e) / Math.sqrt(2);
|
|
868
|
-
const c = 1 / (1 + a * e), h = 1 - ((((s * c + i) * c + r) * c + n) * c + t) * c * Math.exp(-e * e);
|
|
869
|
-
return 0.5 * (1 + l * h);
|
|
870
|
-
},
|
|
871
|
-
/** Chi-square test */
|
|
872
|
-
chiSquare(e, t) {
|
|
873
|
-
if (e.length !== t.length)
|
|
874
|
-
throw new Error("Arrays must have same length");
|
|
875
|
-
let n = 0;
|
|
876
|
-
for (let s = 0; s < e.length; s++)
|
|
877
|
-
n += Math.pow(e[s] - t[s], 2) / t[s];
|
|
878
|
-
const r = e.length - 1;
|
|
879
|
-
return {
|
|
880
|
-
chiSquare: n,
|
|
881
|
-
pValue: 0.05,
|
|
882
|
-
degreesOfFreedom: r
|
|
883
|
-
};
|
|
884
|
-
},
|
|
885
|
-
/** Z-score normalization */
|
|
886
|
-
zScore(e) {
|
|
887
|
-
const t = this.mean(e), n = this.std(e);
|
|
888
|
-
return e.map((r) => (r - t) / n);
|
|
889
|
-
},
|
|
890
|
-
/** Min-max normalization */
|
|
891
|
-
minMaxNormalize(e, t = 0, n = 1) {
|
|
892
|
-
const r = Math.min(...e), s = Math.max(...e) - r;
|
|
893
|
-
return e.map((a) => t + (a - r) / s * (n - t));
|
|
894
|
-
},
|
|
895
|
-
/** Describe dataset */
|
|
896
|
-
describe(e) {
|
|
897
|
-
const t = e.filter((r) => r != null && !isNaN(r)), n = this.quartiles(t);
|
|
898
|
-
return {
|
|
899
|
-
count: t.length,
|
|
900
|
-
mean: this.mean(t),
|
|
901
|
-
median: n.q2,
|
|
902
|
-
std: this.std(t),
|
|
903
|
-
min: Math.min(...t),
|
|
904
|
-
max: Math.max(...t),
|
|
905
|
-
q1: n.q1,
|
|
906
|
-
q3: n.q3,
|
|
907
|
-
skewness: this.skewness(t),
|
|
908
|
-
kurtosis: this.kurtosis(t),
|
|
909
|
-
mode: this.mode(t),
|
|
910
|
-
variance: this.variance(t)
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
};
|
|
914
|
+
};
|
|
915
|
+
})();
|
|
914
916
|
class ft {
|
|
915
917
|
constructor(t = {}) {
|
|
916
918
|
ve(this, "config");
|
|
@@ -929,16 +931,16 @@ class ft {
|
|
|
929
931
|
throw new Error("Empty CSV content");
|
|
930
932
|
const a = (m) => {
|
|
931
933
|
const $ = [];
|
|
932
|
-
let w = "",
|
|
934
|
+
let w = "", j = !1;
|
|
933
935
|
for (const J of m)
|
|
934
|
-
J === '"' ?
|
|
936
|
+
J === '"' ? j = !j : J === r && !j ? ($.push(w.trim()), w = "") : w += J;
|
|
935
937
|
return $.push(w.trim()), $;
|
|
936
938
|
}, l = a(s[0]), c = i ? l : l.map((m, $) => `col_${$ + 1}`), h = i ? 1 : 0, p = [];
|
|
937
939
|
for (let m = h; m < s.length; m++) {
|
|
938
940
|
const $ = a(s[m]), w = {};
|
|
939
|
-
for (let
|
|
940
|
-
const J = $[
|
|
941
|
-
w[c[
|
|
941
|
+
for (let j = 0; j < c.length; j++) {
|
|
942
|
+
const J = $[j], te = parseFloat(J);
|
|
943
|
+
w[c[j]] = !isNaN(te) && J !== "" ? te : J;
|
|
942
944
|
}
|
|
943
945
|
p.push(w);
|
|
944
946
|
}
|
|
@@ -1205,22 +1207,22 @@ class ft {
|
|
|
1205
1207
|
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
1206
1208
|
}
|
|
1207
1209
|
}
|
|
1208
|
-
function
|
|
1210
|
+
function Ht(e) {
|
|
1209
1211
|
return new ft(e);
|
|
1210
1212
|
}
|
|
1211
|
-
function
|
|
1213
|
+
function en({
|
|
1212
1214
|
service: e,
|
|
1213
1215
|
className: t,
|
|
1214
1216
|
style: n
|
|
1215
1217
|
}) {
|
|
1216
|
-
const [r, i] =
|
|
1218
|
+
const [r, i] = F([]), [s, a] = F(null), [l, c] = F("data"), h = q(() => {
|
|
1217
1219
|
i(e.listDatasets());
|
|
1218
1220
|
}, [e]), p = K(
|
|
1219
1221
|
() => r.find((m) => m.id === s),
|
|
1220
1222
|
[r, s]
|
|
1221
1223
|
), y = async (m) => {
|
|
1222
|
-
var
|
|
1223
|
-
const $ = (
|
|
1224
|
+
var j;
|
|
1225
|
+
const $ = (j = m.target.files) == null ? void 0 : j[0];
|
|
1224
1226
|
if (!$)
|
|
1225
1227
|
return;
|
|
1226
1228
|
const w = await $.text();
|
|
@@ -1330,7 +1332,7 @@ function Qt({
|
|
|
1330
1332
|
);
|
|
1331
1333
|
}
|
|
1332
1334
|
function yt({ dataset: e }) {
|
|
1333
|
-
const [t, n] =
|
|
1335
|
+
const [t, n] = F(0), r = 50, i = Math.ceil(e.rowCount / r), s = e.data.slice(t * r, (t + 1) * r);
|
|
1334
1336
|
return /* @__PURE__ */ u("div", { children: [
|
|
1335
1337
|
/* @__PURE__ */ o("div", { style: { overflowX: "auto", marginBottom: "16px" }, children: /* @__PURE__ */ u("table", { style: { borderCollapse: "collapse", width: "100%", fontSize: "13px" }, children: [
|
|
1336
1338
|
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ u("tr", { style: { backgroundColor: "var(--nice-bg-secondary, #f5f5f5)" }, children: [
|
|
@@ -1442,7 +1444,7 @@ function gt({
|
|
|
1442
1444
|
dataset: e,
|
|
1443
1445
|
service: t
|
|
1444
1446
|
}) {
|
|
1445
|
-
const [n, r] =
|
|
1447
|
+
const [n, r] = F("descriptive"), [i, s] = F(null);
|
|
1446
1448
|
return /* @__PURE__ */ u("div", { children: [
|
|
1447
1449
|
/* @__PURE__ */ u("div", { style: { display: "flex", gap: "12px", marginBottom: "24px" }, children: [
|
|
1448
1450
|
/* @__PURE__ */ u(
|
|
@@ -1501,7 +1503,7 @@ function gt({
|
|
|
1501
1503
|
)
|
|
1502
1504
|
] });
|
|
1503
1505
|
}
|
|
1504
|
-
const
|
|
1506
|
+
const We = {
|
|
1505
1507
|
apa: (e) => {
|
|
1506
1508
|
const t = xt(e.authors), n = e.year ? ` (${e.year}).` : ".", r = e.title;
|
|
1507
1509
|
let i = "";
|
|
@@ -1545,7 +1547,7 @@ const Oe = {
|
|
|
1545
1547
|
return e.type === "article" && e.journal && (r = ` *${e.journal}*`, e.volume && (r += ` **${e.volume}**`), e.pages && (r += `, ${e.pages}`), e.year && (r += ` (${e.year})`), r += "."), `${t}, ${n}.${r}`;
|
|
1546
1548
|
},
|
|
1547
1549
|
bibtex: (e) => {
|
|
1548
|
-
const t =
|
|
1550
|
+
const t = Ct(e), n = e.type === "article" ? "article" : e.type === "book" ? "book" : "misc";
|
|
1549
1551
|
let i = ` author = {${e.authors.map((s) => `${s.family}, ${s.given}`).join(" and ")}},
|
|
1550
1552
|
`;
|
|
1551
1553
|
return i += ` title = {${e.title}},
|
|
@@ -1605,12 +1607,12 @@ function Qe(e) {
|
|
|
1605
1607
|
function wt(e) {
|
|
1606
1608
|
return Qe(e);
|
|
1607
1609
|
}
|
|
1608
|
-
function
|
|
1610
|
+
function Ct(e) {
|
|
1609
1611
|
var i;
|
|
1610
1612
|
const t = ((i = e.authors[0]) == null ? void 0 : i.family.toLowerCase()) || "unknown", n = e.year || "0000", r = e.title.split(" ")[0].toLowerCase().replace(/[^a-z]/g, "");
|
|
1611
1613
|
return `${t}${n}${r}`;
|
|
1612
1614
|
}
|
|
1613
|
-
class
|
|
1615
|
+
class St {
|
|
1614
1616
|
constructor(t = {}) {
|
|
1615
1617
|
ve(this, "config");
|
|
1616
1618
|
ve(this, "citations", /* @__PURE__ */ new Map());
|
|
@@ -1727,7 +1729,7 @@ class Ct {
|
|
|
1727
1729
|
const r = this.citations.get(t);
|
|
1728
1730
|
if (!r)
|
|
1729
1731
|
throw new Error(`Citation not found: ${t}`);
|
|
1730
|
-
return
|
|
1732
|
+
return We[n](r);
|
|
1731
1733
|
}
|
|
1732
1734
|
/** Format multiple citations as bibliography */
|
|
1733
1735
|
formatBibliography(t, n) {
|
|
@@ -1735,7 +1737,7 @@ class Ct {
|
|
|
1735
1737
|
const a = this.citations.get(i);
|
|
1736
1738
|
if (!a)
|
|
1737
1739
|
return null;
|
|
1738
|
-
const l =
|
|
1740
|
+
const l = We[n](a);
|
|
1739
1741
|
return n === "bibtex" ? l : ["ieee", "vancouver"].includes(n) ? `[${s + 1}] ${l}` : l;
|
|
1740
1742
|
}).filter(Boolean).join(`
|
|
1741
1743
|
|
|
@@ -1786,7 +1788,7 @@ class Ct {
|
|
|
1786
1788
|
}
|
|
1787
1789
|
/** Export as BibTeX */
|
|
1788
1790
|
exportBibtex(t) {
|
|
1789
|
-
return (t ? t.map((r) => this.citations.get(r)).filter(Boolean) : Array.from(this.citations.values())).map((r) =>
|
|
1791
|
+
return (t ? t.map((r) => this.citations.get(r)).filter(Boolean) : Array.from(this.citations.values())).map((r) => We.bibtex(r)).join(`
|
|
1790
1792
|
|
|
1791
1793
|
`);
|
|
1792
1794
|
}
|
|
@@ -1857,10 +1859,10 @@ class Ct {
|
|
|
1857
1859
|
type: "article",
|
|
1858
1860
|
title: m.title || "",
|
|
1859
1861
|
authors: (m.authors || []).map((w) => {
|
|
1860
|
-
const
|
|
1862
|
+
const j = w.name.split(" ");
|
|
1861
1863
|
return {
|
|
1862
|
-
family:
|
|
1863
|
-
given:
|
|
1864
|
+
family: j.pop() || "",
|
|
1865
|
+
given: j.join(" ")
|
|
1864
1866
|
};
|
|
1865
1867
|
}),
|
|
1866
1868
|
year: m.pubdate ? parseInt(m.pubdate.split(" ")[0], 10) : void 0,
|
|
@@ -1922,12 +1924,12 @@ class Ct {
|
|
|
1922
1924
|
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
1923
1925
|
}
|
|
1924
1926
|
}
|
|
1925
|
-
function
|
|
1926
|
-
return new
|
|
1927
|
+
function tn(e) {
|
|
1928
|
+
return new St(e);
|
|
1927
1929
|
}
|
|
1928
|
-
const He =
|
|
1930
|
+
const He = /* @__PURE__ */ Ze(null);
|
|
1929
1931
|
function et() {
|
|
1930
|
-
const e =
|
|
1932
|
+
const e = Ue(He);
|
|
1931
1933
|
if (!e)
|
|
1932
1934
|
throw new Error("useCitation must be used within CitationProvider");
|
|
1933
1935
|
return e;
|
|
@@ -1989,11 +1991,11 @@ const he = {
|
|
|
1989
1991
|
cursor: "pointer"
|
|
1990
1992
|
}
|
|
1991
1993
|
};
|
|
1992
|
-
function
|
|
1993
|
-
const [r, i] =
|
|
1994
|
+
function nn({ service: e, className: t, style: n }) {
|
|
1995
|
+
const [r, i] = F([]), [s, a] = F([]), [l, c] = F("all"), [h, p] = F(null), [y, m] = F(""), [$, w] = F("apa"), j = q(() => {
|
|
1994
1996
|
i(e.listCitations(l)), a(e.listCollections());
|
|
1995
1997
|
}, [e, l]), J = K(() => y ? e.searchCitations(y, { collection: l }) : r, [r, y, l, e]), te = K(
|
|
1996
|
-
() => r.find((
|
|
1998
|
+
() => r.find((R) => R.id === h),
|
|
1997
1999
|
[r, h]
|
|
1998
2000
|
), V = {
|
|
1999
2001
|
service: e,
|
|
@@ -2007,30 +2009,30 @@ function en({ service: e, className: t, style: n }) {
|
|
|
2007
2009
|
setSearchQuery: m,
|
|
2008
2010
|
citationStyle: $,
|
|
2009
2011
|
setCitationStyle: w,
|
|
2010
|
-
refresh:
|
|
2012
|
+
refresh: j
|
|
2011
2013
|
};
|
|
2012
2014
|
return /* @__PURE__ */ o(He.Provider, { value: V, children: /* @__PURE__ */ u("div", { className: t, style: { ...he.container, ...n }, children: [
|
|
2013
2015
|
/* @__PURE__ */ u("div", { style: he.sidebar, children: [
|
|
2014
2016
|
/* @__PURE__ */ o("div", { style: { padding: "16px", fontWeight: 600 }, children: "Collections" }),
|
|
2015
|
-
s.map((
|
|
2017
|
+
s.map((R) => /* @__PURE__ */ u(
|
|
2016
2018
|
"div",
|
|
2017
2019
|
{
|
|
2018
2020
|
onClick: () => {
|
|
2019
|
-
c(
|
|
2021
|
+
c(R.id), j();
|
|
2020
2022
|
},
|
|
2021
2023
|
style: {
|
|
2022
2024
|
...he.listItem,
|
|
2023
|
-
backgroundColor: l ===
|
|
2025
|
+
backgroundColor: l === R.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
|
|
2024
2026
|
},
|
|
2025
2027
|
children: [
|
|
2026
|
-
/* @__PURE__ */ o("div", { children:
|
|
2028
|
+
/* @__PURE__ */ o("div", { children: R.name }),
|
|
2027
2029
|
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
2028
|
-
|
|
2030
|
+
R.citationCount,
|
|
2029
2031
|
" items"
|
|
2030
2032
|
] })
|
|
2031
2033
|
]
|
|
2032
2034
|
},
|
|
2033
|
-
|
|
2035
|
+
R.id
|
|
2034
2036
|
))
|
|
2035
2037
|
] }),
|
|
2036
2038
|
/* @__PURE__ */ u("div", { style: he.main, children: [
|
|
@@ -2041,7 +2043,7 @@ function en({ service: e, className: t, style: n }) {
|
|
|
2041
2043
|
type: "text",
|
|
2042
2044
|
placeholder: "Search references...",
|
|
2043
2045
|
value: y,
|
|
2044
|
-
onChange: (
|
|
2046
|
+
onChange: (R) => m(R.target.value),
|
|
2045
2047
|
style: { ...he.input, flex: 1 }
|
|
2046
2048
|
}
|
|
2047
2049
|
),
|
|
@@ -2049,7 +2051,7 @@ function en({ service: e, className: t, style: n }) {
|
|
|
2049
2051
|
"select",
|
|
2050
2052
|
{
|
|
2051
2053
|
value: $,
|
|
2052
|
-
onChange: (
|
|
2054
|
+
onChange: (R) => w(R.target.value),
|
|
2053
2055
|
style: he.input,
|
|
2054
2056
|
children: [
|
|
2055
2057
|
/* @__PURE__ */ o("option", { value: "apa", children: "APA" }),
|
|
@@ -2066,21 +2068,21 @@ function en({ service: e, className: t, style: n }) {
|
|
|
2066
2068
|
] }),
|
|
2067
2069
|
/* @__PURE__ */ u("div", { style: { display: "flex", flex: 1, overflow: "hidden" }, children: [
|
|
2068
2070
|
/* @__PURE__ */ u("div", { style: he.list, children: [
|
|
2069
|
-
J.map((
|
|
2071
|
+
J.map((R) => /* @__PURE__ */ u(
|
|
2070
2072
|
"div",
|
|
2071
2073
|
{
|
|
2072
|
-
onClick: () => p(
|
|
2074
|
+
onClick: () => p(R.id),
|
|
2073
2075
|
style: {
|
|
2074
2076
|
...he.listItem,
|
|
2075
|
-
backgroundColor: h ===
|
|
2077
|
+
backgroundColor: h === R.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
|
|
2076
2078
|
},
|
|
2077
2079
|
children: [
|
|
2078
|
-
/* @__PURE__ */ o("div", { style: { fontWeight: 500, marginBottom: "4px" }, children:
|
|
2080
|
+
/* @__PURE__ */ o("div", { style: { fontWeight: 500, marginBottom: "4px" }, children: R.title }),
|
|
2079
2081
|
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
+
R.authors.map((H) => H.family).join(", "),
|
|
2083
|
+
R.year && ` (${R.year})`
|
|
2082
2084
|
] }),
|
|
2083
|
-
|
|
2085
|
+
R.journal && /* @__PURE__ */ o(
|
|
2084
2086
|
"div",
|
|
2085
2087
|
{
|
|
2086
2088
|
style: {
|
|
@@ -2088,12 +2090,12 @@ function en({ service: e, className: t, style: n }) {
|
|
|
2088
2090
|
color: "var(--nice-text-secondary, #888)",
|
|
2089
2091
|
fontStyle: "italic"
|
|
2090
2092
|
},
|
|
2091
|
-
children:
|
|
2093
|
+
children: R.journal
|
|
2092
2094
|
}
|
|
2093
2095
|
)
|
|
2094
2096
|
]
|
|
2095
2097
|
},
|
|
2096
|
-
|
|
2098
|
+
R.id
|
|
2097
2099
|
)),
|
|
2098
2100
|
J.length === 0 && /* @__PURE__ */ o(
|
|
2099
2101
|
"div",
|
|
@@ -2113,7 +2115,7 @@ function en({ service: e, className: t, style: n }) {
|
|
|
2113
2115
|
] }) });
|
|
2114
2116
|
}
|
|
2115
2117
|
function kt() {
|
|
2116
|
-
const { service: e, refresh: t } = et(), [n, r] =
|
|
2118
|
+
const { service: e, refresh: t } = et(), [n, r] = F(!1), [i, s] = F(""), [a, l] = F(!1), c = async () => {
|
|
2117
2119
|
if (i.trim()) {
|
|
2118
2120
|
l(!0);
|
|
2119
2121
|
try {
|
|
@@ -2179,7 +2181,7 @@ function kt() {
|
|
|
2179
2181
|
] });
|
|
2180
2182
|
}
|
|
2181
2183
|
function Dt({ citation: e }) {
|
|
2182
|
-
const { service: t, citationStyle: n } = et(), [r, i] =
|
|
2184
|
+
const { service: t, citationStyle: n } = et(), [r, i] = F(!1), s = K(
|
|
2183
2185
|
() => t.formatCitation(e.id, n),
|
|
2184
2186
|
[t, e.id, n]
|
|
2185
2187
|
), a = () => {
|
|
@@ -2278,7 +2280,7 @@ function Dt({ citation: e }) {
|
|
|
2278
2280
|
] })
|
|
2279
2281
|
] });
|
|
2280
2282
|
}
|
|
2281
|
-
const At = {
|
|
2283
|
+
const At = [], zt = {
|
|
2282
2284
|
series: [],
|
|
2283
2285
|
xAxes: [],
|
|
2284
2286
|
yAxes: [],
|
|
@@ -2288,30 +2290,30 @@ const At = {
|
|
|
2288
2290
|
cursor: null,
|
|
2289
2291
|
hoveredPoint: null
|
|
2290
2292
|
};
|
|
2291
|
-
function
|
|
2293
|
+
function Ne(e) {
|
|
2292
2294
|
return e.reduce((t, n) => t + n, 0) / e.length;
|
|
2293
2295
|
}
|
|
2294
|
-
function
|
|
2296
|
+
function Nt(e) {
|
|
2295
2297
|
const t = [...e].sort((r, i) => r - i), n = Math.floor(t.length / 2);
|
|
2296
2298
|
return t.length % 2 ? t[n] : (t[n - 1] + t[n]) / 2;
|
|
2297
2299
|
}
|
|
2298
|
-
function
|
|
2299
|
-
const t =
|
|
2300
|
-
return Math.sqrt(
|
|
2300
|
+
function _e(e) {
|
|
2301
|
+
const t = Ne(e), n = e.map((r) => Math.pow(r - t, 2));
|
|
2302
|
+
return Math.sqrt(Ne(n));
|
|
2301
2303
|
}
|
|
2302
2304
|
function It(e) {
|
|
2303
|
-
return
|
|
2305
|
+
return _e(e) / Math.sqrt(e.length);
|
|
2304
2306
|
}
|
|
2305
|
-
function
|
|
2306
|
-
const t =
|
|
2307
|
+
function Et(e) {
|
|
2308
|
+
const t = Ne(e), n = It(e), r = 1.96;
|
|
2307
2309
|
return [t - r * n, t + r * n];
|
|
2308
2310
|
}
|
|
2309
|
-
function
|
|
2310
|
-
const t = e.length, n = e.map((w) => typeof w.x == "number" ? w.x : 0), r = e.map((w) => w.y), i = n.reduce((w,
|
|
2311
|
+
function Ft(e) {
|
|
2312
|
+
const t = e.length, n = e.map((w) => typeof w.x == "number" ? w.x : 0), r = e.map((w) => w.y), i = n.reduce((w, j) => w + j, 0), s = r.reduce((w, j) => w + j, 0), a = n.reduce((w, j, J) => w + j * r[J], 0), l = n.reduce((w, j) => w + j * j, 0), c = (t * a - i * s) / (t * l - i * i), h = (s - c * i) / t, p = s / t, y = r.reduce((w, j) => w + Math.pow(j - p, 2), 0), $ = 1 - r.reduce((w, j, J) => w + Math.pow(j - (c * n[J] + h), 2), 0) / y;
|
|
2311
2313
|
return { slope: c, intercept: h, r2: $ };
|
|
2312
2314
|
}
|
|
2313
2315
|
function jt(e, t) {
|
|
2314
|
-
const n =
|
|
2316
|
+
const n = Ne(e), r = Ne(t), i = _e(e) ** 2, s = _e(t) ** 2, a = e.length, l = t.length, c = ((a - 1) * i + (l - 1) * s) / (a + l - 2), h = Math.sqrt(c * (1 / a + 1 / l)), p = (n - r) / h, y = Math.exp(-0.717 * Math.abs(p) - 0.416 * p * p);
|
|
2315
2317
|
return { t: p, p: y, significant: y < 0.05 };
|
|
2316
2318
|
}
|
|
2317
2319
|
function Ye(e, t, n, r = 5) {
|
|
@@ -2321,8 +2323,8 @@ function Ye(e, t, n, r = 5) {
|
|
|
2321
2323
|
function Pe(e, t) {
|
|
2322
2324
|
return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(1) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Math.abs(e) < 0.01 ? e.toExponential(2) : e.toFixed(2).replace(/\.?0+$/, "");
|
|
2323
2325
|
}
|
|
2324
|
-
function
|
|
2325
|
-
series: e,
|
|
2326
|
+
function rn({
|
|
2327
|
+
series: e = At,
|
|
2326
2328
|
title: t,
|
|
2327
2329
|
subtitle: n,
|
|
2328
2330
|
width: r = "100%",
|
|
@@ -2337,11 +2339,11 @@ function tn({
|
|
|
2337
2339
|
zoom: m = { enabled: !0, mode: "xy", wheel: !0, drag: !0, resetButton: !0 },
|
|
2338
2340
|
export: $,
|
|
2339
2341
|
statisticalTests: w = [],
|
|
2340
|
-
gridLines:
|
|
2342
|
+
gridLines: j = !0,
|
|
2341
2343
|
aspectRatio: J,
|
|
2342
2344
|
animation: te = !0,
|
|
2343
2345
|
theme: V = "light",
|
|
2344
|
-
onPointClick:
|
|
2346
|
+
onPointClick: R,
|
|
2345
2347
|
onPointHover: H,
|
|
2346
2348
|
onZoomChange: oe,
|
|
2347
2349
|
onAnnotationChange: U,
|
|
@@ -2350,50 +2352,50 @@ function tn({
|
|
|
2350
2352
|
}) {
|
|
2351
2353
|
const se = ze(null);
|
|
2352
2354
|
ze(null);
|
|
2353
|
-
const [ne, Y] =
|
|
2354
|
-
...
|
|
2355
|
+
const [ne, Y] = F({
|
|
2356
|
+
...zt,
|
|
2355
2357
|
series: e,
|
|
2356
2358
|
annotations: h
|
|
2357
|
-
}), [ce, ue] =
|
|
2359
|
+
}), [ce, ue] = F({ width: 0, height: 0 }), [me, xe] = F({ x: null, y: null }), [X, Z] = F(
|
|
2358
2360
|
null
|
|
2359
|
-
), [ae, G] =
|
|
2361
|
+
), [ae, G] = F(
|
|
2360
2362
|
new Set(e.map((d) => d.id))
|
|
2361
|
-
),
|
|
2363
|
+
), S = K(() => {
|
|
2362
2364
|
const d = e.filter((M) => ae.has(M.id) && M.visible !== !1);
|
|
2363
2365
|
if (d.length === 0)
|
|
2364
2366
|
return { xMin: 0, xMax: 1, yMin: 0, yMax: 1 };
|
|
2365
|
-
let x = 1 / 0,
|
|
2367
|
+
let x = 1 / 0, C = -1 / 0, E = 1 / 0, I = -1 / 0;
|
|
2366
2368
|
for (const M of d)
|
|
2367
2369
|
for (const A of M.data) {
|
|
2368
|
-
const
|
|
2369
|
-
if (x = Math.min(x,
|
|
2370
|
-
const [
|
|
2371
|
-
E = Math.min(E, A.y +
|
|
2370
|
+
const T = typeof A.x == "number" ? A.x : 0;
|
|
2371
|
+
if (x = Math.min(x, T), C = Math.max(C, T), E = Math.min(E, A.y), I = Math.max(I, A.y), A.error) {
|
|
2372
|
+
const [O, le] = Array.isArray(A.error) ? A.error : [-A.error, A.error];
|
|
2373
|
+
E = Math.min(E, A.y + O), I = Math.max(I, A.y + le);
|
|
2372
2374
|
}
|
|
2373
2375
|
}
|
|
2374
|
-
const
|
|
2376
|
+
const L = (C - x) * 0.05 || 0.5, g = (I - E) * 0.05 || 0.5;
|
|
2375
2377
|
return {
|
|
2376
|
-
xMin: x -
|
|
2377
|
-
xMax:
|
|
2378
|
+
xMin: x - L,
|
|
2379
|
+
xMax: C + L,
|
|
2378
2380
|
yMin: E - g,
|
|
2379
|
-
yMax:
|
|
2381
|
+
yMax: I + g
|
|
2380
2382
|
};
|
|
2381
2383
|
}, [e, ae]), Q = K(() => {
|
|
2382
2384
|
const d = {};
|
|
2383
2385
|
for (const x of e) {
|
|
2384
2386
|
if (!ae.has(x.id))
|
|
2385
2387
|
continue;
|
|
2386
|
-
const
|
|
2387
|
-
c.includes("mean") && (d[`${x.id}_mean`] =
|
|
2388
|
+
const C = x.data.map((E) => E.y);
|
|
2389
|
+
c.includes("mean") && (d[`${x.id}_mean`] = Ne(C)), c.includes("median") && (d[`${x.id}_median`] = Nt(C)), c.includes("std-dev") && (d[`${x.id}_std`] = _e(C)), c.includes("regression") && (d[`${x.id}_regression`] = Ft(x.data)), c.includes("confidence-interval") && (d[`${x.id}_ci95`] = Et(C));
|
|
2388
2390
|
}
|
|
2389
2391
|
return d;
|
|
2390
2392
|
}, [e, ae, c]), ee = K(() => w.map((d) => {
|
|
2391
2393
|
if (d.type === "t-test" && d.series.length === 2) {
|
|
2392
|
-
const x = e.find((E) => E.id === d.series[0]),
|
|
2393
|
-
if (x &&
|
|
2394
|
+
const x = e.find((E) => E.id === d.series[0]), C = e.find((E) => E.id === d.series[1]);
|
|
2395
|
+
if (x && C) {
|
|
2394
2396
|
const E = jt(
|
|
2395
|
-
x.data.map((
|
|
2396
|
-
|
|
2397
|
+
x.data.map((I) => I.y),
|
|
2398
|
+
C.data.map((I) => I.y)
|
|
2397
2399
|
);
|
|
2398
2400
|
return {
|
|
2399
2401
|
...d,
|
|
@@ -2409,8 +2411,8 @@ function tn({
|
|
|
2409
2411
|
return d;
|
|
2410
2412
|
}), [w, e]), re = q((d) => {
|
|
2411
2413
|
G((x) => {
|
|
2412
|
-
const
|
|
2413
|
-
return
|
|
2414
|
+
const C = new Set(x);
|
|
2415
|
+
return C.has(d) ? C.delete(d) : C.add(d), C;
|
|
2414
2416
|
});
|
|
2415
2417
|
}, []), ie = q(() => {
|
|
2416
2418
|
xe({ x: null, y: null }), oe == null || oe(null, null);
|
|
@@ -2489,59 +2491,31 @@ function tn({
|
|
|
2489
2491
|
...pe
|
|
2490
2492
|
},
|
|
2491
2493
|
children: [
|
|
2492
|
-
t && /* @__PURE__ */ u(
|
|
2493
|
-
|
|
2494
|
-
{
|
|
2495
|
-
|
|
2496
|
-
style: {
|
|
2497
|
-
textAlign: "center",
|
|
2498
|
-
fontWeight: "bold",
|
|
2499
|
-
fontSize: "1.25rem",
|
|
2500
|
-
padding: "0.5rem"
|
|
2501
|
-
},
|
|
2502
|
-
children: [
|
|
2503
|
-
t,
|
|
2504
|
-
n && /* @__PURE__ */ o("div", { style: { fontSize: "0.875rem", fontWeight: "normal", color: k.axis }, children: n })
|
|
2505
|
-
]
|
|
2506
|
-
}
|
|
2507
|
-
),
|
|
2494
|
+
t && /* @__PURE__ */ u("div", { className: "nice-scientific-chart__title", children: [
|
|
2495
|
+
t,
|
|
2496
|
+
n && /* @__PURE__ */ o("div", { className: "nice-scientific-chart__subtitle", style: { color: k.axis }, children: n })
|
|
2497
|
+
] }),
|
|
2508
2498
|
p.show && /* @__PURE__ */ o(
|
|
2509
2499
|
"div",
|
|
2510
2500
|
{
|
|
2511
2501
|
className: "nice-scientific-chart__legend",
|
|
2512
|
-
style: {
|
|
2513
|
-
display: "flex",
|
|
2514
|
-
flexDirection: p.orientation === "vertical" ? "column" : "row",
|
|
2515
|
-
flexWrap: "wrap",
|
|
2516
|
-
gap: "0.5rem",
|
|
2517
|
-
padding: "0.5rem",
|
|
2518
|
-
justifyContent: "center"
|
|
2519
|
-
},
|
|
2502
|
+
style: { flexDirection: p.orientation === "vertical" ? "column" : "row" },
|
|
2520
2503
|
children: e.map((d, x) => /* @__PURE__ */ u(
|
|
2521
2504
|
"button",
|
|
2522
2505
|
{
|
|
2506
|
+
type: "button",
|
|
2507
|
+
className: "nice-scientific-chart__legend-item",
|
|
2523
2508
|
onClick: () => p.interactive && re(d.id),
|
|
2524
2509
|
style: {
|
|
2525
|
-
display: "flex",
|
|
2526
|
-
alignItems: "center",
|
|
2527
|
-
gap: "0.25rem",
|
|
2528
|
-
background: "none",
|
|
2529
|
-
border: "none",
|
|
2530
2510
|
cursor: p.interactive ? "pointer" : "default",
|
|
2531
|
-
opacity: ae.has(d.id) ? 1 : 0.4
|
|
2532
|
-
color: "inherit",
|
|
2533
|
-
fontSize: "0.875rem"
|
|
2511
|
+
opacity: ae.has(d.id) ? 1 : 0.4
|
|
2534
2512
|
},
|
|
2535
2513
|
children: [
|
|
2536
2514
|
/* @__PURE__ */ o(
|
|
2537
2515
|
"span",
|
|
2538
2516
|
{
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
height: 12,
|
|
2542
|
-
borderRadius: 2,
|
|
2543
|
-
backgroundColor: d.color || z[x % z.length]
|
|
2544
|
-
}
|
|
2517
|
+
className: "nice-scientific-chart__swatch",
|
|
2518
|
+
style: { backgroundColor: d.color || z[x % z.length] }
|
|
2545
2519
|
}
|
|
2546
2520
|
),
|
|
2547
2521
|
d.name
|
|
@@ -2551,303 +2525,255 @@ function tn({
|
|
|
2551
2525
|
))
|
|
2552
2526
|
}
|
|
2553
2527
|
),
|
|
2554
|
-
/* @__PURE__ */ u(
|
|
2555
|
-
"
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2528
|
+
/* @__PURE__ */ u("div", { className: "nice-scientific-chart__canvas", children: [
|
|
2529
|
+
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", children: [
|
|
2530
|
+
j && /* @__PURE__ */ u("g", { className: "nice-scientific-chart__grid", stroke: k.grid, strokeWidth: 1, children: [
|
|
2531
|
+
[0, 0.25, 0.5, 0.75, 1].map((d) => /* @__PURE__ */ o(
|
|
2532
|
+
"line",
|
|
2533
|
+
{
|
|
2534
|
+
x1: "10%",
|
|
2535
|
+
y1: `${d * 100}%`,
|
|
2536
|
+
x2: "95%",
|
|
2537
|
+
y2: `${d * 100}%`,
|
|
2538
|
+
strokeDasharray: "2,2"
|
|
2539
|
+
},
|
|
2540
|
+
`h-${d}`
|
|
2541
|
+
)),
|
|
2542
|
+
[0, 0.25, 0.5, 0.75, 1].map((d) => /* @__PURE__ */ o(
|
|
2543
|
+
"line",
|
|
2544
|
+
{
|
|
2545
|
+
x1: `${10 + d * 85}%`,
|
|
2546
|
+
y1: "5%",
|
|
2547
|
+
x2: `${10 + d * 85}%`,
|
|
2548
|
+
y2: "90%",
|
|
2549
|
+
strokeDasharray: "2,2"
|
|
2550
|
+
},
|
|
2551
|
+
`v-${d}`
|
|
2552
|
+
))
|
|
2553
|
+
] }),
|
|
2554
|
+
e.filter((d) => ae.has(d.id) && d.visible !== !1).map((d, x) => {
|
|
2555
|
+
var I, L, g;
|
|
2556
|
+
const C = d.color || z[x % z.length], E = d.type || s;
|
|
2557
|
+
return /* @__PURE__ */ o("g", { className: "nice-scientific-chart__series", children: E === "scatter" || E === "line" ? /* @__PURE__ */ u(Ae, { children: [
|
|
2558
|
+
E === "line" && d.data.length > 1 && // `points` takes plain numbers — percentages are invalid there (the
|
|
2559
|
+
// line series never rendered; the browser rejected every point). The
|
|
2560
|
+
// same 0–100 coordinates go into a stretched 100×100 viewBox instead,
|
|
2561
|
+
// with a non-scaling stroke so the width stays in pixels.
|
|
2562
|
+
/* @__PURE__ */ o(
|
|
2563
|
+
"svg",
|
|
2564
|
+
{
|
|
2565
|
+
x: "0",
|
|
2566
|
+
y: "0",
|
|
2567
|
+
width: "100%",
|
|
2568
|
+
height: "100%",
|
|
2569
|
+
viewBox: "0 0 100 100",
|
|
2570
|
+
preserveAspectRatio: "none",
|
|
2571
|
+
style: { overflow: "visible" },
|
|
2572
|
+
children: /* @__PURE__ */ o(
|
|
2573
|
+
"polyline",
|
|
2595
2574
|
{
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
{
|
|
2606
|
-
fill: "none",
|
|
2607
|
-
stroke: S,
|
|
2608
|
-
strokeWidth: ((N = d.line) == null ? void 0 : N.width) || 2,
|
|
2609
|
-
vectorEffect: "non-scaling-stroke",
|
|
2610
|
-
strokeDasharray: ((_ = d.line) == null ? void 0 : _.style) === "dashed" ? "5,5" : ((g = d.line) == null ? void 0 : g.style) === "dotted" ? "2,2" : void 0,
|
|
2611
|
-
points: d.data.map((M, A) => {
|
|
2612
|
-
const W = 10 + ((typeof M.x == "number" ? M.x : A) - C.xMin) / (C.xMax - C.xMin) * 85, T = 90 - (M.y - C.yMin) / (C.yMax - C.yMin) * 85;
|
|
2613
|
-
return `${W},${T}`;
|
|
2614
|
-
}).join(" ")
|
|
2615
|
-
}
|
|
2616
|
-
)
|
|
2575
|
+
fill: "none",
|
|
2576
|
+
stroke: C,
|
|
2577
|
+
strokeWidth: ((I = d.line) == null ? void 0 : I.width) || 2,
|
|
2578
|
+
vectorEffect: "non-scaling-stroke",
|
|
2579
|
+
strokeDasharray: ((L = d.line) == null ? void 0 : L.style) === "dashed" ? "5,5" : ((g = d.line) == null ? void 0 : g.style) === "dotted" ? "2,2" : void 0,
|
|
2580
|
+
points: d.data.map((M, A) => {
|
|
2581
|
+
const T = 10 + ((typeof M.x == "number" ? M.x : A) - S.xMin) / (S.xMax - S.xMin) * 85, O = 90 - (M.y - S.yMin) / (S.yMax - S.yMin) * 85;
|
|
2582
|
+
return `${T},${O}`;
|
|
2583
|
+
}).join(" ")
|
|
2617
2584
|
}
|
|
2618
|
-
)
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
x1: `${W}%`,
|
|
2627
|
-
y1: `${90 - (M.y + (Array.isArray(M.error) ? M.error[1] : M.error) - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2628
|
-
x2: `${W}%`,
|
|
2629
|
-
y2: `${90 - (M.y - (Array.isArray(M.error) ? Math.abs(M.error[0]) : M.error) - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2630
|
-
stroke: S,
|
|
2631
|
-
strokeWidth: 1
|
|
2632
|
-
}
|
|
2633
|
-
),
|
|
2634
|
-
/* @__PURE__ */ o(
|
|
2635
|
-
"circle",
|
|
2636
|
-
{
|
|
2637
|
-
cx: `${W}%`,
|
|
2638
|
-
cy: `${T}%`,
|
|
2639
|
-
r: le / 2,
|
|
2640
|
-
fill: M.color || ((be = d.marker) == null ? void 0 : be.fillColor) || S,
|
|
2641
|
-
stroke: ((ge = d.marker) == null ? void 0 : ge.strokeColor) || S,
|
|
2642
|
-
strokeWidth: ((ye = d.marker) == null ? void 0 : ye.strokeWidth) || 1,
|
|
2643
|
-
opacity: ((we = d.marker) == null ? void 0 : we.opacity) ?? 1,
|
|
2644
|
-
style: { cursor: L ? "pointer" : void 0 },
|
|
2645
|
-
onMouseEnter: () => {
|
|
2646
|
-
Z({ seriesId: d.id, pointIndex: A }), H == null || H(M, d);
|
|
2647
|
-
},
|
|
2648
|
-
onMouseLeave: () => {
|
|
2649
|
-
Z(null), H == null || H(null, null);
|
|
2650
|
-
},
|
|
2651
|
-
onClick: (Se) => L == null ? void 0 : L(M, d, Se)
|
|
2652
|
-
}
|
|
2653
|
-
)
|
|
2654
|
-
] }, A);
|
|
2655
|
-
}),
|
|
2656
|
-
Q[`${d.id}_regression`] && /* @__PURE__ */ o(
|
|
2585
|
+
)
|
|
2586
|
+
}
|
|
2587
|
+
),
|
|
2588
|
+
d.data.map((M, A) => {
|
|
2589
|
+
var fe, be, ge, ye, we;
|
|
2590
|
+
const T = 10 + ((typeof M.x == "number" ? M.x : A) - S.xMin) / (S.xMax - S.xMin) * 85, O = 90 - (M.y - S.yMin) / (S.yMax - S.yMin) * 85, le = M.size || ((fe = d.marker) == null ? void 0 : fe.size) || 6;
|
|
2591
|
+
return /* @__PURE__ */ u("g", { className: "nice-scientific-chart__point", children: [
|
|
2592
|
+
M.error && /* @__PURE__ */ o(
|
|
2657
2593
|
"line",
|
|
2658
2594
|
{
|
|
2659
|
-
x1:
|
|
2660
|
-
y1: `${90 - (
|
|
2661
|
-
x2:
|
|
2662
|
-
y2: `${90 - (
|
|
2663
|
-
stroke:
|
|
2664
|
-
strokeWidth: 1
|
|
2665
|
-
strokeDasharray: "5,3",
|
|
2666
|
-
opacity: 0.7
|
|
2595
|
+
x1: `${T}%`,
|
|
2596
|
+
y1: `${90 - (M.y + (Array.isArray(M.error) ? M.error[1] : M.error) - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2597
|
+
x2: `${T}%`,
|
|
2598
|
+
y2: `${90 - (M.y - (Array.isArray(M.error) ? Math.abs(M.error[0]) : M.error) - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2599
|
+
stroke: C,
|
|
2600
|
+
strokeWidth: 1
|
|
2667
2601
|
}
|
|
2668
2602
|
),
|
|
2669
|
-
Q[`${d.id}_mean`] && /* @__PURE__ */ o(
|
|
2670
|
-
"line",
|
|
2671
|
-
{
|
|
2672
|
-
x1: "10%",
|
|
2673
|
-
y1: `${90 - (Q[`${d.id}_mean`] - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2674
|
-
x2: "95%",
|
|
2675
|
-
y2: `${90 - (Q[`${d.id}_mean`] - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2676
|
-
stroke: S,
|
|
2677
|
-
strokeWidth: 1,
|
|
2678
|
-
strokeDasharray: "10,5",
|
|
2679
|
-
opacity: 0.5
|
|
2680
|
-
}
|
|
2681
|
-
)
|
|
2682
|
-
] }) : null }, d.id);
|
|
2683
|
-
}),
|
|
2684
|
-
/* @__PURE__ */ u("g", { className: "nice-scientific-chart__axes", stroke: k.axis, strokeWidth: 1, children: [
|
|
2685
|
-
/* @__PURE__ */ o("line", { x1: "10%", y1: "90%", x2: "95%", y2: "90%" }),
|
|
2686
|
-
/* @__PURE__ */ o("line", { x1: "10%", y1: "5%", x2: "10%", y2: "90%" }),
|
|
2687
|
-
Ye(C.xMin, C.xMax, "linear", 6).map((d, x) => /* @__PURE__ */ u("g", { children: [
|
|
2688
|
-
/* @__PURE__ */ o("line", { x1: `${10 + x * 17}%`, y1: "90%", x2: `${10 + x * 17}%`, y2: "92%" }),
|
|
2689
2603
|
/* @__PURE__ */ o(
|
|
2690
|
-
"
|
|
2691
|
-
{
|
|
2692
|
-
x: `${10 + x * 17}%`,
|
|
2693
|
-
y: "96%",
|
|
2694
|
-
textAnchor: "middle",
|
|
2695
|
-
fill: k.axis,
|
|
2696
|
-
fontSize: "0.75rem",
|
|
2697
|
-
children: Pe(d)
|
|
2698
|
-
}
|
|
2699
|
-
)
|
|
2700
|
-
] }, `x-${x}`)),
|
|
2701
|
-
Ye(C.yMin, C.yMax, "linear", 6).map((d, x) => /* @__PURE__ */ u("g", { children: [
|
|
2702
|
-
/* @__PURE__ */ o("line", { x1: "8%", y1: `${90 - x * 17}%`, x2: "10%", y2: `${90 - x * 17}%` }),
|
|
2703
|
-
/* @__PURE__ */ o(
|
|
2704
|
-
"text",
|
|
2705
|
-
{
|
|
2706
|
-
x: "7%",
|
|
2707
|
-
y: `${90 - x * 17}%`,
|
|
2708
|
-
textAnchor: "end",
|
|
2709
|
-
dominantBaseline: "middle",
|
|
2710
|
-
fill: k.axis,
|
|
2711
|
-
fontSize: "0.75rem",
|
|
2712
|
-
children: Pe(d)
|
|
2713
|
-
}
|
|
2714
|
-
)
|
|
2715
|
-
] }, `y-${x}`))
|
|
2716
|
-
] }),
|
|
2717
|
-
h.filter((d) => d.visible !== !1).map((d) => {
|
|
2718
|
-
var x, S, E, N, _, g, M;
|
|
2719
|
-
return /* @__PURE__ */ u("g", { className: "nice-scientific-chart__annotation", children: [
|
|
2720
|
-
d.type === "text" && d.text && /* @__PURE__ */ o(
|
|
2721
|
-
"text",
|
|
2722
|
-
{
|
|
2723
|
-
x: `${10 + (d.position.x - C.xMin) / (C.xMax - C.xMin) * 85}%`,
|
|
2724
|
-
y: `${90 - (d.position.y - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2725
|
-
fill: ((x = d.style) == null ? void 0 : x.color) || k.text,
|
|
2726
|
-
fontSize: ((S = d.style) == null ? void 0 : S.fontSize) || 12,
|
|
2727
|
-
fontWeight: (E = d.style) == null ? void 0 : E.fontWeight,
|
|
2728
|
-
children: d.text
|
|
2729
|
-
}
|
|
2730
|
-
),
|
|
2731
|
-
d.type === "line" && /* @__PURE__ */ o(
|
|
2732
|
-
"line",
|
|
2604
|
+
"circle",
|
|
2733
2605
|
{
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
stroke: ((
|
|
2739
|
-
strokeWidth: ((
|
|
2740
|
-
|
|
2606
|
+
cx: `${T}%`,
|
|
2607
|
+
cy: `${O}%`,
|
|
2608
|
+
r: le / 2,
|
|
2609
|
+
fill: M.color || ((be = d.marker) == null ? void 0 : be.fillColor) || C,
|
|
2610
|
+
stroke: ((ge = d.marker) == null ? void 0 : ge.strokeColor) || C,
|
|
2611
|
+
strokeWidth: ((ye = d.marker) == null ? void 0 : ye.strokeWidth) || 1,
|
|
2612
|
+
opacity: ((we = d.marker) == null ? void 0 : we.opacity) ?? 1,
|
|
2613
|
+
style: { cursor: R ? "pointer" : void 0 },
|
|
2614
|
+
onMouseEnter: () => {
|
|
2615
|
+
Z({ seriesId: d.id, pointIndex: A }), H == null || H(M, d);
|
|
2616
|
+
},
|
|
2617
|
+
onMouseLeave: () => {
|
|
2618
|
+
Z(null), H == null || H(null, null);
|
|
2619
|
+
},
|
|
2620
|
+
onClick: (Ce) => R == null ? void 0 : R(M, d, Ce)
|
|
2741
2621
|
}
|
|
2742
2622
|
)
|
|
2743
|
-
] },
|
|
2744
|
-
})
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2623
|
+
] }, A);
|
|
2624
|
+
}),
|
|
2625
|
+
Q[`${d.id}_regression`] && /* @__PURE__ */ o(
|
|
2626
|
+
"line",
|
|
2627
|
+
{
|
|
2628
|
+
x1: "10%",
|
|
2629
|
+
y1: `${90 - (Q[`${d.id}_regression`].intercept + Q[`${d.id}_regression`].slope * S.xMin - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2630
|
+
x2: "95%",
|
|
2631
|
+
y2: `${90 - (Q[`${d.id}_regression`].intercept + Q[`${d.id}_regression`].slope * S.xMax - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2632
|
+
stroke: C,
|
|
2633
|
+
strokeWidth: 1,
|
|
2634
|
+
strokeDasharray: "5,3",
|
|
2635
|
+
opacity: 0.7
|
|
2636
|
+
}
|
|
2637
|
+
),
|
|
2638
|
+
Q[`${d.id}_mean`] && /* @__PURE__ */ o(
|
|
2639
|
+
"line",
|
|
2640
|
+
{
|
|
2641
|
+
x1: "10%",
|
|
2642
|
+
y1: `${90 - (Q[`${d.id}_mean`] - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2643
|
+
x2: "95%",
|
|
2644
|
+
y2: `${90 - (Q[`${d.id}_mean`] - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2645
|
+
stroke: C,
|
|
2646
|
+
strokeWidth: 1,
|
|
2647
|
+
strokeDasharray: "10,5",
|
|
2648
|
+
opacity: 0.5
|
|
2649
|
+
}
|
|
2650
|
+
)
|
|
2651
|
+
] }) : null }, d.id);
|
|
2652
|
+
}),
|
|
2653
|
+
/* @__PURE__ */ u("g", { className: "nice-scientific-chart__axes", stroke: k.axis, strokeWidth: 1, children: [
|
|
2654
|
+
/* @__PURE__ */ o("line", { x1: "10%", y1: "90%", x2: "95%", y2: "90%" }),
|
|
2655
|
+
/* @__PURE__ */ o("line", { x1: "10%", y1: "5%", x2: "10%", y2: "90%" }),
|
|
2656
|
+
Ye(S.xMin, S.xMax, "linear", 6).map((d, x) => /* @__PURE__ */ u("g", { children: [
|
|
2657
|
+
/* @__PURE__ */ o("line", { x1: `${10 + x * 17}%`, y1: "90%", x2: `${10 + x * 17}%`, y2: "92%" }),
|
|
2658
|
+
/* @__PURE__ */ o(
|
|
2659
|
+
"text",
|
|
2660
|
+
{
|
|
2661
|
+
x: `${10 + x * 17}%`,
|
|
2662
|
+
y: "96%",
|
|
2663
|
+
textAnchor: "middle",
|
|
2664
|
+
fill: k.axis,
|
|
2665
|
+
fontSize: "0.75rem",
|
|
2666
|
+
children: Pe(d)
|
|
2667
|
+
}
|
|
2668
|
+
)
|
|
2669
|
+
] }, `x-${x}`)),
|
|
2670
|
+
Ye(S.yMin, S.yMax, "linear", 6).map((d, x) => /* @__PURE__ */ u("g", { children: [
|
|
2671
|
+
/* @__PURE__ */ o("line", { x1: "8%", y1: `${90 - x * 17}%`, x2: "10%", y2: `${90 - x * 17}%` }),
|
|
2672
|
+
/* @__PURE__ */ o(
|
|
2673
|
+
"text",
|
|
2674
|
+
{
|
|
2675
|
+
x: "7%",
|
|
2676
|
+
y: `${90 - x * 17}%`,
|
|
2677
|
+
textAnchor: "end",
|
|
2678
|
+
dominantBaseline: "middle",
|
|
2679
|
+
fill: k.axis,
|
|
2680
|
+
fontSize: "0.75rem",
|
|
2681
|
+
children: Pe(d)
|
|
2682
|
+
}
|
|
2683
|
+
)
|
|
2684
|
+
] }, `y-${x}`))
|
|
2685
|
+
] }),
|
|
2686
|
+
h.filter((d) => d.visible !== !1).map((d) => {
|
|
2687
|
+
var x, C, E, I, L, g, M;
|
|
2688
|
+
return /* @__PURE__ */ u("g", { className: "nice-scientific-chart__annotation", children: [
|
|
2689
|
+
d.type === "text" && d.text && /* @__PURE__ */ o(
|
|
2690
|
+
"text",
|
|
2691
|
+
{
|
|
2692
|
+
x: `${10 + (d.position.x - S.xMin) / (S.xMax - S.xMin) * 85}%`,
|
|
2693
|
+
y: `${90 - (d.position.y - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2694
|
+
fill: ((x = d.style) == null ? void 0 : x.color) || k.text,
|
|
2695
|
+
fontSize: ((C = d.style) == null ? void 0 : C.fontSize) || 12,
|
|
2696
|
+
fontWeight: (E = d.style) == null ? void 0 : E.fontWeight,
|
|
2697
|
+
children: d.text
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
d.type === "line" && /* @__PURE__ */ o(
|
|
2701
|
+
"line",
|
|
2702
|
+
{
|
|
2703
|
+
x1: `${10 + (d.position.x - S.xMin) / (S.xMax - S.xMin) * 85}%`,
|
|
2704
|
+
y1: `${90 - (d.position.y - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2705
|
+
x2: `${10 + (d.position.x2 - S.xMin) / (S.xMax - S.xMin) * 85}%`,
|
|
2706
|
+
y2: `${90 - (d.position.y2 - S.yMin) / (S.yMax - S.yMin) * 85}%`,
|
|
2707
|
+
stroke: ((I = d.style) == null ? void 0 : I.color) || k.text,
|
|
2708
|
+
strokeWidth: ((L = d.style) == null ? void 0 : L.lineWidth) || 1,
|
|
2709
|
+
strokeDasharray: ((g = d.style) == null ? void 0 : g.lineStyle) === "dashed" ? "5,5" : ((M = d.style) == null ? void 0 : M.lineStyle) === "dotted" ? "2,2" : void 0
|
|
2710
|
+
}
|
|
2711
|
+
)
|
|
2712
|
+
] }, d.id);
|
|
2713
|
+
})
|
|
2714
|
+
] }),
|
|
2715
|
+
y.enabled && X && /* @__PURE__ */ o(
|
|
2716
|
+
"div",
|
|
2717
|
+
{
|
|
2718
|
+
className: "nice-scientific-chart__tooltip",
|
|
2719
|
+
style: { background: k.tooltip, borderColor: k.grid },
|
|
2720
|
+
children: (() => {
|
|
2721
|
+
const d = e.find((C) => C.id === X.seriesId), x = d == null ? void 0 : d.data[X.pointIndex];
|
|
2722
|
+
return !d || !x ? null : y.format ? y.format(x, d) : /* @__PURE__ */ u(Ae, { children: [
|
|
2723
|
+
/* @__PURE__ */ o("div", { className: "nice-scientific-chart__tooltip-title", children: d.name }),
|
|
2724
|
+
/* @__PURE__ */ u("div", { children: [
|
|
2725
|
+
"X: ",
|
|
2726
|
+
x.x instanceof Date ? x.x.toISOString() : String(x.x)
|
|
2727
|
+
] }),
|
|
2728
|
+
/* @__PURE__ */ u("div", { children: [
|
|
2729
|
+
"Y: ",
|
|
2730
|
+
x.y.toFixed(4)
|
|
2731
|
+
] }),
|
|
2732
|
+
x.error && /* @__PURE__ */ u("div", { children: [
|
|
2733
|
+
"Error: ±",
|
|
2734
|
+
Array.isArray(x.error) ? `${x.error[0]}, +${x.error[1]}` : x.error
|
|
2735
|
+
] })
|
|
2736
|
+
] });
|
|
2737
|
+
})()
|
|
2738
|
+
}
|
|
2739
|
+
)
|
|
2740
|
+
] }),
|
|
2741
|
+
ee.some((d) => d.result) && /* @__PURE__ */ u("div", { className: "nice-scientific-chart__stats", style: { borderTopColor: k.grid }, children: [
|
|
2742
|
+
/* @__PURE__ */ o("strong", { children: "Statistical Tests:" }),
|
|
2743
|
+
ee.filter((d) => d.result).map((d, x) => /* @__PURE__ */ u("div", { children: [
|
|
2744
|
+
d.type,
|
|
2745
|
+
": ",
|
|
2746
|
+
d.result.interpretation
|
|
2747
|
+
] }, x))
|
|
2748
|
+
] }),
|
|
2802
2749
|
m.enabled && m.resetButton && (me.x || me.y) && /* @__PURE__ */ o(
|
|
2803
2750
|
"button",
|
|
2804
2751
|
{
|
|
2752
|
+
type: "button",
|
|
2753
|
+
className: "nice-scientific-chart__reset-zoom",
|
|
2805
2754
|
onClick: ie,
|
|
2806
|
-
style: {
|
|
2807
|
-
position: "absolute",
|
|
2808
|
-
top: 8,
|
|
2809
|
-
right: 8,
|
|
2810
|
-
padding: "0.25rem 0.5rem",
|
|
2811
|
-
fontSize: "0.75rem",
|
|
2812
|
-
background: k.bg,
|
|
2813
|
-
border: `1px solid ${k.grid}`,
|
|
2814
|
-
borderRadius: 4,
|
|
2815
|
-
cursor: "pointer"
|
|
2816
|
-
},
|
|
2755
|
+
style: { background: k.bg, borderColor: k.grid },
|
|
2817
2756
|
children: "Reset Zoom"
|
|
2818
2757
|
}
|
|
2819
2758
|
),
|
|
2820
|
-
$ && $.formats.length > 0 && /* @__PURE__ */ u(
|
|
2821
|
-
"
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
fontSize: "0.75rem",
|
|
2834
|
-
background: "none",
|
|
2835
|
-
border: `1px solid ${k.grid}`,
|
|
2836
|
-
borderRadius: 4,
|
|
2837
|
-
cursor: "pointer"
|
|
2838
|
-
},
|
|
2839
|
-
children: d.toUpperCase()
|
|
2840
|
-
},
|
|
2841
|
-
d
|
|
2842
|
-
))
|
|
2843
|
-
]
|
|
2844
|
-
}
|
|
2845
|
-
)
|
|
2759
|
+
$ && $.formats.length > 0 && /* @__PURE__ */ u("div", { className: "nice-scientific-chart__export", style: { borderTopColor: k.grid }, children: [
|
|
2760
|
+
/* @__PURE__ */ o("span", { className: "nice-scientific-chart__export-label", children: "Export:" }),
|
|
2761
|
+
$.formats.map((d) => /* @__PURE__ */ o(
|
|
2762
|
+
"button",
|
|
2763
|
+
{
|
|
2764
|
+
type: "button",
|
|
2765
|
+
className: "nice-scientific-chart__export-btn",
|
|
2766
|
+
style: { borderColor: k.grid },
|
|
2767
|
+
children: d.toUpperCase()
|
|
2768
|
+
},
|
|
2769
|
+
d
|
|
2770
|
+
))
|
|
2771
|
+
] })
|
|
2846
2772
|
]
|
|
2847
2773
|
}
|
|
2848
2774
|
);
|
|
2849
2775
|
}
|
|
2850
|
-
const qe = {
|
|
2776
|
+
const Bt = [], qe = {
|
|
2851
2777
|
rotationX: 25,
|
|
2852
2778
|
rotationY: -45,
|
|
2853
2779
|
rotationZ: 0,
|
|
@@ -2855,7 +2781,7 @@ const qe = {
|
|
|
2855
2781
|
panX: 0,
|
|
2856
2782
|
panY: 0
|
|
2857
2783
|
};
|
|
2858
|
-
function
|
|
2784
|
+
function _t(e, t) {
|
|
2859
2785
|
const n = t * Math.PI / 180, r = Math.cos(n), i = Math.sin(n);
|
|
2860
2786
|
return {
|
|
2861
2787
|
x: e.x,
|
|
@@ -2863,7 +2789,7 @@ function Ft(e, t) {
|
|
|
2863
2789
|
z: e.y * i + e.z * r
|
|
2864
2790
|
};
|
|
2865
2791
|
}
|
|
2866
|
-
function
|
|
2792
|
+
function Rt(e, t) {
|
|
2867
2793
|
const n = t * Math.PI / 180, r = Math.cos(n), i = Math.sin(n);
|
|
2868
2794
|
return {
|
|
2869
2795
|
x: e.x * r + e.z * i,
|
|
@@ -2871,7 +2797,7 @@ function Bt(e, t) {
|
|
|
2871
2797
|
z: -e.x * i + e.z * r
|
|
2872
2798
|
};
|
|
2873
2799
|
}
|
|
2874
|
-
function
|
|
2800
|
+
function Lt(e, t) {
|
|
2875
2801
|
const n = t * Math.PI / 180, r = Math.cos(n), i = Math.sin(n);
|
|
2876
2802
|
return {
|
|
2877
2803
|
x: e.x * r - e.y * i,
|
|
@@ -2880,8 +2806,8 @@ function Rt(e, t) {
|
|
|
2880
2806
|
};
|
|
2881
2807
|
}
|
|
2882
2808
|
function Me(e, t, n) {
|
|
2883
|
-
let r =
|
|
2884
|
-
r =
|
|
2809
|
+
let r = _t(e, n.rotationX);
|
|
2810
|
+
r = Rt(r, n.rotationY), r = Lt(r, n.rotationZ);
|
|
2885
2811
|
const i = r.z + t, s = t / Math.max(i, 0.1);
|
|
2886
2812
|
return {
|
|
2887
2813
|
x: (r.x * s * n.zoom + n.panX) * 100 + 50,
|
|
@@ -2981,14 +2907,14 @@ function ke(e, t, n, r) {
|
|
|
2981
2907
|
]
|
|
2982
2908
|
}, a = s[r] || s.viridis, l = i * (a.length - 1), c = Math.floor(l), h = l - c;
|
|
2983
2909
|
if (c >= a.length - 1) {
|
|
2984
|
-
const
|
|
2985
|
-
return `rgb(${
|
|
2910
|
+
const j = a[a.length - 1];
|
|
2911
|
+
return `rgb(${j[0]}, ${j[1]}, ${j[2]})`;
|
|
2986
2912
|
}
|
|
2987
2913
|
const p = a[c], y = a[c + 1], m = Math.round(p[0] + h * (y[0] - p[0])), $ = Math.round(p[1] + h * (y[1] - p[1])), w = Math.round(p[2] + h * (y[2] - p[2]));
|
|
2988
2914
|
return `rgb(${m}, ${$}, ${w})`;
|
|
2989
2915
|
}
|
|
2990
|
-
function
|
|
2991
|
-
data: e,
|
|
2916
|
+
function on({
|
|
2917
|
+
data: e = Bt,
|
|
2992
2918
|
title: t,
|
|
2993
2919
|
width: n = "100%",
|
|
2994
2920
|
height: r = 500,
|
|
@@ -3003,35 +2929,35 @@ function nn({
|
|
|
3003
2929
|
showAxes: m = !0,
|
|
3004
2930
|
showAxisLabels: $ = !0,
|
|
3005
2931
|
focalLength: w = 3,
|
|
3006
|
-
theme:
|
|
2932
|
+
theme: j = "light",
|
|
3007
2933
|
onCameraChange: J,
|
|
3008
2934
|
onPointClick: te,
|
|
3009
2935
|
onPointHover: V,
|
|
3010
|
-
className:
|
|
2936
|
+
className: R,
|
|
3011
2937
|
style: H
|
|
3012
2938
|
}) {
|
|
3013
|
-
const oe = ze(null), [U, de] =
|
|
2939
|
+
const oe = ze(null), [U, de] = F(qe), [pe, se] = F(!1), [ne, Y] = F(
|
|
3014
2940
|
null
|
|
3015
|
-
), [ce, ue] =
|
|
2941
|
+
), [ce, ue] = F(
|
|
3016
2942
|
null
|
|
3017
|
-
), [me, xe] =
|
|
3018
|
-
let z = 1 / 0, k = -1 / 0, d = 1 / 0, x = -1 / 0,
|
|
2943
|
+
), [me, xe] = F(0), X = K(() => {
|
|
2944
|
+
let z = 1 / 0, k = -1 / 0, d = 1 / 0, x = -1 / 0, C = 1 / 0, E = -1 / 0, I = 1 / 0, L = -1 / 0;
|
|
3019
2945
|
for (const M of e)
|
|
3020
2946
|
if (M.type === "scatter3d")
|
|
3021
2947
|
for (const A of M.points)
|
|
3022
|
-
z = Math.min(z, A.x), k = Math.max(k, A.x), d = Math.min(d, A.y), x = Math.max(x, A.y),
|
|
2948
|
+
z = Math.min(z, A.x), k = Math.max(k, A.x), d = Math.min(d, A.y), x = Math.max(x, A.y), C = Math.min(C, A.z), E = Math.max(E, A.z), typeof A.color == "number" && (I = Math.min(I, A.color), L = Math.max(L, A.color));
|
|
3023
2949
|
else if (M.type === "surface" || M.type === "wireframe") {
|
|
3024
2950
|
const A = M;
|
|
3025
|
-
for (const
|
|
3026
|
-
z = Math.min(z,
|
|
3027
|
-
for (const
|
|
3028
|
-
d = Math.min(d,
|
|
3029
|
-
for (const
|
|
3030
|
-
for (const
|
|
3031
|
-
|
|
2951
|
+
for (const T of A.xData)
|
|
2952
|
+
z = Math.min(z, T), k = Math.max(k, T);
|
|
2953
|
+
for (const T of A.yData)
|
|
2954
|
+
d = Math.min(d, T), x = Math.max(x, T);
|
|
2955
|
+
for (const T of A.zData)
|
|
2956
|
+
for (const O of T)
|
|
2957
|
+
C = Math.min(C, O), E = Math.max(E, O), I = Math.min(I, O), L = Math.max(L, O);
|
|
3032
2958
|
}
|
|
3033
|
-
const g = Math.max(k - z, x - d, E -
|
|
3034
|
-
return { xMin: z, xMax: k, yMin: d, yMax: x, zMin:
|
|
2959
|
+
const g = Math.max(k - z, x - d, E - C) || 1;
|
|
2960
|
+
return { xMin: z, xMax: k, yMin: d, yMax: x, zMin: C, zMax: E, colorMin: I, colorMax: L, maxRange: g };
|
|
3035
2961
|
}, [e]), Z = q(
|
|
3036
2962
|
(z) => {
|
|
3037
2963
|
const k = 2 / X.maxRange;
|
|
@@ -3063,7 +2989,7 @@ function nn({
|
|
|
3063
2989
|
});
|
|
3064
2990
|
},
|
|
3065
2991
|
[pe, ne, h, y]
|
|
3066
|
-
),
|
|
2992
|
+
), S = q(() => {
|
|
3067
2993
|
se(!1), Y(null);
|
|
3068
2994
|
}, []), Q = q(
|
|
3069
2995
|
(z) => {
|
|
@@ -3078,7 +3004,7 @@ function nn({
|
|
|
3078
3004
|
},
|
|
3079
3005
|
[p]
|
|
3080
3006
|
), ee = K(() => {
|
|
3081
|
-
switch (
|
|
3007
|
+
switch (j) {
|
|
3082
3008
|
case "dark":
|
|
3083
3009
|
return {
|
|
3084
3010
|
bg: "var(--nice-bg, #1a1a2e)",
|
|
@@ -3101,22 +3027,22 @@ function nn({
|
|
|
3101
3027
|
grid: "var(--nice-border, #e0e0e0)"
|
|
3102
3028
|
};
|
|
3103
3029
|
}
|
|
3104
|
-
}, [
|
|
3030
|
+
}, [j]), re = K(() => {
|
|
3105
3031
|
var k;
|
|
3106
3032
|
const z = [];
|
|
3107
3033
|
for (const d of e)
|
|
3108
3034
|
if (d.type === "scatter3d") {
|
|
3109
|
-
const x = d,
|
|
3110
|
-
var A,
|
|
3111
|
-
const
|
|
3035
|
+
const x = d, C = x.points.map((E) => {
|
|
3036
|
+
var A, T, O, le, fe;
|
|
3037
|
+
const I = Z(E), L = Me(I, w, U);
|
|
3112
3038
|
let g = (A = x.marker) == null ? void 0 : A.color;
|
|
3113
|
-
if (Array.isArray((
|
|
3039
|
+
if (Array.isArray((T = x.marker) == null ? void 0 : T.color)) {
|
|
3114
3040
|
const be = x.points.indexOf(E);
|
|
3115
3041
|
g = ke(
|
|
3116
3042
|
x.marker.color[be],
|
|
3117
3043
|
X.colorMin,
|
|
3118
3044
|
X.colorMax,
|
|
3119
|
-
((
|
|
3045
|
+
((O = x.marker) == null ? void 0 : O.colorScale) || "viridis"
|
|
3120
3046
|
);
|
|
3121
3047
|
} else typeof E.color == "number" && (g = ke(
|
|
3122
3048
|
E.color,
|
|
@@ -3126,36 +3052,36 @@ function nn({
|
|
|
3126
3052
|
));
|
|
3127
3053
|
const M = Array.isArray(E.size) ? E.size[0] : E.size || ((fe = x.marker) == null ? void 0 : fe.size) || 5;
|
|
3128
3054
|
return {
|
|
3129
|
-
...
|
|
3055
|
+
...L,
|
|
3130
3056
|
color: g,
|
|
3131
3057
|
size: M,
|
|
3132
3058
|
original: E
|
|
3133
3059
|
};
|
|
3134
3060
|
});
|
|
3135
|
-
z.push({ type: "scatter", points:
|
|
3061
|
+
z.push({ type: "scatter", points: C, data: d });
|
|
3136
3062
|
} else if (d.type === "surface" || d.type === "wireframe") {
|
|
3137
|
-
const x = d,
|
|
3063
|
+
const x = d, C = [];
|
|
3138
3064
|
for (let E = 0; E < x.xData.length; E++)
|
|
3139
|
-
for (let
|
|
3140
|
-
const
|
|
3065
|
+
for (let I = 0; I < x.yData.length; I++) {
|
|
3066
|
+
const L = {
|
|
3141
3067
|
x: x.xData[E],
|
|
3142
|
-
y: x.yData[
|
|
3143
|
-
z: x.zData[E][
|
|
3144
|
-
}, g = Z(
|
|
3145
|
-
((k = x.colorData) == null ? void 0 : k[E][
|
|
3068
|
+
y: x.yData[I],
|
|
3069
|
+
z: x.zData[E][I]
|
|
3070
|
+
}, g = Z(L), M = Me(g, w, U), A = ke(
|
|
3071
|
+
((k = x.colorData) == null ? void 0 : k[E][I]) ?? x.zData[E][I],
|
|
3146
3072
|
X.colorMin,
|
|
3147
3073
|
X.colorMax,
|
|
3148
3074
|
x.colorScale || "viridis"
|
|
3149
3075
|
);
|
|
3150
|
-
|
|
3076
|
+
C.push({ ...M, color: A, size: 3, original: L });
|
|
3151
3077
|
}
|
|
3152
|
-
z.push({ type: d.type, points:
|
|
3078
|
+
z.push({ type: d.type, points: C, data: d });
|
|
3153
3079
|
}
|
|
3154
3080
|
for (const d of z)
|
|
3155
|
-
d.points.sort((x,
|
|
3081
|
+
d.points.sort((x, C) => x.depth - C.depth);
|
|
3156
3082
|
return z;
|
|
3157
3083
|
}, [e, U, w, Z, X]), ie = K(() => {
|
|
3158
|
-
var d, x,
|
|
3084
|
+
var d, x, C;
|
|
3159
3085
|
if (!m)
|
|
3160
3086
|
return null;
|
|
3161
3087
|
const z = 1.2, k = {
|
|
@@ -3234,7 +3160,7 @@ function nn({
|
|
|
3234
3160
|
y: `${k.z[1].y}%`,
|
|
3235
3161
|
fill: "var(--nice-primary, #3498db)",
|
|
3236
3162
|
fontSize: "12",
|
|
3237
|
-
children: ((
|
|
3163
|
+
children: ((C = i.zAxis) == null ? void 0 : C.title) || "Z"
|
|
3238
3164
|
}
|
|
3239
3165
|
)
|
|
3240
3166
|
] });
|
|
@@ -3243,36 +3169,26 @@ function nn({
|
|
|
3243
3169
|
"div",
|
|
3244
3170
|
{
|
|
3245
3171
|
ref: oe,
|
|
3246
|
-
className: `nice-3d-plot nice-3d-plot--${
|
|
3172
|
+
className: `nice-3d-plot nice-3d-plot--${j}${pe ? " nice-3d-plot--dragging" : ""} ${R || ""}`,
|
|
3247
3173
|
style: {
|
|
3248
3174
|
width: n,
|
|
3249
3175
|
height: r,
|
|
3250
3176
|
backgroundColor: ee.bg,
|
|
3251
3177
|
color: ee.text,
|
|
3252
|
-
position: "relative",
|
|
3253
|
-
overflow: "hidden",
|
|
3254
|
-
userSelect: "none",
|
|
3255
|
-
cursor: pe ? "grabbing" : "grab",
|
|
3256
3178
|
...H
|
|
3257
3179
|
},
|
|
3258
3180
|
onMouseDown: ae,
|
|
3259
3181
|
onMouseMove: G,
|
|
3260
|
-
onMouseUp:
|
|
3261
|
-
onMouseLeave:
|
|
3182
|
+
onMouseUp: S,
|
|
3183
|
+
onMouseLeave: S,
|
|
3262
3184
|
onWheel: Q,
|
|
3263
3185
|
children: [
|
|
3264
|
-
t && /* @__PURE__ */ o(
|
|
3265
|
-
|
|
3266
|
-
{
|
|
3267
|
-
style: { position: "absolute", top: 8, left: 8, fontWeight: "bold", fontSize: "1.1rem" },
|
|
3268
|
-
children: t
|
|
3269
|
-
}
|
|
3270
|
-
),
|
|
3271
|
-
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", style: { position: "absolute", top: 0, left: 0 }, children: [
|
|
3186
|
+
t && /* @__PURE__ */ o("div", { className: "nice-3d-plot__title", children: t }),
|
|
3187
|
+
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", className: "nice-3d-plot__canvas", children: [
|
|
3272
3188
|
ie,
|
|
3273
3189
|
re.map((z, k) => /* @__PURE__ */ u("g", { className: "nice-3d-plot__data", children: [
|
|
3274
3190
|
z.type === "scatter" && z.points.map((d, x) => {
|
|
3275
|
-
var
|
|
3191
|
+
var C;
|
|
3276
3192
|
return /* @__PURE__ */ o(
|
|
3277
3193
|
"circle",
|
|
3278
3194
|
{
|
|
@@ -3280,7 +3196,7 @@ function nn({
|
|
|
3280
3196
|
cy: `${d.y}%`,
|
|
3281
3197
|
r: d.size || 4,
|
|
3282
3198
|
fill: d.color || "var(--nice-primary, #3498db)",
|
|
3283
|
-
opacity: ((
|
|
3199
|
+
opacity: ((C = z.data.marker) == null ? void 0 : C.opacity) ?? 0.8,
|
|
3284
3200
|
style: { cursor: te ? "pointer" : void 0 },
|
|
3285
3201
|
onMouseEnter: () => {
|
|
3286
3202
|
ue({ point: d.original, dataIndex: k }), V == null || V(d.original, k);
|
|
@@ -3337,7 +3253,7 @@ function nn({
|
|
|
3337
3253
|
] }, z.id || k))
|
|
3338
3254
|
}
|
|
3339
3255
|
),
|
|
3340
|
-
s && /* @__PURE__ */ u(
|
|
3256
|
+
s && Number.isFinite(X.colorMin) && Number.isFinite(X.colorMax) && /* @__PURE__ */ u(
|
|
3341
3257
|
"div",
|
|
3342
3258
|
{
|
|
3343
3259
|
style: {
|
|
@@ -3365,7 +3281,7 @@ function nn({
|
|
|
3365
3281
|
bottom: 8,
|
|
3366
3282
|
left: 8,
|
|
3367
3283
|
background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
|
|
3368
|
-
color: "var(--nice-
|
|
3284
|
+
color: "var(--nice-color-white, #fff)",
|
|
3369
3285
|
padding: "4px 8px",
|
|
3370
3286
|
borderRadius: 4,
|
|
3371
3287
|
fontSize: "0.75rem"
|
|
@@ -3452,7 +3368,7 @@ const tt = {
|
|
|
3452
3368
|
Rh: "#0A7D8C",
|
|
3453
3369
|
Os: "#266696",
|
|
3454
3370
|
Ir: "#175487"
|
|
3455
|
-
},
|
|
3371
|
+
}, je = {
|
|
3456
3372
|
H: 0.31,
|
|
3457
3373
|
C: 0.77,
|
|
3458
3374
|
N: 0.71,
|
|
@@ -3475,7 +3391,7 @@ const tt = {
|
|
|
3475
3391
|
Zn: 1.22,
|
|
3476
3392
|
Cu: 1.28,
|
|
3477
3393
|
Ni: 1.24
|
|
3478
|
-
},
|
|
3394
|
+
}, Tt = {
|
|
3479
3395
|
H: 1.2,
|
|
3480
3396
|
C: 1.7,
|
|
3481
3397
|
N: 1.55,
|
|
@@ -3509,21 +3425,21 @@ function Ve(e) {
|
|
|
3509
3425
|
if (c === "HEADER")
|
|
3510
3426
|
s = l.substring(10, 50).trim() || s;
|
|
3511
3427
|
else if (c === "ATOM" || c === "HETATM") {
|
|
3512
|
-
const h = parseInt(l.substring(6, 11).trim(), 10), p = l.substring(12, 16).trim(), y = l.substring(17, 20).trim(), m = l.substring(21, 22).trim() || "A", $ = parseInt(l.substring(22, 26).trim(), 10), w = parseFloat(l.substring(30, 38).trim()),
|
|
3428
|
+
const h = parseInt(l.substring(6, 11).trim(), 10), p = l.substring(12, 16).trim(), y = l.substring(17, 20).trim(), m = l.substring(21, 22).trim() || "A", $ = parseInt(l.substring(22, 26).trim(), 10), w = parseFloat(l.substring(30, 38).trim()), j = parseFloat(l.substring(38, 46).trim()), J = parseFloat(l.substring(46, 54).trim()), te = parseFloat(l.substring(54, 60).trim()) || 1, V = parseFloat(l.substring(60, 66).trim()) || 0, R = l.substring(76, 78).trim() || p.replace(/\d/g, "").substring(0, 1), H = {
|
|
3513
3429
|
id: t.length,
|
|
3514
3430
|
serial: h,
|
|
3515
3431
|
name: p,
|
|
3516
|
-
element:
|
|
3432
|
+
element: R.toUpperCase(),
|
|
3517
3433
|
residueName: y,
|
|
3518
3434
|
residueSeq: $,
|
|
3519
3435
|
chainId: m,
|
|
3520
3436
|
x: w,
|
|
3521
|
-
y:
|
|
3437
|
+
y: j,
|
|
3522
3438
|
z: J,
|
|
3523
3439
|
occupancy: te,
|
|
3524
3440
|
bFactor: V,
|
|
3525
|
-
color: tt[
|
|
3526
|
-
radius:
|
|
3441
|
+
color: tt[R.toUpperCase()] || "var(--nice-text-secondary, #808080)",
|
|
3442
|
+
radius: je[R.toUpperCase()] || 1.5
|
|
3527
3443
|
};
|
|
3528
3444
|
t.push(H);
|
|
3529
3445
|
const oe = `${m}_${$}_${y}`;
|
|
@@ -3538,7 +3454,7 @@ function Ve(e) {
|
|
|
3538
3454
|
const h = l.substring(6).trim().split(/\s+/).map(Number), p = h[0], y = t.find((m) => m.serial === p);
|
|
3539
3455
|
if (y)
|
|
3540
3456
|
for (let m = 1; m < h.length; m++) {
|
|
3541
|
-
const $ = h[m], w = t.find((
|
|
3457
|
+
const $ = h[m], w = t.find((j) => j.serial === $);
|
|
3542
3458
|
w && y.id < w.id && n.push({
|
|
3543
3459
|
id: n.length,
|
|
3544
3460
|
atom1: y.id,
|
|
@@ -3551,8 +3467,8 @@ function Ve(e) {
|
|
|
3551
3467
|
if (n.length === 0)
|
|
3552
3468
|
for (let l = 0; l < t.length; l++)
|
|
3553
3469
|
for (let c = l + 1; c < t.length; c++) {
|
|
3554
|
-
const h = t[l], p = t[c], y = h.x - p.x, m = h.y - p.y, $ = h.z - p.z, w = Math.sqrt(y * y + m * m + $ * $),
|
|
3555
|
-
w <
|
|
3470
|
+
const h = t[l], p = t[c], y = h.x - p.x, m = h.y - p.y, $ = h.z - p.z, w = Math.sqrt(y * y + m * m + $ * $), j = (je[h.element] || 1.5) + (je[p.element] || 1.5) + 0.4;
|
|
3471
|
+
w < j && w > 0.4 && n.push({
|
|
3556
3472
|
id: n.length,
|
|
3557
3473
|
atom1: l,
|
|
3558
3474
|
atom2: c,
|
|
@@ -3569,19 +3485,19 @@ function Ve(e) {
|
|
|
3569
3485
|
chains: Array.from(i.values())
|
|
3570
3486
|
};
|
|
3571
3487
|
}
|
|
3572
|
-
function
|
|
3488
|
+
function Wt(e, t, n, r, i, s) {
|
|
3573
3489
|
const a = ($) => $ * Math.PI / 180, l = t * Math.cos(a(r)) - n * Math.sin(a(r)), c = t * Math.sin(a(r)) + n * Math.cos(a(r)), h = e * Math.cos(a(i)) + c * Math.sin(a(i)), p = -e * Math.sin(a(i)) + c * Math.cos(a(i)), y = h * Math.cos(a(s)) - l * Math.sin(a(s)), m = h * Math.sin(a(s)) + l * Math.cos(a(s));
|
|
3574
3490
|
return [y, m, p];
|
|
3575
3491
|
}
|
|
3576
|
-
function
|
|
3577
|
-
const a = e - i.x, l = t - i.y, c = n - i.z, [h, p, y] =
|
|
3492
|
+
function Fe(e, t, n, r, i, s) {
|
|
3493
|
+
const a = e - i.x, l = t - i.y, c = n - i.z, [h, p, y] = Wt(a, l, c, r.rotX, r.rotY, r.rotZ), m = 500, $ = m / (m + y * 50);
|
|
3578
3494
|
return {
|
|
3579
3495
|
x: 50 + h * s * r.zoom * $ + r.panX,
|
|
3580
3496
|
y: 50 - p * s * r.zoom * $ + r.panY,
|
|
3581
3497
|
depth: y
|
|
3582
3498
|
};
|
|
3583
3499
|
}
|
|
3584
|
-
function
|
|
3500
|
+
function sn({
|
|
3585
3501
|
molecule: e,
|
|
3586
3502
|
format: t = "pdb",
|
|
3587
3503
|
style: n = "ball-stick",
|
|
@@ -3599,11 +3515,11 @@ function rn({
|
|
|
3599
3515
|
enableZoom: m = !0,
|
|
3600
3516
|
showControls: $ = !0,
|
|
3601
3517
|
measurements: w = [],
|
|
3602
|
-
surfaces:
|
|
3518
|
+
surfaces: j = [],
|
|
3603
3519
|
labels: J = [],
|
|
3604
3520
|
selection: te,
|
|
3605
3521
|
highlightColor: V = "var(--nice-warning, #ffff00)",
|
|
3606
|
-
spin:
|
|
3522
|
+
spin: R = !1,
|
|
3607
3523
|
spinSpeed: H = 0.5,
|
|
3608
3524
|
onAtomClick: oe,
|
|
3609
3525
|
onAtomHover: U,
|
|
@@ -3611,16 +3527,16 @@ function rn({
|
|
|
3611
3527
|
className: pe,
|
|
3612
3528
|
styleOverride: se
|
|
3613
3529
|
}) {
|
|
3614
|
-
const ne = ze(null), [Y, ce] =
|
|
3530
|
+
const ne = ze(null), [Y, ce] = F(null), [ue, me] = F({
|
|
3615
3531
|
rotX: 0,
|
|
3616
3532
|
rotY: 0,
|
|
3617
3533
|
rotZ: 0,
|
|
3618
3534
|
zoom: 1,
|
|
3619
3535
|
panX: 0,
|
|
3620
3536
|
panY: 0
|
|
3621
|
-
}), [xe, X] =
|
|
3537
|
+
}), [xe, X] = F(!1), [Z, ae] = F(
|
|
3622
3538
|
null
|
|
3623
|
-
), [G,
|
|
3539
|
+
), [G, S] = F(null), [Q, ee] = F(n);
|
|
3624
3540
|
Xe(() => {
|
|
3625
3541
|
if (!e) {
|
|
3626
3542
|
ce(null);
|
|
@@ -3628,40 +3544,40 @@ function rn({
|
|
|
3628
3544
|
}
|
|
3629
3545
|
typeof e == "string" ? (t === "pdb" || console.warn(`Format ${t} parsing not implemented, using PDB parser`), ce(Ve(e))) : ce(e);
|
|
3630
3546
|
}, [e, t]), Xe(() => {
|
|
3631
|
-
if (!
|
|
3547
|
+
if (!R)
|
|
3632
3548
|
return;
|
|
3633
3549
|
const g = setInterval(() => {
|
|
3634
3550
|
me((M) => ({ ...M, rotY: (M.rotY + H) % 360 }));
|
|
3635
3551
|
}, 16);
|
|
3636
3552
|
return () => clearInterval(g);
|
|
3637
|
-
}, [
|
|
3553
|
+
}, [R, H]);
|
|
3638
3554
|
const { center: re, scale: ie } = K(() => {
|
|
3639
3555
|
if (!Y || Y.atoms.length === 0)
|
|
3640
3556
|
return { center: { x: 0, y: 0, z: 0 }, scale: 1 };
|
|
3641
|
-
let g = 1 / 0, M = -1 / 0, A = 1 / 0,
|
|
3557
|
+
let g = 1 / 0, M = -1 / 0, A = 1 / 0, T = -1 / 0, O = 1 / 0, le = -1 / 0;
|
|
3642
3558
|
for (const ye of Y.atoms)
|
|
3643
|
-
g = Math.min(g, ye.x), M = Math.max(M, ye.x), A = Math.min(A, ye.y),
|
|
3559
|
+
g = Math.min(g, ye.x), M = Math.max(M, ye.x), A = Math.min(A, ye.y), T = Math.max(T, ye.y), O = Math.min(O, ye.z), le = Math.max(le, ye.z);
|
|
3644
3560
|
const fe = {
|
|
3645
3561
|
x: (g + M) / 2,
|
|
3646
|
-
y: (A +
|
|
3647
|
-
z: (
|
|
3648
|
-
}, be = Math.max(M - g,
|
|
3562
|
+
y: (A + T) / 2,
|
|
3563
|
+
z: (O + le) / 2
|
|
3564
|
+
}, be = Math.max(M - g, T - A, le - O), ge = be > 0 ? 35 / be : 1;
|
|
3649
3565
|
return { center: fe, scale: ge };
|
|
3650
3566
|
}, [Y]), z = K(() => Y ? Y.atoms.filter((g) => !i && g.element === "H" || !s && g.residueName === "HOH" ? !1 : g.visible !== !1).map((g) => ({
|
|
3651
3567
|
atom: g,
|
|
3652
|
-
...
|
|
3568
|
+
...Fe(g.x, g.y, g.z, ue, re, ie)
|
|
3653
3569
|
})).sort((g, M) => g.depth - M.depth) : [], [Y, ue, re, ie, i, s]), k = K(() => Y ? Y.bonds.filter((g) => g.visible !== !1).map((g) => {
|
|
3654
3570
|
const M = Y.atoms[g.atom1], A = Y.atoms[g.atom2];
|
|
3655
3571
|
if (!M || !A || !i && (M.element === "H" || A.element === "H"))
|
|
3656
3572
|
return null;
|
|
3657
|
-
const
|
|
3573
|
+
const T = Fe(M.x, M.y, M.z, ue, re, ie), O = Fe(A.x, A.y, A.z, ue, re, ie);
|
|
3658
3574
|
return {
|
|
3659
3575
|
bond: g,
|
|
3660
|
-
x1:
|
|
3661
|
-
y1:
|
|
3662
|
-
x2:
|
|
3663
|
-
y2:
|
|
3664
|
-
depth: (
|
|
3576
|
+
x1: T.x,
|
|
3577
|
+
y1: T.y,
|
|
3578
|
+
x2: O.x,
|
|
3579
|
+
y2: O.y,
|
|
3580
|
+
depth: (T.depth + O.depth) / 2,
|
|
3665
3581
|
color1: M.color,
|
|
3666
3582
|
color2: A.color
|
|
3667
3583
|
};
|
|
@@ -3686,7 +3602,7 @@ function rn({
|
|
|
3686
3602
|
});
|
|
3687
3603
|
},
|
|
3688
3604
|
[xe, Z]
|
|
3689
|
-
),
|
|
3605
|
+
), C = q(() => {
|
|
3690
3606
|
X(!1), ae(null);
|
|
3691
3607
|
}, []), E = q(
|
|
3692
3608
|
(g) => {
|
|
@@ -3697,13 +3613,13 @@ function rn({
|
|
|
3697
3613
|
me((A) => ({ ...A, zoom: Math.max(0.1, Math.min(10, A.zoom * M)) }));
|
|
3698
3614
|
},
|
|
3699
3615
|
[m]
|
|
3700
|
-
),
|
|
3616
|
+
), I = q(
|
|
3701
3617
|
(g) => {
|
|
3702
3618
|
switch (Q) {
|
|
3703
3619
|
case "space-filling":
|
|
3704
|
-
return (
|
|
3620
|
+
return (Tt[g.element] || 1.5) * 4;
|
|
3705
3621
|
case "ball-stick":
|
|
3706
|
-
return (
|
|
3622
|
+
return (je[g.element] || 0.5) * 3;
|
|
3707
3623
|
case "stick":
|
|
3708
3624
|
case "wireframe":
|
|
3709
3625
|
return 2;
|
|
@@ -3712,7 +3628,7 @@ function rn({
|
|
|
3712
3628
|
}
|
|
3713
3629
|
},
|
|
3714
3630
|
[Q]
|
|
3715
|
-
),
|
|
3631
|
+
), L = q(
|
|
3716
3632
|
(g) => (Q === "wireframe" ? 1 : Q === "stick" ? 3 : 2) * (g.order || 1),
|
|
3717
3633
|
[Q]
|
|
3718
3634
|
);
|
|
@@ -3720,23 +3636,15 @@ function rn({
|
|
|
3720
3636
|
"div",
|
|
3721
3637
|
{
|
|
3722
3638
|
ref: ne,
|
|
3723
|
-
className: `nice-molecular-viewer ${pe || ""}`,
|
|
3724
|
-
style: {
|
|
3725
|
-
width: c,
|
|
3726
|
-
height: h,
|
|
3727
|
-
backgroundColor: p,
|
|
3728
|
-
position: "relative",
|
|
3729
|
-
overflow: "hidden",
|
|
3730
|
-
cursor: xe ? "grabbing" : "grab",
|
|
3731
|
-
...se
|
|
3732
|
-
},
|
|
3639
|
+
className: `nice-molecular-viewer${xe ? " nice-molecular-viewer--dragging" : ""} ${pe || ""}`,
|
|
3640
|
+
style: { width: c, height: h, backgroundColor: p, ...se },
|
|
3733
3641
|
onMouseDown: d,
|
|
3734
3642
|
onMouseMove: x,
|
|
3735
|
-
onMouseUp:
|
|
3736
|
-
onMouseLeave:
|
|
3643
|
+
onMouseUp: C,
|
|
3644
|
+
onMouseLeave: C,
|
|
3737
3645
|
onWheel: E,
|
|
3738
3646
|
children: [
|
|
3739
|
-
/* @__PURE__ */ u("svg", { width: "100%", height: "100%",
|
|
3647
|
+
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", className: "nice-molecular-viewer__canvas", children: [
|
|
3740
3648
|
Q !== "space-filling" && k.map((g, M) => /* @__PURE__ */ o(
|
|
3741
3649
|
"line",
|
|
3742
3650
|
{
|
|
@@ -3745,14 +3653,14 @@ function rn({
|
|
|
3745
3653
|
x2: `${g.x2}%`,
|
|
3746
3654
|
y2: `${g.y2}%`,
|
|
3747
3655
|
stroke: g.bond.color || "var(--nice-text-secondary, #888888)",
|
|
3748
|
-
strokeWidth:
|
|
3656
|
+
strokeWidth: L(g.bond),
|
|
3749
3657
|
strokeLinecap: "round"
|
|
3750
3658
|
},
|
|
3751
3659
|
`bond-${M}`
|
|
3752
3660
|
)),
|
|
3753
3661
|
z.map(({ atom: g, x: M, y: A }) => {
|
|
3754
3662
|
var fe;
|
|
3755
|
-
const
|
|
3663
|
+
const T = (fe = te == null ? void 0 : te.atoms) == null ? void 0 : fe.includes(g.id), O = (G == null ? void 0 : G.id) === g.id, le = I(g);
|
|
3756
3664
|
return /* @__PURE__ */ u("g", { children: [
|
|
3757
3665
|
/* @__PURE__ */ o(
|
|
3758
3666
|
"circle",
|
|
@@ -3761,14 +3669,14 @@ function rn({
|
|
|
3761
3669
|
cy: `${A}%`,
|
|
3762
3670
|
r: le,
|
|
3763
3671
|
fill: g.color || tt[g.element] || "#808080",
|
|
3764
|
-
stroke:
|
|
3765
|
-
strokeWidth:
|
|
3672
|
+
stroke: T ? V : O ? "#fff" : "none",
|
|
3673
|
+
strokeWidth: T || O ? 2 : 0,
|
|
3766
3674
|
style: { cursor: "pointer" },
|
|
3767
3675
|
onMouseEnter: () => {
|
|
3768
|
-
|
|
3676
|
+
S(g), U == null || U(g);
|
|
3769
3677
|
},
|
|
3770
3678
|
onMouseLeave: () => {
|
|
3771
|
-
|
|
3679
|
+
S(null), U == null || U(null);
|
|
3772
3680
|
},
|
|
3773
3681
|
onClick: () => oe == null ? void 0 : oe(g)
|
|
3774
3682
|
}
|
|
@@ -3778,7 +3686,7 @@ function rn({
|
|
|
3778
3686
|
{
|
|
3779
3687
|
x: `${M}%`,
|
|
3780
3688
|
y: `${A - le * 0.15}%`,
|
|
3781
|
-
fill: "var(--nice-
|
|
3689
|
+
fill: "var(--nice-color-white, #fff)",
|
|
3782
3690
|
fontSize: "10",
|
|
3783
3691
|
textAnchor: "middle",
|
|
3784
3692
|
dominantBaseline: "middle",
|
|
@@ -3794,15 +3702,15 @@ function rn({
|
|
|
3794
3702
|
const M = Y.atoms[g.atoms[0]], A = Y.atoms[g.atoms[1]];
|
|
3795
3703
|
if (!M || !A)
|
|
3796
3704
|
return null;
|
|
3797
|
-
const
|
|
3705
|
+
const T = Fe(M.x, M.y, M.z, ue, re, ie), O = Fe(A.x, A.y, A.z, ue, re, ie);
|
|
3798
3706
|
return /* @__PURE__ */ u("g", { children: [
|
|
3799
3707
|
/* @__PURE__ */ o(
|
|
3800
3708
|
"line",
|
|
3801
3709
|
{
|
|
3802
|
-
x1: `${
|
|
3803
|
-
y1: `${
|
|
3804
|
-
x2: `${
|
|
3805
|
-
y2: `${
|
|
3710
|
+
x1: `${T.x}%`,
|
|
3711
|
+
y1: `${T.y}%`,
|
|
3712
|
+
x2: `${O.x}%`,
|
|
3713
|
+
y2: `${O.y}%`,
|
|
3806
3714
|
stroke: g.color || "var(--nice-warning, #ffff00)",
|
|
3807
3715
|
strokeWidth: 1,
|
|
3808
3716
|
strokeDasharray: "3,3"
|
|
@@ -3811,8 +3719,8 @@ function rn({
|
|
|
3811
3719
|
/* @__PURE__ */ u(
|
|
3812
3720
|
"text",
|
|
3813
3721
|
{
|
|
3814
|
-
x: `${(
|
|
3815
|
-
y: `${(
|
|
3722
|
+
x: `${(T.x + O.x) / 2}%`,
|
|
3723
|
+
y: `${(T.y + O.y) / 2 - 1}%`,
|
|
3816
3724
|
fill: g.color || "var(--nice-warning, #ffff00)",
|
|
3817
3725
|
fontSize: "10",
|
|
3818
3726
|
textAnchor: "middle",
|
|
@@ -3859,7 +3767,7 @@ function rn({
|
|
|
3859
3767
|
bottom: 8,
|
|
3860
3768
|
left: 8,
|
|
3861
3769
|
background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
|
|
3862
|
-
color: "var(--nice-
|
|
3770
|
+
color: "var(--nice-color-white, #fff)",
|
|
3863
3771
|
padding: "4px 8px",
|
|
3864
3772
|
borderRadius: 4,
|
|
3865
3773
|
fontSize: "0.75rem"
|
|
@@ -3937,21 +3845,12 @@ function rn({
|
|
|
3937
3845
|
"div",
|
|
3938
3846
|
{
|
|
3939
3847
|
className: `nice-molecular-viewer nice-molecular-viewer--empty ${pe || ""}`,
|
|
3940
|
-
style: {
|
|
3941
|
-
width: c,
|
|
3942
|
-
height: h,
|
|
3943
|
-
backgroundColor: p,
|
|
3944
|
-
display: "flex",
|
|
3945
|
-
alignItems: "center",
|
|
3946
|
-
justifyContent: "center",
|
|
3947
|
-
color: "var(--nice-text-secondary, #666)",
|
|
3948
|
-
...se
|
|
3949
|
-
},
|
|
3848
|
+
style: { width: c, height: h, backgroundColor: p, ...se },
|
|
3950
3849
|
children: "Load a molecule (PDB, MOL, SDF)"
|
|
3951
3850
|
}
|
|
3952
3851
|
);
|
|
3953
3852
|
}
|
|
3954
|
-
function
|
|
3853
|
+
function Ot(e) {
|
|
3955
3854
|
let t = 0, n = 0;
|
|
3956
3855
|
function r() {
|
|
3957
3856
|
var l;
|
|
@@ -4021,7 +3920,7 @@ function ot(e, t, n = 0) {
|
|
|
4021
3920
|
for (const i of e.children)
|
|
4022
3921
|
ot(i, t, r);
|
|
4023
3922
|
}
|
|
4024
|
-
function
|
|
3923
|
+
function an({
|
|
4025
3924
|
tree: e,
|
|
4026
3925
|
layout: t = "rectangular",
|
|
4027
3926
|
branchStyle: n = "rectangular",
|
|
@@ -4037,11 +3936,11 @@ function on({
|
|
|
4037
3936
|
branchColor: m = "var(--nice-text-secondary, #666666)",
|
|
4038
3937
|
nodeColor: $ = "var(--nice-text, #333333)",
|
|
4039
3938
|
highlightColor: w = "var(--nice-primary, #2196f3)",
|
|
4040
|
-
clades:
|
|
3939
|
+
clades: j = [],
|
|
4041
3940
|
annotations: J = [],
|
|
4042
3941
|
colorScale: te,
|
|
4043
3942
|
width: V = "100%",
|
|
4044
|
-
height:
|
|
3943
|
+
height: R = 500,
|
|
4045
3944
|
padding: H = 40,
|
|
4046
3945
|
enableZoom: oe = !0,
|
|
4047
3946
|
enablePan: U = !0,
|
|
@@ -4052,7 +3951,7 @@ function on({
|
|
|
4052
3951
|
className: Y,
|
|
4053
3952
|
style: ce
|
|
4054
3953
|
}) {
|
|
4055
|
-
const ue = ze(null), [me, xe] =
|
|
3954
|
+
const ue = ze(null), [me, xe] = F(1), [X, Z] = F({ x: 0, y: 0 }), [ae, G] = F(!1), [S, Q] = F(null), [ee, re] = F(null), [ie, z] = F(t), [k, d] = F(/* @__PURE__ */ new Set()), x = K(() => e ? typeof e == "string" ? Ot(e) : e : null, [e]), C = K(() => {
|
|
4056
3955
|
if (!x)
|
|
4057
3956
|
return null;
|
|
4058
3957
|
const v = (D) => {
|
|
@@ -4064,15 +3963,15 @@ function on({
|
|
|
4064
3963
|
};
|
|
4065
3964
|
};
|
|
4066
3965
|
return v(x);
|
|
4067
|
-
}, [x, k]), { positions: E, leafCount:
|
|
4068
|
-
if (!
|
|
3966
|
+
}, [x, k]), { positions: E, leafCount: I, maxX: L } = K(() => {
|
|
3967
|
+
if (!C)
|
|
4069
3968
|
return { positions: { x: /* @__PURE__ */ new Map(), y: /* @__PURE__ */ new Map() }, leafCount: 0, maxX: 0 };
|
|
4070
|
-
const v = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), B = rt(
|
|
4071
|
-
it(
|
|
3969
|
+
const v = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), B = rt(C);
|
|
3970
|
+
it(C, D, { value: 0 }), ot(C, v, 0);
|
|
4072
3971
|
const f = Math.max(...Array.from(v.values()));
|
|
4073
3972
|
return { positions: { x: v, y: D }, leafCount: B, maxX: f || 1 };
|
|
4074
|
-
}, [
|
|
4075
|
-
const B = D / (
|
|
3973
|
+
}, [C]), g = K(() => C ? nt(C) : [], [C]), M = typeof V == "number" ? V : 800, A = typeof R == "number" ? R : 500, T = M - H * 2, O = A - H * 2, le = (v) => H + v / L * T * 0.7, fe = (v) => H + v / (I - 1 || 1) * O, be = (v, D) => {
|
|
3974
|
+
const B = D / (I - 1 || 1) * 2 * Math.PI - Math.PI / 2, f = v / L * Math.min(T, O) * 0.4;
|
|
4076
3975
|
return {
|
|
4077
3976
|
x: M / 2 + f * Math.cos(B),
|
|
4078
3977
|
y: A / 2 + f * Math.sin(B)
|
|
@@ -4087,15 +3986,15 @@ function on({
|
|
|
4087
3986
|
[U, X]
|
|
4088
3987
|
), we = q(
|
|
4089
3988
|
(v) => {
|
|
4090
|
-
if (!ae || !
|
|
3989
|
+
if (!ae || !S)
|
|
4091
3990
|
return;
|
|
4092
|
-
const D = v.clientX -
|
|
4093
|
-
Z({ x:
|
|
3991
|
+
const D = v.clientX - S.x, B = v.clientY - S.y;
|
|
3992
|
+
Z({ x: S.pan.x + D, y: S.pan.y + B });
|
|
4094
3993
|
},
|
|
4095
|
-
[ae,
|
|
4096
|
-
),
|
|
3994
|
+
[ae, S]
|
|
3995
|
+
), Ce = q(() => {
|
|
4097
3996
|
G(!1), Q(null);
|
|
4098
|
-
}, []),
|
|
3997
|
+
}, []), Re = q(
|
|
4099
3998
|
(v) => {
|
|
4100
3999
|
if (!oe)
|
|
4101
4000
|
return;
|
|
@@ -4104,12 +4003,12 @@ function on({
|
|
|
4104
4003
|
xe((B) => Math.max(0.1, Math.min(5, B * D)));
|
|
4105
4004
|
},
|
|
4106
4005
|
[oe]
|
|
4107
|
-
),
|
|
4006
|
+
), Le = q((v) => {
|
|
4108
4007
|
d((D) => {
|
|
4109
4008
|
const B = new Set(D);
|
|
4110
4009
|
return B.has(v) ? B.delete(v) : B.add(v), B;
|
|
4111
4010
|
});
|
|
4112
|
-
}, []),
|
|
4011
|
+
}, []), Te = (v, D) => {
|
|
4113
4012
|
const B = ge(v.id), f = ge(D.id);
|
|
4114
4013
|
if (ie === "radial" || ie === "circular")
|
|
4115
4014
|
return /* @__PURE__ */ o(
|
|
@@ -4171,19 +4070,19 @@ function on({
|
|
|
4171
4070
|
}
|
|
4172
4071
|
);
|
|
4173
4072
|
}
|
|
4174
|
-
},
|
|
4175
|
-
const D = ge(v.id), B = !v.children || v.children.length === 0 || v.collapsed, f = (ee == null ? void 0 : ee.id) === v.id, b = f ? i * 1.5 : i,
|
|
4073
|
+
}, Ie = (v) => {
|
|
4074
|
+
const D = ge(v.id), B = !v.children || v.children.length === 0 || v.collapsed, f = (ee == null ? void 0 : ee.id) === v.id, b = f ? i * 1.5 : i, W = (() => {
|
|
4176
4075
|
switch (r) {
|
|
4177
4076
|
case "circle":
|
|
4178
4077
|
return /* @__PURE__ */ o("circle", { cx: D.x, cy: D.y, r: b });
|
|
4179
4078
|
case "square":
|
|
4180
4079
|
return /* @__PURE__ */ o("rect", { x: D.x - b, y: D.y - b, width: b * 2, height: b * 2 });
|
|
4181
4080
|
case "triangle": {
|
|
4182
|
-
const
|
|
4081
|
+
const N = b * 1.5;
|
|
4183
4082
|
return /* @__PURE__ */ o(
|
|
4184
4083
|
"polygon",
|
|
4185
4084
|
{
|
|
4186
|
-
points: `${D.x},${D.y -
|
|
4085
|
+
points: `${D.x},${D.y - N} ${D.x - N},${D.y + N} ${D.x + N},${D.y + N}`
|
|
4187
4086
|
}
|
|
4188
4087
|
);
|
|
4189
4088
|
}
|
|
@@ -4201,7 +4100,7 @@ function on({
|
|
|
4201
4100
|
}
|
|
4202
4101
|
})();
|
|
4203
4102
|
return /* @__PURE__ */ u("g", { children: [
|
|
4204
|
-
|
|
4103
|
+
W && /* @__PURE__ */ o(
|
|
4205
4104
|
"g",
|
|
4206
4105
|
{
|
|
4207
4106
|
fill: v.highlighted ? w : v.color || $,
|
|
@@ -4216,9 +4115,9 @@ function on({
|
|
|
4216
4115
|
},
|
|
4217
4116
|
onClick: () => pe == null ? void 0 : pe(v),
|
|
4218
4117
|
onDoubleClick: () => {
|
|
4219
|
-
v.children && v.children.length > 0 &&
|
|
4118
|
+
v.children && v.children.length > 0 && Le(v.id);
|
|
4220
4119
|
},
|
|
4221
|
-
children:
|
|
4120
|
+
children: W
|
|
4222
4121
|
}
|
|
4223
4122
|
),
|
|
4224
4123
|
v.collapsed && v.children && /* @__PURE__ */ o(
|
|
@@ -4267,30 +4166,20 @@ function on({
|
|
|
4267
4166
|
const D = [];
|
|
4268
4167
|
if (v.children && !v.collapsed)
|
|
4269
4168
|
for (const B of v.children)
|
|
4270
|
-
D.push(/* @__PURE__ */ o("g", { children:
|
|
4169
|
+
D.push(/* @__PURE__ */ o("g", { children: Te(v, B) }, `branch-${v.id}-${B.id}`)), D.push(...Ee(B));
|
|
4271
4170
|
return D;
|
|
4272
4171
|
};
|
|
4273
|
-
return
|
|
4172
|
+
return C ? /* @__PURE__ */ u(
|
|
4274
4173
|
"div",
|
|
4275
4174
|
{
|
|
4276
4175
|
ref: ue,
|
|
4277
|
-
className: `nice-phylogenetic-tree ${Y || ""}`,
|
|
4278
|
-
style: {
|
|
4279
|
-
width: V,
|
|
4280
|
-
height: L,
|
|
4281
|
-
position: "relative",
|
|
4282
|
-
overflow: "hidden",
|
|
4283
|
-
background: "var(--nice-bg-secondary, #fafafa)",
|
|
4284
|
-
border: "1px solid var(--nice-border, #e0e0e0)",
|
|
4285
|
-
borderRadius: 4,
|
|
4286
|
-
cursor: ae ? "grabbing" : "grab",
|
|
4287
|
-
...ce
|
|
4288
|
-
},
|
|
4176
|
+
className: `nice-phylogenetic-tree${ae ? " nice-phylogenetic-tree--dragging" : ""} ${Y || ""}`,
|
|
4177
|
+
style: { width: V, height: R, ...ce },
|
|
4289
4178
|
onMouseDown: ye,
|
|
4290
4179
|
onMouseMove: we,
|
|
4291
|
-
onMouseUp:
|
|
4292
|
-
onMouseLeave:
|
|
4293
|
-
onWheel:
|
|
4180
|
+
onMouseUp: Ce,
|
|
4181
|
+
onMouseLeave: Ce,
|
|
4182
|
+
onWheel: Re,
|
|
4294
4183
|
children: [
|
|
4295
4184
|
/* @__PURE__ */ u(
|
|
4296
4185
|
"svg",
|
|
@@ -4302,19 +4191,19 @@ function on({
|
|
|
4302
4191
|
transformOrigin: "center center"
|
|
4303
4192
|
},
|
|
4304
4193
|
children: [
|
|
4305
|
-
|
|
4306
|
-
const D = g.filter((
|
|
4194
|
+
j.map((v) => {
|
|
4195
|
+
const D = g.filter((_) => v.nodeIds.includes(_.id));
|
|
4307
4196
|
if (D.length === 0)
|
|
4308
4197
|
return null;
|
|
4309
|
-
const B = D.map((
|
|
4198
|
+
const B = D.map((_) => ge(_.id)), f = Math.min(...B.map((_) => _.x)) - 10, b = Math.max(...B.map((_) => _.x)) + 10, W = Math.min(...B.map((_) => _.y)) - 10, N = Math.max(...B.map((_) => _.y)) + 10;
|
|
4310
4199
|
return /* @__PURE__ */ u("g", { children: [
|
|
4311
4200
|
/* @__PURE__ */ o(
|
|
4312
4201
|
"rect",
|
|
4313
4202
|
{
|
|
4314
4203
|
x: f,
|
|
4315
|
-
y:
|
|
4204
|
+
y: W,
|
|
4316
4205
|
width: b - f,
|
|
4317
|
-
height:
|
|
4206
|
+
height: N - W,
|
|
4318
4207
|
fill: v.background || `${v.color}20` || "var(--nice-primary-bg, #e3f2fd)",
|
|
4319
4208
|
stroke: v.color || "var(--nice-primary, #2196f3)",
|
|
4320
4209
|
strokeWidth: 1,
|
|
@@ -4326,7 +4215,7 @@ function on({
|
|
|
4326
4215
|
"text",
|
|
4327
4216
|
{
|
|
4328
4217
|
x: b + 5,
|
|
4329
|
-
y: (
|
|
4218
|
+
y: (W + N) / 2,
|
|
4330
4219
|
fontSize: 10,
|
|
4331
4220
|
fill: v.color || "var(--nice-text-secondary, #666)",
|
|
4332
4221
|
dominantBaseline: "middle",
|
|
@@ -4335,8 +4224,8 @@ function on({
|
|
|
4335
4224
|
)
|
|
4336
4225
|
] }, v.id);
|
|
4337
4226
|
}),
|
|
4338
|
-
Ee(
|
|
4339
|
-
g.map((v) =>
|
|
4227
|
+
Ee(C),
|
|
4228
|
+
g.map((v) => Ie(v)),
|
|
4340
4229
|
J.map((v) => {
|
|
4341
4230
|
if (!g.find((b) => b.id === v.nodeId))
|
|
4342
4231
|
return null;
|
|
@@ -4376,7 +4265,7 @@ function on({
|
|
|
4376
4265
|
children: [
|
|
4377
4266
|
g.length,
|
|
4378
4267
|
" nodes • ",
|
|
4379
|
-
|
|
4268
|
+
I,
|
|
4380
4269
|
" leaves"
|
|
4381
4270
|
]
|
|
4382
4271
|
}
|
|
@@ -4463,39 +4352,28 @@ function on({
|
|
|
4463
4352
|
"div",
|
|
4464
4353
|
{
|
|
4465
4354
|
className: `nice-phylogenetic-tree nice-phylogenetic-tree--empty ${Y || ""}`,
|
|
4466
|
-
style: {
|
|
4467
|
-
width: V,
|
|
4468
|
-
height: L,
|
|
4469
|
-
display: "flex",
|
|
4470
|
-
alignItems: "center",
|
|
4471
|
-
justifyContent: "center",
|
|
4472
|
-
background: "var(--nice-bg-secondary, #f5f5f5)",
|
|
4473
|
-
color: "var(--nice-text-secondary, #666)",
|
|
4474
|
-
border: "1px dashed var(--nice-border, #ccc)",
|
|
4475
|
-
borderRadius: 4,
|
|
4476
|
-
...ce
|
|
4477
|
-
},
|
|
4355
|
+
style: { width: V, height: R, ...ce },
|
|
4478
4356
|
children: "Load a phylogenetic tree (Newick format)"
|
|
4479
4357
|
}
|
|
4480
4358
|
);
|
|
4481
4359
|
}
|
|
4482
4360
|
const De = (e) => e * Math.PI / 180;
|
|
4483
|
-
function
|
|
4361
|
+
function Xt(e, t, n, r) {
|
|
4484
4362
|
const i = (t + 180) / 360 * n, s = De(e), a = Math.log(Math.tan(Math.PI / 4 + s / 2)), l = r / 2 - n * a / (2 * Math.PI);
|
|
4485
4363
|
return { x: i, y: l };
|
|
4486
4364
|
}
|
|
4487
|
-
function
|
|
4365
|
+
function Yt(e, t, n, r) {
|
|
4488
4366
|
const i = (t + 180) / 360 * n, s = (90 - e) / 180 * r;
|
|
4489
4367
|
return { x: i, y: s };
|
|
4490
4368
|
}
|
|
4491
|
-
function
|
|
4369
|
+
function Pt(e, t, n, r, i, s) {
|
|
4492
4370
|
const a = De(e), l = De(t), c = De(i), h = De(s);
|
|
4493
4371
|
if (Math.sin(c) * Math.sin(a) + Math.cos(c) * Math.cos(a) * Math.cos(l - h) < 0)
|
|
4494
4372
|
return { x: 0, y: 0, visible: !1 };
|
|
4495
4373
|
const y = Math.min(n, r) / 2 - 10, m = n / 2 + y * Math.cos(a) * Math.sin(l - h), $ = r / 2 - y * (Math.cos(c) * Math.sin(a) - Math.sin(c) * Math.cos(a) * Math.cos(l - h));
|
|
4496
4374
|
return { x: m, y: $, visible: !0 };
|
|
4497
4375
|
}
|
|
4498
|
-
function
|
|
4376
|
+
function qt(e, t, n, r) {
|
|
4499
4377
|
const i = [
|
|
4500
4378
|
[0, 1, 0],
|
|
4501
4379
|
[5, 0.9986, 0.062],
|
|
@@ -4527,7 +4405,7 @@ function Yt(e, t, n, r) {
|
|
|
4527
4405
|
const c = n / (2 * Math.PI), h = n / 2 + c * De(t) * a, p = r / 2 - c * l * 1.3523 * Math.sign(e);
|
|
4528
4406
|
return { x: h, y: p };
|
|
4529
4407
|
}
|
|
4530
|
-
const
|
|
4408
|
+
const Vt = `
|
|
4531
4409
|
M 50,30 L 55,28 60,30 65,35 60,40 55,42 50,40 Z
|
|
4532
4410
|
M 70,25 L 80,23 85,28 87,35 85,45 78,50 72,48 68,40 70,32 Z
|
|
4533
4411
|
M 55,55 L 58,52 65,55 68,60 65,70 58,75 52,70 50,60 Z
|
|
@@ -4535,7 +4413,7 @@ M 80,55 L 90,50 92,60 88,70 80,75 75,65 Z
|
|
|
4535
4413
|
M 15,30 L 25,28 32,32 35,38 30,45 22,48 15,42 12,35 Z
|
|
4536
4414
|
M 30,55 L 35,50 40,52 42,58 38,65 32,68 28,62 Z
|
|
4537
4415
|
`;
|
|
4538
|
-
function
|
|
4416
|
+
function ln({
|
|
4539
4417
|
projection: e = "equirectangular",
|
|
4540
4418
|
layers: t = [],
|
|
4541
4419
|
markers: n = [],
|
|
@@ -4549,13 +4427,14 @@ function sn({
|
|
|
4549
4427
|
graticuleInterval: p = 30,
|
|
4550
4428
|
showCoastlines: y = !0,
|
|
4551
4429
|
showBorders: m = !1,
|
|
4430
|
+
// audit-allow: literal-color +2 — the map's default land and ocean colours
|
|
4552
4431
|
landColor: $ = "#D4E6C3",
|
|
4553
4432
|
oceanColor: w = "#A8D4E6",
|
|
4554
|
-
borderColor:
|
|
4433
|
+
borderColor: j = "var(--nice-text-muted, #999999)",
|
|
4555
4434
|
graticuleColor: J = "var(--nice-border, #cccccc)",
|
|
4556
4435
|
width: te = "100%",
|
|
4557
4436
|
height: V = 400,
|
|
4558
|
-
enablePan:
|
|
4437
|
+
enablePan: R = !0,
|
|
4559
4438
|
enableZoom: H = !0,
|
|
4560
4439
|
showControls: oe = !0,
|
|
4561
4440
|
scaleBar: U = { show: !0, position: "bottom-left" },
|
|
@@ -4570,87 +4449,87 @@ function sn({
|
|
|
4570
4449
|
style: xe
|
|
4571
4450
|
}) {
|
|
4572
4451
|
var Ee, v, D, B;
|
|
4573
|
-
const X = ze(null), [Z, ae] =
|
|
4452
|
+
const X = ze(null), [Z, ae] = F(l), [G, S] = F(c), [Q, ee] = F(!1), [re, ie] = F(null), [z, k] = F(null), [d, x] = F(e), [C, E] = F(
|
|
4574
4453
|
new Set(t.filter((f) => f.visible !== !1).map((f) => f.id))
|
|
4575
|
-
),
|
|
4454
|
+
), I = typeof te == "number" ? te : 800, L = typeof V == "number" ? V : 400, g = q(
|
|
4576
4455
|
(f, b) => {
|
|
4577
4456
|
switch (d) {
|
|
4578
4457
|
case "mercator":
|
|
4579
|
-
return
|
|
4458
|
+
return Xt(f, b, I, L);
|
|
4580
4459
|
case "orthographic":
|
|
4581
|
-
return
|
|
4460
|
+
return Pt(f, b, I, L, Z.lat, Z.lng);
|
|
4582
4461
|
case "robinson":
|
|
4583
|
-
return
|
|
4462
|
+
return qt(f, b, I, L);
|
|
4584
4463
|
case "equirectangular":
|
|
4585
4464
|
default:
|
|
4586
|
-
return
|
|
4465
|
+
return Yt(f, b, I, L);
|
|
4587
4466
|
}
|
|
4588
4467
|
},
|
|
4589
|
-
[d,
|
|
4468
|
+
[d, I, L, Z]
|
|
4590
4469
|
), M = q(
|
|
4591
4470
|
(f, b) => {
|
|
4592
|
-
const
|
|
4593
|
-
return { lat: Math.max(-90, Math.min(90,
|
|
4471
|
+
const W = f / I * 360 - 180, N = 90 - b / L * 180;
|
|
4472
|
+
return { lat: Math.max(-90, Math.min(90, N)), lng: Math.max(-180, Math.min(180, W)) };
|
|
4594
4473
|
},
|
|
4595
|
-
[
|
|
4474
|
+
[I, L]
|
|
4596
4475
|
), A = K(() => {
|
|
4597
4476
|
const f = [];
|
|
4598
4477
|
for (let b = -90 + p; b < 90; b += p) {
|
|
4599
|
-
let
|
|
4600
|
-
for (let
|
|
4601
|
-
const
|
|
4602
|
-
|
|
4478
|
+
let W = "";
|
|
4479
|
+
for (let N = -180; N <= 180; N += 5) {
|
|
4480
|
+
const _ = g(b, N);
|
|
4481
|
+
_.visible !== !1 && (W += W === "" ? `M${_.x},${_.y}` : ` L${_.x},${_.y}`);
|
|
4603
4482
|
}
|
|
4604
|
-
|
|
4483
|
+
W && f.push(W);
|
|
4605
4484
|
}
|
|
4606
4485
|
for (let b = -180; b <= 180; b += p) {
|
|
4607
|
-
let
|
|
4608
|
-
for (let
|
|
4609
|
-
const
|
|
4610
|
-
|
|
4486
|
+
let W = "";
|
|
4487
|
+
for (let N = -90; N <= 90; N += 5) {
|
|
4488
|
+
const _ = g(N, b);
|
|
4489
|
+
_.visible !== !1 && (W += W === "" ? `M${_.x},${_.y}` : ` L${_.x},${_.y}`);
|
|
4611
4490
|
}
|
|
4612
|
-
|
|
4491
|
+
W && f.push(W);
|
|
4613
4492
|
}
|
|
4614
4493
|
return f;
|
|
4615
|
-
}, [g, p]),
|
|
4494
|
+
}, [g, p]), T = K(() => {
|
|
4616
4495
|
if (d === "orthographic") {
|
|
4617
|
-
const f = Math.min(
|
|
4618
|
-
return `M${
|
|
4619
|
-
A${f},${f} 0 1,1 ${
|
|
4620
|
-
A${f},${f} 0 1,1 ${
|
|
4496
|
+
const f = Math.min(I, L) / 2 - 10;
|
|
4497
|
+
return `M${I / 2 + f},${L / 2}
|
|
4498
|
+
A${f},${f} 0 1,1 ${I / 2 - f},${L / 2}
|
|
4499
|
+
A${f},${f} 0 1,1 ${I / 2 + f},${L / 2}`;
|
|
4621
4500
|
}
|
|
4622
4501
|
return null;
|
|
4623
|
-
}, [d,
|
|
4502
|
+
}, [d, I, L]), O = K(() => {
|
|
4624
4503
|
const f = [...n];
|
|
4625
4504
|
for (const b of t)
|
|
4626
|
-
|
|
4505
|
+
C.has(b.id) && b.markers && f.push(...b.markers);
|
|
4627
4506
|
return f;
|
|
4628
|
-
}, [n, t,
|
|
4507
|
+
}, [n, t, C]), le = K(() => {
|
|
4629
4508
|
const f = [...r];
|
|
4630
4509
|
for (const b of t)
|
|
4631
|
-
|
|
4510
|
+
C.has(b.id) && b.polylines && f.push(...b.polylines);
|
|
4632
4511
|
return f;
|
|
4633
|
-
}, [r, t,
|
|
4512
|
+
}, [r, t, C]), fe = K(() => {
|
|
4634
4513
|
const f = [...i];
|
|
4635
4514
|
for (const b of t)
|
|
4636
|
-
|
|
4515
|
+
C.has(b.id) && b.polygons && f.push(...b.polygons);
|
|
4637
4516
|
return f;
|
|
4638
|
-
}, [i, t,
|
|
4517
|
+
}, [i, t, C]), be = q(
|
|
4639
4518
|
(f) => {
|
|
4640
|
-
|
|
4519
|
+
R && (ee(!0), ie({ x: f.clientX, y: f.clientY, center: { ...Z } }));
|
|
4641
4520
|
},
|
|
4642
|
-
[
|
|
4521
|
+
[R, Z]
|
|
4643
4522
|
), ge = q(
|
|
4644
4523
|
(f) => {
|
|
4645
4524
|
if (!Q || !re)
|
|
4646
4525
|
return;
|
|
4647
|
-
const b = f.clientX - re.x,
|
|
4526
|
+
const b = f.clientX - re.x, W = f.clientY - re.y, N = -(b / I) * 360 / G, _ = W / L * 180 / G;
|
|
4648
4527
|
ae({
|
|
4649
|
-
lat: Math.max(-85, Math.min(85, re.center.lat +
|
|
4650
|
-
lng: (re.center.lng +
|
|
4528
|
+
lat: Math.max(-85, Math.min(85, re.center.lat + _)),
|
|
4529
|
+
lng: (re.center.lng + N + 180) % 360 - 180
|
|
4651
4530
|
});
|
|
4652
4531
|
},
|
|
4653
|
-
[Q, re,
|
|
4532
|
+
[Q, re, I, L, G]
|
|
4654
4533
|
), ye = q(() => {
|
|
4655
4534
|
ee(!1), ie(null);
|
|
4656
4535
|
}, []), we = q(
|
|
@@ -4659,41 +4538,41 @@ function sn({
|
|
|
4659
4538
|
return;
|
|
4660
4539
|
f.preventDefault();
|
|
4661
4540
|
const b = f.deltaY > 0 ? 0.9 : 1.1;
|
|
4662
|
-
|
|
4541
|
+
S((W) => Math.max(0.5, Math.min(20, W * b)));
|
|
4663
4542
|
},
|
|
4664
4543
|
[H]
|
|
4665
|
-
),
|
|
4544
|
+
), Ce = q(
|
|
4666
4545
|
(f) => {
|
|
4667
|
-
var
|
|
4546
|
+
var _;
|
|
4668
4547
|
if (!Y)
|
|
4669
4548
|
return;
|
|
4670
|
-
const b = (
|
|
4549
|
+
const b = (_ = X.current) == null ? void 0 : _.getBoundingClientRect();
|
|
4671
4550
|
if (!b)
|
|
4672
4551
|
return;
|
|
4673
|
-
const
|
|
4674
|
-
Y(M(
|
|
4552
|
+
const W = f.clientX - b.left, N = f.clientY - b.top;
|
|
4553
|
+
Y(M(W, N));
|
|
4675
4554
|
},
|
|
4676
4555
|
[Y, M]
|
|
4677
|
-
),
|
|
4556
|
+
), Re = (f) => {
|
|
4678
4557
|
const b = g(f.position.lat, f.position.lng);
|
|
4679
4558
|
if (b.visible === !1)
|
|
4680
4559
|
return null;
|
|
4681
|
-
const
|
|
4560
|
+
const W = (z == null ? void 0 : z.id) === f.id, N = (f.size || 8) * (W ? 1.3 : 1), _ = (() => {
|
|
4682
4561
|
switch (f.shape) {
|
|
4683
4562
|
case "square":
|
|
4684
|
-
return /* @__PURE__ */ o("rect", { x: b.x -
|
|
4563
|
+
return /* @__PURE__ */ o("rect", { x: b.x - N / 2, y: b.y - N / 2, width: N, height: N });
|
|
4685
4564
|
case "triangle":
|
|
4686
4565
|
return /* @__PURE__ */ o(
|
|
4687
4566
|
"polygon",
|
|
4688
4567
|
{
|
|
4689
|
-
points: `${b.x},${b.y -
|
|
4568
|
+
points: `${b.x},${b.y - N} ${b.x - N},${b.y + N / 2} ${b.x + N},${b.y + N / 2}`
|
|
4690
4569
|
}
|
|
4691
4570
|
);
|
|
4692
4571
|
case "diamond":
|
|
4693
4572
|
return /* @__PURE__ */ o(
|
|
4694
4573
|
"polygon",
|
|
4695
4574
|
{
|
|
4696
|
-
points: `${b.x},${b.y -
|
|
4575
|
+
points: `${b.x},${b.y - N} ${b.x + N},${b.y} ${b.x},${b.y + N} ${b.x - N},${b.y}`
|
|
4697
4576
|
}
|
|
4698
4577
|
);
|
|
4699
4578
|
case "pin":
|
|
@@ -4701,22 +4580,22 @@ function sn({
|
|
|
4701
4580
|
"path",
|
|
4702
4581
|
{
|
|
4703
4582
|
d: `M${b.x},${b.y}
|
|
4704
|
-
c0,-${
|
|
4705
|
-
a${
|
|
4706
|
-
c0,${
|
|
4583
|
+
c0,-${N * 1.5} -${N},-${N * 2} -${N},-${N * 2.5}
|
|
4584
|
+
a${N},${N} 0 1,1 ${N * 2},0
|
|
4585
|
+
c0,${N * 0.5} -${N},${N} -${N},${N * 2.5}`
|
|
4707
4586
|
}
|
|
4708
4587
|
);
|
|
4709
4588
|
case "circle":
|
|
4710
4589
|
default:
|
|
4711
|
-
return /* @__PURE__ */ o("circle", { cx: b.x, cy: b.y, r:
|
|
4590
|
+
return /* @__PURE__ */ o("circle", { cx: b.x, cy: b.y, r: N / 2 });
|
|
4712
4591
|
}
|
|
4713
4592
|
})();
|
|
4714
4593
|
return /* @__PURE__ */ u(
|
|
4715
4594
|
"g",
|
|
4716
4595
|
{
|
|
4717
4596
|
fill: f.color || "var(--nice-color-accent-pink, #e91e63)",
|
|
4718
|
-
stroke:
|
|
4719
|
-
strokeWidth:
|
|
4597
|
+
stroke: W ? "var(--nice-text, #000)" : "var(--nice-bg, #fff)",
|
|
4598
|
+
strokeWidth: W ? 2 : 1,
|
|
4720
4599
|
style: { cursor: "pointer" },
|
|
4721
4600
|
onMouseEnter: () => {
|
|
4722
4601
|
k(f), ne == null || ne(f);
|
|
@@ -4724,15 +4603,15 @@ function sn({
|
|
|
4724
4603
|
onMouseLeave: () => {
|
|
4725
4604
|
k(null), ne == null || ne(null);
|
|
4726
4605
|
},
|
|
4727
|
-
onClick: (
|
|
4728
|
-
|
|
4606
|
+
onClick: (Se) => {
|
|
4607
|
+
Se.stopPropagation(), se == null || se(f);
|
|
4729
4608
|
},
|
|
4730
4609
|
children: [
|
|
4731
|
-
|
|
4610
|
+
_,
|
|
4732
4611
|
f.label && /* @__PURE__ */ o(
|
|
4733
4612
|
"text",
|
|
4734
4613
|
{
|
|
4735
|
-
x: b.x +
|
|
4614
|
+
x: b.x + N,
|
|
4736
4615
|
y: b.y,
|
|
4737
4616
|
fontSize: 10,
|
|
4738
4617
|
fill: "var(--nice-text, #333)",
|
|
@@ -4744,12 +4623,12 @@ function sn({
|
|
|
4744
4623
|
},
|
|
4745
4624
|
f.id
|
|
4746
4625
|
);
|
|
4747
|
-
},
|
|
4626
|
+
}, Le = (f) => {
|
|
4748
4627
|
if (f.path.length < 2)
|
|
4749
4628
|
return null;
|
|
4750
|
-
const b = f.path.map((
|
|
4751
|
-
const
|
|
4752
|
-
return
|
|
4629
|
+
const b = f.path.map((W, N) => {
|
|
4630
|
+
const _ = g(W.lat, W.lng);
|
|
4631
|
+
return _.visible === !1 ? "" : N === 0 ? `M${_.x},${_.y}` : `L${_.x},${_.y}`;
|
|
4753
4632
|
}).filter(Boolean).join(" ");
|
|
4754
4633
|
return b ? /* @__PURE__ */ o(
|
|
4755
4634
|
"path",
|
|
@@ -4763,12 +4642,12 @@ function sn({
|
|
|
4763
4642
|
},
|
|
4764
4643
|
f.id
|
|
4765
4644
|
) : null;
|
|
4766
|
-
},
|
|
4645
|
+
}, Te = (f) => {
|
|
4767
4646
|
if (f.path.length < 3)
|
|
4768
4647
|
return null;
|
|
4769
|
-
const b = f.path.map((
|
|
4770
|
-
const
|
|
4771
|
-
return
|
|
4648
|
+
const b = f.path.map((W, N) => {
|
|
4649
|
+
const _ = g(W.lat, W.lng);
|
|
4650
|
+
return _.visible === !1 ? "" : N === 0 ? `M${_.x},${_.y}` : `L${_.x},${_.y}`;
|
|
4772
4651
|
}).filter(Boolean).join(" ") + " Z";
|
|
4773
4652
|
return /* @__PURE__ */ o(
|
|
4774
4653
|
"path",
|
|
@@ -4783,15 +4662,15 @@ function sn({
|
|
|
4783
4662
|
},
|
|
4784
4663
|
f.id
|
|
4785
4664
|
);
|
|
4786
|
-
},
|
|
4665
|
+
}, Ie = K(() => {
|
|
4787
4666
|
if (!U.show)
|
|
4788
4667
|
return null;
|
|
4789
|
-
const f = 111, b =
|
|
4668
|
+
const f = 111, b = I / 360 * G, W = f / b, N = W * 100, _ = Math.pow(10, Math.floor(Math.log10(N))), Se = _ * (N / _ >= 5 ? 5 : N / _ >= 2 ? 2 : 1);
|
|
4790
4669
|
return {
|
|
4791
|
-
width:
|
|
4792
|
-
label:
|
|
4670
|
+
width: Se / W,
|
|
4671
|
+
label: Se >= 1e3 ? `${Se / 1e3} km` : `${Se} km`
|
|
4793
4672
|
};
|
|
4794
|
-
}, [U.show,
|
|
4673
|
+
}, [U.show, I, G]);
|
|
4795
4674
|
return /* @__PURE__ */ u(
|
|
4796
4675
|
"div",
|
|
4797
4676
|
{
|
|
@@ -4813,15 +4692,15 @@ function sn({
|
|
|
4813
4692
|
onMouseUp: ye,
|
|
4814
4693
|
onMouseLeave: ye,
|
|
4815
4694
|
onWheel: we,
|
|
4816
|
-
onClick:
|
|
4695
|
+
onClick: Ce,
|
|
4817
4696
|
children: [
|
|
4818
4697
|
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", children: [
|
|
4819
4698
|
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o("marker", { id: "arrow", markerWidth: "10", markerHeight: "10", refX: "9", refY: "3", orient: "auto", children: /* @__PURE__ */ o("path", { d: "M0,0 L0,6 L9,3 z", fill: "var(--nice-primary, #2196f3)" }) }) }),
|
|
4820
|
-
d === "orthographic" &&
|
|
4699
|
+
d === "orthographic" && T && /* @__PURE__ */ u(Ae, { children: [
|
|
4821
4700
|
/* @__PURE__ */ o(
|
|
4822
4701
|
"path",
|
|
4823
4702
|
{
|
|
4824
|
-
d:
|
|
4703
|
+
d: T,
|
|
4825
4704
|
fill: w,
|
|
4826
4705
|
stroke: "var(--nice-text-muted, #999)",
|
|
4827
4706
|
strokeWidth: 1
|
|
@@ -4830,9 +4709,9 @@ function sn({
|
|
|
4830
4709
|
/* @__PURE__ */ o(
|
|
4831
4710
|
"circle",
|
|
4832
4711
|
{
|
|
4833
|
-
cx:
|
|
4834
|
-
cy:
|
|
4835
|
-
r: Math.min(
|
|
4712
|
+
cx: I / 2,
|
|
4713
|
+
cy: L / 2,
|
|
4714
|
+
r: Math.min(I, L) / 2 - 11,
|
|
4836
4715
|
fill: $,
|
|
4837
4716
|
opacity: 0.3
|
|
4838
4717
|
}
|
|
@@ -4849,20 +4728,20 @@ function sn({
|
|
|
4849
4728
|
},
|
|
4850
4729
|
`graticule-${b}`
|
|
4851
4730
|
)),
|
|
4852
|
-
y && d !== "orthographic" && /* @__PURE__ */ o("g", { transform: `scale(${
|
|
4731
|
+
y && d !== "orthographic" && /* @__PURE__ */ o("g", { transform: `scale(${I / 100}, ${L / 100})`, children: /* @__PURE__ */ o(
|
|
4853
4732
|
"path",
|
|
4854
4733
|
{
|
|
4855
|
-
d:
|
|
4734
|
+
d: Vt,
|
|
4856
4735
|
fill: $,
|
|
4857
|
-
stroke:
|
|
4736
|
+
stroke: j,
|
|
4858
4737
|
strokeWidth: 0.2
|
|
4859
4738
|
}
|
|
4860
4739
|
) }),
|
|
4861
|
-
fe.map(
|
|
4862
|
-
le.map(
|
|
4863
|
-
|
|
4740
|
+
fe.map(Te),
|
|
4741
|
+
le.map(Le),
|
|
4742
|
+
O.map(Re)
|
|
4864
4743
|
] }),
|
|
4865
|
-
|
|
4744
|
+
Ie && /* @__PURE__ */ u(
|
|
4866
4745
|
"div",
|
|
4867
4746
|
{
|
|
4868
4747
|
style: {
|
|
@@ -4881,7 +4760,7 @@ function sn({
|
|
|
4881
4760
|
"div",
|
|
4882
4761
|
{
|
|
4883
4762
|
style: {
|
|
4884
|
-
width:
|
|
4763
|
+
width: Ie.width,
|
|
4885
4764
|
height: 4,
|
|
4886
4765
|
// The bar is ink, drawn in the label's colour.
|
|
4887
4766
|
background: "currentColor",
|
|
@@ -4889,7 +4768,7 @@ function sn({
|
|
|
4889
4768
|
}
|
|
4890
4769
|
}
|
|
4891
4770
|
),
|
|
4892
|
-
/* @__PURE__ */ o("div", { children:
|
|
4771
|
+
/* @__PURE__ */ o("div", { children: Ie.label })
|
|
4893
4772
|
]
|
|
4894
4773
|
}
|
|
4895
4774
|
),
|
|
@@ -4934,7 +4813,7 @@ function sn({
|
|
|
4934
4813
|
left: g(z.position.lat, z.position.lng).x,
|
|
4935
4814
|
transform: "translateX(-50%)",
|
|
4936
4815
|
background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
|
|
4937
|
-
color: "var(--nice-
|
|
4816
|
+
color: "var(--nice-color-white, #fff)",
|
|
4938
4817
|
padding: "4px 8px",
|
|
4939
4818
|
borderRadius: 4,
|
|
4940
4819
|
fontSize: "0.75rem",
|
|
@@ -4989,10 +4868,10 @@ function sn({
|
|
|
4989
4868
|
"input",
|
|
4990
4869
|
{
|
|
4991
4870
|
type: "checkbox",
|
|
4992
|
-
checked:
|
|
4871
|
+
checked: C.has(f.id),
|
|
4993
4872
|
onChange: (b) => {
|
|
4994
|
-
const
|
|
4995
|
-
b.target.checked ?
|
|
4873
|
+
const W = new Set(C);
|
|
4874
|
+
b.target.checked ? W.add(f.id) : W.delete(f.id), E(W);
|
|
4996
4875
|
}
|
|
4997
4876
|
}
|
|
4998
4877
|
),
|
|
@@ -5034,7 +4913,7 @@ function sn({
|
|
|
5034
4913
|
"button",
|
|
5035
4914
|
{
|
|
5036
4915
|
onClick: () => {
|
|
5037
|
-
|
|
4916
|
+
S(1), ae({ lat: 0, lng: 0 });
|
|
5038
4917
|
},
|
|
5039
4918
|
style: { padding: "2px 4px", fontSize: "0.75rem", cursor: "pointer" },
|
|
5040
4919
|
children: "Reset View"
|
|
@@ -5048,22 +4927,22 @@ function sn({
|
|
|
5048
4927
|
);
|
|
5049
4928
|
}
|
|
5050
4929
|
export {
|
|
5051
|
-
|
|
4930
|
+
St as CitationService,
|
|
5052
4931
|
ft as DataAnalysisService,
|
|
5053
4932
|
ct as LabNotebookProvider,
|
|
5054
4933
|
lt as LabNotebookService,
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
4934
|
+
on as Nice3DPlot,
|
|
4935
|
+
nn as NiceCitation,
|
|
4936
|
+
en as NiceDataAnalysis,
|
|
4937
|
+
ln as NiceGeographicMap,
|
|
4938
|
+
Qt as NiceLabNotebook,
|
|
4939
|
+
sn as NiceMolecularViewer,
|
|
4940
|
+
an as NicePhylogeneticTree,
|
|
4941
|
+
rn as NiceScientificChart,
|
|
5063
4942
|
$e as Stats,
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
4943
|
+
tn as createCitationService,
|
|
4944
|
+
Ht as createDataAnalysisService,
|
|
4945
|
+
Gt as createLabNotebookService,
|
|
5067
4946
|
et as useCitation,
|
|
5068
|
-
|
|
4947
|
+
Oe as useLabNotebook
|
|
5069
4948
|
};
|