@nice2dev/ui-science 1.1.6 โ†’ 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  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
- import { jsx as o, jsxs as u, Fragment as ze } from "react/jsx-runtime";
5
- import { createContext as Ue, useContext as Ze, useState as j, useCallback as P, useMemo as K, useRef as Ae, useEffect as Xe } from "react";
4
+ import { jsx as o, jsxs as u, Fragment as Ae } from "react/jsx-runtime";
5
+ import { createContext as Ue, useContext as Ze, useState as j, useCallback as q, useMemo as K, useRef as ze, useEffect as Xe } from "react";
6
6
  class lt {
7
7
  constructor(t) {
8
8
  ve(this, "config");
@@ -156,6 +156,9 @@ class lt {
156
156
  <meta charset="utf-8">
157
157
  <title>${t.title}</title>
158
158
  <style>
159
+ /* audit-allow: token-role +5 โ€” this stylesheet ships inside a STANDALONE exported
160
+ document, where no --nice-* property is declared, so every reference here renders
161
+ its fallback and nothing else. The ink colours are intentional. */
159
162
  body { font-family: 'Times New Roman', serif; max-width: 800px; margin: 0 auto; padding: var(--nice-space-5, 20px); }
160
163
  h1 { border-bottom: 2px solid var(--nice-text, #333); }
161
164
  .meta { color: var(--nice-text-secondary, #666); font-size: 0.9em; }
@@ -213,7 +216,7 @@ function ct({
213
216
  service: e,
214
217
  children: t
215
218
  }) {
216
- const [n, r] = j([]), [i, s] = j(null), [a, l] = j(null), c = P(async () => {
219
+ const [n, r] = j([]), [i, s] = j(null), [a, l] = j(null), c = q(async () => {
217
220
  const $ = await e.listNotebooks();
218
221
  r($);
219
222
  }, [e]), h = K(
@@ -222,7 +225,7 @@ function ct({
222
225
  ), p = K(
223
226
  () => (h == null ? void 0 : h.entries.find(($) => $.id === a)) || null,
224
227
  [h, a]
225
- ), y = P(($) => {
228
+ ), y = q(($) => {
226
229
  s($), l(null);
227
230
  }, []), m = {
228
231
  service: e,
@@ -235,7 +238,7 @@ function ct({
235
238
  };
236
239
  return /* @__PURE__ */ o(Ke.Provider, { value: m, children: t });
237
240
  }
238
- const q = {
241
+ const P = {
239
242
  container: {
240
243
  display: "flex",
241
244
  height: "100%",
@@ -298,7 +301,7 @@ const q = {
298
301
  button: {
299
302
  padding: "8px 16px",
300
303
  backgroundColor: "var(--nice-primary-hover, #1976d2)",
301
- color: "var(--nice-bg, #fff)",
304
+ color: "var(--nice-text-on-primary, #fff)",
302
305
  border: "none",
303
306
  borderRadius: "4px",
304
307
  cursor: "pointer",
@@ -312,20 +315,20 @@ const q = {
312
315
  signed: "var(--nice-accent, #9c27b0)",
313
316
  locked: "var(--nice-danger, #f44336)"
314
317
  }, Je = {
315
- experiment: "๐Ÿงช",
316
- protocol: "๐Ÿ“‹",
317
- observation: "๐Ÿ‘",
318
- calculation: "๐Ÿ”ข",
319
- meeting: "๐Ÿ‘ฅ",
320
- report: "๐Ÿ“Š",
321
- note: "๐Ÿ“"
318
+ experiment: "EXP",
319
+ protocol: "PRO",
320
+ observation: "OBS",
321
+ calculation: "CALC",
322
+ meeting: "MEET",
323
+ report: "REP",
324
+ note: "NOTE"
322
325
  };
323
326
  function Jt({
324
327
  service: e,
325
328
  className: t,
326
329
  style: n
327
330
  }) {
328
- return /* @__PURE__ */ o(ct, { service: e, children: /* @__PURE__ */ u("div", { className: t, style: { ...q.container, ...n }, children: [
331
+ return /* @__PURE__ */ o(ct, { service: e, children: /* @__PURE__ */ u("div", { className: t, style: { ...P.container, ...n }, children: [
329
332
  /* @__PURE__ */ o(dt, {}),
330
333
  /* @__PURE__ */ o(ut, {})
331
334
  ] }) });
@@ -334,22 +337,32 @@ function dt() {
334
337
  const { notebooks: e, currentNotebook: t, setCurrentNotebook: n, service: r, refresh: i } = Te(), [s, a] = j(!1), [l, c] = j(""), h = async () => {
335
338
  l.trim() && (await r.createNotebook({ name: l.trim() }), await i(), c(""), a(!1));
336
339
  };
337
- return /* @__PURE__ */ u("div", { style: q.sidebar, children: [
338
- /* @__PURE__ */ o("div", { style: { padding: "16px", borderBottom: "1px solid var(--nice-border, #e0e0e0)" }, children: /* @__PURE__ */ o("h2", { style: { margin: 0, fontSize: "18px" }, children: "๐Ÿ““ Lab Notebooks" }) }),
340
+ return /* @__PURE__ */ u("div", { style: P.sidebar, children: [
341
+ /* @__PURE__ */ o("div", { style: { padding: "16px", borderBottom: "1px solid var(--nice-border, #e0e0e0)" }, children: /* @__PURE__ */ o("h2", { style: { margin: 0, fontSize: "18px" }, children: "Lab Notebooks" }) }),
339
342
  /* @__PURE__ */ o("div", { style: { flex: 1, overflow: "auto" }, children: e.map((p) => /* @__PURE__ */ u(
340
343
  "div",
341
344
  {
342
345
  onClick: () => n(p.id),
343
346
  style: {
344
- ...q.entryCard,
347
+ ...P.entryCard,
345
348
  backgroundColor: (t == null ? void 0 : t.id) === p.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
346
349
  },
347
350
  children: [
348
351
  /* @__PURE__ */ o("div", { style: { fontWeight: 500 }, children: p.name }),
349
- /* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginTop: "4px" }, children: [
350
- p.entries.length,
351
- " entries"
352
- ] })
352
+ /* @__PURE__ */ u(
353
+ "div",
354
+ {
355
+ style: {
356
+ fontSize: "12px",
357
+ color: "var(--nice-text-secondary, #666)",
358
+ marginTop: "4px"
359
+ },
360
+ children: [
361
+ p.entries.length,
362
+ " entries"
363
+ ]
364
+ }
365
+ )
353
366
  ]
354
367
  },
355
368
  p.id
@@ -362,73 +375,100 @@ function dt() {
362
375
  value: l,
363
376
  onChange: (p) => c(p.target.value),
364
377
  placeholder: "Notebook name",
365
- style: q.input,
378
+ style: P.input,
366
379
  autoFocus: !0
367
380
  }
368
381
  ),
369
382
  /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px" }, children: [
370
- /* @__PURE__ */ o("button", { onClick: h, style: q.button, children: "Create" }),
383
+ /* @__PURE__ */ o("button", { onClick: h, style: P.button, children: "Create" }),
371
384
  /* @__PURE__ */ o(
372
385
  "button",
373
386
  {
374
387
  onClick: () => a(!1),
375
- style: { ...q.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
388
+ style: { ...P.button, backgroundColor: "var(--nice-bg-tertiary, #9e9e9e)" },
376
389
  children: "Cancel"
377
390
  }
378
391
  )
379
392
  ] })
380
- ] }) : /* @__PURE__ */ o("button", { onClick: () => a(!0), style: { ...q.button, width: "100%" }, children: "+ New Notebook" }) })
393
+ ] }) : /* @__PURE__ */ o("button", { onClick: () => a(!0), style: { ...P.button, width: "100%" }, children: "+ New Notebook" }) })
381
394
  ] });
382
395
  }
383
396
  function ut() {
384
397
  const { currentNotebook: e, currentEntry: t, setCurrentEntry: n, service: r, refresh: i } = Te(), [s, a] = j(!1);
385
398
  if (!e)
386
- return /* @__PURE__ */ o("div", { style: { ...q.main, justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ u("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)" }, children: [
387
- /* @__PURE__ */ o("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "๐Ÿ““" }),
388
- /* @__PURE__ */ o("div", { style: { fontSize: "18px" }, children: "Select a notebook to get started" })
389
- ] }) });
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" }) }) });
390
400
  const l = async (c) => {
391
401
  const h = await r.createEntry(e.id, c);
392
402
  await i(), n(h.id), a(!1);
393
403
  };
394
- return /* @__PURE__ */ u("div", { style: q.main, children: [
395
- /* @__PURE__ */ o("div", { style: q.header, children: /* @__PURE__ */ u("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
404
+ return /* @__PURE__ */ u("div", { style: P.main, children: [
405
+ /* @__PURE__ */ o("div", { style: P.header, children: /* @__PURE__ */ u("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
396
406
  /* @__PURE__ */ o("h1", { style: { margin: 0, fontSize: "20px" }, children: e.name }),
397
- /* @__PURE__ */ o("button", { onClick: () => a(!0), style: q.button, children: "+ New Entry" })
407
+ /* @__PURE__ */ o("button", { onClick: () => a(!0), style: P.button, children: "+ New Entry" })
398
408
  ] }) }),
399
409
  /* @__PURE__ */ u("div", { style: { display: "flex", flex: 1, overflow: "hidden" }, children: [
400
- /* @__PURE__ */ o("div", { style: { width: "300px", borderRight: "1px solid var(--nice-border, #e0e0e0)", overflow: "auto" }, children: e.entries.map((c) => /* @__PURE__ */ u(
410
+ /* @__PURE__ */ o(
401
411
  "div",
402
412
  {
403
- onClick: () => n(c.id),
404
413
  style: {
405
- ...q.entryCard,
406
- backgroundColor: (t == null ? void 0 : t.id) === c.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
414
+ width: "300px",
415
+ borderRight: "1px solid var(--nice-border, #e0e0e0)",
416
+ overflow: "auto"
407
417
  },
408
- children: [
409
- /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
410
- /* @__PURE__ */ o("span", { children: Je[c.type] }),
411
- /* @__PURE__ */ o("span", { style: { fontWeight: 500 }, children: c.title })
412
- ] }),
413
- /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", marginTop: "8px" }, children: [
414
- /* @__PURE__ */ o(
415
- "span",
416
- {
417
- style: {
418
- ...q.badge,
419
- backgroundColor: `${Be[c.status]}20`,
420
- color: Be[c.status]
421
- },
422
- children: c.status
423
- }
424
- ),
425
- /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: new Date(c.updatedAt).toLocaleDateString() })
426
- ] })
427
- ]
428
- },
429
- c.id
430
- )) }),
431
- /* @__PURE__ */ o("div", { style: q.content, children: t ? /* @__PURE__ */ o(ht, { entry: t }) : s ? /* @__PURE__ */ o(pt, { onSubmit: l, onCancel: () => a(!1) }) : /* @__PURE__ */ o("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)", marginTop: "100px" }, children: "Select an entry or create a new one" }) })
418
+ children: e.entries.map((c) => /* @__PURE__ */ u(
419
+ "div",
420
+ {
421
+ onClick: () => n(c.id),
422
+ style: {
423
+ ...P.entryCard,
424
+ backgroundColor: (t == null ? void 0 : t.id) === c.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
425
+ },
426
+ children: [
427
+ /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
428
+ /* @__PURE__ */ o(
429
+ "span",
430
+ {
431
+ style: {
432
+ fontSize: "10px",
433
+ fontWeight: 600,
434
+ color: "var(--nice-text-secondary, #666)"
435
+ },
436
+ children: Je[c.type]
437
+ }
438
+ ),
439
+ /* @__PURE__ */ o("span", { style: { fontWeight: 500 }, children: c.title })
440
+ ] }),
441
+ /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", marginTop: "8px" }, children: [
442
+ /* @__PURE__ */ o(
443
+ "span",
444
+ {
445
+ style: {
446
+ ...P.badge,
447
+ backgroundColor: `${Be[c.status]}20`,
448
+ color: Be[c.status]
449
+ },
450
+ children: c.status
451
+ }
452
+ ),
453
+ /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: new Date(c.updatedAt).toLocaleDateString() })
454
+ ] })
455
+ ]
456
+ },
457
+ c.id
458
+ ))
459
+ }
460
+ ),
461
+ /* @__PURE__ */ o("div", { style: P.content, children: t ? /* @__PURE__ */ o(ht, { entry: t }) : s ? /* @__PURE__ */ o(pt, { onSubmit: l, onCancel: () => a(!1) }) : /* @__PURE__ */ o(
462
+ "div",
463
+ {
464
+ style: {
465
+ textAlign: "center",
466
+ color: "var(--nice-text-secondary, #666)",
467
+ marginTop: "100px"
468
+ },
469
+ children: "Select an entry or create a new one"
470
+ }
471
+ ) })
432
472
  ] })
433
473
  ] });
434
474
  }
@@ -460,7 +500,7 @@ function ht({ entry: e }) {
460
500
  "span",
461
501
  {
462
502
  style: {
463
- ...q.badge,
503
+ ...P.badge,
464
504
  backgroundColor: `${Be[e.status]}20`,
465
505
  color: Be[e.status]
466
506
  },
@@ -473,25 +513,28 @@ function ht({ entry: e }) {
473
513
  ] })
474
514
  ] })
475
515
  ] }),
476
- !c && /* @__PURE__ */ o("div", { style: { display: "flex", gap: "8px" }, children: i ? /* @__PURE__ */ u(ze, { children: [
477
- /* @__PURE__ */ o("button", { onClick: h, style: q.button, children: "Save" }),
516
+ !c && /* @__PURE__ */ o("div", { style: { display: "flex", gap: "8px" }, children: i ? /* @__PURE__ */ u(Ae, { children: [
517
+ /* @__PURE__ */ o("button", { onClick: h, style: P.button, children: "Save" }),
478
518
  /* @__PURE__ */ o(
479
519
  "button",
480
520
  {
481
521
  onClick: () => {
482
522
  s(!1), l(e);
483
523
  },
484
- style: { ...q.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
524
+ style: {
525
+ ...P.button,
526
+ backgroundColor: "var(--nice-bg-tertiary, #9e9e9e)"
527
+ },
485
528
  children: "Cancel"
486
529
  }
487
530
  )
488
- ] }) : /* @__PURE__ */ u(ze, { children: [
489
- /* @__PURE__ */ o("button", { onClick: () => s(!0), style: q.button, children: "Edit" }),
531
+ ] }) : /* @__PURE__ */ u(Ae, { children: [
532
+ /* @__PURE__ */ o("button", { onClick: () => s(!0), style: P.button, children: "Edit" }),
490
533
  /* @__PURE__ */ o(
491
534
  "button",
492
535
  {
493
536
  onClick: p,
494
- style: { ...q.button, backgroundColor: "var(--nice-accent, #9c27b0)" },
537
+ style: { ...P.button, backgroundColor: "var(--nice-accent, #9c27b0)" },
495
538
  children: "Sign"
496
539
  }
497
540
  )
@@ -508,7 +551,7 @@ function ht({ entry: e }) {
508
551
  type: "text",
509
552
  value: a.title,
510
553
  onChange: (y) => l({ ...a, title: y.target.value }),
511
- style: q.input
554
+ style: P.input
512
555
  }
513
556
  )
514
557
  ] }),
@@ -519,7 +562,7 @@ function ht({ entry: e }) {
519
562
  {
520
563
  value: a.objective || "",
521
564
  onChange: (y) => l({ ...a, objective: y.target.value }),
522
- style: q.textarea
565
+ style: P.textarea
523
566
  }
524
567
  )
525
568
  ] }),
@@ -530,7 +573,7 @@ function ht({ entry: e }) {
530
573
  {
531
574
  value: a.methods || "",
532
575
  onChange: (y) => l({ ...a, methods: y.target.value }),
533
- style: q.textarea
576
+ style: P.textarea
534
577
  }
535
578
  )
536
579
  ] }),
@@ -541,7 +584,7 @@ function ht({ entry: e }) {
541
584
  {
542
585
  value: a.results || "",
543
586
  onChange: (y) => l({ ...a, results: y.target.value }),
544
- style: q.textarea
587
+ style: P.textarea
545
588
  }
546
589
  )
547
590
  ] }),
@@ -552,7 +595,7 @@ function ht({ entry: e }) {
552
595
  {
553
596
  value: a.conclusions || "",
554
597
  onChange: (y) => l({ ...a, conclusions: y.target.value }),
555
- style: q.textarea
598
+ style: P.textarea
556
599
  }
557
600
  )
558
601
  ] })
@@ -607,9 +650,12 @@ function ht({ entry: e }) {
607
650
  href: y.url,
608
651
  target: "_blank",
609
652
  rel: "noopener noreferrer",
610
- style: { display: "block", color: "var(--nice-primary-hover, #1976d2)", textDecoration: "none" },
653
+ style: {
654
+ display: "block",
655
+ color: "var(--nice-primary-hover, #1976d2)",
656
+ textDecoration: "none"
657
+ },
611
658
  children: [
612
- "๐Ÿ“Ž ",
613
659
  y.name,
614
660
  " (",
615
661
  (y.size / 1024).toFixed(1),
@@ -643,7 +689,7 @@ function pt({
643
689
  {
644
690
  value: n.type,
645
691
  onChange: (s) => r({ ...n, type: s.target.value }),
646
- style: q.input,
692
+ style: P.input,
647
693
  children: Object.entries(Je).map(([s, a]) => /* @__PURE__ */ u("option", { value: s, children: [
648
694
  a,
649
695
  " ",
@@ -661,7 +707,7 @@ function pt({
661
707
  value: n.title,
662
708
  onChange: (s) => r({ ...n, title: s.target.value }),
663
709
  placeholder: "Enter entry title",
664
- style: q.input,
710
+ style: P.input,
665
711
  required: !0
666
712
  }
667
713
  )
@@ -674,18 +720,18 @@ function pt({
674
720
  value: n.objective,
675
721
  onChange: (s) => r({ ...n, objective: s.target.value }),
676
722
  placeholder: "What is the goal of this entry?",
677
- style: q.textarea
723
+ style: P.textarea
678
724
  }
679
725
  )
680
726
  ] }),
681
727
  /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px" }, children: [
682
- /* @__PURE__ */ o("button", { type: "submit", style: q.button, children: "Create Entry" }),
728
+ /* @__PURE__ */ o("button", { type: "submit", style: P.button, children: "Create Entry" }),
683
729
  /* @__PURE__ */ o(
684
730
  "button",
685
731
  {
686
732
  type: "button",
687
733
  onClick: t,
688
- style: { ...q.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
734
+ style: { ...P.button, backgroundColor: "var(--nice-bg-tertiary, #9e9e9e)" },
689
735
  children: "Cancel"
690
736
  }
691
737
  )
@@ -1167,7 +1213,7 @@ function Qt({
1167
1213
  className: t,
1168
1214
  style: n
1169
1215
  }) {
1170
- const [r, i] = j([]), [s, a] = j(null), [l, c] = j("data"), h = P(() => {
1216
+ const [r, i] = j([]), [s, a] = j(null), [l, c] = j("data"), h = q(() => {
1171
1217
  i(e.listDatasets());
1172
1218
  }, [e]), p = K(
1173
1219
  () => r.find((m) => m.id === s),
@@ -1232,7 +1278,11 @@ function Qt({
1232
1278
  {
1233
1279
  value: s || "",
1234
1280
  onChange: (m) => a(m.target.value || null),
1235
- style: { padding: "8px 12px", borderRadius: "4px", border: "1px solid var(--nice-border, #ddd)" },
1281
+ style: {
1282
+ padding: "8px 12px",
1283
+ borderRadius: "4px",
1284
+ border: "1px solid var(--nice-border, #ddd)"
1285
+ },
1236
1286
  children: [
1237
1287
  /* @__PURE__ */ o("option", { value: "", children: "Select dataset..." }),
1238
1288
  r.map((m) => /* @__PURE__ */ u("option", { value: m.id, children: [
@@ -1264,10 +1314,17 @@ function Qt({
1264
1314
  ]
1265
1315
  }
1266
1316
  ),
1267
- /* @__PURE__ */ o("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: p ? l === "data" ? /* @__PURE__ */ o(yt, { dataset: p }) : l === "stats" ? /* @__PURE__ */ o(mt, { dataset: p }) : /* @__PURE__ */ o(gt, { dataset: p, service: e }) : /* @__PURE__ */ u("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)", padding: "48px" }, children: [
1268
- /* @__PURE__ */ o("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "๐Ÿ“Š" }),
1269
- /* @__PURE__ */ o("div", { style: { fontSize: "18px" }, children: "Import a dataset or select an existing one to begin" })
1270
- ] }) })
1317
+ /* @__PURE__ */ o("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: p ? l === "data" ? /* @__PURE__ */ o(yt, { dataset: p }) : l === "stats" ? /* @__PURE__ */ o(mt, { dataset: p }) : /* @__PURE__ */ o(gt, { dataset: p, service: e }) : /* @__PURE__ */ o(
1318
+ "div",
1319
+ {
1320
+ style: {
1321
+ textAlign: "center",
1322
+ color: "var(--nice-text-secondary, #666)",
1323
+ padding: "48px"
1324
+ },
1325
+ children: /* @__PURE__ */ o("div", { style: { fontSize: "18px" }, children: "Import a dataset or select an existing one to begin" })
1326
+ }
1327
+ ) })
1271
1328
  ]
1272
1329
  }
1273
1330
  );
@@ -1277,22 +1334,63 @@ function yt({ dataset: e }) {
1277
1334
  return /* @__PURE__ */ u("div", { children: [
1278
1335
  /* @__PURE__ */ o("div", { style: { overflowX: "auto", marginBottom: "16px" }, children: /* @__PURE__ */ u("table", { style: { borderCollapse: "collapse", width: "100%", fontSize: "13px" }, children: [
1279
1336
  /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ u("tr", { style: { backgroundColor: "var(--nice-bg-secondary, #f5f5f5)" }, children: [
1280
- /* @__PURE__ */ o("th", { style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)", textAlign: "left" }, children: "#" }),
1337
+ /* @__PURE__ */ o(
1338
+ "th",
1339
+ {
1340
+ style: {
1341
+ padding: "8px 12px",
1342
+ border: "1px solid var(--nice-border, #ddd)",
1343
+ textAlign: "left"
1344
+ },
1345
+ children: "#"
1346
+ }
1347
+ ),
1281
1348
  e.columns.map((a) => /* @__PURE__ */ u(
1282
1349
  "th",
1283
1350
  {
1284
- style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)", textAlign: "left" },
1351
+ style: {
1352
+ padding: "8px 12px",
1353
+ border: "1px solid var(--nice-border, #ddd)",
1354
+ textAlign: "left"
1355
+ },
1285
1356
  children: [
1286
1357
  a.name,
1287
- /* @__PURE__ */ o("div", { style: { fontSize: "10px", color: "var(--nice-text-secondary, #666)", fontWeight: "normal" }, children: a.type })
1358
+ /* @__PURE__ */ o(
1359
+ "div",
1360
+ {
1361
+ style: {
1362
+ fontSize: "10px",
1363
+ color: "var(--nice-text-secondary, #666)",
1364
+ fontWeight: "normal"
1365
+ },
1366
+ children: a.type
1367
+ }
1368
+ )
1288
1369
  ]
1289
1370
  },
1290
1371
  a.name
1291
1372
  ))
1292
1373
  ] }) }),
1293
1374
  /* @__PURE__ */ o("tbody", { children: s.map((a, l) => /* @__PURE__ */ u("tr", { children: [
1294
- /* @__PURE__ */ o("td", { style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)", color: "var(--nice-text-secondary, #666)" }, children: t * r + l + 1 }),
1295
- e.columns.map((c) => /* @__PURE__ */ o("td", { style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)" }, children: a[c.name] != null ? String(a[c.name]) : /* @__PURE__ */ o("span", { style: { color: "var(--nice-border, #ccc)" }, children: "null" }) }, c.name))
1375
+ /* @__PURE__ */ o(
1376
+ "td",
1377
+ {
1378
+ style: {
1379
+ padding: "8px 12px",
1380
+ border: "1px solid var(--nice-border, #ddd)",
1381
+ color: "var(--nice-text-secondary, #666)"
1382
+ },
1383
+ children: t * r + l + 1
1384
+ }
1385
+ ),
1386
+ e.columns.map((c) => /* @__PURE__ */ o(
1387
+ "td",
1388
+ {
1389
+ style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)" },
1390
+ children: a[c.name] != null ? String(a[c.name]) : /* @__PURE__ */ o("span", { style: { color: "var(--nice-text-secondary, #ccc)" }, children: "null" })
1391
+ },
1392
+ c.name
1393
+ ))
1296
1394
  ] }, l)) })
1297
1395
  ] }) }),
1298
1396
  /* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", alignItems: "center", justifyContent: "center" }, children: [
@@ -1322,7 +1420,11 @@ function mt({ dataset: e }) {
1322
1420
  children: t.map((n) => /* @__PURE__ */ u(
1323
1421
  "div",
1324
1422
  {
1325
- style: { padding: "16px", backgroundColor: "var(--nice-bg-secondary, #f9f9f9)", borderRadius: "8px" },
1423
+ style: {
1424
+ padding: "16px",
1425
+ backgroundColor: "var(--nice-bg-secondary, #f9f9f9)",
1426
+ borderRadius: "8px"
1427
+ },
1326
1428
  children: [
1327
1429
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px 0" }, children: n.name }),
1328
1430
  n.stats && /* @__PURE__ */ o("table", { style: { width: "100%", fontSize: "13px" }, children: /* @__PURE__ */ o("tbody", { children: Object.entries(n.stats).map(([r, i]) => /* @__PURE__ */ u("tr", { children: [
@@ -1348,7 +1450,11 @@ function gt({
1348
1450
  {
1349
1451
  value: n,
1350
1452
  onChange: (l) => r(l.target.value),
1351
- style: { padding: "8px 12px", borderRadius: "4px", border: "1px solid var(--nice-border, #ddd)" },
1453
+ style: {
1454
+ padding: "8px 12px",
1455
+ borderRadius: "4px",
1456
+ border: "1px solid var(--nice-border, #ddd)"
1457
+ },
1352
1458
  children: [
1353
1459
  /* @__PURE__ */ o("option", { value: "descriptive", children: "Descriptive Statistics" }),
1354
1460
  /* @__PURE__ */ o("option", { value: "correlation", children: "Correlation Matrix" }),
@@ -1375,14 +1481,24 @@ function gt({
1375
1481
  }
1376
1482
  )
1377
1483
  ] }),
1378
- i && /* @__PURE__ */ u("div", { style: { padding: "16px", backgroundColor: "var(--nice-bg-secondary, #f9f9f9)", borderRadius: "8px" }, children: [
1379
- /* @__PURE__ */ u("h3", { style: { margin: "0 0 12px 0" }, children: [
1380
- "Results (",
1381
- i.executionTimeMs.toFixed(2),
1382
- "ms)"
1383
- ] }),
1384
- /* @__PURE__ */ o("pre", { style: { margin: 0, overflow: "auto", fontSize: "12px" }, children: JSON.stringify(i.result, null, 2) })
1385
- ] })
1484
+ i && /* @__PURE__ */ u(
1485
+ "div",
1486
+ {
1487
+ style: {
1488
+ padding: "16px",
1489
+ backgroundColor: "var(--nice-bg-secondary, #f9f9f9)",
1490
+ borderRadius: "8px"
1491
+ },
1492
+ children: [
1493
+ /* @__PURE__ */ u("h3", { style: { margin: "0 0 12px 0" }, children: [
1494
+ "Results (",
1495
+ i.executionTimeMs.toFixed(2),
1496
+ "ms)"
1497
+ ] }),
1498
+ /* @__PURE__ */ o("pre", { style: { margin: 0, overflow: "auto", fontSize: "12px" }, children: JSON.stringify(i.result, null, 2) })
1499
+ ]
1500
+ }
1501
+ )
1386
1502
  ] });
1387
1503
  }
1388
1504
  const Oe = {
@@ -1874,7 +1990,7 @@ const he = {
1874
1990
  }
1875
1991
  };
1876
1992
  function en({ service: e, className: t, style: n }) {
1877
- const [r, i] = j([]), [s, a] = j([]), [l, c] = j("all"), [h, p] = j(null), [y, m] = j(""), [$, w] = j("apa"), F = P(() => {
1993
+ const [r, i] = j([]), [s, a] = j([]), [l, c] = j("all"), [h, p] = j(null), [y, m] = j(""), [$, w] = j("apa"), F = q(() => {
1878
1994
  i(e.listCitations(l)), a(e.listCollections());
1879
1995
  }, [e, l]), J = K(() => y ? e.searchCitations(y, { collection: l }) : r, [r, y, l, e]), te = K(
1880
1996
  () => r.find((L) => L.id === h),
@@ -1964,12 +2080,32 @@ function en({ service: e, className: t, style: n }) {
1964
2080
  L.authors.map((H) => H.family).join(", "),
1965
2081
  L.year && ` (${L.year})`
1966
2082
  ] }),
1967
- L.journal && /* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #888)", fontStyle: "italic" }, children: L.journal })
2083
+ L.journal && /* @__PURE__ */ o(
2084
+ "div",
2085
+ {
2086
+ style: {
2087
+ fontSize: "12px",
2088
+ color: "var(--nice-text-secondary, #888)",
2089
+ fontStyle: "italic"
2090
+ },
2091
+ children: L.journal
2092
+ }
2093
+ )
1968
2094
  ]
1969
2095
  },
1970
2096
  L.id
1971
2097
  )),
1972
- J.length === 0 && /* @__PURE__ */ o("div", { style: { padding: "24px", textAlign: "center", color: "var(--nice-text-secondary, #666)" }, children: "No references found" })
2098
+ J.length === 0 && /* @__PURE__ */ o(
2099
+ "div",
2100
+ {
2101
+ style: {
2102
+ padding: "24px",
2103
+ textAlign: "center",
2104
+ color: "var(--nice-text-secondary, #666)"
2105
+ },
2106
+ children: "No references found"
2107
+ }
2108
+ )
1973
2109
  ] }),
1974
2110
  te && /* @__PURE__ */ o("div", { style: he.detail, children: /* @__PURE__ */ o(Dt, { citation: te }) })
1975
2111
  ] })
@@ -1987,7 +2123,7 @@ function kt() {
1987
2123
  }
1988
2124
  }
1989
2125
  };
1990
- return /* @__PURE__ */ u(ze, { children: [
2126
+ return /* @__PURE__ */ u(Ae, { children: [
1991
2127
  /* @__PURE__ */ o("button", { onClick: () => r(!0), style: he.button, children: "+ Add Reference" }),
1992
2128
  n && /* @__PURE__ */ o(
1993
2129
  "div",
@@ -2029,7 +2165,7 @@ function kt() {
2029
2165
  "button",
2030
2166
  {
2031
2167
  onClick: () => r(!1),
2032
- style: { ...he.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
2168
+ style: { ...he.button, backgroundColor: "var(--nice-bg-tertiary, #9e9e9e)" },
2033
2169
  children: "Cancel"
2034
2170
  }
2035
2171
  ),
@@ -2142,7 +2278,7 @@ function Dt({ citation: e }) {
2142
2278
  ] })
2143
2279
  ] });
2144
2280
  }
2145
- const zt = {
2281
+ const At = {
2146
2282
  series: [],
2147
2283
  xAxes: [],
2148
2284
  yAxes: [],
@@ -2155,7 +2291,7 @@ const zt = {
2155
2291
  function Ie(e) {
2156
2292
  return e.reduce((t, n) => t + n, 0) / e.length;
2157
2293
  }
2158
- function At(e) {
2294
+ function zt(e) {
2159
2295
  const t = [...e].sort((r, i) => r - i), n = Math.floor(t.length / 2);
2160
2296
  return t.length % 2 ? t[n] : (t[n - 1] + t[n]) / 2;
2161
2297
  }
@@ -2182,7 +2318,7 @@ function Ye(e, t, n, r = 5) {
2182
2318
  const s = (t - e) / (r - 1);
2183
2319
  return Array.from({ length: r }, (a, l) => e + l * s);
2184
2320
  }
2185
- function qe(e, t) {
2321
+ function Pe(e, t) {
2186
2322
  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+$/, "");
2187
2323
  }
2188
2324
  function tn({
@@ -2212,10 +2348,10 @@ function tn({
2212
2348
  className: de,
2213
2349
  style: pe
2214
2350
  }) {
2215
- const se = Ae(null);
2216
- Ae(null);
2351
+ const se = ze(null);
2352
+ ze(null);
2217
2353
  const [ne, Y] = j({
2218
- ...zt,
2354
+ ...At,
2219
2355
  series: e,
2220
2356
  annotations: h
2221
2357
  }), [ce, ue] = j({ width: 0, height: 0 }), [me, xe] = j({ x: null, y: null }), [X, Z] = j(
@@ -2228,11 +2364,11 @@ function tn({
2228
2364
  return { xMin: 0, xMax: 1, yMin: 0, yMax: 1 };
2229
2365
  let x = 1 / 0, S = -1 / 0, E = 1 / 0, N = -1 / 0;
2230
2366
  for (const M of d)
2231
- for (const z of M.data) {
2232
- const W = typeof z.x == "number" ? z.x : 0;
2233
- if (x = Math.min(x, W), S = Math.max(S, W), E = Math.min(E, z.y), N = Math.max(N, z.y), z.error) {
2234
- const [T, le] = Array.isArray(z.error) ? z.error : [-z.error, z.error];
2235
- E = Math.min(E, z.y + T), N = Math.max(N, z.y + le);
2367
+ for (const A of M.data) {
2368
+ const W = typeof A.x == "number" ? A.x : 0;
2369
+ if (x = Math.min(x, W), S = Math.max(S, W), E = Math.min(E, A.y), N = Math.max(N, A.y), A.error) {
2370
+ const [T, le] = Array.isArray(A.error) ? A.error : [-A.error, A.error];
2371
+ E = Math.min(E, A.y + T), N = Math.max(N, A.y + le);
2236
2372
  }
2237
2373
  }
2238
2374
  const _ = (S - x) * 0.05 || 0.5, g = (N - E) * 0.05 || 0.5;
@@ -2248,7 +2384,7 @@ function tn({
2248
2384
  if (!ae.has(x.id))
2249
2385
  continue;
2250
2386
  const S = x.data.map((E) => E.y);
2251
- c.includes("mean") && (d[`${x.id}_mean`] = Ie(S)), c.includes("median") && (d[`${x.id}_median`] = At(S)), c.includes("std-dev") && (d[`${x.id}_std`] = Re(S)), c.includes("regression") && (d[`${x.id}_regression`] = Et(x.data)), c.includes("confidence-interval") && (d[`${x.id}_ci95`] = Nt(S));
2387
+ c.includes("mean") && (d[`${x.id}_mean`] = Ie(S)), c.includes("median") && (d[`${x.id}_median`] = zt(S)), c.includes("std-dev") && (d[`${x.id}_std`] = Re(S)), c.includes("regression") && (d[`${x.id}_regression`] = Et(x.data)), c.includes("confidence-interval") && (d[`${x.id}_ci95`] = Nt(S));
2252
2388
  }
2253
2389
  return d;
2254
2390
  }, [e, ae, c]), ee = K(() => w.map((d) => {
@@ -2271,30 +2407,51 @@ function tn({
2271
2407
  }
2272
2408
  }
2273
2409
  return d;
2274
- }), [w, e]), re = P((d) => {
2410
+ }), [w, e]), re = q((d) => {
2275
2411
  G((x) => {
2276
2412
  const S = new Set(x);
2277
2413
  return S.has(d) ? S.delete(d) : S.add(d), S;
2278
2414
  });
2279
- }, []), ie = P(() => {
2415
+ }, []), ie = q(() => {
2280
2416
  xe({ x: null, y: null }), oe == null || oe(null, null);
2281
- }, [oe]), A = K(() => {
2417
+ }, [oe]), z = K(() => {
2282
2418
  switch (V) {
2283
2419
  case "dark":
2284
- return ["var(--nice-primary-light, #60a5fa)", "var(--nice-accent-pink, #f472b6)", "var(--nice-success-light, #34d399)", "var(--nice-warning-light, #fbbf24)", "var(--nice-accent, #a78bfa)", "#fb923c"];
2420
+ return [
2421
+ "var(--nice-primary-light, #60a5fa)",
2422
+ "var(--nice-color-accent-pink, #f472b6)",
2423
+ "var(--nice-success-light, #34d399)",
2424
+ "var(--nice-warning-light, #fbbf24)",
2425
+ "var(--nice-accent, #a78bfa)",
2426
+ "#fb923c"
2427
+ ];
2285
2428
  case "publication":
2286
2429
  return ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b"];
2287
2430
  case "presentation":
2288
- return ["var(--nice-primary, #3b82f6)", "var(--nice-danger, #ef4444)", "var(--nice-success, #22c55e)", "var(--nice-warning, #f59e0b)", "var(--nice-accent, #8b5cf6)", "var(--nice-accent-pink, #ec4899)"];
2431
+ return [
2432
+ "var(--nice-primary, #3b82f6)",
2433
+ "var(--nice-danger, #ef4444)",
2434
+ "var(--nice-success, #22c55e)",
2435
+ "var(--nice-warning, #f59e0b)",
2436
+ "var(--nice-accent, #8b5cf6)",
2437
+ "var(--nice-color-accent-pink, #ec4899)"
2438
+ ];
2289
2439
  default:
2290
- return ["var(--nice-primary-hover, #2563eb)", "var(--nice-danger-dark, #dc2626)", "var(--nice-success-dark, #16a34a)", "#ca8a04", "var(--nice-accent, #7c3aed)", "var(--nice-accent-pink, #db2777)"];
2440
+ return [
2441
+ "var(--nice-primary-hover, #2563eb)",
2442
+ "var(--nice-danger-dark, #dc2626)",
2443
+ "var(--nice-success-dark, #16a34a)",
2444
+ "#ca8a04",
2445
+ "var(--nice-accent, #7c3aed)",
2446
+ "var(--nice-color-accent-pink, #db2777)"
2447
+ ];
2291
2448
  }
2292
2449
  }, [V]), k = K(() => {
2293
2450
  switch (V) {
2294
2451
  case "dark":
2295
2452
  return {
2296
- bg: "var(--nice-text, #1f2937)",
2297
- text: "var(--nice-bg-secondary, #f3f4f6)",
2453
+ bg: "var(--nice-bg-secondary, #1f2937)",
2454
+ text: "var(--nice-text-primary, #f3f4f6)",
2298
2455
  grid: "var(--nice-text, #374151)",
2299
2456
  axis: "var(--nice-text-muted, #9ca3af)",
2300
2457
  tooltip: "var(--nice-text, #374151)"
@@ -2383,7 +2540,7 @@ function tn({
2383
2540
  width: 12,
2384
2541
  height: 12,
2385
2542
  borderRadius: 2,
2386
- backgroundColor: d.color || A[x % A.length]
2543
+ backgroundColor: d.color || z[x % z.length]
2387
2544
  }
2388
2545
  }
2389
2546
  ),
@@ -2427,24 +2584,41 @@ function tn({
2427
2584
  ] }),
2428
2585
  e.filter((d) => ae.has(d.id) && d.visible !== !1).map((d, x) => {
2429
2586
  var N, _, g;
2430
- const S = d.color || A[x % A.length], E = d.type || s;
2431
- return /* @__PURE__ */ o("g", { className: "nice-scientific-chart__series", children: E === "scatter" || E === "line" ? /* @__PURE__ */ u(ze, { children: [
2432
- E === "line" && d.data.length > 1 && /* @__PURE__ */ o(
2433
- "polyline",
2587
+ const S = d.color || z[x % z.length], E = d.type || s;
2588
+ return /* @__PURE__ */ o("g", { className: "nice-scientific-chart__series", children: E === "scatter" || E === "line" ? /* @__PURE__ */ u(Ae, { children: [
2589
+ E === "line" && d.data.length > 1 && // `points` takes plain numbers โ€” percentages are invalid there (the
2590
+ // line series never rendered; the browser rejected every point). The
2591
+ // same 0โ€“100 coordinates go into a stretched 100ร—100 viewBox instead,
2592
+ // with a non-scaling stroke so the width stays in pixels.
2593
+ /* @__PURE__ */ o(
2594
+ "svg",
2434
2595
  {
2435
- fill: "none",
2436
- stroke: S,
2437
- strokeWidth: ((N = d.line) == null ? void 0 : N.width) || 2,
2438
- strokeDasharray: ((_ = d.line) == null ? void 0 : _.style) === "dashed" ? "5,5" : ((g = d.line) == null ? void 0 : g.style) === "dotted" ? "2,2" : void 0,
2439
- points: d.data.map((M, z) => {
2440
- const W = 10 + ((typeof M.x == "number" ? M.x : z) - C.xMin) / (C.xMax - C.xMin) * 85, T = 90 - (M.y - C.yMin) / (C.yMax - C.yMin) * 85;
2441
- return `${W}%,${T}%`;
2442
- }).join(" ")
2596
+ x: "0",
2597
+ y: "0",
2598
+ width: "100%",
2599
+ height: "100%",
2600
+ viewBox: "0 0 100 100",
2601
+ preserveAspectRatio: "none",
2602
+ style: { overflow: "visible" },
2603
+ children: /* @__PURE__ */ o(
2604
+ "polyline",
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
+ )
2443
2617
  }
2444
2618
  ),
2445
- d.data.map((M, z) => {
2619
+ d.data.map((M, A) => {
2446
2620
  var fe, be, ge, ye, we;
2447
- const W = 10 + ((typeof M.x == "number" ? M.x : z) - C.xMin) / (C.xMax - C.xMin) * 85, T = 90 - (M.y - C.yMin) / (C.yMax - C.yMin) * 85, le = M.size || ((fe = d.marker) == null ? void 0 : fe.size) || 6;
2621
+ 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, le = M.size || ((fe = d.marker) == null ? void 0 : fe.size) || 6;
2448
2622
  return /* @__PURE__ */ u("g", { className: "nice-scientific-chart__point", children: [
2449
2623
  M.error && /* @__PURE__ */ o(
2450
2624
  "line",
@@ -2469,7 +2643,7 @@ function tn({
2469
2643
  opacity: ((we = d.marker) == null ? void 0 : we.opacity) ?? 1,
2470
2644
  style: { cursor: L ? "pointer" : void 0 },
2471
2645
  onMouseEnter: () => {
2472
- Z({ seriesId: d.id, pointIndex: z }), H == null || H(M, d);
2646
+ Z({ seriesId: d.id, pointIndex: A }), H == null || H(M, d);
2473
2647
  },
2474
2648
  onMouseLeave: () => {
2475
2649
  Z(null), H == null || H(null, null);
@@ -2477,7 +2651,7 @@ function tn({
2477
2651
  onClick: (Se) => L == null ? void 0 : L(M, d, Se)
2478
2652
  }
2479
2653
  )
2480
- ] }, z);
2654
+ ] }, A);
2481
2655
  }),
2482
2656
  Q[`${d.id}_regression`] && /* @__PURE__ */ o(
2483
2657
  "line",
@@ -2520,7 +2694,7 @@ function tn({
2520
2694
  textAnchor: "middle",
2521
2695
  fill: k.axis,
2522
2696
  fontSize: "0.75rem",
2523
- children: qe(d)
2697
+ children: Pe(d)
2524
2698
  }
2525
2699
  )
2526
2700
  ] }, `x-${x}`)),
@@ -2535,7 +2709,7 @@ function tn({
2535
2709
  dominantBaseline: "middle",
2536
2710
  fill: k.axis,
2537
2711
  fontSize: "0.75rem",
2538
- children: qe(d)
2712
+ children: Pe(d)
2539
2713
  }
2540
2714
  )
2541
2715
  ] }, `y-${x}`))
@@ -2585,7 +2759,7 @@ function tn({
2585
2759
  },
2586
2760
  children: (() => {
2587
2761
  const d = e.find((S) => S.id === X.seriesId), x = d == null ? void 0 : d.data[X.pointIndex];
2588
- return !d || !x ? null : y.format ? y.format(x, d) : /* @__PURE__ */ u(ze, { children: [
2762
+ return !d || !x ? null : y.format ? y.format(x, d) : /* @__PURE__ */ u(Ae, { children: [
2589
2763
  /* @__PURE__ */ o("div", { style: { fontWeight: "bold" }, children: d.name }),
2590
2764
  /* @__PURE__ */ u("div", { children: [
2591
2765
  "X: ",
@@ -2673,7 +2847,7 @@ function tn({
2673
2847
  }
2674
2848
  );
2675
2849
  }
2676
- const Pe = {
2850
+ const qe = {
2677
2851
  rotationX: 25,
2678
2852
  rotationY: -45,
2679
2853
  rotationZ: 0,
@@ -2836,49 +3010,49 @@ function nn({
2836
3010
  className: L,
2837
3011
  style: H
2838
3012
  }) {
2839
- const oe = Ae(null), [U, de] = j(Pe), [pe, se] = j(!1), [ne, Y] = j(
3013
+ const oe = ze(null), [U, de] = j(qe), [pe, se] = j(!1), [ne, Y] = j(
2840
3014
  null
2841
3015
  ), [ce, ue] = j(
2842
3016
  null
2843
3017
  ), [me, xe] = j(0), X = K(() => {
2844
- let A = 1 / 0, k = -1 / 0, d = 1 / 0, x = -1 / 0, S = 1 / 0, E = -1 / 0, N = 1 / 0, _ = -1 / 0;
3018
+ let z = 1 / 0, k = -1 / 0, d = 1 / 0, x = -1 / 0, S = 1 / 0, E = -1 / 0, N = 1 / 0, _ = -1 / 0;
2845
3019
  for (const M of e)
2846
3020
  if (M.type === "scatter3d")
2847
- for (const z of M.points)
2848
- A = Math.min(A, z.x), k = Math.max(k, z.x), d = Math.min(d, z.y), x = Math.max(x, z.y), S = Math.min(S, z.z), E = Math.max(E, z.z), typeof z.color == "number" && (N = Math.min(N, z.color), _ = Math.max(_, z.color));
3021
+ 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), S = Math.min(S, A.z), E = Math.max(E, A.z), typeof A.color == "number" && (N = Math.min(N, A.color), _ = Math.max(_, A.color));
2849
3023
  else if (M.type === "surface" || M.type === "wireframe") {
2850
- const z = M;
2851
- for (const W of z.xData)
2852
- A = Math.min(A, W), k = Math.max(k, W);
2853
- for (const W of z.yData)
3024
+ const A = M;
3025
+ for (const W of A.xData)
3026
+ z = Math.min(z, W), k = Math.max(k, W);
3027
+ for (const W of A.yData)
2854
3028
  d = Math.min(d, W), x = Math.max(x, W);
2855
- for (const W of z.zData)
3029
+ for (const W of A.zData)
2856
3030
  for (const T of W)
2857
3031
  S = Math.min(S, T), E = Math.max(E, T), N = Math.min(N, T), _ = Math.max(_, T);
2858
3032
  }
2859
- const g = Math.max(k - A, x - d, E - S) || 1;
2860
- return { xMin: A, xMax: k, yMin: d, yMax: x, zMin: S, zMax: E, colorMin: N, colorMax: _, maxRange: g };
2861
- }, [e]), Z = P(
2862
- (A) => {
3033
+ const g = Math.max(k - z, x - d, E - S) || 1;
3034
+ return { xMin: z, xMax: k, yMin: d, yMax: x, zMin: S, zMax: E, colorMin: N, colorMax: _, maxRange: g };
3035
+ }, [e]), Z = q(
3036
+ (z) => {
2863
3037
  const k = 2 / X.maxRange;
2864
3038
  return {
2865
- x: (A.x - (X.xMin + X.xMax) / 2) * k,
2866
- y: (A.y - (X.yMin + X.yMax) / 2) * k,
2867
- z: (A.z - (X.zMin + X.zMax) / 2) * k
3039
+ x: (z.x - (X.xMin + X.xMax) / 2) * k,
3040
+ y: (z.y - (X.yMin + X.yMax) / 2) * k,
3041
+ z: (z.z - (X.zMin + X.zMax) / 2) * k
2868
3042
  };
2869
3043
  },
2870
3044
  [X]
2871
- ), ae = P(
2872
- (A) => {
2873
- !h && !y || (se(!0), Y({ x: A.clientX, y: A.clientY, viewState: { ...U } }));
3045
+ ), ae = q(
3046
+ (z) => {
3047
+ !h && !y || (se(!0), Y({ x: z.clientX, y: z.clientY, viewState: { ...U } }));
2874
3048
  },
2875
3049
  [h, y, U]
2876
- ), G = P(
2877
- (A) => {
3050
+ ), G = q(
3051
+ (z) => {
2878
3052
  if (!pe || !ne)
2879
3053
  return;
2880
- const k = A.clientX - ne.x, d = A.clientY - ne.y;
2881
- A.shiftKey && y ? de({
3054
+ const k = z.clientX - ne.x, d = z.clientY - ne.y;
3055
+ z.shiftKey && y ? de({
2882
3056
  ...ne.viewState,
2883
3057
  panX: ne.viewState.panX + k * 2e-3,
2884
3058
  panY: ne.viewState.panY + d * 2e-3
@@ -2889,14 +3063,14 @@ function nn({
2889
3063
  });
2890
3064
  },
2891
3065
  [pe, ne, h, y]
2892
- ), C = P(() => {
3066
+ ), C = q(() => {
2893
3067
  se(!1), Y(null);
2894
- }, []), Q = P(
2895
- (A) => {
3068
+ }, []), Q = q(
3069
+ (z) => {
2896
3070
  if (!p)
2897
3071
  return;
2898
- A.preventDefault();
2899
- const k = A.deltaY > 0 ? 0.9 : 1.1;
3072
+ z.preventDefault();
3073
+ const k = z.deltaY > 0 ? 0.9 : 1.1;
2900
3074
  de((d) => ({
2901
3075
  ...d,
2902
3076
  zoom: Math.max(0.1, Math.min(10, d.zoom * k))
@@ -2906,21 +3080,36 @@ function nn({
2906
3080
  ), ee = K(() => {
2907
3081
  switch (F) {
2908
3082
  case "dark":
2909
- return { bg: "var(--nice-bg, #1a1a2e)", text: "var(--nice-border, #e0e0e0)", axis: "var(--nice-text-secondary, #555)", grid: "var(--nice-text, #333)" };
3083
+ return {
3084
+ bg: "var(--nice-bg, #1a1a2e)",
3085
+ text: "var(--nice-text-secondary, #e0e0e0)",
3086
+ axis: "var(--nice-text-secondary, #555)",
3087
+ grid: "var(--nice-text, #333)"
3088
+ };
2910
3089
  case "scientific":
2911
- return { bg: "var(--nice-bg-secondary, #f8f8f8)", text: "var(--nice-text, #333)", axis: "var(--nice-text-secondary, #666)", grid: "var(--nice-border, #ddd)" };
3090
+ return {
3091
+ bg: "var(--nice-bg-secondary, #f8f8f8)",
3092
+ text: "var(--nice-text, #333)",
3093
+ axis: "var(--nice-text-secondary, #666)",
3094
+ grid: "var(--nice-border, #ddd)"
3095
+ };
2912
3096
  default:
2913
- return { bg: "var(--nice-bg, #fff)", text: "var(--nice-text, #333)", axis: "var(--nice-text-secondary, #888)", grid: "var(--nice-border, #e0e0e0)" };
3097
+ return {
3098
+ bg: "var(--nice-bg, #fff)",
3099
+ text: "var(--nice-text, #333)",
3100
+ axis: "var(--nice-text-secondary, #888)",
3101
+ grid: "var(--nice-border, #e0e0e0)"
3102
+ };
2914
3103
  }
2915
3104
  }, [F]), re = K(() => {
2916
3105
  var k;
2917
- const A = [];
3106
+ const z = [];
2918
3107
  for (const d of e)
2919
3108
  if (d.type === "scatter3d") {
2920
3109
  const x = d, S = x.points.map((E) => {
2921
- var z, W, T, le, fe;
3110
+ var A, W, T, le, fe;
2922
3111
  const N = Z(E), _ = Me(N, w, U);
2923
- let g = (z = x.marker) == null ? void 0 : z.color;
3112
+ let g = (A = x.marker) == null ? void 0 : A.color;
2924
3113
  if (Array.isArray((W = x.marker) == null ? void 0 : W.color)) {
2925
3114
  const be = x.points.indexOf(E);
2926
3115
  g = ke(
@@ -2943,7 +3132,7 @@ function nn({
2943
3132
  original: E
2944
3133
  };
2945
3134
  });
2946
- A.push({ type: "scatter", points: S, data: d });
3135
+ z.push({ type: "scatter", points: S, data: d });
2947
3136
  } else if (d.type === "surface" || d.type === "wireframe") {
2948
3137
  const x = d, S = [];
2949
3138
  for (let E = 0; E < x.xData.length; E++)
@@ -2952,35 +3141,35 @@ function nn({
2952
3141
  x: x.xData[E],
2953
3142
  y: x.yData[N],
2954
3143
  z: x.zData[E][N]
2955
- }, g = Z(_), M = Me(g, w, U), z = ke(
3144
+ }, g = Z(_), M = Me(g, w, U), A = ke(
2956
3145
  ((k = x.colorData) == null ? void 0 : k[E][N]) ?? x.zData[E][N],
2957
3146
  X.colorMin,
2958
3147
  X.colorMax,
2959
3148
  x.colorScale || "viridis"
2960
3149
  );
2961
- S.push({ ...M, color: z, size: 3, original: _ });
3150
+ S.push({ ...M, color: A, size: 3, original: _ });
2962
3151
  }
2963
- A.push({ type: d.type, points: S, data: d });
3152
+ z.push({ type: d.type, points: S, data: d });
2964
3153
  }
2965
- for (const d of A)
3154
+ for (const d of z)
2966
3155
  d.points.sort((x, S) => x.depth - S.depth);
2967
- return A;
3156
+ return z;
2968
3157
  }, [e, U, w, Z, X]), ie = K(() => {
2969
3158
  var d, x, S;
2970
3159
  if (!m)
2971
3160
  return null;
2972
- const A = 1.2, k = {
3161
+ const z = 1.2, k = {
2973
3162
  x: [
2974
- Me({ x: -A, y: 0, z: 0 }, w, U),
2975
- Me({ x: A, y: 0, z: 0 }, w, U)
3163
+ Me({ x: -z, y: 0, z: 0 }, w, U),
3164
+ Me({ x: z, y: 0, z: 0 }, w, U)
2976
3165
  ],
2977
3166
  y: [
2978
- Me({ x: 0, y: -A, z: 0 }, w, U),
2979
- Me({ x: 0, y: A, z: 0 }, w, U)
3167
+ Me({ x: 0, y: -z, z: 0 }, w, U),
3168
+ Me({ x: 0, y: z, z: 0 }, w, U)
2980
3169
  ],
2981
3170
  z: [
2982
- Me({ x: 0, y: 0, z: -A }, w, U),
2983
- Me({ x: 0, y: 0, z: A }, w, U)
3171
+ Me({ x: 0, y: 0, z: -z }, w, U),
3172
+ Me({ x: 0, y: 0, z }, w, U)
2984
3173
  ]
2985
3174
  };
2986
3175
  return /* @__PURE__ */ u("g", { className: "nice-3d-plot__axes", children: [
@@ -3081,8 +3270,8 @@ function nn({
3081
3270
  ),
3082
3271
  /* @__PURE__ */ u("svg", { width: "100%", height: "100%", style: { position: "absolute", top: 0, left: 0 }, children: [
3083
3272
  ie,
3084
- re.map((A, k) => /* @__PURE__ */ u("g", { className: "nice-3d-plot__data", children: [
3085
- A.type === "scatter" && A.points.map((d, x) => {
3273
+ re.map((z, k) => /* @__PURE__ */ u("g", { className: "nice-3d-plot__data", children: [
3274
+ z.type === "scatter" && z.points.map((d, x) => {
3086
3275
  var S;
3087
3276
  return /* @__PURE__ */ o(
3088
3277
  "circle",
@@ -3091,7 +3280,7 @@ function nn({
3091
3280
  cy: `${d.y}%`,
3092
3281
  r: d.size || 4,
3093
3282
  fill: d.color || "var(--nice-primary, #3498db)",
3094
- opacity: ((S = A.data.marker) == null ? void 0 : S.opacity) ?? 0.8,
3283
+ opacity: ((S = z.data.marker) == null ? void 0 : S.opacity) ?? 0.8,
3095
3284
  style: { cursor: te ? "pointer" : void 0 },
3096
3285
  onMouseEnter: () => {
3097
3286
  ue({ point: d.original, dataIndex: k }), V == null || V(d.original, k);
@@ -3104,7 +3293,7 @@ function nn({
3104
3293
  x
3105
3294
  );
3106
3295
  }),
3107
- (A.type === "surface" || A.type === "wireframe") && A.points.map((d, x) => /* @__PURE__ */ o(
3296
+ (z.type === "surface" || z.type === "wireframe") && z.points.map((d, x) => /* @__PURE__ */ o(
3108
3297
  "rect",
3109
3298
  {
3110
3299
  x: `${d.x - 1}%`,
@@ -3112,11 +3301,11 @@ function nn({
3112
3301
  width: "2%",
3113
3302
  height: "2%",
3114
3303
  fill: d.color || "var(--nice-primary, #3498db)",
3115
- opacity: A.data.opacity ?? 0.7
3304
+ opacity: z.data.opacity ?? 0.7
3116
3305
  },
3117
3306
  x
3118
3307
  ))
3119
- ] }, A.data.id || k))
3308
+ ] }, z.data.id || k))
3120
3309
  ] }),
3121
3310
  l && e.length > 1 && /* @__PURE__ */ o(
3122
3311
  "div",
@@ -3132,10 +3321,20 @@ function nn({
3132
3321
  ...c === "bottom-right" && { bottom: 8, right: 8 },
3133
3322
  ...c === "bottom-left" && { bottom: 8, left: 8 }
3134
3323
  },
3135
- children: e.map((A, k) => /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
3136
- /* @__PURE__ */ o("span", { style: { width: 12, height: 12, background: "var(--nice-primary, #3498db)", borderRadius: 2 } }),
3137
- A.name
3138
- ] }, A.id || k))
3324
+ children: e.map((z, k) => /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
3325
+ /* @__PURE__ */ o(
3326
+ "span",
3327
+ {
3328
+ style: {
3329
+ width: 12,
3330
+ height: 12,
3331
+ background: "var(--nice-primary, #3498db)",
3332
+ borderRadius: 2
3333
+ }
3334
+ }
3335
+ ),
3336
+ z.name
3337
+ ] }, z.id || k))
3139
3338
  }
3140
3339
  ),
3141
3340
  s && /* @__PURE__ */ u(
@@ -3166,7 +3365,7 @@ function nn({
3166
3365
  bottom: 8,
3167
3366
  left: 8,
3168
3367
  background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
3169
- color: "var(--nice-bg, #fff)",
3368
+ color: "var(--nice-text-on-primary, #fff)",
3170
3369
  padding: "4px 8px",
3171
3370
  borderRadius: 4,
3172
3371
  fontSize: "0.75rem"
@@ -3185,7 +3384,7 @@ function nn({
3185
3384
  /* @__PURE__ */ o("div", { style: { position: "absolute", bottom: 8, right: 8, display: "flex", gap: 4 }, children: /* @__PURE__ */ o(
3186
3385
  "button",
3187
3386
  {
3188
- onClick: () => de(Pe),
3387
+ onClick: () => de(qe),
3189
3388
  style: { padding: "4px 8px", fontSize: "0.75rem", cursor: "pointer" },
3190
3389
  children: "Reset View"
3191
3390
  }
@@ -3393,7 +3592,9 @@ function rn({
3393
3592
  labelType: l = "element",
3394
3593
  width: c = "100%",
3395
3594
  height: h = 500,
3396
- backgroundColor: p = "var(--nice-text, #000000)",
3595
+ // A molecule viewport is a black stage in both themes; --nice-text turned it white
3596
+ // in the dark theme.
3597
+ backgroundColor: p = "#000000",
3397
3598
  enableRotation: y = !0,
3398
3599
  enableZoom: m = !0,
3399
3600
  showControls: $ = !0,
@@ -3410,7 +3611,7 @@ function rn({
3410
3611
  className: pe,
3411
3612
  styleOverride: se
3412
3613
  }) {
3413
- const ne = Ae(null), [Y, ce] = j(null), [ue, me] = j({
3614
+ const ne = ze(null), [Y, ce] = j(null), [ue, me] = j({
3414
3615
  rotX: 0,
3415
3616
  rotY: 0,
3416
3617
  rotZ: 0,
@@ -3437,23 +3638,23 @@ function rn({
3437
3638
  const { center: re, scale: ie } = K(() => {
3438
3639
  if (!Y || Y.atoms.length === 0)
3439
3640
  return { center: { x: 0, y: 0, z: 0 }, scale: 1 };
3440
- let g = 1 / 0, M = -1 / 0, z = 1 / 0, W = -1 / 0, T = 1 / 0, le = -1 / 0;
3641
+ let g = 1 / 0, M = -1 / 0, A = 1 / 0, W = -1 / 0, T = 1 / 0, le = -1 / 0;
3441
3642
  for (const ye of Y.atoms)
3442
- g = Math.min(g, ye.x), M = Math.max(M, ye.x), z = Math.min(z, ye.y), W = Math.max(W, ye.y), T = Math.min(T, ye.z), le = Math.max(le, ye.z);
3643
+ g = Math.min(g, ye.x), M = Math.max(M, ye.x), A = Math.min(A, ye.y), W = Math.max(W, ye.y), T = Math.min(T, ye.z), le = Math.max(le, ye.z);
3443
3644
  const fe = {
3444
3645
  x: (g + M) / 2,
3445
- y: (z + W) / 2,
3646
+ y: (A + W) / 2,
3446
3647
  z: (T + le) / 2
3447
- }, be = Math.max(M - g, W - z, le - T), ge = be > 0 ? 35 / be : 1;
3648
+ }, be = Math.max(M - g, W - A, le - T), ge = be > 0 ? 35 / be : 1;
3448
3649
  return { center: fe, scale: ge };
3449
- }, [Y]), A = K(() => Y ? Y.atoms.filter((g) => !i && g.element === "H" || !s && g.residueName === "HOH" ? !1 : g.visible !== !1).map((g) => ({
3650
+ }, [Y]), z = K(() => Y ? Y.atoms.filter((g) => !i && g.element === "H" || !s && g.residueName === "HOH" ? !1 : g.visible !== !1).map((g) => ({
3450
3651
  atom: g,
3451
3652
  ...je(g.x, g.y, g.z, ue, re, ie)
3452
3653
  })).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) => {
3453
- const M = Y.atoms[g.atom1], z = Y.atoms[g.atom2];
3454
- if (!M || !z || !i && (M.element === "H" || z.element === "H"))
3654
+ const M = Y.atoms[g.atom1], A = Y.atoms[g.atom2];
3655
+ if (!M || !A || !i && (M.element === "H" || A.element === "H"))
3455
3656
  return null;
3456
- const W = je(M.x, M.y, M.z, ue, re, ie), T = je(z.x, z.y, z.z, ue, re, ie);
3657
+ const W = je(M.x, M.y, M.z, ue, re, ie), T = je(A.x, A.y, A.z, ue, re, ie);
3457
3658
  return {
3458
3659
  bond: g,
3459
3660
  x1: W.x,
@@ -3462,41 +3663,41 @@ function rn({
3462
3663
  y2: T.y,
3463
3664
  depth: (W.depth + T.depth) / 2,
3464
3665
  color1: M.color,
3465
- color2: z.color
3666
+ color2: A.color
3466
3667
  };
3467
- }).filter(Boolean).sort((g, M) => g.depth - M.depth) : [], [Y, ue, re, ie, i]), d = P(
3668
+ }).filter(Boolean).sort((g, M) => g.depth - M.depth) : [], [Y, ue, re, ie, i]), d = q(
3468
3669
  (g) => {
3469
3670
  y && (X(!0), ae({ x: g.clientX, y: g.clientY, view: { ...ue } }));
3470
3671
  },
3471
3672
  [y, ue]
3472
- ), x = P(
3673
+ ), x = q(
3473
3674
  (g) => {
3474
3675
  if (!xe || !Z)
3475
3676
  return;
3476
- const M = g.clientX - Z.x, z = g.clientY - Z.y;
3677
+ const M = g.clientX - Z.x, A = g.clientY - Z.y;
3477
3678
  g.shiftKey ? me({
3478
3679
  ...Z.view,
3479
3680
  panX: Z.view.panX + M * 0.1,
3480
- panY: Z.view.panY + z * 0.1
3681
+ panY: Z.view.panY + A * 0.1
3481
3682
  }) : me({
3482
3683
  ...Z.view,
3483
3684
  rotY: Z.view.rotY + M * 0.5,
3484
- rotX: Z.view.rotX + z * 0.5
3685
+ rotX: Z.view.rotX + A * 0.5
3485
3686
  });
3486
3687
  },
3487
3688
  [xe, Z]
3488
- ), S = P(() => {
3689
+ ), S = q(() => {
3489
3690
  X(!1), ae(null);
3490
- }, []), E = P(
3691
+ }, []), E = q(
3491
3692
  (g) => {
3492
3693
  if (!m)
3493
3694
  return;
3494
3695
  g.preventDefault();
3495
3696
  const M = g.deltaY > 0 ? 0.9 : 1.1;
3496
- me((z) => ({ ...z, zoom: Math.max(0.1, Math.min(10, z.zoom * M)) }));
3697
+ me((A) => ({ ...A, zoom: Math.max(0.1, Math.min(10, A.zoom * M)) }));
3497
3698
  },
3498
3699
  [m]
3499
- ), N = P(
3700
+ ), N = q(
3500
3701
  (g) => {
3501
3702
  switch (Q) {
3502
3703
  case "space-filling":
@@ -3511,7 +3712,7 @@ function rn({
3511
3712
  }
3512
3713
  },
3513
3714
  [Q]
3514
- ), _ = P(
3715
+ ), _ = q(
3515
3716
  (g) => (Q === "wireframe" ? 1 : Q === "stick" ? 3 : 2) * (g.order || 1),
3516
3717
  [Q]
3517
3718
  );
@@ -3549,7 +3750,7 @@ function rn({
3549
3750
  },
3550
3751
  `bond-${M}`
3551
3752
  )),
3552
- A.map(({ atom: g, x: M, y: z }) => {
3753
+ z.map(({ atom: g, x: M, y: A }) => {
3553
3754
  var fe;
3554
3755
  const W = (fe = te == null ? void 0 : te.atoms) == null ? void 0 : fe.includes(g.id), T = (G == null ? void 0 : G.id) === g.id, le = N(g);
3555
3756
  return /* @__PURE__ */ u("g", { children: [
@@ -3557,10 +3758,10 @@ function rn({
3557
3758
  "circle",
3558
3759
  {
3559
3760
  cx: `${M}%`,
3560
- cy: `${z}%`,
3761
+ cy: `${A}%`,
3561
3762
  r: le,
3562
- fill: g.color || tt[g.element] || "var(--nice-text-secondary, #808080)",
3563
- stroke: W ? V : T ? "var(--nice-bg, #fff)" : "none",
3763
+ fill: g.color || tt[g.element] || "#808080",
3764
+ stroke: W ? V : T ? "#fff" : "none",
3564
3765
  strokeWidth: W || T ? 2 : 0,
3565
3766
  style: { cursor: "pointer" },
3566
3767
  onMouseEnter: () => {
@@ -3576,8 +3777,8 @@ function rn({
3576
3777
  "text",
3577
3778
  {
3578
3779
  x: `${M}%`,
3579
- y: `${z - le * 0.15}%`,
3580
- fill: "var(--nice-bg, #fff)",
3780
+ y: `${A - le * 0.15}%`,
3781
+ fill: "var(--nice-text-on-primary, #fff)",
3581
3782
  fontSize: "10",
3582
3783
  textAnchor: "middle",
3583
3784
  dominantBaseline: "middle",
@@ -3590,10 +3791,10 @@ function rn({
3590
3791
  w.map((g) => {
3591
3792
  if (g.atoms.length < 2)
3592
3793
  return null;
3593
- const M = Y.atoms[g.atoms[0]], z = Y.atoms[g.atoms[1]];
3594
- if (!M || !z)
3794
+ const M = Y.atoms[g.atoms[0]], A = Y.atoms[g.atoms[1]];
3795
+ if (!M || !A)
3595
3796
  return null;
3596
- const W = je(M.x, M.y, M.z, ue, re, ie), T = je(z.x, z.y, z.z, ue, re, ie);
3797
+ const W = je(M.x, M.y, M.z, ue, re, ie), T = je(A.x, A.y, A.z, ue, re, ie);
3597
3798
  return /* @__PURE__ */ u("g", { children: [
3598
3799
  /* @__PURE__ */ o(
3599
3800
  "line",
@@ -3625,19 +3826,31 @@ function rn({
3625
3826
  ] }, g.id);
3626
3827
  })
3627
3828
  ] }),
3628
- /* @__PURE__ */ u("div", { style: { position: "absolute", top: 8, left: 8, color: "var(--nice-bg, #fff)", fontSize: "0.8rem" }, children: [
3629
- /* @__PURE__ */ o("div", { style: { fontWeight: "bold" }, children: Y.name }),
3630
- /* @__PURE__ */ u("div", { children: [
3631
- Y.atoms.length,
3632
- " atoms, ",
3633
- Y.bonds.length,
3634
- " bonds"
3635
- ] }),
3636
- Y.formula && /* @__PURE__ */ u("div", { children: [
3637
- "Formula: ",
3638
- Y.formula
3639
- ] })
3640
- ] }),
3829
+ /* @__PURE__ */ u(
3830
+ "div",
3831
+ {
3832
+ style: {
3833
+ position: "absolute",
3834
+ top: 8,
3835
+ left: 8,
3836
+ color: "var(--nice-text-primary, #fff)",
3837
+ fontSize: "0.8rem"
3838
+ },
3839
+ children: [
3840
+ /* @__PURE__ */ o("div", { style: { fontWeight: "bold" }, children: Y.name }),
3841
+ /* @__PURE__ */ u("div", { children: [
3842
+ Y.atoms.length,
3843
+ " atoms, ",
3844
+ Y.bonds.length,
3845
+ " bonds"
3846
+ ] }),
3847
+ Y.formula && /* @__PURE__ */ u("div", { children: [
3848
+ "Formula: ",
3849
+ Y.formula
3850
+ ] })
3851
+ ]
3852
+ }
3853
+ ),
3641
3854
  G && /* @__PURE__ */ u(
3642
3855
  "div",
3643
3856
  {
@@ -3646,7 +3859,7 @@ function rn({
3646
3859
  bottom: 8,
3647
3860
  left: 8,
3648
3861
  background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
3649
- color: "var(--nice-bg, #fff)",
3862
+ color: "var(--nice-text-on-primary, #fff)",
3650
3863
  padding: "4px 8px",
3651
3864
  borderRadius: 4,
3652
3865
  fontSize: "0.75rem"
@@ -3839,7 +4052,7 @@ function on({
3839
4052
  className: Y,
3840
4053
  style: ce
3841
4054
  }) {
3842
- const ue = Ae(null), [me, xe] = j(1), [X, Z] = j({ x: 0, y: 0 }), [ae, G] = j(!1), [C, Q] = j(null), [ee, re] = j(null), [ie, A] = j(t), [k, d] = j(/* @__PURE__ */ new Set()), x = K(() => e ? typeof e == "string" ? Wt(e) : e : null, [e]), S = K(() => {
4055
+ const ue = ze(null), [me, xe] = j(1), [X, Z] = j({ x: 0, y: 0 }), [ae, G] = j(!1), [C, Q] = j(null), [ee, re] = j(null), [ie, z] = j(t), [k, d] = j(/* @__PURE__ */ new Set()), x = K(() => e ? typeof e == "string" ? Wt(e) : e : null, [e]), S = K(() => {
3843
4056
  if (!x)
3844
4057
  return null;
3845
4058
  const v = (D) => {
@@ -3858,21 +4071,21 @@ function on({
3858
4071
  it(S, D, { value: 0 }), ot(S, v, 0);
3859
4072
  const f = Math.max(...Array.from(v.values()));
3860
4073
  return { positions: { x: v, y: D }, leafCount: B, maxX: f || 1 };
3861
- }, [S]), g = K(() => S ? nt(S) : [], [S]), M = typeof V == "number" ? V : 800, z = typeof L == "number" ? L : 500, W = M - H * 2, T = z - H * 2, le = (v) => H + v / _ * W * 0.7, fe = (v) => H + v / (N - 1 || 1) * T, be = (v, D) => {
4074
+ }, [S]), g = K(() => S ? nt(S) : [], [S]), M = typeof V == "number" ? V : 800, A = typeof L == "number" ? L : 500, W = M - H * 2, T = A - H * 2, le = (v) => H + v / _ * W * 0.7, fe = (v) => H + v / (N - 1 || 1) * T, be = (v, D) => {
3862
4075
  const B = D / (N - 1 || 1) * 2 * Math.PI - Math.PI / 2, f = v / _ * Math.min(W, T) * 0.4;
3863
4076
  return {
3864
4077
  x: M / 2 + f * Math.cos(B),
3865
- y: z / 2 + f * Math.sin(B)
4078
+ y: A / 2 + f * Math.sin(B)
3866
4079
  };
3867
4080
  }, ge = (v) => {
3868
4081
  const D = E.x.get(v) || 0, B = E.y.get(v) || 0;
3869
4082
  return ie === "radial" || ie === "circular" ? be(D, B) : { x: le(D), y: fe(B) };
3870
- }, ye = P(
4083
+ }, ye = q(
3871
4084
  (v) => {
3872
4085
  U && (G(!0), Q({ x: v.clientX, y: v.clientY, pan: { ...X } }));
3873
4086
  },
3874
4087
  [U, X]
3875
- ), we = P(
4088
+ ), we = q(
3876
4089
  (v) => {
3877
4090
  if (!ae || !C)
3878
4091
  return;
@@ -3880,9 +4093,9 @@ function on({
3880
4093
  Z({ x: C.pan.x + D, y: C.pan.y + B });
3881
4094
  },
3882
4095
  [ae, C]
3883
- ), Se = P(() => {
4096
+ ), Se = q(() => {
3884
4097
  G(!1), Q(null);
3885
- }, []), Le = P(
4098
+ }, []), Le = q(
3886
4099
  (v) => {
3887
4100
  if (!oe)
3888
4101
  return;
@@ -3891,7 +4104,7 @@ function on({
3891
4104
  xe((B) => Math.max(0.1, Math.min(5, B * D)));
3892
4105
  },
3893
4106
  [oe]
3894
- ), _e = P((v) => {
4107
+ ), _e = q((v) => {
3895
4108
  d((D) => {
3896
4109
  const B = new Set(D);
3897
4110
  return B.has(v) ? B.delete(v) : B.add(v), B;
@@ -4044,7 +4257,7 @@ function on({
4044
4257
  x: D.x,
4045
4258
  y: D.y - i - 2,
4046
4259
  fontSize: p * 0.8,
4047
- fill: "var(--nice-accent-pink, #e91e63)",
4260
+ fill: "var(--nice-color-accent-pink, #e91e63)",
4048
4261
  textAnchor: "middle",
4049
4262
  children: v.bootstrap.toFixed(0)
4050
4263
  }
@@ -4150,12 +4363,24 @@ function on({
4150
4363
  ]
4151
4364
  }
4152
4365
  ),
4153
- /* @__PURE__ */ u("div", { style: { position: "absolute", top: 8, left: 8, fontSize: "0.75rem", color: "var(--nice-text-secondary, #666)" }, children: [
4154
- g.length,
4155
- " nodes โ€ข ",
4156
- N,
4157
- " leaves"
4158
- ] }),
4366
+ /* @__PURE__ */ u(
4367
+ "div",
4368
+ {
4369
+ style: {
4370
+ position: "absolute",
4371
+ top: 8,
4372
+ left: 8,
4373
+ fontSize: "0.75rem",
4374
+ color: "var(--nice-text-secondary, #666)"
4375
+ },
4376
+ children: [
4377
+ g.length,
4378
+ " nodes โ€ข ",
4379
+ N,
4380
+ " leaves"
4381
+ ]
4382
+ }
4383
+ ),
4159
4384
  ee && /* @__PURE__ */ u(
4160
4385
  "div",
4161
4386
  {
@@ -4202,7 +4427,7 @@ function on({
4202
4427
  "select",
4203
4428
  {
4204
4429
  value: ie,
4205
- onChange: (v) => A(v.target.value),
4430
+ onChange: (v) => z(v.target.value),
4206
4431
  style: { padding: "2px 4px", fontSize: "0.75rem" },
4207
4432
  children: [
4208
4433
  /* @__PURE__ */ o("option", { value: "rectangular", children: "Rectangular" }),
@@ -4302,7 +4527,7 @@ function Yt(e, t, n, r) {
4302
4527
  const c = n / (2 * Math.PI), h = n / 2 + c * De(t) * a, p = r / 2 - c * l * 1.3523 * Math.sign(e);
4303
4528
  return { x: h, y: p };
4304
4529
  }
4305
- const qt = `
4530
+ const Pt = `
4306
4531
  M 50,30 L 55,28 60,30 65,35 60,40 55,42 50,40 Z
4307
4532
  M 70,25 L 80,23 85,28 87,35 85,45 78,50 72,48 68,40 70,32 Z
4308
4533
  M 55,55 L 58,52 65,55 68,60 65,70 58,75 52,70 50,60 Z
@@ -4345,9 +4570,9 @@ function sn({
4345
4570
  style: xe
4346
4571
  }) {
4347
4572
  var Ee, v, D, B;
4348
- const X = Ae(null), [Z, ae] = j(l), [G, C] = j(c), [Q, ee] = j(!1), [re, ie] = j(null), [A, k] = j(null), [d, x] = j(e), [S, E] = j(
4573
+ const X = ze(null), [Z, ae] = j(l), [G, C] = j(c), [Q, ee] = j(!1), [re, ie] = j(null), [z, k] = j(null), [d, x] = j(e), [S, E] = j(
4349
4574
  new Set(t.filter((f) => f.visible !== !1).map((f) => f.id))
4350
- ), N = typeof te == "number" ? te : 800, _ = typeof V == "number" ? V : 400, g = P(
4575
+ ), N = typeof te == "number" ? te : 800, _ = typeof V == "number" ? V : 400, g = q(
4351
4576
  (f, b) => {
4352
4577
  switch (d) {
4353
4578
  case "mercator":
@@ -4362,13 +4587,13 @@ function sn({
4362
4587
  }
4363
4588
  },
4364
4589
  [d, N, _, Z]
4365
- ), M = P(
4590
+ ), M = q(
4366
4591
  (f, b) => {
4367
4592
  const O = f / N * 360 - 180, I = 90 - b / _ * 180;
4368
4593
  return { lat: Math.max(-90, Math.min(90, I)), lng: Math.max(-180, Math.min(180, O)) };
4369
4594
  },
4370
4595
  [N, _]
4371
- ), z = K(() => {
4596
+ ), A = K(() => {
4372
4597
  const f = [];
4373
4598
  for (let b = -90 + p; b < 90; b += p) {
4374
4599
  let O = "";
@@ -4410,12 +4635,12 @@ function sn({
4410
4635
  for (const b of t)
4411
4636
  S.has(b.id) && b.polygons && f.push(...b.polygons);
4412
4637
  return f;
4413
- }, [i, t, S]), be = P(
4638
+ }, [i, t, S]), be = q(
4414
4639
  (f) => {
4415
4640
  L && (ee(!0), ie({ x: f.clientX, y: f.clientY, center: { ...Z } }));
4416
4641
  },
4417
4642
  [L, Z]
4418
- ), ge = P(
4643
+ ), ge = q(
4419
4644
  (f) => {
4420
4645
  if (!Q || !re)
4421
4646
  return;
@@ -4426,9 +4651,9 @@ function sn({
4426
4651
  });
4427
4652
  },
4428
4653
  [Q, re, N, _, G]
4429
- ), ye = P(() => {
4654
+ ), ye = q(() => {
4430
4655
  ee(!1), ie(null);
4431
- }, []), we = P(
4656
+ }, []), we = q(
4432
4657
  (f) => {
4433
4658
  if (!H)
4434
4659
  return;
@@ -4437,7 +4662,7 @@ function sn({
4437
4662
  C((O) => Math.max(0.5, Math.min(20, O * b)));
4438
4663
  },
4439
4664
  [H]
4440
- ), Se = P(
4665
+ ), Se = q(
4441
4666
  (f) => {
4442
4667
  var R;
4443
4668
  if (!Y)
@@ -4453,7 +4678,7 @@ function sn({
4453
4678
  const b = g(f.position.lat, f.position.lng);
4454
4679
  if (b.visible === !1)
4455
4680
  return null;
4456
- const O = (A == null ? void 0 : A.id) === f.id, I = (f.size || 8) * (O ? 1.3 : 1), R = (() => {
4681
+ const O = (z == null ? void 0 : z.id) === f.id, I = (f.size || 8) * (O ? 1.3 : 1), R = (() => {
4457
4682
  switch (f.shape) {
4458
4683
  case "square":
4459
4684
  return /* @__PURE__ */ o("rect", { x: b.x - I / 2, y: b.y - I / 2, width: I, height: I });
@@ -4489,7 +4714,7 @@ function sn({
4489
4714
  return /* @__PURE__ */ u(
4490
4715
  "g",
4491
4716
  {
4492
- fill: f.color || "var(--nice-accent-pink, #e91e63)",
4717
+ fill: f.color || "var(--nice-color-accent-pink, #e91e63)",
4493
4718
  stroke: O ? "var(--nice-text, #000)" : "var(--nice-bg, #fff)",
4494
4719
  strokeWidth: O ? 2 : 1,
4495
4720
  style: { cursor: "pointer" },
@@ -4504,7 +4729,17 @@ function sn({
4504
4729
  },
4505
4730
  children: [
4506
4731
  R,
4507
- f.label && /* @__PURE__ */ o("text", { x: b.x + I, y: b.y, fontSize: 10, fill: "var(--nice-text, #333)", dominantBaseline: "middle", children: f.label })
4732
+ f.label && /* @__PURE__ */ o(
4733
+ "text",
4734
+ {
4735
+ x: b.x + I,
4736
+ y: b.y,
4737
+ fontSize: 10,
4738
+ fill: "var(--nice-text, #333)",
4739
+ dominantBaseline: "middle",
4740
+ children: f.label
4741
+ }
4742
+ )
4508
4743
  ]
4509
4744
  },
4510
4745
  f.id
@@ -4582,8 +4817,16 @@ function sn({
4582
4817
  children: [
4583
4818
  /* @__PURE__ */ u("svg", { width: "100%", height: "100%", children: [
4584
4819
  /* @__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)" }) }) }),
4585
- d === "orthographic" && W && /* @__PURE__ */ u(ze, { children: [
4586
- /* @__PURE__ */ o("path", { d: W, fill: w, stroke: "var(--nice-text-muted, #999)", strokeWidth: 1 }),
4820
+ d === "orthographic" && W && /* @__PURE__ */ u(Ae, { children: [
4821
+ /* @__PURE__ */ o(
4822
+ "path",
4823
+ {
4824
+ d: W,
4825
+ fill: w,
4826
+ stroke: "var(--nice-text-muted, #999)",
4827
+ strokeWidth: 1
4828
+ }
4829
+ ),
4587
4830
  /* @__PURE__ */ o(
4588
4831
  "circle",
4589
4832
  {
@@ -4595,7 +4838,7 @@ function sn({
4595
4838
  }
4596
4839
  )
4597
4840
  ] }),
4598
- h && z.map((f, b) => /* @__PURE__ */ o(
4841
+ h && A.map((f, b) => /* @__PURE__ */ o(
4599
4842
  "path",
4600
4843
  {
4601
4844
  d: f,
@@ -4609,7 +4852,7 @@ function sn({
4609
4852
  y && d !== "orthographic" && /* @__PURE__ */ o("g", { transform: `scale(${N / 100}, ${_ / 100})`, children: /* @__PURE__ */ o(
4610
4853
  "path",
4611
4854
  {
4612
- d: qt,
4855
+ d: Pt,
4613
4856
  fill: $,
4614
4857
  stroke: F,
4615
4858
  strokeWidth: 0.2
@@ -4626,7 +4869,9 @@ function sn({
4626
4869
  position: "absolute",
4627
4870
  [(Ee = U.position) != null && Ee.includes("bottom") ? "bottom" : "top"]: 8,
4628
4871
  [(v = U.position) != null && v.includes("right") ? "right" : "left"]: 8,
4629
- background: "var(--nice-overlay-light-90, rgba(255, 255, 255, 0.9))",
4872
+ // Theme surface + theme text: a fixed white box inherited white text in dark themes.
4873
+ background: "color-mix(in srgb, var(--nice-bg-elevated, #ffffff) 90%, transparent)",
4874
+ color: "var(--nice-text-primary, #333)",
4630
4875
  padding: "4px 8px",
4631
4876
  borderRadius: 4,
4632
4877
  fontSize: "0.7rem"
@@ -4638,7 +4883,8 @@ function sn({
4638
4883
  style: {
4639
4884
  width: Ne.width,
4640
4885
  height: 4,
4641
- background: "var(--nice-text, #333)",
4886
+ // The bar is ink, drawn in the label's colour.
4887
+ background: "currentColor",
4642
4888
  marginBottom: 2
4643
4889
  }
4644
4890
  }
@@ -4679,23 +4925,23 @@ function sn({
4679
4925
  ]
4680
4926
  }
4681
4927
  ),
4682
- (A == null ? void 0 : A.tooltip) && /* @__PURE__ */ o(
4928
+ (z == null ? void 0 : z.tooltip) && /* @__PURE__ */ o(
4683
4929
  "div",
4684
4930
  {
4685
4931
  style: {
4686
4932
  position: "absolute",
4687
- top: g(A.position.lat, A.position.lng).y - 30,
4688
- left: g(A.position.lat, A.position.lng).x,
4933
+ top: g(z.position.lat, z.position.lng).y - 30,
4934
+ left: g(z.position.lat, z.position.lng).x,
4689
4935
  transform: "translateX(-50%)",
4690
4936
  background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
4691
- color: "var(--nice-bg, #fff)",
4937
+ color: "var(--nice-text-on-primary, #fff)",
4692
4938
  padding: "4px 8px",
4693
4939
  borderRadius: 4,
4694
4940
  fontSize: "0.75rem",
4695
4941
  pointerEvents: "none",
4696
4942
  whiteSpace: "nowrap"
4697
4943
  },
4698
- children: A.tooltip
4944
+ children: z.tooltip
4699
4945
  }
4700
4946
  ),
4701
4947
  /* @__PURE__ */ u(
@@ -4705,7 +4951,8 @@ function sn({
4705
4951
  position: "absolute",
4706
4952
  bottom: 8,
4707
4953
  right: 8,
4708
- background: "var(--nice-overlay-light-90, rgba(255, 255, 255, 0.9))",
4954
+ // Theme surface at 90 %, so the box flips with its theme-coloured text.
4955
+ background: "color-mix(in srgb, var(--nice-bg-elevated, #ffffff) 90%, transparent)",
4709
4956
  padding: "2px 6px",
4710
4957
  borderRadius: 4,
4711
4958
  fontSize: "0.7rem",