@powerhousedao/design-system 6.2.2-dev.4 → 6.2.2-dev.40

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.
@@ -1,10 +1,9 @@
1
- import { _ as DropdownMenuTrigger, c as SidebarHeader, d as PackageAnimation, f as Modal, h as DropdownMenuItem, l as SidebarPanel, m as DropdownMenuContent, n as usePagination, o as Sidebar, p as DropdownMenu, s as SidebarFooter, u as Pagination, v as PowerhouseButton } from "../src-DpUTb0dJ.js";
1
+ import { _ as DropdownMenuTrigger, c as SidebarHeader, d as PackageAnimation, f as Modal, h as DropdownMenuItem, l as SidebarPanel, m as DropdownMenuContent, n as usePagination, o as Sidebar, p as DropdownMenu, s as SidebarFooter, u as Pagination, v as PowerhouseButton } from "../src-CVV6HzQZ.js";
2
2
  import { n as getDimensions, t as Icon } from "../icon-C4QOpsdI.js";
3
3
  import { Popover, PopoverContent, PopoverTrigger } from "../ui/components/popover/popover.js";
4
4
  import { SelectFieldRaw } from "../ui/components/select-field/select-field.js";
5
5
  import { Input } from "../ui/components/input/input.js";
6
6
  import { JsonViewer } from "../ui/components/json-viewer/json-viewer.js";
7
- import { SearchAutocomplete } from "../ui/components/search-autocomplete/search-autocomplete.js";
8
7
  import React, { Fragment, createElement, forwardRef, memo, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
9
8
  import { twJoin, twMerge } from "tailwind-merge";
10
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -13,6 +12,7 @@ import { Controller, useForm } from "react-hook-form";
13
12
  import { Anchor, Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
14
13
  import { format, formatDistanceToNow, parseISO } from "date-fns";
15
14
  import { useCopyToClipboard, useDebounceValue, useEventListener, useOnClickOutside } from "usehooks-ts";
15
+ import { Loader2, Mail, Monitor, Moon, Settings, Smartphone, Sun, Wallet } from "lucide-react";
16
16
  import { SyncOperationStatus, addFolder, getSyncStatusSync, preloadEditorModule, setSelectedDrive, setSelectedNode, showDeleteNodeModal, showPHModal, showRevisionHistory, useDocumentById, useDownloadDocument, useDragNode, useDropFile, useDropNode, useEditorModulesForDocumentType, useGetSwitchboardLink, useIsDragAndDropEnabled, useNodeActions, useNodeById, useNodeParentFolderById, useOnDropFile, useSelectedDocumentSafe, useSelectedDriveId, useSelectedDriveSafe, useSelectedNodePath, useTheme, useUserPermissions } from "@powerhousedao/reactor-browser";
17
17
  import Select, { components } from "react-select";
18
18
  import { Content as Content$2, List, Root as Root$2, Trigger as Trigger$2 } from "@radix-ui/react-tabs";
@@ -25,22 +25,152 @@ import { lightTheme } from "@uiw/react-json-view/light";
25
25
  import { isValidName } from "@powerhousedao/shared/document-drive";
26
26
  import { capitalCase } from "change-case";
27
27
  import { useVirtualizer } from "@tanstack/react-virtual";
28
- import { Monitor, Moon, Settings, Sun } from "lucide-react";
29
28
  //#region src/connect/components/account-popover/account-popover.tsx
30
- const AccountPopover = ({ children, content }) => {
31
- return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
32
- asChild: true,
33
- children: /* @__PURE__ */ jsx("button", {
29
+ const AccountPopover = ({ children, content, open, onOpenChange }) => {
30
+ return /* @__PURE__ */ jsxs(Popover, {
31
+ open,
32
+ onOpenChange,
33
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
34
+ asChild: true,
35
+ children: /* @__PURE__ */ jsx("button", {
36
+ type: "button",
37
+ "aria-label": "Open Account",
38
+ className: "cursor-pointer",
39
+ children
40
+ })
41
+ }), /* @__PURE__ */ jsx(PopoverContent, {
42
+ className: "w-52 p-0",
43
+ align: "start",
44
+ children: content
45
+ })]
46
+ });
47
+ };
48
+ //#endregion
49
+ //#region src/connect/components/account-popover/account-popover-login.tsx
50
+ const AccountPopoverLogin = ({ onLogin }) => {
51
+ const allowLogin = !!onLogin;
52
+ return /* @__PURE__ */ jsxs("div", {
53
+ className: "p-4",
54
+ children: [/* @__PURE__ */ jsx("div", {
55
+ className: "mb-4 flex justify-center",
56
+ children: /* @__PURE__ */ jsx("div", {
57
+ className: "flex h-5.5 w-20.75 items-center justify-center overflow-hidden text-foreground",
58
+ children: /* @__PURE__ */ jsx(Icon, {
59
+ name: "RenownLight",
60
+ size: 83
61
+ })
62
+ })
63
+ }), /* @__PURE__ */ jsx("button", {
64
+ onClick: allowLogin ? onLogin : void 0,
65
+ className: allowLogin ? "mt-4 flex h-7 w-full cursor-pointer items-center justify-center rounded-lg border border-border bg-transparent text-sm text-foreground active:active-effect" : "mt-4 flex h-7 w-full cursor-wait items-center justify-center rounded-lg border border-border bg-transparent text-sm text-foreground",
34
66
  type: "button",
35
- "aria-label": "Open Account",
36
- className: "cursor-pointer",
37
- children
67
+ children: /* @__PURE__ */ jsx("span", { children: "Connect" })
68
+ })]
69
+ });
70
+ };
71
+ //#endregion
72
+ //#region src/connect/components/renown-login/renown-login-methods.tsx
73
+ const GoogleMark = () => /* @__PURE__ */ jsxs("svg", {
74
+ width: "18",
75
+ height: "18",
76
+ viewBox: "0 0 18 18",
77
+ "aria-hidden": "true",
78
+ children: [
79
+ /* @__PURE__ */ jsx("path", {
80
+ fill: "#4285F4",
81
+ d: "M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z"
82
+ }),
83
+ /* @__PURE__ */ jsx("path", {
84
+ fill: "#34A853",
85
+ d: "M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.859-3.048.859-2.344 0-4.328-1.583-5.036-3.71H.957v2.332A8.997 8.997 0 0 0 9 18z"
86
+ }),
87
+ /* @__PURE__ */ jsx("path", {
88
+ fill: "#FBBC05",
89
+ d: "M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.997 8.997 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z"
90
+ }),
91
+ /* @__PURE__ */ jsx("path", {
92
+ fill: "#EA4335",
93
+ d: "M9 3.58c1.321 0 2.508.454 3.44 1.346l2.582-2.581C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z"
38
94
  })
39
- }), /* @__PURE__ */ jsx(PopoverContent, {
40
- className: "w-52 p-0",
41
- align: "start",
42
- children: content
43
- })] });
95
+ ]
96
+ });
97
+ const AppleMark = () => /* @__PURE__ */ jsx("svg", {
98
+ width: "18",
99
+ height: "18",
100
+ viewBox: "0 0 24 24",
101
+ fill: "currentColor",
102
+ "aria-hidden": "true",
103
+ children: /* @__PURE__ */ jsx("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.51 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" })
104
+ });
105
+ const METHOD_ICONS = {
106
+ wallet: /* @__PURE__ */ jsx(Wallet, {
107
+ size: 18,
108
+ "aria-hidden": "true"
109
+ }),
110
+ email: /* @__PURE__ */ jsx(Mail, {
111
+ size: 18,
112
+ "aria-hidden": "true"
113
+ }),
114
+ sms: /* @__PURE__ */ jsx(Smartphone, {
115
+ size: 18,
116
+ "aria-hidden": "true"
117
+ }),
118
+ google: /* @__PURE__ */ jsx(GoogleMark, {}),
119
+ apple: /* @__PURE__ */ jsx(AppleMark, {})
120
+ };
121
+ const baseButton = "relative flex h-10 w-full items-center justify-center gap-2 rounded-lg px-3 text-sm font-semibold transition-colors disabled:pointer-events-none disabled:opacity-60";
122
+ const primaryButton = "bg-primary text-primary-foreground hover:bg-primary/85";
123
+ const secondaryButton = "border border-border bg-card text-foreground hover:bg-muted";
124
+ const RenownLoginMethods = ({ methods, loading = false, error, className }) => {
125
+ const [pendingId, setPendingId] = useState(null);
126
+ const wallet = methods.find((method) => method.id === "wallet");
127
+ const others = methods.filter((method) => method.id !== "wallet");
128
+ const renderButton = (method, primary) => {
129
+ const isPending = loading && pendingId === method.id;
130
+ return /* @__PURE__ */ jsxs("button", {
131
+ type: "button",
132
+ disabled: loading,
133
+ onClick: () => {
134
+ setPendingId(method.id);
135
+ method.onSelect();
136
+ },
137
+ className: twMerge(baseButton, primary ? primaryButton : secondaryButton, isPending && "animate-pulse"),
138
+ children: [
139
+ isPending ? /* @__PURE__ */ jsx(Loader2, {
140
+ size: 18,
141
+ className: "animate-spin",
142
+ "aria-hidden": "true"
143
+ }) : METHOD_ICONS[method.id],
144
+ /* @__PURE__ */ jsx("span", { children: method.label }),
145
+ method.lastUsed ? /* @__PURE__ */ jsx("span", {
146
+ className: "absolute -top-2 right-2 rounded-full bg-foreground px-1.5 py-0.5 text-[10px] leading-none font-semibold text-background shadow-sm",
147
+ children: "Last used"
148
+ }) : null
149
+ ]
150
+ }, method.id);
151
+ };
152
+ return /* @__PURE__ */ jsxs("div", {
153
+ className: twMerge("flex w-full flex-col gap-3", className),
154
+ children: [
155
+ wallet ? renderButton(wallet, true) : null,
156
+ wallet && others.length > 0 ? /* @__PURE__ */ jsxs("div", {
157
+ className: "my-1 flex items-center gap-3",
158
+ children: [
159
+ /* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" }),
160
+ /* @__PURE__ */ jsx("span", {
161
+ className: "text-xs tracking-wider text-muted-foreground uppercase",
162
+ children: "or"
163
+ }),
164
+ /* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
165
+ ]
166
+ }) : null,
167
+ others.map((method) => renderButton(method, false)),
168
+ error ? /* @__PURE__ */ jsx("p", {
169
+ className: "text-center text-xs text-destructive",
170
+ children: error
171
+ }) : null
172
+ ]
173
+ });
44
174
  };
45
175
  //#endregion
46
176
  //#region assets/connect-loader.mp4
@@ -574,7 +704,7 @@ function fixedForwardRef(render) {
574
704
  return /* @__PURE__ */ forwardRef(render);
575
705
  }
576
706
  const ConnectSelect = /* @__PURE__ */ fixedForwardRef(function Select(props, ref) {
577
- const { items, value, id, onChange, containerClassName, menuClassName, itemClassName, absolutePositionMenu = false, borderRadius = "6px" } = props;
707
+ const { items, value, id, onChange, containerClassName, menuClassName, itemClassName, absolutePositionMenu = false, borderRadius = "6px", listClassName } = props;
578
708
  const [showItems, setShowItems] = useState(false);
579
709
  const selectedItem = getItemByValue(value) ?? items[0];
580
710
  function onItemClick(item) {
@@ -603,7 +733,7 @@ const ConnectSelect = /* @__PURE__ */ fixedForwardRef(function Select(props, ref
603
733
  name: "ChevronDown"
604
734
  })]
605
735
  }), /* @__PURE__ */ jsx("div", {
606
- className: twMerge("max-h-0 w-full overflow-hidden bg-inherit transition-[max-height] ease-in-out", showItems && "max-h-screen", absolutePositionMenu && "absolute"),
736
+ className: twMerge("max-h-0 w-full overflow-hidden bg-inherit transition-[max-height] ease-in-out", showItems && "max-h-screen", absolutePositionMenu && "absolute", showItems && listClassName),
607
737
  style: { borderRadius: `0 0 ${borderRadius} ${borderRadius}` },
608
738
  children: itemsToShow.map((item) => /* @__PURE__ */ jsx(ItemContainer, {
609
739
  ...item,
@@ -1643,33 +1773,35 @@ function TabContent(props) {
1643
1773
  //#endregion
1644
1774
  //#region src/connect/components/tabs/tabs.tsx
1645
1775
  const toTabValue = (label) => label.trim().replace(/\s+/g, "-");
1646
- function Tabs({ children, defaultValue }) {
1776
+ const resolveTabValue = (props) => props.value ?? toTabValue(props.label);
1777
+ function Tabs({ children, defaultValue, onValueChange, listClassName }) {
1647
1778
  return /* @__PURE__ */ jsxs(Root$2, {
1648
1779
  defaultValue: toTabValue(defaultValue),
1780
+ onValueChange,
1649
1781
  className: "flex min-h-0 flex-1 flex-col gap-2",
1650
1782
  children: [/* @__PURE__ */ jsx("div", {
1651
- className: "flex w-full shrink-0 justify-between",
1783
+ className: twMerge("flex w-full shrink-0 justify-between", listClassName),
1652
1784
  children: /* @__PURE__ */ jsx(List, {
1653
1785
  className: "flex w-full gap-x-2 rounded-xl p-1 text-sm font-semibold text-foreground outline-none",
1654
1786
  children: React.Children.map(children, (child, _i) => {
1655
1787
  if (!/* @__PURE__ */ React.isValidElement(child)) return;
1656
- const { label, disabled } = child.props;
1788
+ const props = child.props;
1789
+ const value = resolveTabValue(props);
1657
1790
  return /* @__PURE__ */ jsx(Trigger$2, {
1658
1791
  className: "flex min-h-7 flex-1 items-center justify-center rounded-lg border border-border bg-background py-2 text-foreground transition duration-300 data-disabled:disabled-effect data-[state=active]:bg-accent data-[state=active]:text-foreground",
1659
- value: toTabValue(label),
1660
- disabled: disabled ?? false,
1661
- children: label
1662
- }, label);
1792
+ value,
1793
+ disabled: props.disabled ?? false,
1794
+ children: props.label
1795
+ }, value);
1663
1796
  })
1664
1797
  })
1665
1798
  }), /* @__PURE__ */ jsx("div", {
1666
1799
  className: "mt-3 min-h-0 flex-1 rounded-md bg-background",
1667
1800
  children: React.Children.map(children, (child, i) => {
1668
1801
  if (!/* @__PURE__ */ React.isValidElement(child)) return;
1669
- const { label } = child.props;
1670
1802
  return /* @__PURE__ */ jsx(Content$2, {
1671
1803
  className: "h-full",
1672
- value: toTabValue(label),
1804
+ value: resolveTabValue(child.props),
1673
1805
  children: child
1674
1806
  }, i);
1675
1807
  })
@@ -2441,11 +2573,6 @@ function ControlsContainerSlot(props) {
2441
2573
  }
2442
2574
  //#endregion
2443
2575
  //#region src/connect/components/drive-auth-gate/drive-auth-gate.tsx
2444
- /**
2445
- * Reusable "log in to access this drive" card. Used both as the content of the
2446
- * drive-add auth modal and as the full-page gate shown when the user logs out
2447
- * while inside a protected drive — so the two stay visually identical.
2448
- */
2449
2576
  function DriveAuthGate(props) {
2450
2577
  const { mode = "login", onLogin, onLogout, className } = props;
2451
2578
  return /* @__PURE__ */ jsx("div", {
@@ -4662,19 +4789,19 @@ function AddDriveModal(props) {
4662
4789
  }
4663
4790
  //#endregion
4664
4791
  //#region src/connect/components/modal/create-document-modal.tsx
4665
- const CLOSE_ANIMATION_DURATION = 300;
4792
+ const CLOSE_ANIMATION_DURATION$1 = 300;
4666
4793
  function CreateDocumentModal(props) {
4667
4794
  const { onOpenChange, onContinue, overlayProps, contentProps, ...restProps } = props;
4668
4795
  const [nodeName, setNodeName] = useState("");
4669
4796
  const [isValid, setIsValid] = useState(false);
4670
4797
  const handleCancel = () => {
4671
4798
  onOpenChange?.(false);
4672
- setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION);
4799
+ setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION$1);
4673
4800
  };
4674
4801
  const handleCreate = useCallback(() => {
4675
4802
  if (!isValid) return;
4676
4803
  onContinue(nodeName);
4677
- setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION);
4804
+ setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION$1);
4678
4805
  }, [
4679
4806
  isValid,
4680
4807
  nodeName,
@@ -4737,6 +4864,135 @@ function CreateDocumentModal(props) {
4737
4864
  });
4738
4865
  }
4739
4866
  //#endregion
4867
+ //#region src/connect/components/modal/create-document-with-type-modal.tsx
4868
+ const CLOSE_ANIMATION_DURATION = 300;
4869
+ const PLACEHOLDER_KEY = "";
4870
+ function optionKey(option) {
4871
+ return `${option.documentType}::${option.version ?? "latest"}`;
4872
+ }
4873
+ function optionDisplayName(option) {
4874
+ return option.version ? `${option.name} v${option.version}` : option.name;
4875
+ }
4876
+ function CreateDocumentWithTypeModal(props) {
4877
+ const { documentTypes, onCreate, onTypeSelected, onOpenChange, overlayProps, contentProps, ...restProps } = props;
4878
+ const [documentName, setDocumentName] = useState("");
4879
+ const [isNameValid, setIsNameValid] = useState(false);
4880
+ const [selectedKey, setSelectedKey] = useState(PLACEHOLDER_KEY);
4881
+ const selectedOption = documentTypes.find((option) => optionKey(option) === selectedKey);
4882
+ const canCreate = isNameValid && selectedOption !== void 0;
4883
+ const typeItems = documentTypes.map((option) => ({
4884
+ value: optionKey(option),
4885
+ displayValue: optionDisplayName(option)
4886
+ }));
4887
+ const items = selectedKey === PLACEHOLDER_KEY ? [{
4888
+ value: PLACEHOLDER_KEY,
4889
+ displayValue: "Select document type…"
4890
+ }, ...typeItems] : typeItems;
4891
+ const resetAfterClose = useCallback(() => {
4892
+ setTimeout(() => {
4893
+ setDocumentName("");
4894
+ setIsNameValid(false);
4895
+ setSelectedKey(PLACEHOLDER_KEY);
4896
+ }, CLOSE_ANIMATION_DURATION);
4897
+ }, []);
4898
+ const handleOpenChange = (open) => {
4899
+ onOpenChange?.(open);
4900
+ if (!open) resetAfterClose();
4901
+ };
4902
+ const handleCancel = () => {
4903
+ handleOpenChange(false);
4904
+ };
4905
+ const handleTypeChange = (value) => {
4906
+ if (value === PLACEHOLDER_KEY) return;
4907
+ setSelectedKey(value);
4908
+ const option = documentTypes.find((o) => optionKey(o) === value);
4909
+ if (option) onTypeSelected?.(option.documentType);
4910
+ };
4911
+ const handleCreate = useCallback(() => {
4912
+ if (!canCreate) return;
4913
+ onCreate({
4914
+ name: documentName,
4915
+ documentType: selectedOption.documentType,
4916
+ version: selectedOption.version
4917
+ });
4918
+ resetAfterClose();
4919
+ }, [
4920
+ canCreate,
4921
+ documentName,
4922
+ onCreate,
4923
+ resetAfterClose,
4924
+ selectedOption
4925
+ ]);
4926
+ const handleSubmit = useCallback((e) => {
4927
+ e.preventDefault();
4928
+ handleCreate();
4929
+ }, [handleCreate]);
4930
+ return /* @__PURE__ */ jsx(Modal, {
4931
+ contentProps,
4932
+ onOpenChange: handleOpenChange,
4933
+ overlayProps,
4934
+ title: "Create a new document",
4935
+ ...restProps,
4936
+ children: /* @__PURE__ */ jsxs("form", {
4937
+ name: "create-document-with-type",
4938
+ className: "max-h-[85vh] w-100 overflow-y-auto rounded-xl bg-background p-6 text-foreground",
4939
+ onSubmit: handleSubmit,
4940
+ children: [
4941
+ /* @__PURE__ */ jsx("div", {
4942
+ className: "pb-2 text-2xl font-bold text-foreground",
4943
+ children: "Create a new document"
4944
+ }),
4945
+ /* @__PURE__ */ jsxs("div", {
4946
+ className: "my-6",
4947
+ children: [!isNameValid && documentName ? /* @__PURE__ */ jsx("div", {
4948
+ className: "mb-2 text-destructive",
4949
+ children: "Document name must not be empty or contain control characters."
4950
+ }) : null, /* @__PURE__ */ jsx(FormInput, {
4951
+ icon: /* @__PURE__ */ jsx(Icon, { name: "BrickGlobe" }),
4952
+ onChange: (e) => {
4953
+ const name = e.target.value;
4954
+ setDocumentName(name);
4955
+ setIsNameValid(isValidName(name));
4956
+ },
4957
+ placeholder: "Document name",
4958
+ required: true,
4959
+ value: documentName
4960
+ })]
4961
+ }),
4962
+ /* @__PURE__ */ jsxs("div", {
4963
+ className: "my-6",
4964
+ children: [/* @__PURE__ */ jsx(Label, {
4965
+ className: "mb-2 text-sm font-medium text-foreground",
4966
+ htmlFor: "document-type",
4967
+ children: "Document type"
4968
+ }), /* @__PURE__ */ jsx(ConnectSelect, {
4969
+ id: "document-type",
4970
+ items,
4971
+ listClassName: "max-h-80 overflow-y-auto overscroll-contain",
4972
+ menuClassName: "min-w-0",
4973
+ onChange: handleTypeChange,
4974
+ value: selectedKey
4975
+ })]
4976
+ }),
4977
+ /* @__PURE__ */ jsxs("div", {
4978
+ className: "mt-8 flex justify-between gap-3",
4979
+ children: [/* @__PURE__ */ jsx(ModalButton, {
4980
+ onClick: handleCancel,
4981
+ type: "button",
4982
+ variant: "cancel",
4983
+ children: "Cancel"
4984
+ }), /* @__PURE__ */ jsx(ModalButton, {
4985
+ disabled: !canCreate,
4986
+ type: "submit",
4987
+ variant: "confirm",
4988
+ children: "Create"
4989
+ })]
4990
+ })
4991
+ ]
4992
+ })
4993
+ });
4994
+ }
4995
+ //#endregion
4740
4996
  //#region src/connect/components/modal/delete-drive-modal.tsx
4741
4997
  const ConnectDeleteDriveModal = (props) => {
4742
4998
  const { inputPlaceholder, body, driveName, ...confirmationModalProps } = props;
@@ -7373,6 +7629,76 @@ function buildPackageSpec(name, tag) {
7373
7629
  return tag ? `${name}@${tag}` : name;
7374
7630
  }
7375
7631
  //#endregion
7632
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/filter-packages.ts
7633
+ /**
7634
+ * Client-side package filter used by both Package Manager tabs. Matches the
7635
+ * query's name part (any `@tag` suffix is ignored for matching — it drives
7636
+ * version preselection instead) against the package name only.
7637
+ *
7638
+ * This is the seam a future registry search endpoint replaces: when the
7639
+ * Available tab searches server-side, its panel skips this function and
7640
+ * renders the API results as-is.
7641
+ */
7642
+ function filterPackages(packages, query) {
7643
+ const { name } = parsePackageSpec(query);
7644
+ const needle = name.toLowerCase();
7645
+ if (!needle) return packages;
7646
+ return packages.filter((pkg) => pkg.name.toLowerCase().includes(needle));
7647
+ }
7648
+ //#endregion
7649
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/npm-fallback-row.tsx
7650
+ /**
7651
+ * Shown in the Available tab when the search query matches nothing in the
7652
+ * registry but looks like a valid npm package name: the registry's verdaccio
7653
+ * backend proxies npmjs.org, so the install can still succeed. Replaces the
7654
+ * old SearchAutocomplete fallback option. The button label is "Install from
7655
+ * npm" (not "Install") so it doesn't collide with the row-kebab menu item.
7656
+ */
7657
+ const NpmFallbackRow = (props) => {
7658
+ const { query, onInstall, disabled } = props;
7659
+ const [isInstalling, setIsInstalling] = useState(false);
7660
+ const { name, tag } = parsePackageSpec(query);
7661
+ const spec = buildPackageSpec(name, tag);
7662
+ function handleInstall() {
7663
+ setIsInstalling(true);
7664
+ onInstall(spec).catch(console.error).finally(() => setIsInstalling(false));
7665
+ }
7666
+ return /* @__PURE__ */ jsxs("div", {
7667
+ className: "flex items-start justify-between gap-3 rounded-md border border-dashed border-border bg-background p-3 text-sm/5",
7668
+ children: [/* @__PURE__ */ jsxs("div", {
7669
+ className: "min-w-0 flex-1",
7670
+ children: [
7671
+ /* @__PURE__ */ jsx("p", {
7672
+ className: "truncate font-semibold text-foreground",
7673
+ children: tag ? `${name} @ ${tag}` : name
7674
+ }),
7675
+ /* @__PURE__ */ jsx("p", {
7676
+ className: "text-xs text-foreground",
7677
+ children: "Not published to this registry. Install via the npmjs.org uplink."
7678
+ }),
7679
+ /* @__PURE__ */ jsx("p", {
7680
+ className: "text-xs text-muted-foreground",
7681
+ children: "npm fallback"
7682
+ })
7683
+ ]
7684
+ }), /* @__PURE__ */ jsx("div", {
7685
+ className: "shrink-0 self-center",
7686
+ children: /* @__PURE__ */ jsx("button", {
7687
+ onClick: handleInstall,
7688
+ disabled: disabled || isInstalling,
7689
+ className: "rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
7690
+ children: isInstalling ? "Installing..." : "Install from npm"
7691
+ })
7692
+ })]
7693
+ });
7694
+ };
7695
+ //#endregion
7696
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/npm-name.ts
7697
+ const NPM_NAME_RE = /^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$|^[a-z0-9][a-z0-9._-]*$/i;
7698
+ function isPlausiblePackageName(name) {
7699
+ return name.length >= 2 && NPM_NAME_RE.test(name);
7700
+ }
7701
+ //#endregion
7376
7702
  //#region src/connect/components/modal/settings-modal-v2/package-manager/version-picker.tsx
7377
7703
  function resolveDefaultVersionSelection(options) {
7378
7704
  const { distTags, versions, version, preferredTag } = options;
@@ -7516,147 +7842,6 @@ const VersionPicker = (props) => {
7516
7842
  });
7517
7843
  };
7518
7844
  //#endregion
7519
- //#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager-input.tsx
7520
- const NPM_NAME_RE = /^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$|^[a-z0-9][a-z0-9._-]*$/i;
7521
- function isPlausiblePackageName(name) {
7522
- return name.length >= 2 && NPM_NAME_RE.test(name);
7523
- }
7524
- function PackageResultCard(props) {
7525
- const { option, ctx, typedTag } = props;
7526
- const { selectingValue, selectLabel, selectingContent, handleSelect } = ctx;
7527
- const baseName = option.label.split(" @ ")[0] ?? option.value;
7528
- const hasVersionMetadata = option.distTags && Object.keys(option.distTags).length > 0 || (option.versions?.length ?? 0) > 0;
7529
- const [selected, setSelected] = useState(() => resolveDefaultVersionSelection({
7530
- distTags: option.distTags,
7531
- versions: option.versions,
7532
- version: option.version,
7533
- preferredTag: typedTag
7534
- }));
7535
- useEffect(() => {
7536
- if (!typedTag) return;
7537
- if (option.distTags && typedTag in option.distTags) setSelected({
7538
- kind: "tag",
7539
- value: typedTag
7540
- });
7541
- else if (option.versions?.includes(typedTag)) setSelected({
7542
- kind: "version",
7543
- value: typedTag
7544
- });
7545
- }, [
7546
- typedTag,
7547
- option.distTags,
7548
- option.versions
7549
- ]);
7550
- const installSpec = hasVersionMetadata ? buildPackageSpec(baseName, selected.value) : option.value;
7551
- const isSelecting = selectingValue === installSpec;
7552
- const isDisabled = option.disabled === true;
7553
- return /* @__PURE__ */ jsxs("div", {
7554
- className: "flex items-start justify-between gap-3 rounded-md p-2 hover:hover-effect",
7555
- children: [/* @__PURE__ */ jsxs("div", {
7556
- className: "min-w-0 flex-1",
7557
- children: [
7558
- /* @__PURE__ */ jsx("p", {
7559
- className: "truncate text-sm font-medium text-foreground",
7560
- children: baseName
7561
- }),
7562
- option.description && /* @__PURE__ */ jsx("p", {
7563
- className: "truncate text-xs text-foreground",
7564
- children: option.description
7565
- }),
7566
- option.meta && /* @__PURE__ */ jsx("p", {
7567
- className: "truncate text-xs text-foreground",
7568
- children: option.meta
7569
- }),
7570
- hasVersionMetadata && /* @__PURE__ */ jsx("div", {
7571
- className: "mt-2",
7572
- children: /* @__PURE__ */ jsx(VersionPicker, {
7573
- distTags: option.distTags,
7574
- versions: option.versions,
7575
- selected,
7576
- onChange: setSelected,
7577
- disabled: isDisabled
7578
- })
7579
- })
7580
- ]
7581
- }), /* @__PURE__ */ jsx("div", {
7582
- className: "shrink-0 self-center",
7583
- children: isSelecting && selectingContent ? /* @__PURE__ */ jsx("div", {
7584
- className: "flex items-center justify-center",
7585
- children: selectingContent
7586
- }) : isDisabled ? /* @__PURE__ */ jsx("span", {
7587
- className: "rounded-md bg-muted px-3 py-1 text-xs font-medium text-muted-foreground",
7588
- children: option.disabledLabel ?? "Unavailable"
7589
- }) : /* @__PURE__ */ jsx("button", {
7590
- onClick: () => handleSelect(installSpec),
7591
- disabled: isSelecting,
7592
- className: "rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
7593
- children: isSelecting ? "..." : selectLabel
7594
- })
7595
- })]
7596
- });
7597
- }
7598
- const PackageManagerInput = (props) => {
7599
- const { registryPackageList, onInstall, disabled, className } = props;
7600
- const [typedTag, setTypedTag] = useState(void 0);
7601
- const fetchOptions = async (query) => {
7602
- const { name: namePart, tag } = parsePackageSpec(query);
7603
- setTypedTag(tag);
7604
- const needle = namePart.toLowerCase();
7605
- const localOptions = registryPackageList.filter((pkg) => pkg.name.toLowerCase().includes(needle) || pkg.manifest?.description?.toLowerCase().includes(needle)).map((pkg) => {
7606
- const isInstalled = pkg.status === "local-install" || pkg.status === "registry-install";
7607
- return {
7608
- value: pkg.name,
7609
- label: pkg.name,
7610
- version: pkg.version,
7611
- description: pkg.manifest?.description,
7612
- meta: pkg.manifest?.publisher?.name,
7613
- disabled: isInstalled,
7614
- disabledLabel: isInstalled ? "Installed" : void 0,
7615
- distTags: pkg.distTags,
7616
- versions: pkg.versions
7617
- };
7618
- });
7619
- if (!isPlausiblePackageName(namePart) || localOptions.length > 0) return Promise.resolve(localOptions);
7620
- const fallbackOption = {
7621
- value: buildPackageSpec(namePart, tag),
7622
- label: tag ? `${namePart} @ ${tag}` : namePart,
7623
- version: tag,
7624
- description: "Not published to this registry. Install via the npmjs.org uplink.",
7625
- meta: "npm fallback"
7626
- };
7627
- return Promise.resolve([fallbackOption]);
7628
- };
7629
- const handleSelect = useCallback((value) => {
7630
- return onInstall(value);
7631
- }, [onInstall]);
7632
- const renderRow = useCallback((option, ctx) => /* @__PURE__ */ jsx(PackageResultCard, {
7633
- option,
7634
- ctx,
7635
- typedTag
7636
- }), [typedTag]);
7637
- return /* @__PURE__ */ jsxs("div", {
7638
- className,
7639
- children: [/* @__PURE__ */ jsx("h3", {
7640
- className: "mb-4 font-semibold text-foreground",
7641
- children: "Install Package"
7642
- }), /* @__PURE__ */ jsx(SearchAutocomplete, {
7643
- fetchOptions,
7644
- onSelect: handleSelect,
7645
- selectLabel: "Install",
7646
- selectingContent: /* @__PURE__ */ jsx(PackageAnimation, {
7647
- animate: true,
7648
- loop: true,
7649
- color: "#6b7280",
7650
- size: 48
7651
- }),
7652
- placeholder: "Search packages (e.g. my-pkg, my-pkg@dev, my-pkg@1.2.3)...",
7653
- disabled,
7654
- renderRow,
7655
- keepOpenSelector: "[data-version-picker],[data-version-picker-trigger]"
7656
- })]
7657
- });
7658
- };
7659
- //#endregion
7660
7845
  //#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager-list.tsx
7661
7846
  const PackageDetail = ({ label, value }) => {
7662
7847
  return /* @__PURE__ */ jsxs("div", {
@@ -7671,15 +7856,31 @@ const PackageDetail = ({ label, value }) => {
7671
7856
  });
7672
7857
  };
7673
7858
  const PackageManagerListItem = (props) => {
7674
- const { registryPackage, onInstall, onUninstall, className } = props;
7859
+ const { registryPackage, onInstall, onUninstall, preferredTag, className } = props;
7675
7860
  const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
7676
7861
  const canPickVersion = registryPackage.status === "available" || registryPackage.status === "dismissed";
7677
7862
  const hasVersionMetadata = registryPackage.distTags && Object.keys(registryPackage.distTags).length > 0 || (registryPackage.versions?.length ?? 0) > 0;
7678
7863
  const [selected, setSelected] = useState(() => resolveDefaultVersionSelection({
7679
7864
  distTags: registryPackage.distTags,
7680
7865
  versions: registryPackage.versions,
7681
- version: registryPackage.version
7866
+ version: registryPackage.version,
7867
+ preferredTag
7682
7868
  }));
7869
+ useEffect(() => {
7870
+ if (!preferredTag) return;
7871
+ if (registryPackage.distTags && preferredTag in registryPackage.distTags) setSelected({
7872
+ kind: "tag",
7873
+ value: preferredTag
7874
+ });
7875
+ else if (registryPackage.versions?.includes(preferredTag)) setSelected({
7876
+ kind: "version",
7877
+ value: preferredTag
7878
+ });
7879
+ }, [
7880
+ preferredTag,
7881
+ registryPackage.distTags,
7882
+ registryPackage.versions
7883
+ ]);
7683
7884
  const installDropdownItem = {
7684
7885
  id: "install",
7685
7886
  label: "Install",
@@ -7716,31 +7917,38 @@ const PackageManagerListItem = (props) => {
7716
7917
  }),
7717
7918
  registryPackage.manifest !== null && (() => {
7718
7919
  const { description, category, publisher } = registryPackage.manifest;
7719
- if (!(description != null || category != null || publisher?.name != null || publisher?.url != null)) return null;
7920
+ const publisherName = publisher?.name;
7921
+ const publisherUrl = publisher?.url;
7922
+ const hasText = (value) => typeof value === "string" && value.trim() !== "";
7923
+ const showDescription = hasText(description);
7924
+ const showCategory = hasText(category);
7925
+ const showPublisher = hasText(publisherName);
7926
+ const showPublisherUrl = hasText(publisherUrl);
7927
+ if (!showDescription && !showCategory && !showPublisher && !showPublisherUrl) return null;
7720
7928
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
7721
- description != null && /* @__PURE__ */ jsx(PackageDetail, {
7929
+ showDescription && /* @__PURE__ */ jsx(PackageDetail, {
7722
7930
  label: "Description",
7723
7931
  value: description
7724
7932
  }),
7725
- category != null && /* @__PURE__ */ jsx(PackageDetail, {
7933
+ showCategory && /* @__PURE__ */ jsx(PackageDetail, {
7726
7934
  label: "Category",
7727
7935
  value: category
7728
7936
  }),
7729
- publisher?.name != null && /* @__PURE__ */ jsx(PackageDetail, {
7937
+ showPublisher && /* @__PURE__ */ jsx(PackageDetail, {
7730
7938
  label: "Publisher",
7731
- value: publisher.name
7939
+ value: publisherName
7732
7940
  }),
7733
- publisher?.url != null && /* @__PURE__ */ jsx(PackageDetail, {
7941
+ showPublisherUrl && /* @__PURE__ */ jsx(PackageDetail, {
7734
7942
  label: "Publisher URL",
7735
7943
  value: /* @__PURE__ */ jsx("a", {
7736
7944
  className: "underline",
7737
- href: publisher.url,
7738
- children: publisher.url
7945
+ href: publisherUrl,
7946
+ children: publisherUrl
7739
7947
  })
7740
7948
  })
7741
7949
  ] });
7742
7950
  })(),
7743
- /* @__PURE__ */ jsx(ConnectDropdownMenu, {
7951
+ dropdownItems.length > 0 && /* @__PURE__ */ jsx(ConnectDropdownMenu, {
7744
7952
  items: dropdownItems,
7745
7953
  onItemClick: (id) => {
7746
7954
  if (id === "install") {
@@ -7766,141 +7974,46 @@ const PackageManagerListItem = (props) => {
7766
7974
  ]
7767
7975
  });
7768
7976
  };
7769
- const PackageManagerList = (props) => {
7770
- const { className, registryPackageList, onInstall, onUninstall } = props;
7771
- const [maxHeight, setMaxHeight] = useState();
7772
- const locallyInstalledPackages = registryPackageList.filter((p) => p.status === "local-install");
7773
- const registryInstalledPackages = registryPackageList.filter((p) => p.status === "registry-install");
7774
- const availablePackages = registryPackageList.filter((p) => p.status === "available");
7775
- const dismissedPackages = registryPackageList.filter((p) => p.status === "dismissed");
7776
- useLayoutEffect(() => {
7777
- const calculateMaxHeight = () => {
7778
- const availableHeight = window.innerHeight - 516;
7779
- setMaxHeight(Math.max(200, availableHeight));
7780
- };
7781
- calculateMaxHeight();
7782
- window.addEventListener("resize", calculateMaxHeight);
7783
- return () => window.removeEventListener("resize", calculateMaxHeight);
7784
- }, []);
7785
- const hasLocallyInstalled = locallyInstalledPackages.length > 0;
7786
- const hasRegistryInstalled = registryInstalledPackages.length > 0;
7787
- const hasAnyInstalled = hasLocallyInstalled || hasRegistryInstalled;
7788
- const hasAvailable = availablePackages.length > 0;
7789
- const hasDismissed = dismissedPackages.length > 0;
7790
- const installedCount = locallyInstalledPackages.length + registryInstalledPackages.length;
7791
- return /* @__PURE__ */ jsx("div", {
7792
- className: twMerge("flex flex-col items-stretch overflow-hidden", className),
7793
- style: { maxHeight },
7794
- children: /* @__PURE__ */ jsxs("div", {
7795
- className: "flex-1 overflow-y-auto pr-2",
7796
- children: [
7797
- /* @__PURE__ */ jsxs(PackageSection, {
7798
- sectionId: "installed",
7799
- title: "Installed Packages",
7800
- count: installedCount,
7801
- isEmpty: !hasAnyInstalled,
7802
- emptyText: "No packages installed.",
7803
- children: [hasLocallyInstalled && /* @__PURE__ */ jsx(PackageSubSection, {
7804
- title: "Locally installed",
7805
- count: locallyInstalledPackages.length,
7806
- children: /* @__PURE__ */ jsx(PackageList, {
7807
- packages: locallyInstalledPackages,
7808
- onInstall,
7809
- onUninstall
7810
- })
7811
- }), hasRegistryInstalled && /* @__PURE__ */ jsx(PackageSubSection, {
7812
- title: "Installed from registry",
7813
- count: registryInstalledPackages.length,
7814
- children: /* @__PURE__ */ jsx(PackageList, {
7815
- packages: registryInstalledPackages,
7816
- onInstall,
7817
- onUninstall
7818
- })
7819
- })]
7820
- }),
7821
- /* @__PURE__ */ jsx(PackageSection, {
7822
- sectionId: "available",
7823
- title: "Available Packages",
7824
- count: availablePackages.length,
7825
- isEmpty: !hasAvailable,
7826
- emptyText: "No packages available to install.",
7827
- children: /* @__PURE__ */ jsx(PackageList, {
7828
- packages: availablePackages,
7829
- onInstall,
7830
- onUninstall
7831
- })
7832
- }),
7833
- hasDismissed && /* @__PURE__ */ jsx(PackageSection, {
7834
- sectionId: "dismissed",
7835
- title: "Dismissed Packages",
7836
- count: dismissedPackages.length,
7837
- children: /* @__PURE__ */ jsx(PackageList, {
7838
- packages: dismissedPackages,
7839
- onInstall,
7840
- onUninstall
7841
- })
7842
- })
7843
- ]
7844
- })
7977
+ /**
7978
+ * Scroll region shared by both Package Manager tab panels. Fills the space
7979
+ * the panel gives it and scrolls its overflow. This works because the tab
7980
+ * panel sits inside the settings content card, which has a bounded height
7981
+ * (`m-6 ... h-full flex-1 overflow-hidden`); the flex chain down to here is
7982
+ * unbroken (`min-h-0` + `flex-1`/`h-full` at every level), so no
7983
+ * viewport-measuring hack is needed.
7984
+ */
7985
+ const PackagePanelScrollArea = ({ children, className, onReachEnd }) => {
7986
+ const scrollRef = useRef(null);
7987
+ const sentinelRef = useRef(null);
7988
+ const onReachEndRef = useRef(onReachEnd);
7989
+ useEffect(() => {
7990
+ onReachEndRef.current = onReachEnd;
7845
7991
  });
7846
- };
7847
- const STORAGE_KEY = "ph:package-manager:collapsed-sections";
7848
- function loadCollapsedSections() {
7849
- if (typeof window === "undefined") return {};
7850
- try {
7851
- const raw = window.localStorage.getItem(STORAGE_KEY);
7852
- return raw ? JSON.parse(raw) : {};
7853
- } catch {
7854
- return {};
7855
- }
7856
- }
7857
- function useCollapsedSection(sectionId) {
7858
- const [collapsed, setCollapsed] = useState(() => loadCollapsedSections()[sectionId] ?? true);
7992
+ const hasHandler = onReachEnd !== void 0;
7859
7993
  useEffect(() => {
7860
- if (typeof window === "undefined") return;
7861
- try {
7862
- const current = loadCollapsedSections();
7863
- current[sectionId] = collapsed;
7864
- window.localStorage.setItem(STORAGE_KEY, JSON.stringify(current));
7865
- } catch {}
7866
- }, [sectionId, collapsed]);
7867
- return [collapsed, useCallback(() => setCollapsed((prev) => !prev), [])];
7868
- }
7869
- const PackageSection = ({ sectionId, title, count, isEmpty, emptyText, children }) => {
7870
- const [collapsed, toggle] = useCollapsedSection(sectionId);
7871
- const contentId = `package-section-${sectionId}`;
7872
- return /* @__PURE__ */ jsxs("section", {
7873
- className: "mb-6",
7874
- children: [/* @__PURE__ */ jsx("h3", {
7875
- className: "sticky top-0 z-10 mb-3 border-b border-border bg-background text-foreground",
7876
- children: /* @__PURE__ */ jsxs("button", {
7877
- type: "button",
7878
- onClick: toggle,
7879
- "aria-expanded": !collapsed,
7880
- "aria-controls": contentId,
7881
- className: "flex w-full items-center gap-2 pb-2 text-left text-base font-semibold text-foreground hover:hover-effect",
7882
- children: [
7883
- /* @__PURE__ */ jsx(Icon, {
7884
- name: "ChevronDown",
7885
- size: 16,
7886
- className: twMerge("shrink-0 text-foreground transition-transform", collapsed && "-rotate-90")
7887
- }),
7888
- /* @__PURE__ */ jsx("span", { children: title }),
7889
- /* @__PURE__ */ jsx("span", {
7890
- className: "text-xs font-medium text-foreground",
7891
- children: count
7892
- })
7893
- ]
7894
- })
7895
- }), !collapsed && /* @__PURE__ */ jsx("div", {
7896
- id: contentId,
7897
- children: isEmpty ? /* @__PURE__ */ jsx("p", {
7898
- className: "text-sm text-foreground",
7899
- children: emptyText
7900
- }) : /* @__PURE__ */ jsx("div", {
7901
- className: "flex flex-col gap-4",
7902
- children
7903
- })
7994
+ if (!hasHandler) return;
7995
+ const root = scrollRef.current;
7996
+ const sentinel = sentinelRef.current;
7997
+ if (!root || !sentinel) return;
7998
+ const observer = new IntersectionObserver((entries) => {
7999
+ if (entries.some((e) => e.isIntersecting)) onReachEndRef.current?.();
8000
+ }, {
8001
+ root,
8002
+ rootMargin: "200px"
8003
+ });
8004
+ observer.observe(sentinel);
8005
+ return () => observer.disconnect();
8006
+ }, [hasHandler]);
8007
+ return /* @__PURE__ */ jsxs("div", {
8008
+ ref: scrollRef,
8009
+ className: twMerge("min-h-0 flex-1 overflow-y-auto", className),
8010
+ children: [/* @__PURE__ */ jsx("div", {
8011
+ className: "pr-3 pb-3",
8012
+ children
8013
+ }), hasHandler && /* @__PURE__ */ jsx("div", {
8014
+ ref: sentinelRef,
8015
+ "aria-hidden": true,
8016
+ className: "h-px w-full"
7904
8017
  })]
7905
8018
  });
7906
8019
  };
@@ -7917,31 +8030,286 @@ const PackageSubSection = ({ title, count, children }) => {
7917
8030
  })]
7918
8031
  }), children] });
7919
8032
  };
7920
- const PackageList = ({ packages, onInstall, onUninstall }) => {
8033
+ const PackageList = ({ packages, onInstall, onUninstall, preferredTag }) => {
7921
8034
  return /* @__PURE__ */ jsx("ul", {
7922
- className: "flex flex-col items-stretch gap-4 pr-2",
8035
+ className: "flex flex-col items-stretch gap-4",
7923
8036
  children: packages.map((pkg) => /* @__PURE__ */ jsx(PackageManagerListItem, {
7924
8037
  registryPackage: pkg,
7925
8038
  onInstall,
7926
- onUninstall
8039
+ onUninstall,
8040
+ preferredTag
7927
8041
  }, pkg.name))
7928
8042
  });
7929
8043
  };
7930
8044
  //#endregion
8045
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/package-registry-error.tsx
8046
+ /**
8047
+ * Friendly registry-error banner. Never surfaces raw API / network messages —
8048
+ * those stay in the console for debugging.
8049
+ */
8050
+ const PackageRegistryError = ({ variant, onRetry }) => {
8051
+ const isEmpty = variant === "empty";
8052
+ return /* @__PURE__ */ jsxs("div", {
8053
+ className: isEmpty ? "flex items-start gap-3 rounded-lg border border-destructive bg-destructive/10 p-4" : "flex items-start gap-3 rounded-lg border border-destructive bg-destructive/10 px-3 py-2.5",
8054
+ role: "alert",
8055
+ children: [
8056
+ /* @__PURE__ */ jsx(Icon, {
8057
+ name: "Error",
8058
+ size: 16,
8059
+ className: "mt-0.5 shrink-0 text-destructive"
8060
+ }),
8061
+ /* @__PURE__ */ jsxs("div", {
8062
+ className: "min-w-0 flex-1",
8063
+ children: [
8064
+ /* @__PURE__ */ jsx("p", {
8065
+ className: "text-sm font-medium text-destructive",
8066
+ children: isEmpty ? "Couldn't load packages" : "Couldn't refresh packages"
8067
+ }),
8068
+ /* @__PURE__ */ jsx("p", {
8069
+ className: "mt-0.5 text-xs text-muted-foreground",
8070
+ children: isEmpty ? "We couldn't reach the package registry. Check your connection and try again." : "Showing previously loaded packages. Check your connection and try again."
8071
+ }),
8072
+ isEmpty && onRetry && /* @__PURE__ */ jsx("button", {
8073
+ type: "button",
8074
+ onClick: onRetry,
8075
+ className: "mt-3 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect",
8076
+ children: "Try again"
8077
+ })
8078
+ ]
8079
+ }),
8080
+ !isEmpty && onRetry && /* @__PURE__ */ jsx("button", {
8081
+ type: "button",
8082
+ onClick: onRetry,
8083
+ className: "shrink-0 self-center rounded-md border border-border bg-background px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:hover-effect",
8084
+ children: "Try again"
8085
+ })
8086
+ ]
8087
+ });
8088
+ };
8089
+ //#endregion
8090
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/package-search-input.tsx
8091
+ /**
8092
+ * Plain controlled search box shared by the Installed/Available tabs. It only
8093
+ * reports the query — filtering happens in the panels (client-side today, a
8094
+ * registry search endpoint later).
8095
+ */
8096
+ const PackageSearchInput = (props) => {
8097
+ const { value, onChange, placeholder, disabled, className } = props;
8098
+ return /* @__PURE__ */ jsxs("div", {
8099
+ className: twMerge("relative", className),
8100
+ children: [/* @__PURE__ */ jsx(Icon, {
8101
+ name: "Search",
8102
+ size: 14,
8103
+ className: "absolute top-1/2 left-2 -translate-y-1/2 text-muted-foreground"
8104
+ }), /* @__PURE__ */ jsx(Input, {
8105
+ value,
8106
+ onChange: (e) => onChange(e.target.value),
8107
+ placeholder,
8108
+ disabled,
8109
+ className: "pl-7"
8110
+ })]
8111
+ });
8112
+ };
8113
+ //#endregion
8114
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/available-packages-panel.tsx
8115
+ const LoadingRow = ({ label, center }) => /* @__PURE__ */ jsxs("div", {
8116
+ className: `flex items-center gap-2 text-sm text-muted-foreground ${center ? "justify-center" : ""}`,
8117
+ children: [/* @__PURE__ */ jsx(PackageAnimation, {
8118
+ animate: true,
8119
+ loop: true,
8120
+ color: "#6b7280",
8121
+ size: 24
8122
+ }), /* @__PURE__ */ jsx("span", { children: label })]
8123
+ });
8124
+ const AvailablePackagesPanel = (props) => {
8125
+ const { packages, installedNames, query, onQueryChange, serverSearch, isLoading, isLoadingMore, hasMore, onLoadMore, error, onRetry, mutable, onInstall, onUninstall, disabled } = props;
8126
+ const filtered = serverSearch ? packages : filterPackages(packages, query);
8127
+ const available = filtered.filter((p) => p.status === "available");
8128
+ const dismissed = filtered.filter((p) => p.status === "dismissed");
8129
+ const { name: queryName, tag: queryTag } = parsePackageSpec(query);
8130
+ const showNpmFallback = mutable && filtered.length === 0 && isPlausiblePackageName(queryName) && !installedNames.includes(queryName);
8131
+ const isEmpty = filtered.length === 0;
8132
+ const paginated = onLoadMore !== void 0;
8133
+ function renderContent() {
8134
+ if (isEmpty && isLoading) return /* @__PURE__ */ jsx(LoadingRow, {
8135
+ label: "Loading packages…",
8136
+ center: true
8137
+ });
8138
+ if (isEmpty && error) return /* @__PURE__ */ jsx(PackageRegistryError, {
8139
+ variant: "empty",
8140
+ onRetry
8141
+ });
8142
+ if (isEmpty) {
8143
+ if (showNpmFallback) return /* @__PURE__ */ jsx(NpmFallbackRow, {
8144
+ query,
8145
+ onInstall,
8146
+ disabled
8147
+ });
8148
+ return /* @__PURE__ */ jsx("p", {
8149
+ className: "text-sm text-foreground",
8150
+ children: query ? "No packages match your search." : "No packages available to install."
8151
+ });
8152
+ }
8153
+ return /* @__PURE__ */ jsxs("div", {
8154
+ className: "flex flex-col gap-4",
8155
+ children: [
8156
+ available.length > 0 && /* @__PURE__ */ jsx(PackageList, {
8157
+ packages: available,
8158
+ onInstall,
8159
+ onUninstall,
8160
+ preferredTag: queryTag
8161
+ }),
8162
+ dismissed.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
8163
+ title: "Dismissed",
8164
+ count: dismissed.length,
8165
+ children: /* @__PURE__ */ jsx(PackageList, {
8166
+ packages: dismissed,
8167
+ onInstall,
8168
+ onUninstall,
8169
+ preferredTag: queryTag
8170
+ })
8171
+ }),
8172
+ isLoadingMore && /* @__PURE__ */ jsx(LoadingRow, {
8173
+ label: "Loading more…",
8174
+ center: true
8175
+ }),
8176
+ paginated && !hasMore && !isLoadingMore && /* @__PURE__ */ jsx("p", {
8177
+ className: "py-2 text-center text-sm text-muted-foreground",
8178
+ children: "You’ve reached the end of the list."
8179
+ })
8180
+ ]
8181
+ });
8182
+ }
8183
+ return /* @__PURE__ */ jsxs("div", {
8184
+ className: "flex h-full flex-col gap-3",
8185
+ children: [/* @__PURE__ */ jsxs("div", {
8186
+ className: "pr-3",
8187
+ children: [
8188
+ /* @__PURE__ */ jsx(PackageSearchInput, {
8189
+ value: query,
8190
+ onChange: onQueryChange,
8191
+ placeholder: "Search available packages",
8192
+ disabled
8193
+ }),
8194
+ !isEmpty && isLoading && /* @__PURE__ */ jsx("div", {
8195
+ className: "mt-3",
8196
+ children: /* @__PURE__ */ jsx(LoadingRow, { label: "Refreshing packages…" })
8197
+ }),
8198
+ !isEmpty && error && /* @__PURE__ */ jsx("div", {
8199
+ className: "mt-3",
8200
+ children: /* @__PURE__ */ jsx(PackageRegistryError, {
8201
+ variant: "refresh",
8202
+ onRetry
8203
+ })
8204
+ })
8205
+ ]
8206
+ }), /* @__PURE__ */ jsx(PackagePanelScrollArea, {
8207
+ onReachEnd: hasMore && onLoadMore ? onLoadMore : void 0,
8208
+ children: renderContent()
8209
+ })]
8210
+ });
8211
+ };
8212
+ //#endregion
8213
+ //#region src/connect/components/modal/settings-modal-v2/package-manager/installed-packages-panel.tsx
8214
+ const InstalledPackagesPanel = (props) => {
8215
+ const { packages, query, onQueryChange, onInstall, onUninstall, disabled } = props;
8216
+ const filtered = filterPackages(packages, query);
8217
+ const locallyInstalled = filtered.filter((p) => p.status === "local-install");
8218
+ const registryInstalled = filtered.filter((p) => p.status === "registry-install");
8219
+ return /* @__PURE__ */ jsxs("div", {
8220
+ className: "flex h-full flex-col gap-3",
8221
+ children: [/* @__PURE__ */ jsx("div", {
8222
+ className: "pr-3",
8223
+ children: /* @__PURE__ */ jsx(PackageSearchInput, {
8224
+ value: query,
8225
+ onChange: onQueryChange,
8226
+ placeholder: "Search installed packages",
8227
+ disabled
8228
+ })
8229
+ }), /* @__PURE__ */ jsx(PackagePanelScrollArea, { children: packages.length === 0 ? /* @__PURE__ */ jsx("p", {
8230
+ className: "text-sm text-foreground",
8231
+ children: "No packages installed."
8232
+ }) : filtered.length === 0 ? /* @__PURE__ */ jsx("p", {
8233
+ className: "text-sm text-foreground",
8234
+ children: "No installed packages match your search."
8235
+ }) : /* @__PURE__ */ jsxs("div", {
8236
+ className: "flex flex-col gap-4",
8237
+ children: [locallyInstalled.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
8238
+ title: "Locally installed",
8239
+ count: locallyInstalled.length,
8240
+ children: /* @__PURE__ */ jsx(PackageList, {
8241
+ packages: locallyInstalled,
8242
+ onInstall,
8243
+ onUninstall
8244
+ })
8245
+ }), registryInstalled.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
8246
+ title: "Installed from registry",
8247
+ count: registryInstalled.length,
8248
+ children: /* @__PURE__ */ jsx(PackageList, {
8249
+ packages: registryInstalled,
8250
+ onInstall,
8251
+ onUninstall
8252
+ })
8253
+ })]
8254
+ }) })]
8255
+ });
8256
+ };
8257
+ //#endregion
7931
8258
  //#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager.tsx
7932
8259
  const PackageManager = (props) => {
7933
- const { registryPackageList, onInstall, onUninstall, mutable, disabled, className } = props;
8260
+ const { installedPackages, availablePackages, isAvailableLoading, isLoadingMoreAvailable, hasMoreAvailable, onLoadMoreAvailable, availableError, onAvailableRetry, onAvailableSearchChange, onInstall, onUninstall, onAvailableTabOpen, initialTab = "installed", mutable, disabled, className } = props;
8261
+ const [installedQuery, setInstalledQuery] = useState("");
8262
+ const [availableQuery, setAvailableQuery] = useState("");
8263
+ useEffect(() => {
8264
+ if (initialTab === "available") onAvailableTabOpen?.();
8265
+ }, []);
8266
+ const installedNames = installedPackages.map((p) => p.name);
7934
8267
  return /* @__PURE__ */ jsxs("div", {
7935
- className: twMerge("flex h-full flex-1 flex-col rounded-lg bg-background p-3 text-foreground", className),
7936
- children: [mutable && /* @__PURE__ */ jsx(PackageManagerInput, {
7937
- className: "mb-4",
7938
- registryPackageList,
7939
- onInstall,
7940
- disabled
7941
- }), /* @__PURE__ */ jsx(PackageManagerList, {
7942
- registryPackageList,
7943
- onUninstall,
7944
- onInstall
8268
+ className: twMerge("flex min-h-0 flex-1 flex-col rounded-lg bg-background pt-3 pl-3 text-foreground", className),
8269
+ children: [/* @__PURE__ */ jsx("h2", {
8270
+ className: "mb-4 shrink-0 pr-3 font-semibold text-foreground",
8271
+ children: "Packages"
8272
+ }), /* @__PURE__ */ jsxs(Tabs, {
8273
+ defaultValue: initialTab,
8274
+ listClassName: "pr-3",
8275
+ onValueChange: (value) => {
8276
+ if (value === "available") onAvailableTabOpen?.();
8277
+ },
8278
+ children: [/* @__PURE__ */ jsx(TabContent, {
8279
+ value: "installed",
8280
+ label: `Installed (${installedPackages.length})`,
8281
+ children: /* @__PURE__ */ jsx(InstalledPackagesPanel, {
8282
+ packages: installedPackages,
8283
+ query: installedQuery,
8284
+ onQueryChange: setInstalledQuery,
8285
+ onInstall,
8286
+ onUninstall,
8287
+ disabled
8288
+ })
8289
+ }), /* @__PURE__ */ jsx(TabContent, {
8290
+ value: "available",
8291
+ label: "Available",
8292
+ children: /* @__PURE__ */ jsx(AvailablePackagesPanel, {
8293
+ packages: availablePackages,
8294
+ installedNames,
8295
+ query: availableQuery,
8296
+ onQueryChange: (q) => {
8297
+ setAvailableQuery(q);
8298
+ onAvailableSearchChange?.(q);
8299
+ },
8300
+ serverSearch: onAvailableSearchChange !== void 0,
8301
+ isLoading: isAvailableLoading,
8302
+ isLoadingMore: isLoadingMoreAvailable,
8303
+ hasMore: hasMoreAvailable,
8304
+ onLoadMore: onLoadMoreAvailable,
8305
+ error: availableError,
8306
+ onRetry: onAvailableRetry,
8307
+ mutable,
8308
+ onInstall,
8309
+ onUninstall,
8310
+ disabled
8311
+ })
8312
+ })]
7945
8313
  })]
7946
8314
  });
7947
8315
  };
@@ -7950,19 +8318,21 @@ const PackageManager = (props) => {
7950
8318
  function SettingsModal(props) {
7951
8319
  const { title, overlayProps, contentProps, onOpenChange, tabs, defaultTab, navFooter, ...restProps } = props;
7952
8320
  const [selectedTab, setSelectedTab] = useState(defaultTab ?? tabs.at(0)?.id);
7953
- const tabsContent = tabs.map((tab) => /* @__PURE__ */ jsx("button", {
7954
- type: "button",
7955
- onClick: () => setSelectedTab(tab.id),
7956
- children: /* @__PURE__ */ jsxs("div", {
7957
- className: twMerge("flex h-9 w-48 cursor-pointer items-center gap-x-2 rounded-md pl-3 text-foreground hover:hover-effect", selectedTab === tab.id ? "bg-background" : "bg-transparent"),
8321
+ const tabsContent = tabs.map((tab) => {
8322
+ const isActive = selectedTab === tab.id;
8323
+ return /* @__PURE__ */ jsxs("button", {
8324
+ type: "button",
8325
+ "aria-current": isActive ? "page" : void 0,
8326
+ onClick: isActive ? void 0 : () => setSelectedTab(tab.id),
8327
+ className: twMerge("flex h-9 w-48 items-center gap-x-2 rounded-md pl-3 text-left text-foreground", isActive ? "cursor-default bg-accent" : "cursor-pointer bg-transparent hover:bg-accent"),
7958
8328
  children: [tab.icon, /* @__PURE__ */ jsx("span", { children: tab.label })]
7959
- })
7960
- }, tab.id));
8329
+ }, tab.id);
8330
+ });
7961
8331
  const SelectedTabComponent = tabs.find((tab) => tab.id === selectedTab)?.content;
7962
8332
  return /* @__PURE__ */ jsxs(Modal, {
7963
8333
  contentProps: {
7964
8334
  ...contentProps,
7965
- className: twMerge("min-h-full w-full max-w-4xl rounded-xl", contentProps?.className)
8335
+ className: twMerge("flex max-h-[calc(100dvh-14rem)] min-h-full w-full max-w-4xl flex-col rounded-xl", contentProps?.className)
7966
8336
  },
7967
8337
  onOpenChange,
7968
8338
  overlayProps: {
@@ -7986,7 +8356,7 @@ function SettingsModal(props) {
7986
8356
  })
7987
8357
  })]
7988
8358
  }), /* @__PURE__ */ jsxs("div", {
7989
- className: "flex flex-1",
8359
+ className: "flex min-h-0 flex-1",
7990
8360
  children: [/* @__PURE__ */ jsxs("div", {
7991
8361
  className: "flex flex-col p-3 pt-6",
7992
8362
  children: [/* @__PURE__ */ jsx("div", {
@@ -7997,7 +8367,7 @@ function SettingsModal(props) {
7997
8367
  children: navFooter
7998
8368
  })]
7999
8369
  }), /* @__PURE__ */ jsx("div", {
8000
- className: "m-6 flex h-full flex-1 flex-col overflow-hidden rounded-lg border border-border bg-background",
8370
+ className: "m-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-background",
8001
8371
  children: typeof SelectedTabComponent === "function" ? /* @__PURE__ */ jsx(SelectedTabComponent, {}) : SelectedTabComponent
8002
8372
  })]
8003
8373
  })]
@@ -8772,50 +9142,20 @@ var renown_short_hover_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA
8772
9142
  //#region assets/renown-short.png
8773
9143
  var renown_short_default = "data:image/png;base64,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";
8774
9144
  //#endregion
8775
- //#region src/connect/components/account-popover/account-popover-login.tsx
8776
- const AccountPopoverLogin = ({ onLogin }) => {
8777
- const [loading, setLoading] = useState(false);
8778
- const allowLogin = !loading && !!onLogin;
8779
- const content = loading ? /* @__PURE__ */ jsx(Icon, {
8780
- name: "Reload",
8781
- size: 14,
8782
- className: "animate-spin"
8783
- }) : /* @__PURE__ */ jsx("span", { children: "Connect" });
8784
- const handleLogin = () => {
8785
- if (onLogin) {
8786
- setLoading(true);
8787
- onLogin();
8788
- }
8789
- };
8790
- return /* @__PURE__ */ jsxs("div", {
8791
- className: "p-4",
8792
- children: [/* @__PURE__ */ jsx("div", {
8793
- className: "mb-4 flex justify-center",
8794
- children: /* @__PURE__ */ jsx("div", {
8795
- className: "flex h-5.5 w-20.75 items-center justify-center overflow-hidden text-foreground",
8796
- children: /* @__PURE__ */ jsx(Icon, {
8797
- name: "RenownLight",
8798
- size: 83
8799
- })
8800
- })
8801
- }), /* @__PURE__ */ jsx("button", {
8802
- onClick: allowLogin ? handleLogin : void 0,
8803
- className: twMerge("mt-4 flex h-7 w-full cursor-pointer items-center justify-center rounded-lg border border-border bg-transparent text-sm text-foreground active:active-effect", allowLogin ? "cursor-pointer" : "cursor-wait"),
8804
- type: "button",
8805
- children: content
8806
- })]
8807
- });
8808
- };
8809
- //#endregion
8810
9145
  //#region src/connect/components/sidebar/sidebar-login.tsx
8811
9146
  const SidebarLogin = ({ onLogin }) => {
8812
- const content = /* @__PURE__ */ jsx(AccountPopoverLogin, { onLogin });
9147
+ const [open, setOpen] = useState(false);
8813
9148
  const { theme } = useTheme();
8814
9149
  const isDark = theme === "dark";
8815
9150
  const src = isDark ? renown_short_dark_default : renown_short_default;
8816
9151
  const hoverSrc = isDark ? renown_short_hover_dark_default : renown_short_hover_default;
8817
9152
  return /* @__PURE__ */ jsx(AccountPopover, {
8818
- content,
9153
+ open,
9154
+ onOpenChange: setOpen,
9155
+ content: /* @__PURE__ */ jsx(AccountPopoverLogin, { onLogin: onLogin ? () => {
9156
+ setOpen(false);
9157
+ onLogin();
9158
+ } : void 0 }),
8819
9159
  children: /* @__PURE__ */ jsxs("div", {
8820
9160
  className: twMerge("group/sidebar-footer flex w-full items-baseline justify-start text-sm/10 font-semibold text-foreground", onLogin ? "cursor-pointer" : "cursor-wait"),
8821
9161
  children: [/* @__PURE__ */ jsx("img", {
@@ -9139,6 +9479,6 @@ const removeSuccessFiles = (files) => {
9139
9479
  return files.filter((file) => file.status !== "SUCCESS");
9140
9480
  };
9141
9481
  //#endregion
9142
- export { About, AccountPopover, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageManager, PackageManagerInput, PackageManagerList, PackageManagerListItem, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, getFolderStatus, locationInfoByLocation, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
9482
+ export { About, AccountPopover, AccountPopoverLogin, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, AvailablePackagesPanel, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, CreateDocumentWithTypeModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, InstalledPackagesPanel, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, ModalButton, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageList, PackageManager, PackageManagerListItem, PackagePanelScrollArea, PackageRegistryError, PackageSubSection, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RenownLoginMethods, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, formatFileSize, generateId, getFolderStatus, locationInfoByLocation, mapProgressStageToStatus, mapUploadsToFileItems, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
9143
9483
 
9144
9484
  //# sourceMappingURL=index.js.map