@ethersphere/bee-dashboard 0.34.0 → 0.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/build/assets/__vite-browser-external-BmZ7Lxtg.js +2 -0
  2. package/build/assets/{download.browser-C9Uz7OzH.js → download.browser-BISIRUf5.js} +1 -1
  3. package/build/assets/{download.node-tVxxcrzZ.js → download.node-C7FKEca1.js} +1 -1
  4. package/build/assets/fs.node-DO9PavmO.js +2 -0
  5. package/build/assets/index-BmV9k6jK.js +116 -0
  6. package/build/assets/index-DMp5phAM.css +1 -0
  7. package/build/assets/vendor-ethers-BjcsqZe1.js +25 -0
  8. package/build/assets/{vendor-react-mui-CMfvLA_U.js → vendor-react-mui-Dv6xxk4a.js} +1 -1
  9. package/build/index.html +4 -4
  10. package/lib/{App-DJxgFkgf.js → App-BsgbFuqW.js} +663 -456
  11. package/lib/{App-CyZvPEkk.mjs → App-CtEEza9I.mjs} +663 -456
  12. package/lib/App.cjs.js +1 -1
  13. package/lib/App.css +51 -51
  14. package/lib/App.js +1 -1
  15. package/lib/components/StampExtensionModal.d.ts +10 -4
  16. package/lib/constants.d.ts +2 -0
  17. package/lib/{download.browser-Bp7NWws0.js → download.browser-BhXh2eCY.js} +1 -1
  18. package/lib/{download.browser-Cta85Yx2.mjs → download.browser-JHhkjxaR.mjs} +1 -1
  19. package/lib/{download.node-B-ryR03L.mjs → download.node-Bf2R_PzI.mjs} +1 -1
  20. package/lib/{download.node-C_IiKmHA.js → download.node-CzhxALxQ.js} +1 -1
  21. package/lib/{fs.node-l47yAJ14.mjs → fs.node-CR5kFsrm.mjs} +1 -1
  22. package/lib/{fs.node-DOrfMQwF.js → fs.node-DrM1ewLt.js} +1 -1
  23. package/lib/modules/filemanager/components/ConfirmModal/ConfirmModal.d.ts +1 -1
  24. package/lib/modules/filemanager/components/ExpiringNotificationModal/ExpiringNotificationModal.d.ts +4 -2
  25. package/lib/pages/files/AssetPreview.d.ts +1 -0
  26. package/lib/{upload.node-D_XLym_5.mjs → upload.node-BUOo237h.mjs} +3 -3
  27. package/lib/{upload.node-DUSvlJwc.js → upload.node-DRiLZjhW.js} +3 -3
  28. package/lib/utils/chain.d.ts +6 -0
  29. package/lib/utils/file.d.ts +11 -0
  30. package/lib/utils/index.d.ts +0 -7
  31. package/lib/utils/stamp.d.ts +8 -0
  32. package/package.json +1 -1
  33. package/build/assets/fs.node-B2ZMKqzu.js +0 -2
  34. package/build/assets/index-BTuZ_M-A.js +0 -116
  35. package/build/assets/index-CPiKID9h.css +0 -1
  36. package/build/assets/upload.node-W5QYw_5j.js +0 -2
  37. package/build/assets/vendor-ethers-DTkFbbYN.js +0 -16
  38. package/lib/modules/filemanager/utils/view.d.ts +0 -11
@@ -48858,6 +48858,8 @@ const BEE_DESKTOP_LATEST_RELEASE_PAGE = "https://github.com/ethersphere/bee-desk
48858
48858
  const BEE_DESKTOP_LATEST_RELEASE_PAGE_API = "https://api.github.com/repos/ethersphere/bee-desktop/releases/latest";
48859
48859
  const DEFAULT_BEE_API_HOST = "http://localhost:1633";
48860
48860
  const DEFAULT_RPC_URL = "https://xdai.fairdatasociety.org";
48861
+ const MIN_STAMP_DEPTH = 17;
48862
+ const MAX_STAMP_DEPTH = 255;
48861
48863
  class AuthError extends Error {
48862
48864
  constructor() {
48863
48865
  super("Bad API key");
@@ -68452,8 +68454,18 @@ function chainIdToName(chainId) {
68452
68454
  function ethAddressString(address) {
68453
68455
  return typeof address === "string" ? getAddress(address) : getAddress(address.toHex());
68454
68456
  }
68457
+ class FixedIdJsonRpcProvider extends JsonRpcProvider {
68458
+ async _send(payload) {
68459
+ const results = await super._send(payload);
68460
+ const payloads = Array.isArray(payload) ? payload : [payload];
68461
+ return results.map((result, i2) => ({ ...result, id: payloads[i2]?.id ?? result.id }));
68462
+ }
68463
+ }
68455
68464
  function newGnosisProvider(url) {
68456
- return new JsonRpcProvider(url, GnosisNetwork, { staticNetwork: true });
68465
+ return new FixedIdJsonRpcProvider(url, GnosisNetwork, { staticNetwork: true, batchMaxCount: 1 });
68466
+ }
68467
+ function newGnosisProviderForValidation(url) {
68468
+ return new FixedIdJsonRpcProvider(url, void 0, { batchMaxCount: 1 });
68457
68469
  }
68458
68470
  const initialValues$9 = {
68459
68471
  beeApi: null,
@@ -68895,7 +68907,7 @@ const Warning = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
68895
68907
  const Web = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
68896
68908
  d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m-5 14H4v-4h11zm0-5H4V9h11zm5 5h-4V9h4z"
68897
68909
  }), "Web");
68898
- const useStyles$C = makeStyles()((theme2) => ({
68910
+ const useStyles$D = makeStyles()((theme2) => ({
68899
68911
  root: {
68900
68912
  width: "100%",
68901
68913
  padding: 0,
@@ -68921,7 +68933,7 @@ const useStyles$C = makeStyles()((theme2) => ({
68921
68933
  }
68922
68934
  }));
68923
68935
  function ExpandableList({ children, label, level, defaultOpen, info }) {
68924
- const { classes: classes2 } = useStyles$C();
68936
+ const { classes: classes2 } = useStyles$D();
68925
68937
  const [open2, setOpen] = useState(Boolean(defaultOpen));
68926
68938
  const handleClick = () => {
68927
68939
  setOpen(!open2);
@@ -68996,7 +69008,7 @@ function requireInformationLineIcon() {
68996
69008
  }
68997
69009
  var InformationLineIconExports = requireInformationLineIcon();
68998
69010
  const Info = /* @__PURE__ */ getDefaultExportFromCjs(InformationLineIconExports);
68999
- const useStyles$B = makeStyles()((theme2) => ({
69011
+ const useStyles$C = makeStyles()((theme2) => ({
69000
69012
  header: {
69001
69013
  backgroundColor: theme2.palette.background.paper,
69002
69014
  marginBottom: theme2.spacing(0.25),
@@ -69013,16 +69025,16 @@ const useStyles$B = makeStyles()((theme2) => ({
69013
69025
  }
69014
69026
  }));
69015
69027
  function ExpandableListItem({ label, value, tooltip }) {
69016
- const { classes: classes2 } = useStyles$B();
69028
+ const { classes: classes2 } = useStyles$C();
69017
69029
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: classes2.header, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "100%", children: [
69018
69030
  label && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", children: label }) }),
69019
- value && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", children: [
69031
+ value && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", component: "div", children: [
69020
69032
  value,
69021
69033
  tooltip && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: tooltip, placement: "top", arrow: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "small", className: classes2.copyValue, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Info, { strokeWidth: 1 }) }) })
69022
69034
  ] }) })
69023
69035
  ] }) });
69024
69036
  }
69025
- const useStyles$A = makeStyles()((theme2) => ({
69037
+ const useStyles$B = makeStyles()((theme2) => ({
69026
69038
  wrapper: {
69027
69039
  display: "flex",
69028
69040
  flexDirection: "row",
@@ -69034,7 +69046,7 @@ const useStyles$A = makeStyles()((theme2) => ({
69034
69046
  }
69035
69047
  }));
69036
69048
  function ExpandableListItemActions({ children }) {
69037
- const { classes: classes2 } = useStyles$A();
69049
+ const { classes: classes2 } = useStyles$B();
69038
69050
  if (Array.isArray(children)) {
69039
69051
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.wrapper, children: children.filter((x) => x).map((a2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.action, children: a2 }, i2)) });
69040
69052
  }
@@ -69202,15 +69214,21 @@ function useClipboardCopy(value) {
69202
69214
  tooltipCloseHandler
69203
69215
  };
69204
69216
  }
69205
- const useStyles$z = makeStyles()((theme2) => ({
69217
+ const useStyles$A = makeStyles()((theme2) => ({
69206
69218
  header: {
69207
69219
  backgroundColor: theme2.palette.background.paper,
69208
69220
  marginBottom: theme2.spacing(0.25),
69209
- borderLeft: `${theme2.spacing(0.25)}px solid rgba(0,0,0,0)`,
69210
- wordBreak: "break-word"
69221
+ borderLeft: `${theme2.spacing(0.25)} solid rgba(0,0,0,0)`,
69222
+ wordBreak: "break-word",
69223
+ "&:hover": {
69224
+ backgroundColor: theme2.palette.background.paper
69225
+ },
69226
+ "&:focus-within": {
69227
+ backgroundColor: theme2.palette.background.paper
69228
+ }
69211
69229
  },
69212
69230
  headerOpen: {
69213
- borderLeft: `${theme2.spacing(0.25)}px solid ${theme2.palette.primary.main}`
69231
+ borderLeft: `${theme2.spacing(0.25)} solid ${theme2.palette.primary.main}`
69214
69232
  },
69215
69233
  copyValue: {
69216
69234
  cursor: "pointer",
@@ -69239,14 +69257,14 @@ const split = (s2) => {
69239
69257
  return s2.match(/(0x|.{1,8})/gi) || [];
69240
69258
  };
69241
69259
  function ExpandableListItemKey({ label, value, expanded }) {
69242
- const { classes: classes2 } = useStyles$z();
69260
+ const { classes: classes2 } = useStyles$A();
69243
69261
  const [open2, setOpen] = useState(expanded || false);
69244
69262
  const { copied, handleCopy, tooltipCloseHandler } = useClipboardCopy(value);
69245
69263
  const toggleOpen = () => setOpen(!open2);
69246
69264
  const splitValues = split(value);
69247
69265
  const hasPrefix = isPrefixedHexString(value);
69248
69266
  const spanText = `${hasPrefix ? `${splitValues[0]} ${splitValues[1]}` : splitValues[0]}[…]${splitValues[splitValues.length - 1]}`;
69249
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "column", justifyContent: "space-between", alignItems: "stretch", children: [
69267
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "column", justifyContent: "space-between", alignItems: "stretch", style: { width: "100%" }, children: [
69250
69268
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
69251
69269
  label && /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", component: "span", children: label }),
69252
69270
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", component: "span", children: [
@@ -69304,7 +69322,7 @@ function requirePulseLineIcon() {
69304
69322
  }
69305
69323
  var PulseLineIconExports = requirePulseLineIcon();
69306
69324
  const Activity = /* @__PURE__ */ getDefaultExportFromCjs(PulseLineIconExports);
69307
- const useStyles$y = makeStyles()((theme2) => ({
69325
+ const useStyles$z = makeStyles()((theme2) => ({
69308
69326
  root: {
69309
69327
  height: "100%"
69310
69328
  },
@@ -69320,7 +69338,7 @@ const useStyles$y = makeStyles()((theme2) => ({
69320
69338
  }
69321
69339
  }));
69322
69340
  function TroubleshootConnectionCard() {
69323
- const { classes: classes2 } = useStyles$y();
69341
+ const { classes: classes2 } = useStyles$z();
69324
69342
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "column", justifyContent: "center", alignItems: "center", className: classes2.root, children: [
69325
69343
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { className: classes2.content, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h1", align: "center", children: "Uh oh, it looks like your node is not connected." }) }),
69326
69344
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { className: classes2.content, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { align: "center", children: [
@@ -69392,7 +69410,7 @@ function requireDownloadLineIcon() {
69392
69410
  }
69393
69411
  var DownloadLineIconExports = requireDownloadLineIcon();
69394
69412
  const Download$1 = /* @__PURE__ */ getDefaultExportFromCjs(DownloadLineIconExports);
69395
- const useStyles$x = makeStyles()((theme2) => ({
69413
+ const useStyles$y = makeStyles()((theme2) => ({
69396
69414
  link: {
69397
69415
  color: "#dd7700",
69398
69416
  textDecoration: "underline",
@@ -69404,14 +69422,14 @@ const useStyles$x = makeStyles()((theme2) => ({
69404
69422
  }
69405
69423
  },
69406
69424
  buttonSelected: {
69407
- color: "white",
69408
- backgroundColor: theme2.palette.primary.main,
69425
+ color: theme2.palette.secondary.main,
69426
+ backgroundColor: "white",
69409
69427
  "&:hover": {
69410
- color: theme2.palette.secondary.main,
69411
- backgroundColor: "white",
69428
+ color: "white",
69429
+ backgroundColor: theme2.palette.primary.main,
69412
69430
  "@media (hover: none)": {
69413
- color: "white",
69414
- backgroundColor: theme2.palette.primary.main
69431
+ color: theme2.palette.secondary.main,
69432
+ backgroundColor: "white"
69415
69433
  }
69416
69434
  }
69417
69435
  },
@@ -69430,7 +69448,7 @@ function WithdrawDepositModal({
69430
69448
  action,
69431
69449
  icon
69432
69450
  }) {
69433
- const { classes: classes2 } = useStyles$x();
69451
+ const { classes: classes2 } = useStyles$y();
69434
69452
  const [open2, setOpen] = useState(false);
69435
69453
  const [amount, setAmount] = useState("");
69436
69454
  const [amountToken, setAmountToken] = useState(null);
@@ -71027,26 +71045,6 @@ function shortenText(text, length2 = 20, separator = "[…]") {
71027
71045
  }
71028
71046
  return `${text.slice(0, length2)}${separator}${text.slice(-length2)}`;
71029
71047
  }
71030
- const DEFAULT_POLLING_FREQUENCY = 1e3;
71031
- const DEFAULT_STAMP_USABLE_TIMEOUT = 5 * 6e4;
71032
- function waitUntilStampUsable(batchId, bee, options) {
71033
- return waitForStamp(batchId, bee);
71034
- }
71035
- async function waitForStamp(batchId, bee, options) {
71036
- const timeout3 = DEFAULT_STAMP_USABLE_TIMEOUT;
71037
- const pollingFrequency = DEFAULT_POLLING_FREQUENCY;
71038
- for (let i2 = 0; i2 < timeout3; i2 += pollingFrequency) {
71039
- try {
71040
- const stamp = await bee.getPostageBatch(batchId);
71041
- if (stamp.usable) {
71042
- return stamp;
71043
- }
71044
- } catch {
71045
- }
71046
- await sleepMs(pollingFrequency);
71047
- }
71048
- throw new Error("Wait until stamp usable timeout has been reached");
71049
- }
71050
71048
  function mergeAccounting(balances, settlements, uncashedAmounts) {
71051
71049
  if (!balances || !settlements) return null;
71052
71050
  const accounting = {};
@@ -71272,7 +71270,7 @@ const tabMap = {
71272
71270
  FEEDS: 3,
71273
71271
  STAKING: 4
71274
71272
  };
71275
- const useStyles$w = makeStyles()((theme2) => ({
71273
+ const useStyles$x = makeStyles()((theme2) => ({
71276
71274
  root: {
71277
71275
  flexGrow: 1,
71278
71276
  marginBottom: theme2.spacing(4),
@@ -71286,7 +71284,7 @@ const useStyles$w = makeStyles()((theme2) => ({
71286
71284
  }
71287
71285
  }));
71288
71286
  function AccountNavigation({ active }) {
71289
- const { classes: classes2 } = useStyles$w();
71287
+ const { classes: classes2 } = useStyles$x();
71290
71288
  const navigate = useNavigate();
71291
71289
  const { nodeInfo } = useContext(Context$7);
71292
71290
  function onChange(_event, newValue) {
@@ -71508,7 +71506,7 @@ function requireDownload2LineIcon() {
71508
71506
  }
71509
71507
  var Download2LineIconExports = requireDownload2LineIcon();
71510
71508
  const DownloadIcon = /* @__PURE__ */ getDefaultExportFromCjs(Download2LineIconExports);
71511
- const useStyles$v = makeStyles()(() => ({
71509
+ const useStyles$w = makeStyles()(() => ({
71512
71510
  button: {
71513
71511
  height: "42px",
71514
71512
  position: "relative",
@@ -71546,7 +71544,7 @@ function SwarmButton({
71546
71544
  style: style2,
71547
71545
  ...other
71548
71546
  }) {
71549
- const { classes: classes2 } = useStyles$v();
71547
+ const { classes: classes2 } = useStyles$w();
71550
71548
  function getIconColor() {
71551
71549
  if (loading || disabled) {
71552
71550
  return "rgba(0, 0, 0, 0.26)";
@@ -71605,8 +71603,47 @@ function Provider$6({ children }) {
71605
71603
  }, [setIdentities]);
71606
71604
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Context$6.Provider, { value: { identities, setIdentities }, children });
71607
71605
  }
71606
+ function validateDepthInput(depthInput, onError, onSuccess) {
71607
+ let validDepthInput = "0";
71608
+ if (!depthInput) {
71609
+ onError("Required field");
71610
+ } else {
71611
+ const depth = new BigNumber(depthInput);
71612
+ if (!depth.isInteger()) {
71613
+ onError("Depth must be an integer");
71614
+ } else if (depth.isLessThan(MIN_STAMP_DEPTH)) {
71615
+ onError(`Minimal depth is ${MIN_STAMP_DEPTH}`);
71616
+ } else if (depth.isGreaterThan(MAX_STAMP_DEPTH)) {
71617
+ onError(`Depth has to be at most ${MAX_STAMP_DEPTH}`);
71618
+ } else {
71619
+ onError("");
71620
+ validDepthInput = depthInput;
71621
+ }
71622
+ }
71623
+ onSuccess(validDepthInput);
71624
+ }
71625
+ const DEFAULT_POLLING_FREQUENCY = 1e3;
71626
+ const DEFAULT_STAMP_USABLE_TIMEOUT = 5 * 6e4;
71627
+ function waitUntilStampUsable(batchId, bee, options) {
71628
+ return waitForStamp(batchId, bee);
71629
+ }
71630
+ async function waitForStamp(batchId, bee, options) {
71631
+ const timeout3 = DEFAULT_STAMP_USABLE_TIMEOUT;
71632
+ const pollingFrequency = DEFAULT_POLLING_FREQUENCY;
71633
+ for (let i2 = 0; i2 < timeout3; i2 += pollingFrequency) {
71634
+ try {
71635
+ const stamp = await bee.getPostageBatch(batchId);
71636
+ if (stamp.usable) {
71637
+ return stamp;
71638
+ }
71639
+ } catch {
71640
+ }
71641
+ await sleepMs(pollingFrequency);
71642
+ }
71643
+ throw new Error("Wait until stamp usable timeout has been reached");
71644
+ }
71608
71645
  function generateWallet() {
71609
- const privateKey = randomBytes(PrivateKey.LENGTH).toString();
71646
+ const privateKey = new Bytes(randomBytes(PrivateKey.LENGTH)).toString();
71610
71647
  return new Wallet(privateKey);
71611
71648
  }
71612
71649
  function persistIdentity(identities, identity2) {
@@ -71689,24 +71726,24 @@ function SwarmDialog({ children }) {
71689
71726
  }
71690
71727
  );
71691
71728
  }
71692
- const useStyles$u = makeStyles()((theme2) => ({
71729
+ const useStyles$v = makeStyles()((theme2) => ({
71693
71730
  wrapper: {
71694
71731
  padding: theme2.spacing(1),
71695
71732
  cursor: "pointer"
71696
71733
  }
71697
71734
  }));
71698
71735
  function CloseButton({ onClose }) {
71699
- const { classes: classes2 } = useStyles$u();
71736
+ const { classes: classes2 } = useStyles$v();
71700
71737
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.wrapper, onClick: onClose, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Close, {}) });
71701
71738
  }
71702
- const useStyles$t = makeStyles()(() => ({
71739
+ const useStyles$u = makeStyles()(() => ({
71703
71740
  text: {
71704
71741
  color: "#606060",
71705
71742
  fontWeight: "bold"
71706
71743
  }
71707
71744
  }));
71708
71745
  function TitleWithClose({ children, onClose }) {
71709
- const { classes: classes2 } = useStyles$t();
71746
+ const { classes: classes2 } = useStyles$u();
71710
71747
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", alignItems: "center", children: [
71711
71748
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: " " }),
71712
71749
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { className: classes2.text, align: "center", children }),
@@ -71847,7 +71884,7 @@ function requireClipboardLineIcon() {
71847
71884
  }
71848
71885
  var ClipboardLineIconExports = requireClipboardLineIcon();
71849
71886
  const Clipboard = /* @__PURE__ */ getDefaultExportFromCjs(ClipboardLineIconExports);
71850
- const useStyles$s = makeStyles()((theme2) => ({
71887
+ const useStyles$t = makeStyles()((theme2) => ({
71851
71888
  wrapper: {
71852
71889
  overflow: "scroll",
71853
71890
  background: "#ffffff"
@@ -71865,17 +71902,17 @@ function prettifyString(string) {
71865
71902
  }
71866
71903
  }
71867
71904
  function Code({ children, prettify }) {
71868
- const { classes: classes2 } = useStyles$s();
71905
+ const { classes: classes2 } = useStyles$t();
71869
71906
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.wrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: classes2.pre, children: prettify ? prettifyString(children) : children }) });
71870
71907
  }
71871
- const useStyles$r = makeStyles()(() => ({
71908
+ const useStyles$s = makeStyles()(() => ({
71872
71909
  wrapper: {
71873
71910
  maxWidth: "100%"
71874
71911
  }
71875
71912
  }));
71876
71913
  function ExportFeedDialog({ identity: identity2, onClose }) {
71877
71914
  const { enqueueSnackbar } = useSnackbar();
71878
- const { classes: classes2 } = useStyles$r();
71915
+ const { classes: classes2 } = useStyles$s();
71879
71916
  function onDownload() {
71880
71917
  FileSaver_minExports.saveAs(
71881
71918
  new Blob([identity2.identity], {
@@ -74036,7 +74073,7 @@ function TextField2({ children, ...props }) {
74036
74073
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TextField$1, { ...fieldToTextField(props), children });
74037
74074
  }
74038
74075
  TextField2.displayName = "FormikMaterialUITextField";
74039
- const useStyles$q = makeStyles()((theme2) => ({
74076
+ const useStyles$r = makeStyles()((theme2) => ({
74040
74077
  field: {
74041
74078
  background: theme2.palette.background.paper,
74042
74079
  "& fieldset": {
@@ -74063,7 +74100,7 @@ function SwarmTextInput({
74063
74100
  defaultValue,
74064
74101
  placeholder
74065
74102
  }) {
74066
- const { classes: classes2 } = useStyles$q();
74103
+ const { classes: classes2 } = useStyles$r();
74067
74104
  if (formik) {
74068
74105
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
74069
74106
  Field,
@@ -74077,7 +74114,7 @@ function SwarmTextInput({
74077
74114
  variant: "filled",
74078
74115
  className: classes2.field,
74079
74116
  defaultValue: defaultValue || "",
74080
- InputProps: { disableUnderline: true },
74117
+ slotProps: { input: { disableUnderline: true } },
74081
74118
  placeholder
74082
74119
  }
74083
74120
  );
@@ -74093,12 +74130,12 @@ function SwarmTextInput({
74093
74130
  className: classes2.field,
74094
74131
  defaultValue: defaultValue || "",
74095
74132
  onChange,
74096
- InputProps: { disableUnderline: true },
74133
+ slotProps: { input: { disableUnderline: true } },
74097
74134
  placeholder
74098
74135
  }
74099
74136
  );
74100
74137
  }
74101
- const useStyles$p = makeStyles()((theme2) => ({
74138
+ const useStyles$q = makeStyles()((theme2) => ({
74102
74139
  textarea: {
74103
74140
  width: "100%",
74104
74141
  border: 0,
@@ -74114,7 +74151,7 @@ function ImportFeedDialog({ onClose }) {
74114
74151
  const fileInputRef = useRef(null);
74115
74152
  const { identities, setIdentities } = useContext(Context$6);
74116
74153
  const { enqueueSnackbar } = useSnackbar();
74117
- const { classes: classes2 } = useStyles$p();
74154
+ const { classes: classes2 } = useStyles$q();
74118
74155
  async function onImport() {
74119
74156
  const feed = await importIdentity(name, textareaValue);
74120
74157
  if (feed) {
@@ -74231,7 +74268,7 @@ function AccountFeeds() {
74231
74268
  /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemKey, { label: "Topic", value: NULL_TOPIC.toHex() }),
74232
74269
  x.feedHash && /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemKey, { label: "Feed hash", value: x.feedHash }),
74233
74270
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 0.75, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExpandableListItemActions, { children: [
74234
- /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => viewFeed(x.uuid), iconType: Info, children: "View Feed Page" }),
74271
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => viewFeed(x.uuid), iconType: Info, disabled: Boolean(!x.feedHash), children: "View Feed Page" }),
74235
74272
  /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => onShowExport(x), iconType: DownloadIcon, children: "Export..." }),
74236
74273
  /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => onShowDelete(x), iconType: Trash, children: "Delete..." })
74237
74274
  ] }) })
@@ -74470,7 +74507,7 @@ function requireTimerFlashLineIcon() {
74470
74507
  }
74471
74508
  var TimerFlashLineIconExports = requireTimerFlashLineIcon();
74472
74509
  const TimerFlashLine = /* @__PURE__ */ getDefaultExportFromCjs(TimerFlashLineIconExports);
74473
- const useStyles$o = makeStyles()((theme2) => ({
74510
+ const useStyles$p = makeStyles()((theme2) => ({
74474
74511
  root: {
74475
74512
  width: "100%",
74476
74513
  padding: 0,
@@ -74499,7 +74536,7 @@ const useStyles$o = makeStyles()((theme2) => ({
74499
74536
  }
74500
74537
  }));
74501
74538
  function ExpandableElement({ children, expandable, defaultOpen }) {
74502
- const { classes: classes2 } = useStyles$o();
74539
+ const { classes: classes2 } = useStyles$p();
74503
74540
  const [open2, setOpen] = useState(Boolean(defaultOpen));
74504
74541
  const handleClick = () => {
74505
74542
  setOpen(!open2);
@@ -74512,11 +74549,35 @@ function ExpandableElement({ children, expandable, defaultOpen }) {
74512
74549
  /* @__PURE__ */ jsxRuntimeExports.jsx(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.contentLevel12, children: expandable }) })
74513
74550
  ] });
74514
74551
  }
74515
- function StampExtensionModal({ type, icon, bee, stamp }) {
74552
+ const useStyles$o = makeStyles()((theme2) => ({
74553
+ buttonSelected: {
74554
+ color: "white",
74555
+ backgroundColor: theme2.palette.primary.main,
74556
+ "&:hover": {
74557
+ color: theme2.palette.secondary.main,
74558
+ backgroundColor: "white",
74559
+ "@media (hover: none)": {
74560
+ color: "white",
74561
+ backgroundColor: theme2.palette.primary.main
74562
+ }
74563
+ }
74564
+ },
74565
+ buttonUnselected: {
74566
+ color: "#dd7700",
74567
+ backgroundColor: "white"
74568
+ }
74569
+ }));
74570
+ var StampExtensionType = /* @__PURE__ */ ((StampExtensionType2) => {
74571
+ StampExtensionType2["Topup"] = "Topup";
74572
+ StampExtensionType2["Dilute"] = "Dilute";
74573
+ return StampExtensionType2;
74574
+ })(StampExtensionType || {});
74575
+ function StampExtensionModal({ type, icon, bee, stamp, status }) {
74576
+ const { classes: classes2 } = useStyles$o();
74516
74577
  const [open2, setOpen] = useState(false);
74517
74578
  const [amount, setAmount] = useState("");
74518
74579
  const { enqueueSnackbar } = useSnackbar();
74519
- const label = `${type} ${stamp.toHex().substring(0, 8)}`;
74580
+ const label = `${type} ${stamp.batchID.toHex().substring(0, 8)}`;
74520
74581
  const handleClickOpen = (e2) => {
74521
74582
  setOpen(true);
74522
74583
  e2.stopPropagation();
@@ -74525,28 +74586,57 @@ function StampExtensionModal({ type, icon, bee, stamp }) {
74525
74586
  setOpen(false);
74526
74587
  };
74527
74588
  const handleAction = async () => {
74589
+ if (status !== CheckState.OK) {
74590
+ enqueueSnackbar(`Node connection status is not ${CheckState.OK}: ${status}`, { variant: "error" });
74591
+ return;
74592
+ }
74528
74593
  if (type === "Topup") {
74594
+ const isAmountInvalid = BigInt(amount) <= BigInt(0);
74595
+ if (isAmountInvalid) {
74596
+ enqueueSnackbar(`Invalid amount: ${amount}, it must be greate than 0`, { variant: "error" });
74597
+ return;
74598
+ }
74529
74599
  try {
74530
- await bee.topUpBatch(stamp, amount);
74600
+ await bee.topUpBatch(stamp.batchID, amount);
74531
74601
  enqueueSnackbar(`Successfully topped up stamp, your changes will appear soon`, { variant: "success" });
74532
74602
  } catch (error) {
74533
74603
  enqueueSnackbar(`Failed to topup stamp: ${error || "Unknown reason"}`, { variant: "error" });
74534
74604
  }
74605
+ return;
74535
74606
  }
74536
74607
  if (type === "Dilute") {
74608
+ const newDepth = parseInt(amount, 10);
74609
+ const ttlDays = stamp.duration.toDays();
74610
+ const currentDepth = stamp.depth;
74611
+ const maxHalvings = Math.floor(Math.log2(ttlDays)) + currentDepth;
74612
+ const isDepthInvalid = newDepth > maxHalvings || newDepth <= currentDepth;
74613
+ if (isDepthInvalid) {
74614
+ enqueueSnackbar(`Invalid depth: ${newDepth} (${currentDepth} < new depth < ${maxHalvings})`, {
74615
+ variant: "error"
74616
+ });
74617
+ return;
74618
+ }
74619
+ if (ttlDays <= 2) {
74620
+ enqueueSnackbar(`TTL: ${ttlDays} <= 2 days, cannot dilute stamp (min. TTL is 1 day)`, {
74621
+ variant: "warning"
74622
+ });
74623
+ return;
74624
+ }
74537
74625
  try {
74538
- await bee.diluteBatch(stamp, parseInt(amount, 10));
74626
+ await bee.diluteBatch(stamp.batchID, newDepth);
74539
74627
  enqueueSnackbar(`Successfully diluted stamp, your changes will appear soon`, { variant: "success" });
74540
74628
  } catch (error) {
74541
74629
  enqueueSnackbar(`Failed to dilute stamp: ${error || "Unknown reason"}`, { variant: "error" });
74542
74630
  }
74631
+ return;
74543
74632
  }
74633
+ enqueueSnackbar(`Failed to extend stamp, unknown operation: ${type}`, { variant: "error" });
74544
74634
  };
74545
74635
  const handleChange = (event) => {
74546
74636
  setAmount(event.target.value);
74547
74637
  };
74548
74638
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
74549
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { variant: "contained", onClick: handleClickOpen, startIcon: icon, children: type }),
74639
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { className: classes2.buttonSelected, variant: "contained", onClick: handleClickOpen, startIcon: icon, children: type }),
74550
74640
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: open2, onClose: handleClose, "aria-labelledby": "form-dialog-title", children: [
74551
74641
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { id: "form-dialog-title", children: label }),
74552
74642
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -74564,7 +74654,18 @@ function StampExtensionModal({ type, icon, bee, stamp }) {
74564
74654
  ) }),
74565
74655
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogActions, { children: [
74566
74656
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: handleClose, color: "primary", children: "Cancel" }),
74567
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { disabled: amount === "", onClick: handleAction, color: "primary", children: type })
74657
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
74658
+ Button$1,
74659
+ {
74660
+ disabled: amount === "",
74661
+ onClick: async () => {
74662
+ await handleAction();
74663
+ handleClose();
74664
+ },
74665
+ color: "primary",
74666
+ children: type
74667
+ }
74668
+ )
74568
74669
  ] })
74569
74670
  ] })
74570
74671
  ] });
@@ -74752,6 +74853,102 @@ function packageFile(file, pathOverwrite) {
74752
74853
  bytes: file.bytes
74753
74854
  };
74754
74855
  }
74856
+ function getExtensionFromName(name) {
74857
+ const ext = name.split(".").pop()?.toLowerCase() || "";
74858
+ const hasExtension = name.includes(".") && ext && ext !== name;
74859
+ return hasExtension ? ext : "";
74860
+ }
74861
+ const EXT_TO_MIME = {
74862
+ mp4: "video/mp4",
74863
+ webm: "video/webm",
74864
+ ogv: "video/ogg",
74865
+ mp3: "audio/mpeg",
74866
+ m4a: "audio/mp4",
74867
+ aac: "audio/aac",
74868
+ wav: "audio/wav",
74869
+ ogg: "audio/ogg",
74870
+ png: "image/png",
74871
+ jpg: "image/jpeg",
74872
+ jpeg: "image/jpeg",
74873
+ gif: "image/gif",
74874
+ webp: "image/webp",
74875
+ avif: "image/avif",
74876
+ svg: "image/svg+xml",
74877
+ pdf: "application/pdf",
74878
+ txt: "text/plain",
74879
+ md: "text/markdown",
74880
+ json: "application/json",
74881
+ csv: "text/csv",
74882
+ html: "text/html",
74883
+ htm: "text/html",
74884
+ ico: "image/vnd.microsoft.icon"
74885
+ };
74886
+ function guessMime(name, mtdt) {
74887
+ const md = mtdt?.mimeType || mtdt?.mime || mtdt?.["content-type"];
74888
+ const ext = getExtensionFromName(name);
74889
+ if (md) return { mime: md, ext };
74890
+ const mime = EXT_TO_MIME[ext] || "application/octet-stream";
74891
+ return { mime, ext };
74892
+ }
74893
+ const VIDEO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#000">
74894
+ <video controls autoplay style="width:100%;height:100%" src="${u2}"></video>
74895
+ </body></html>`;
74896
+ const AUDIO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body>
74897
+ <audio controls autoplay style="width:100%" src="${u2}"></audio>
74898
+ </body></html>`;
74899
+ const IMAGE_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#111;display:grid;place-items:center;min-height:100vh">
74900
+ <img style="max-width:100%;max-height:100vh" src="${u2}" />
74901
+ </body></html>`;
74902
+ const VIEWERS = [
74903
+ {
74904
+ name: "video",
74905
+ test: (m) => m.startsWith("video/"),
74906
+ render: (w, url, mime, name) => {
74907
+ w.document.write(VIDEO_HTML(url, name));
74908
+ w.document.title = name;
74909
+ }
74910
+ },
74911
+ {
74912
+ name: "audio",
74913
+ test: (m) => m.startsWith("audio/"),
74914
+ render: (w, url, mime, name) => {
74915
+ w.document.write(AUDIO_HTML(url, name));
74916
+ w.document.title = name;
74917
+ }
74918
+ },
74919
+ {
74920
+ name: "image",
74921
+ test: (m) => m.startsWith("image/"),
74922
+ render: (w, url, mime, name) => {
74923
+ w.document.write(IMAGE_HTML(url, name));
74924
+ w.document.title = name;
74925
+ }
74926
+ },
74927
+ {
74928
+ name: "pdf",
74929
+ test: (m) => m === "application/pdf",
74930
+ render: (w, url, mime, name) => {
74931
+ w.document.title = name;
74932
+ w.location.href = url;
74933
+ }
74934
+ },
74935
+ {
74936
+ name: "html",
74937
+ test: (m) => m === "text/html",
74938
+ render: (w, url, mime, name) => {
74939
+ w.document.title = name;
74940
+ w.location.href = url;
74941
+ }
74942
+ },
74943
+ {
74944
+ name: "text-like",
74945
+ test: (m) => m.startsWith("text/") || m === "application/json" || m === "text/markdown",
74946
+ render: (w, url, mime, name) => {
74947
+ w.document.title = name;
74948
+ w.location.href = url;
74949
+ }
74950
+ }
74951
+ ];
74755
74952
  function Capacity({ width: width2, usage }) {
74756
74953
  const integerUsage = Math.round(usage * 100);
74757
74954
  const used = integerUsage + "%";
@@ -74772,6 +74969,7 @@ function PostageStamp({ stamp, shorten }) {
74772
74969
  }
74773
74970
  function StampsTable({ postageStamps }) {
74774
74971
  const { beeApi } = useContext(Context$8);
74972
+ const { status } = useContext(Context$7);
74775
74973
  if (!postageStamps || !beeApi) {
74776
74974
  return null;
74777
74975
  }
@@ -74785,8 +74983,8 @@ function StampsTable({ postageStamps }) {
74785
74983
  ExpandableListItem,
74786
74984
  {
74787
74985
  label: "Capacity",
74788
- value: `${getHumanReadableFileSize(2 ** stamp.depth * 4096 * stamp.usage)} / ${getHumanReadableFileSize(
74789
- 2 ** stamp.depth * 4096
74986
+ value: `${getHumanReadableFileSize(stamp.size.toBytes() - stamp.remainingSize.toBytes())} / ${getHumanReadableFileSize(
74987
+ stamp.size.toBytes()
74790
74988
  )}`
74791
74989
  }
74792
74990
  ),
@@ -74800,19 +74998,21 @@ function StampsTable({ postageStamps }) {
74800
74998
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74801
74999
  StampExtensionModal,
74802
75000
  {
74803
- type: "Topup",
75001
+ type: StampExtensionType.Topup,
74804
75002
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TimerFlashFill, { size: "1rem" }),
74805
75003
  bee: beeApi,
74806
- stamp: stamp.batchID
75004
+ stamp,
75005
+ status: status.all
74807
75006
  }
74808
75007
  ),
74809
75008
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74810
75009
  StampExtensionModal,
74811
75010
  {
74812
- type: "Dilute",
75011
+ type: StampExtensionType.Dilute,
74813
75012
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TimerFlashLine, { size: "1rem" }),
74814
75013
  bee: beeApi,
74815
- stamp: stamp.batchID
75014
+ stamp,
75015
+ status: status.all
74816
75016
  }
74817
75017
  )
74818
75018
  ] })
@@ -75175,7 +75375,7 @@ function WalletInfoCard() {
75175
75375
  4
75176
75376
  )} xBZZ | ${walletBalance.nativeTokenBalance.toSignificantDigits(4)} xDAI`;
75177
75377
  }
75178
- if (nodeInfo?.beeMode && ["light", "full", "dev"].includes(nodeInfo.beeMode)) {
75378
+ if (nodeInfo?.beeMode && [BeeModes.LIGHT, BeeModes.FULL, BeeModes.DEV].includes(nodeInfo.beeMode)) {
75179
75379
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
75180
75380
  Card$1,
75181
75381
  {
@@ -75332,6 +75532,7 @@ function SwarmSelect({
75332
75532
  value,
75333
75533
  className: classes2.select,
75334
75534
  displayEmpty: true,
75535
+ onChange,
75335
75536
  renderValue: (value2) => value2 ? renderValue(value2) : placeholder,
75336
75537
  MenuProps: { MenuListProps: { disablePadding: true }, PaperProps: { square: true } },
75337
75538
  children: options.map((x, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem$1, { value: x.value, className: classes2.option, children: x.label }, i2))
@@ -75368,6 +75569,7 @@ const initialValues$5 = {
75368
75569
  function CreateNewFeed() {
75369
75570
  const { beeApi } = useContext(Context$8);
75370
75571
  const { identities, setIdentities } = useContext(Context$6);
75572
+ const [identityType, setIdentityType] = useState(IdentityType.PrivateKey);
75371
75573
  const [loading, setLoading] = useState(false);
75372
75574
  const { enqueueSnackbar } = useSnackbar();
75373
75575
  const navigate = useNavigate();
@@ -75378,10 +75580,19 @@ function CreateNewFeed() {
75378
75580
  setLoading(false);
75379
75581
  return;
75380
75582
  }
75381
- const wallet = generateWallet();
75382
- const stamps = await beeApi.getPostageBatches();
75583
+ let stamps = [];
75584
+ let wallet;
75585
+ try {
75586
+ wallet = generateWallet();
75587
+ stamps = (await beeApi.getPostageBatches()).filter((s2) => s2.usable);
75588
+ } catch (err) {
75589
+ console.log(err);
75590
+ enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Error during wallet generation or postage stamp retrieval!" }), { variant: "error" });
75591
+ setLoading(false);
75592
+ return;
75593
+ }
75383
75594
  if (!stamps || !stamps.length) {
75384
- enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "No stamp available" }), { variant: "error" });
75595
+ enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "No usable stamp available" }), { variant: "error" });
75385
75596
  setLoading(false);
75386
75597
  return;
75387
75598
  }
@@ -75390,15 +75601,25 @@ function CreateNewFeed() {
75390
75601
  setLoading(false);
75391
75602
  return;
75392
75603
  }
75393
- const identity2 = await convertWalletToIdentity(wallet, values2.type, values2.identityName, values2.password);
75394
- persistIdentity(identities, identity2);
75395
- setIdentities(identities);
75396
- navigate(ROUTES.ACCOUNT_FEEDS);
75397
- setLoading(false);
75604
+ try {
75605
+ const identity2 = await convertWalletToIdentity(wallet, values2.type, values2.identityName, values2.password);
75606
+ persistIdentity(identities, identity2);
75607
+ setIdentities(identities);
75608
+ navigate(ROUTES.ACCOUNT_FEEDS);
75609
+ } catch (err) {
75610
+ console.log(err);
75611
+ enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Error identity creation!" }), { variant: "error" });
75612
+ } finally {
75613
+ setLoading(false);
75614
+ }
75398
75615
  }
75399
75616
  function cancel() {
75400
75617
  navigate(-1);
75401
75618
  }
75619
+ function onIdentityTypeChange(event) {
75620
+ const type = event.target.value;
75621
+ setIdentityType(type);
75622
+ }
75402
75623
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
75403
75624
  /* @__PURE__ */ jsxRuntimeExports.jsx(HistoryHeader, { children: "Create new feed" }),
75404
75625
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DocumentationText, { children: [
@@ -75423,10 +75644,13 @@ function CreateNewFeed() {
75423
75644
  {
75424
75645
  formik: true,
75425
75646
  name: "type",
75647
+ label: "type",
75648
+ value: identityType,
75426
75649
  options: [
75427
75650
  { label: "Keypair Only", value: IdentityType.PrivateKey },
75428
75651
  { label: "Password Protected", value: IdentityType.V3 }
75429
- ]
75652
+ ],
75653
+ onChange: onIdentityTypeChange
75430
75654
  }
75431
75655
  ) }),
75432
75656
  values2.type === IdentityType.V3 && /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmTextInput, { name: "password", label: "Password", password: true, formik: true }),
@@ -78387,8 +78611,8 @@ function UpdateFeed() {
78387
78611
  const { stamps, refresh } = useContext(Context$5);
78388
78612
  const { status } = useContext(Context$7);
78389
78613
  const { hash: hash2 } = useParams();
78390
- const [selectedStamp, setSelectedStamp] = useState(null);
78391
- const [selectedIdentity, setSelectedIdentity] = useState(null);
78614
+ const [selectedStamp, setSelectedStamp] = useState(stamps ? stamps[0]?.batchID.toHex() : null);
78615
+ const [selectedIdentity, setSelectedIdentity] = useState(identities[0] ?? null);
78392
78616
  const [loading, setLoading] = useState(false);
78393
78617
  const { enqueueSnackbar } = useSnackbar();
78394
78618
  const [showPasswordPrompt, setShowPasswordPrompt] = useState(false);
@@ -78460,18 +78684,23 @@ function UpdateFeed() {
78460
78684
  }
78461
78685
  ),
78462
78686
  /* @__PURE__ */ jsxRuntimeExports.jsx(HistoryHeader, { children: "Update feed" }),
78463
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
78687
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: identities && identities.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
78464
78688
  SwarmSelect,
78465
78689
  {
78690
+ value: selectedIdentity?.uuid ?? "",
78466
78691
  options: identities.map((x) => ({ value: x.uuid, label: `${x.name} Website` })),
78467
78692
  onChange: onFeedChange,
78468
78693
  label: "Feed"
78469
78694
  }
78470
- ) }) }),
78471
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: stamps ? /* @__PURE__ */ jsxRuntimeExports.jsx(
78695
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "You need to create an identiy first to be able to update its feed." }) }) }),
78696
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: stamps && stamps.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
78472
78697
  SwarmSelect,
78473
78698
  {
78474
- options: stamps.map((x) => ({ value: x.batchID.toHex(), label: x.batchID.toHex().slice(0, 8) })),
78699
+ value: selectedStamp ?? "",
78700
+ options: stamps.map((x) => ({
78701
+ value: x.batchID.toHex(),
78702
+ label: x.label ? x.batchID.toHex().slice(0, 8) + ` (${x.label})` : x.batchID.toHex().slice(0, 8)
78703
+ })),
78475
78704
  onChange: onStampChange,
78476
78705
  label: "Stamp"
78477
78706
  }
@@ -78491,128 +78720,6 @@ function UpdateFeed() {
78491
78720
  ] })
78492
78721
  ] });
78493
78722
  }
78494
- const Ctx = createContext(void 0);
78495
- function SearchProvider({ children }) {
78496
- const [query, _setQuery] = useState("");
78497
- const [scope, setScope] = useState("all");
78498
- const [includeActive, setIncludeActive] = useState(true);
78499
- const [includeTrashed, setIncludeTrashed] = useState(true);
78500
- const preSearchState = useRef(null);
78501
- const inSearch = useRef(false);
78502
- const setQuery = useCallback(
78503
- (q) => {
78504
- const trimmed = q.trim();
78505
- if (!inSearch.current && trimmed.length > 0) {
78506
- preSearchState.current = { scope, includeActive, includeTrashed };
78507
- inSearch.current = true;
78508
- }
78509
- if (inSearch.current && trimmed.length === 0) {
78510
- const prev2 = preSearchState.current;
78511
- if (prev2) {
78512
- setScope(prev2.scope);
78513
- setIncludeActive(prev2.includeActive);
78514
- setIncludeTrashed(prev2.includeTrashed);
78515
- }
78516
- preSearchState.current = null;
78517
- inSearch.current = false;
78518
- }
78519
- _setQuery(q);
78520
- },
78521
- [scope, includeActive, includeTrashed]
78522
- );
78523
- const clear = useCallback(() => {
78524
- setQuery("");
78525
- }, [setQuery]);
78526
- const value = useMemo(
78527
- () => ({
78528
- query,
78529
- scope,
78530
- includeActive,
78531
- includeTrashed,
78532
- setQuery,
78533
- clear,
78534
- setScope,
78535
- setIncludeActive,
78536
- setIncludeTrashed
78537
- }),
78538
- [query, scope, includeActive, includeTrashed, clear, setQuery]
78539
- );
78540
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Ctx.Provider, { value, children });
78541
- }
78542
- function useSearch() {
78543
- const v = useContext(Ctx);
78544
- if (!v) throw new Error("useFMSearch must be used within SearchProvider");
78545
- return v;
78546
- }
78547
- var FileTransferType = /* @__PURE__ */ ((FileTransferType2) => {
78548
- FileTransferType2["Upload"] = "upload";
78549
- FileTransferType2["Download"] = "download";
78550
- FileTransferType2["Update"] = "update";
78551
- return FileTransferType2;
78552
- })(FileTransferType || {});
78553
- var TransferStatus = /* @__PURE__ */ ((TransferStatus2) => {
78554
- TransferStatus2["Uploading"] = "uploading";
78555
- TransferStatus2["Downloading"] = "downloading";
78556
- TransferStatus2["Done"] = "done";
78557
- TransferStatus2["Error"] = "error";
78558
- TransferStatus2["Queued"] = "queued";
78559
- TransferStatus2["Cancelled"] = "cancelled";
78560
- return TransferStatus2;
78561
- })(TransferStatus || {});
78562
- var TransferBarColor = /* @__PURE__ */ ((TransferBarColor2) => {
78563
- TransferBarColor2["Upload"] = "#22c55e";
78564
- TransferBarColor2["Update"] = "#f59e0b";
78565
- TransferBarColor2["Download"] = "#3b82f6";
78566
- return TransferBarColor2;
78567
- })(TransferBarColor || {});
78568
- var ViewType = /* @__PURE__ */ ((ViewType2) => {
78569
- ViewType2["File"] = "file";
78570
- ViewType2["Trash"] = "trash";
78571
- ViewType2["Expired"] = "expired";
78572
- return ViewType2;
78573
- })(ViewType || {});
78574
- var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
78575
- ActionTag2["Trashed"] = "trashed";
78576
- ActionTag2["Recovered"] = "recovered";
78577
- ActionTag2["Restored"] = "restored";
78578
- return ActionTag2;
78579
- })(ActionTag || {});
78580
- var FileAction = /* @__PURE__ */ ((FileAction2) => {
78581
- FileAction2["Trash"] = "trash";
78582
- FileAction2["Forget"] = "forget";
78583
- FileAction2["Destroy"] = "destroy";
78584
- return FileAction2;
78585
- })(FileAction || {});
78586
- var DownloadState = /* @__PURE__ */ ((DownloadState2) => {
78587
- DownloadState2["InProgress"] = "in-progress";
78588
- DownloadState2["Cancelled"] = "cancelled";
78589
- DownloadState2["Error"] = "error";
78590
- return DownloadState2;
78591
- })(DownloadState || {});
78592
- const ViewContext = createContext(void 0);
78593
- function ViewProvider({ children }) {
78594
- const [view, setView] = useState(ViewType.File);
78595
- const [actualItemView, setActualItemView] = useState(void 0);
78596
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
78597
- ViewContext.Provider,
78598
- {
78599
- value: {
78600
- view,
78601
- setView,
78602
- actualItemView,
78603
- setActualItemView
78604
- },
78605
- children
78606
- }
78607
- );
78608
- }
78609
- function useView() {
78610
- const context = useContext(ViewContext);
78611
- if (!context) {
78612
- throw new Error("useView must be used within a ViewProvider");
78613
- }
78614
- return context;
78615
- }
78616
78723
  function isRecord(value) {
78617
78724
  return Types.isStrictlyObject(value) && Object.values(value).every((v) => typeof v === "string");
78618
78725
  }
@@ -78883,10 +78990,10 @@ P?.name || "";
78883
78990
  const bytesEndpoint = "bytes";
78884
78991
  async function processDownload(bee, resources, options, requestOptions) {
78885
78992
  if (O$1) {
78886
- const { downloadNode } = await import("./download.node-B-ryR03L.mjs");
78993
+ const { downloadNode } = await import("./download.node-Bf2R_PzI.mjs");
78887
78994
  return await downloadNode(bee, Object.values(resources), options, requestOptions);
78888
78995
  }
78889
- const { downloadBrowser } = await import("./download.browser-Cta85Yx2.mjs");
78996
+ const { downloadBrowser } = await import("./download.browser-JHhkjxaR.mjs");
78890
78997
  return await downloadBrowser(Object.values(resources), bee.url, bytesEndpoint, options, requestOptions);
78891
78998
  }
78892
78999
  class EventEmitterBase {
@@ -78943,7 +79050,7 @@ async function processUpload(bee, driveInfo, fileOptions, uploadOptions, request
78943
79050
  return processedOptions.file;
78944
79051
  }
78945
79052
  if (O$1) {
78946
- const { processUploadNode } = await import("./upload.node-D_XLym_5.mjs");
79053
+ const { processUploadNode } = await import("./upload.node-BUOo237h.mjs");
78947
79054
  const nodeOptions = processedOptions.options;
78948
79055
  return processUploadNode(bee, driveInfo, nodeOptions, uploadOptions, requestOptions);
78949
79056
  }
@@ -79727,6 +79834,51 @@ const FILE_MANAGER_EVENTS = {
79727
79834
  const POLLING_TIMEOUT_MS = 9e4;
79728
79835
  const UPLOAD_POLLING_TIMEOUT_MS = 1e4;
79729
79836
  const POLLING_INTERVAL_MS = 2e3;
79837
+ var FileTransferType = /* @__PURE__ */ ((FileTransferType2) => {
79838
+ FileTransferType2["Upload"] = "upload";
79839
+ FileTransferType2["Download"] = "download";
79840
+ FileTransferType2["Update"] = "update";
79841
+ return FileTransferType2;
79842
+ })(FileTransferType || {});
79843
+ var TransferStatus = /* @__PURE__ */ ((TransferStatus2) => {
79844
+ TransferStatus2["Uploading"] = "uploading";
79845
+ TransferStatus2["Downloading"] = "downloading";
79846
+ TransferStatus2["Done"] = "done";
79847
+ TransferStatus2["Error"] = "error";
79848
+ TransferStatus2["Queued"] = "queued";
79849
+ TransferStatus2["Cancelled"] = "cancelled";
79850
+ return TransferStatus2;
79851
+ })(TransferStatus || {});
79852
+ var TransferBarColor = /* @__PURE__ */ ((TransferBarColor2) => {
79853
+ TransferBarColor2["Upload"] = "#22c55e";
79854
+ TransferBarColor2["Update"] = "#f59e0b";
79855
+ TransferBarColor2["Download"] = "#3b82f6";
79856
+ return TransferBarColor2;
79857
+ })(TransferBarColor || {});
79858
+ var ViewType = /* @__PURE__ */ ((ViewType2) => {
79859
+ ViewType2["File"] = "file";
79860
+ ViewType2["Trash"] = "trash";
79861
+ ViewType2["Expired"] = "expired";
79862
+ return ViewType2;
79863
+ })(ViewType || {});
79864
+ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
79865
+ ActionTag2["Trashed"] = "trashed";
79866
+ ActionTag2["Recovered"] = "recovered";
79867
+ ActionTag2["Restored"] = "restored";
79868
+ return ActionTag2;
79869
+ })(ActionTag || {});
79870
+ var FileAction = /* @__PURE__ */ ((FileAction2) => {
79871
+ FileAction2["Trash"] = "trash";
79872
+ FileAction2["Forget"] = "forget";
79873
+ FileAction2["Destroy"] = "destroy";
79874
+ return FileAction2;
79875
+ })(FileAction || {});
79876
+ var DownloadState = /* @__PURE__ */ ((DownloadState2) => {
79877
+ DownloadState2["InProgress"] = "in-progress";
79878
+ DownloadState2["Cancelled"] = "cancelled";
79879
+ DownloadState2["Error"] = "error";
79880
+ return DownloadState2;
79881
+ })(DownloadState || {});
79730
79882
  const getUsableStamps = async (bee) => {
79731
79883
  try {
79732
79884
  return (await bee.getPostageBatches()).filter((s2) => s2.usable).sort((a2, b2) => (a2.label || "").localeCompare(b2.label || ""));
@@ -81345,7 +81497,12 @@ function AdminStatusBar({
81345
81497
  const isBusy = loading || isUpgrading || isCreationInProgress;
81346
81498
  const blurCls = isBusy ? " is-loading" : "";
81347
81499
  const statusVerb = isCreationInProgress ? "Creating" : "Loading";
81348
- const statusText = statusVerb + " admin drive, please do not reload";
81500
+ const statusText = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
81501
+ statusVerb,
81502
+ " admin drive — please do not reload the page.",
81503
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
81504
+ "This may take a few minutes."
81505
+ ] });
81349
81506
  const renderModalsAndOverlays = () => {
81350
81507
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
81351
81508
  isUpgradeDriveModalOpen && actualStamp && adminDrive && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -81429,6 +81586,83 @@ function ErrorModal({ label, onClick }) {
81429
81586
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-error-modal-button-container", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button2, { variant: "primary", label: "OK", width: 100, onClick }) })
81430
81587
  ] }) });
81431
81588
  }
81589
+ const Ctx = createContext(void 0);
81590
+ function SearchProvider({ children }) {
81591
+ const [query, _setQuery] = useState("");
81592
+ const [scope, setScope] = useState("all");
81593
+ const [includeActive, setIncludeActive] = useState(true);
81594
+ const [includeTrashed, setIncludeTrashed] = useState(true);
81595
+ const preSearchState = useRef(null);
81596
+ const inSearch = useRef(false);
81597
+ const setQuery = useCallback(
81598
+ (q) => {
81599
+ const trimmed = q.trim();
81600
+ if (!inSearch.current && trimmed.length > 0) {
81601
+ preSearchState.current = { scope, includeActive, includeTrashed };
81602
+ inSearch.current = true;
81603
+ }
81604
+ if (inSearch.current && trimmed.length === 0) {
81605
+ const prev2 = preSearchState.current;
81606
+ if (prev2) {
81607
+ setScope(prev2.scope);
81608
+ setIncludeActive(prev2.includeActive);
81609
+ setIncludeTrashed(prev2.includeTrashed);
81610
+ }
81611
+ preSearchState.current = null;
81612
+ inSearch.current = false;
81613
+ }
81614
+ _setQuery(q);
81615
+ },
81616
+ [scope, includeActive, includeTrashed]
81617
+ );
81618
+ const clear = useCallback(() => {
81619
+ setQuery("");
81620
+ }, [setQuery]);
81621
+ const value = useMemo(
81622
+ () => ({
81623
+ query,
81624
+ scope,
81625
+ includeActive,
81626
+ includeTrashed,
81627
+ setQuery,
81628
+ clear,
81629
+ setScope,
81630
+ setIncludeActive,
81631
+ setIncludeTrashed
81632
+ }),
81633
+ [query, scope, includeActive, includeTrashed, clear, setQuery]
81634
+ );
81635
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Ctx.Provider, { value, children });
81636
+ }
81637
+ function useSearch() {
81638
+ const v = useContext(Ctx);
81639
+ if (!v) throw new Error("useFMSearch must be used within SearchProvider");
81640
+ return v;
81641
+ }
81642
+ const ViewContext = createContext(void 0);
81643
+ function ViewProvider({ children }) {
81644
+ const [view, setView] = useState(ViewType.File);
81645
+ const [actualItemView, setActualItemView] = useState(void 0);
81646
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
81647
+ ViewContext.Provider,
81648
+ {
81649
+ value: {
81650
+ view,
81651
+ setView,
81652
+ actualItemView,
81653
+ setActualItemView
81654
+ },
81655
+ children
81656
+ }
81657
+ );
81658
+ }
81659
+ function useView() {
81660
+ const context = useContext(ViewContext);
81661
+ if (!context) {
81662
+ throw new Error("useView must be used within a ViewProvider");
81663
+ }
81664
+ return context;
81665
+ }
81432
81666
  class AbortManager {
81433
81667
  controllers = /* @__PURE__ */ new Map();
81434
81668
  create(key) {
@@ -81562,101 +81796,6 @@ async function performBulkFileOperation({
81562
81796
  const isPickerSupported = () => typeof window.showSaveFilePicker === "function";
81563
81797
  const isDirectoryPickerSupported = () => typeof window.showDirectoryPicker === "function";
81564
81798
  const isElementPickerSupported = (el) => typeof el.showPicker === "function";
81565
- const EXT_TO_MIME = {
81566
- mp4: "video/mp4",
81567
- webm: "video/webm",
81568
- ogv: "video/ogg",
81569
- mp3: "audio/mpeg",
81570
- m4a: "audio/mp4",
81571
- aac: "audio/aac",
81572
- wav: "audio/wav",
81573
- ogg: "audio/ogg",
81574
- png: "image/png",
81575
- jpg: "image/jpeg",
81576
- jpeg: "image/jpeg",
81577
- gif: "image/gif",
81578
- webp: "image/webp",
81579
- avif: "image/avif",
81580
- svg: "image/svg+xml",
81581
- pdf: "application/pdf",
81582
- txt: "text/plain",
81583
- md: "text/markdown",
81584
- json: "application/json",
81585
- csv: "text/csv",
81586
- html: "text/html",
81587
- htm: "text/html"
81588
- };
81589
- function getExtensionFromName(name) {
81590
- const ext = name.split(".").pop()?.toLowerCase() || "";
81591
- const hasExtension = name.includes(".") && ext && ext !== name;
81592
- return hasExtension ? ext : "";
81593
- }
81594
- function guessMime(name, mtdt) {
81595
- const md = mtdt?.mimeType || mtdt?.mime || mtdt?.["content-type"];
81596
- const ext = getExtensionFromName(name);
81597
- if (md) return { mime: md, ext };
81598
- const mime = EXT_TO_MIME[ext] || "application/octet-stream";
81599
- return { mime, ext };
81600
- }
81601
- const VIDEO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#000">
81602
- <video controls autoplay style="width:100%;height:100%" src="${u2}"></video>
81603
- </body></html>`;
81604
- const AUDIO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body>
81605
- <audio controls autoplay style="width:100%" src="${u2}"></audio>
81606
- </body></html>`;
81607
- const IMAGE_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#111;display:grid;place-items:center;min-height:100vh">
81608
- <img style="max-width:100%;max-height:100vh" src="${u2}" />
81609
- </body></html>`;
81610
- const VIEWERS = [
81611
- {
81612
- name: "video",
81613
- test: (m) => m.startsWith("video/"),
81614
- render: (w, url, mime, name) => {
81615
- w.document.write(VIDEO_HTML(url, name));
81616
- w.document.title = name;
81617
- }
81618
- },
81619
- {
81620
- name: "audio",
81621
- test: (m) => m.startsWith("audio/"),
81622
- render: (w, url, mime, name) => {
81623
- w.document.write(AUDIO_HTML(url, name));
81624
- w.document.title = name;
81625
- }
81626
- },
81627
- {
81628
- name: "image",
81629
- test: (m) => m.startsWith("image/"),
81630
- render: (w, url, mime, name) => {
81631
- w.document.write(IMAGE_HTML(url, name));
81632
- w.document.title = name;
81633
- }
81634
- },
81635
- {
81636
- name: "pdf",
81637
- test: (m) => m === "application/pdf",
81638
- render: (w, url, mime, name) => {
81639
- w.document.title = name;
81640
- w.location.href = url;
81641
- }
81642
- },
81643
- {
81644
- name: "html",
81645
- test: (m) => m === "text/html",
81646
- render: (w, url, mime, name) => {
81647
- w.document.title = name;
81648
- w.location.href = url;
81649
- }
81650
- },
81651
- {
81652
- name: "text-like",
81653
- test: (m) => m.startsWith("text/") || m === "application/json" || m === "text/markdown",
81654
- render: (w, url, mime, name) => {
81655
- w.document.title = name;
81656
- w.location.href = url;
81657
- }
81658
- }
81659
- ];
81660
81799
  const DefaultDownloadFolder = "downloads";
81661
81800
  const downloadAborts = new AbortManager();
81662
81801
  function createDownloadAbort(id2) {
@@ -82237,7 +82376,7 @@ function useDragAndDrop({ onFilesDropped }) {
82237
82376
  }
82238
82377
  function useFileFiltering(props) {
82239
82378
  const { files, currentDrive, view, isSearchMode, query, scope, includeActive, includeTrashed } = props;
82240
- const q = query.trim().toLowerCase();
82379
+ const q = query.trim().toLowerCase().normalize("NFC");
82241
82380
  const statusIncluded = useCallback(
82242
82381
  (fi) => {
82243
82382
  const trashed = isTrashed(fi);
@@ -82250,9 +82389,9 @@ function useFileFiltering(props) {
82250
82389
  const matchesQuery = useCallback(
82251
82390
  (fi) => {
82252
82391
  if (!q) return true;
82253
- const name = fi.name.toLowerCase();
82254
- const mime = (fi.customMetadata?.mime || "").toLowerCase();
82255
- const topic = String(fi.topic ?? "").toLowerCase();
82392
+ const name = fi.name.toLowerCase().normalize("NFC");
82393
+ const mime = (fi.customMetadata?.mime || "").toLowerCase().normalize("NFC");
82394
+ const topic = String(fi.topic ?? "").toLowerCase().normalize("NFC");
82256
82395
  return name.includes(q) || mime.includes(q) || topic.includes(q);
82257
82396
  },
82258
82397
  [q]
@@ -83867,11 +84006,13 @@ function ExpiringNotificationModalItem({
83867
84006
  }
83868
84007
  const EXPIRING_ITEMS_PAGE_SIZE = 3;
83869
84008
  function ExpiringNotificationModal({
84009
+ bee,
83870
84010
  stamps,
83871
84011
  drives,
83872
84012
  files,
83873
84013
  onCancelClick,
83874
- setErrorMessage
84014
+ setErrorMessage,
84015
+ setShowError
83875
84016
  }) {
83876
84017
  const [showUpgradeDriveModal, setShowUpgradeDriveModal] = useState(false);
83877
84018
  const [actualStamp, setActualStamp] = useState(void 0);
@@ -83910,7 +84051,15 @@ function ExpiringNotificationModal({
83910
84051
  files,
83911
84052
  currentPage,
83912
84053
  index,
83913
- onUpgradeClick: (stamp2, drive) => {
84054
+ onUpgradeClick: async (stamp2, drive) => {
84055
+ const isStampValid = await validateStampStillExists(bee, stamp2.batchID);
84056
+ if (!isStampValid) {
84057
+ setErrorMessage?.(
84058
+ `Drive ${drive.name} has expired. Please clear the browser cache and reload the page.`
84059
+ );
84060
+ setShowError(true);
84061
+ return;
84062
+ }
83914
84063
  setActualStamp(stamp2);
83915
84064
  setActualDrive(drive);
83916
84065
  setShowUpgradeDriveModal(true);
@@ -83958,7 +84107,7 @@ function NotificationBar({ setErrorMessage }) {
83958
84107
  const [stampsToExpire, setStampsToExpire] = useState([]);
83959
84108
  const [drivesToExpire, setDrivesToExpire] = useState([]);
83960
84109
  const { beeApi } = useContext(Context$8);
83961
- const { drives, files, adminDrive } = useContext(Context$3);
84110
+ const { drives, files, adminDrive, setShowError } = useContext(Context$3);
83962
84111
  const showExpiration = stampsToExpire.length > 0;
83963
84112
  useEffect(() => {
83964
84113
  let isMounted = true;
@@ -84020,16 +84169,18 @@ function NotificationBar({ setErrorMessage }) {
84020
84169
  " expiring soon ",
84021
84170
  /* @__PURE__ */ jsxRuntimeExports.jsx(UpIcon, { size: "16px" })
84022
84171
  ] }),
84023
- showExpiringModal && /* @__PURE__ */ jsxRuntimeExports.jsx(
84172
+ showExpiringModal && beeApi && /* @__PURE__ */ jsxRuntimeExports.jsx(
84024
84173
  ExpiringNotificationModal,
84025
84174
  {
84175
+ bee: beeApi,
84026
84176
  stamps: stampsToExpire,
84027
84177
  drives: drivesToExpire,
84028
84178
  files,
84029
84179
  onCancelClick: () => {
84030
84180
  setShowExpiringModal(false);
84031
84181
  },
84032
- setErrorMessage
84182
+ setErrorMessage,
84183
+ setShowError
84033
84184
  }
84034
84185
  )
84035
84186
  ] });
@@ -86349,7 +86500,8 @@ function ErrorModalBlock$1({
86349
86500
  if (!showError) {
86350
86501
  return null;
86351
86502
  }
86352
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorModal, { label, onClick: onOk });
86503
+ const modalRoot = document.querySelector(".fm-main") || document.body;
86504
+ return createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorModal, { label, onClick: onOk }), modalRoot);
86353
86505
  }
86354
86506
  const extractFilesFromClipboardEvent = (e2) => {
86355
86507
  const out = [];
@@ -86616,8 +86768,9 @@ function FileBrowser({ errorMessage, setErrorMessage }) {
86616
86768
  if (rafIdRef.current) {
86617
86769
  cancelAnimationFrame(rafIdRef.current);
86618
86770
  }
86771
+ setShowError(false);
86619
86772
  };
86620
- }, []);
86773
+ }, [setShowError]);
86621
86774
  useEffect(() => {
86622
86775
  let title = currentDrive?.name || "";
86623
86776
  if (isSearchMode) {
@@ -89183,7 +89336,11 @@ function Sidebar({ setErrorMessage, loading }) {
89183
89336
  );
89184
89337
  }) })
89185
89338
  ] }),
89186
- isDriveCreationInProgress && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-sidebar-drive-creation", children: "Creating drive, please do not reload" })
89339
+ isDriveCreationInProgress && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fm-sidebar-drive-creation", children: [
89340
+ "Creating drive — please do not reload the page.",
89341
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
89342
+ "This may take a few minutes."
89343
+ ] })
89187
89344
  ] });
89188
89345
  }
89189
89346
  var SupportedPlatforms = /* @__PURE__ */ ((SupportedPlatforms2) => {
@@ -89258,6 +89415,9 @@ function InitializationErrorBlock({ onOk }) {
89258
89415
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: "flex", justifyContent: "center", marginTop: "16px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { minWidth: "120px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button2, { label: "OK", variant: "primary", disabled: false, onClick: onOk }) }) })
89259
89416
  ] }) });
89260
89417
  }
89418
+ function UltraLightNodeErrorBlock() {
89419
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-main", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-loading", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-loading-title", children: "File Manager is not available with an Ultra-light node. Please upgrade to a Light node to continue." }) }) });
89420
+ }
89261
89421
  function ResetModalBlock({ cacheHelpUrl, onConfirm }) {
89262
89422
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-main", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89263
89423
  ConfirmModal,
@@ -89295,6 +89455,17 @@ function LoadingBlock() {
89295
89455
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-loading-subtitle", children: "Please wait a few seconds" })
89296
89456
  ] }) });
89297
89457
  }
89458
+ function ChainSyncingBlock() {
89459
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-main", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fm-loading", "aria-live": "polite", children: [
89460
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-spinner", "aria-hidden": "true" }),
89461
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-loading-title", children: "Bee node is syncing…" }),
89462
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fm-loading-subtitle", children: [
89463
+ "Your Bee node is still syncing the postage batch state from the chain.",
89464
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
89465
+ "File Manager will be available once the sync is complete."
89466
+ ] })
89467
+ ] }) });
89468
+ }
89298
89469
  function ErrorModalBlock({ onClick, label }) {
89299
89470
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorModal, { label, onClick });
89300
89471
  }
@@ -89345,7 +89516,7 @@ function FileManagerPage() {
89345
89516
  const [isCreationInProgress, setIsCreationInProgress] = useState(false);
89346
89517
  const [connectionErrorDismissed, setConnectionErrorDismissed] = useState(false);
89347
89518
  const [cacheHelpUrl, setCacheHelpUrl] = useState(cacheClearUrls[BrowserPlatform.Chrome]);
89348
- const { status } = useContext(Context$7);
89519
+ const { status, chainState, nodeInfo } = useContext(Context$7);
89349
89520
  const { fm, initDone, shallReset, adminDrive, initializationError, notifyPkSaved } = useContext(Context$3);
89350
89521
  useEffect(() => {
89351
89522
  isMountedRef.current = true;
@@ -89372,15 +89543,19 @@ function FileManagerPage() {
89372
89543
  }
89373
89544
  }, [isConnectionError]);
89374
89545
  const pageState = useMemo(() => {
89546
+ const isChainSyncing = chainState === null;
89375
89547
  if (!isBeeReady && !initDone) return "connecting";
89548
+ if (nodeInfo?.beeMode === BeeModes.ULTRA_LIGHT) return "ultra-light-node";
89376
89549
  if (!hasPk) return "no-pk";
89377
89550
  if (!initDone) return "loading";
89378
89551
  if (shallReset && !resetAcknowledged) return "reset";
89379
89552
  if (initializationError && !shallReset) return "init-error";
89380
- if (showAdminErrorModal) return "admin-error";
89381
89553
  const hasAdminStamp = Boolean(fm?.adminStamp);
89382
89554
  const hasAdminDrive = Boolean(adminDrive);
89383
- if (!hasAdminStamp && !hasAdminDrive && !isCreationInProgress) return "initial";
89555
+ const setupIncomplete = !hasAdminStamp && !hasAdminDrive;
89556
+ if (setupIncomplete && isChainSyncing) return "chain-syncing";
89557
+ if (showAdminErrorModal) return "admin-error";
89558
+ if (setupIncomplete && !isCreationInProgress) return "initial";
89384
89559
  return "ready";
89385
89560
  }, [
89386
89561
  isBeeReady,
@@ -89392,7 +89567,9 @@ function FileManagerPage() {
89392
89567
  showAdminErrorModal,
89393
89568
  fm,
89394
89569
  adminDrive,
89395
- isCreationInProgress
89570
+ isCreationInProgress,
89571
+ chainState,
89572
+ nodeInfo?.beeMode
89396
89573
  ]);
89397
89574
  const handlePrivateKeySaved = useCallback(() => {
89398
89575
  if (!isMountedRef.current) return;
@@ -89402,9 +89579,15 @@ function FileManagerPage() {
89402
89579
  }, [fm, notifyPkSaved]);
89403
89580
  const loading = !fm?.adminStamp || !adminDrive;
89404
89581
  const isFormbricksActive = Boolean(fm && fm.adminStamp && adminDrive && !loading);
89582
+ if (pageState === "ultra-light-node") {
89583
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(UltraLightNodeErrorBlock, {});
89584
+ }
89405
89585
  if (pageState === "connecting" || pageState === "loading") {
89406
89586
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingBlock, {});
89407
89587
  }
89588
+ if (pageState === "chain-syncing") {
89589
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ChainSyncingBlock, {});
89590
+ }
89408
89591
  if (pageState === "no-pk") {
89409
89592
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PrivateKeyModalBlock, { onSaved: handlePrivateKeySaved });
89410
89593
  }
@@ -89436,10 +89619,11 @@ function FileManagerPage() {
89436
89619
  );
89437
89620
  }
89438
89621
  if (pageState === "admin-error") {
89622
+ const adminErrorLabel = chainState === null ? "Your Bee node is still syncing the postage batch state from the chain. Please wait for the sync to complete and try again." : errorMessage || "Error creating Admin Drive. Please try again. Possible causes include insufficient xDAI balance or a lost connection to the RPC.";
89439
89623
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
89440
89624
  ErrorModalBlock,
89441
89625
  {
89442
- label: errorMessage || "Error creating Admin Drive. Please try again. Possible causes include insufficient xDAI balance or a lost connection to the RPC.",
89626
+ label: adminErrorLabel,
89443
89627
  onClick: () => {
89444
89628
  setAdminShowErrorModal(false);
89445
89629
  setErrorMessage("");
@@ -89526,11 +89710,17 @@ const useStyles$e = makeStyles()((theme2) => ({
89526
89710
  header: {
89527
89711
  backgroundColor: theme2.palette.background.paper,
89528
89712
  marginBottom: theme2.spacing(0.25),
89529
- borderLeft: `${theme2.spacing(0.25)}px solid rgba(0,0,0,0)`,
89530
- wordBreak: "break-word"
89713
+ borderLeft: `${theme2.spacing(0.25)} solid rgba(0,0,0,0)`,
89714
+ wordBreak: "break-word",
89715
+ "&:hover": {
89716
+ backgroundColor: theme2.palette.background.paper
89717
+ },
89718
+ "&:focus-within": {
89719
+ backgroundColor: theme2.palette.background.paper
89720
+ }
89531
89721
  },
89532
89722
  headerOpen: {
89533
- borderLeft: `${theme2.spacing(0.25)}px solid ${theme2.palette.primary.main}`
89723
+ borderLeft: `${theme2.spacing(0.25)} solid ${theme2.palette.primary.main}`
89534
89724
  },
89535
89725
  copyValue: {
89536
89726
  cursor: "pointer",
@@ -89584,72 +89774,74 @@ function ExpandableListItemInput({
89584
89774
  setInputValue(newValue);
89585
89775
  if (onChange) onChange(newValue);
89586
89776
  };
89587
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
89588
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "100%", children: [
89589
- label && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", className: classes2.unselectableLabel, component: "span", children: label }) }),
89590
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { flex: 3, display: "flex", alignItems: "center", justifyContent: "flex-end", minWidth: 0, gap: 1, children: [
89591
- !open2 && value && /* @__PURE__ */ jsxRuntimeExports.jsx(
89592
- Typography,
89777
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89778
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
89779
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "100%", children: [
89780
+ label && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", className: classes2.unselectableLabel, component: "span", children: label }) }),
89781
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { flex: 3, display: "flex", alignItems: "center", justifyContent: "flex-end", minWidth: 0, gap: 1, children: [
89782
+ !open2 && value && /* @__PURE__ */ jsxRuntimeExports.jsx(
89783
+ Typography,
89784
+ {
89785
+ variant: "body2",
89786
+ component: "span",
89787
+ sx: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
89788
+ children: value
89789
+ }
89790
+ ),
89791
+ !expandedOnly && !locked2 && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "small", className: classes2.copyValue, onClick: toggleOpen, children: open2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minus, { strokeWidth: 1 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { strokeWidth: 1 }) })
89792
+ ] })
89793
+ ] }),
89794
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: [
89795
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", alignItems: "center", width: "100%", minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89796
+ InputBase,
89593
89797
  {
89594
- variant: "body2",
89595
- component: "span",
89596
- sx: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
89597
- children: value
89798
+ value: inputValue,
89799
+ placeholder,
89800
+ onChange: handleChange,
89801
+ fullWidth: true,
89802
+ className: classes2.content,
89803
+ autoFocus: true,
89804
+ hidden: locked2,
89805
+ inputProps: {
89806
+ style: {
89807
+ width: "100%",
89808
+ minWidth: 220,
89809
+ whiteSpace: "nowrap",
89810
+ overflow: "hidden",
89811
+ textOverflow: "ellipsis"
89812
+ },
89813
+ maxLength: 512
89814
+ }
89598
89815
  }
89599
- ),
89600
- !expandedOnly && !locked2 && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "small", className: classes2.copyValue, onClick: toggleOpen, children: open2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minus, { strokeWidth: 1 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { strokeWidth: 1 }) })
89816
+ ) }),
89817
+ helperText && /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemNote, { children: helperText })
89601
89818
  ] })
89602
- ] }),
89603
- /* @__PURE__ */ jsxRuntimeExports.jsx(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
89604
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", alignItems: "center", width: "100%", minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89605
- InputBase,
89819
+ ] }) }),
89820
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExpandableListItemActions, { children: [
89821
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89822
+ SwarmButton,
89606
89823
  {
89607
- value: inputValue,
89608
- placeholder,
89609
- onChange: handleChange,
89610
- fullWidth: true,
89611
- className: classes2.content,
89612
- autoFocus: true,
89613
- hidden: locked2,
89614
- inputProps: {
89615
- style: {
89616
- width: "100%",
89617
- minWidth: 220,
89618
- whiteSpace: "nowrap",
89619
- overflow: "hidden",
89620
- textOverflow: "ellipsis"
89621
- },
89622
- maxLength: 512
89623
- }
89824
+ disabled: loading || inputValue === value || Boolean(confirmLabelDisabled) || inputValue === "" && value === void 0,
89825
+ loading,
89826
+ iconType: confirmIcon ?? Check,
89827
+ onClick: () => {
89828
+ onConfirm?.(inputValue.trim());
89829
+ },
89830
+ children: confirmLabel || "Save"
89624
89831
  }
89625
- ) }),
89626
- helperText && /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemNote, { children: helperText }),
89627
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExpandableListItemActions, { children: [
89628
- /* @__PURE__ */ jsxRuntimeExports.jsx(
89629
- SwarmButton,
89630
- {
89631
- disabled: loading || inputValue === value || Boolean(confirmLabelDisabled) || inputValue === "" && value === void 0,
89632
- loading,
89633
- iconType: confirmIcon ?? Check,
89634
- onClick: () => {
89635
- onConfirm?.(inputValue.trim());
89636
- },
89637
- children: confirmLabel || "Save"
89638
- }
89639
- ),
89640
- /* @__PURE__ */ jsxRuntimeExports.jsx(
89641
- SwarmButton,
89642
- {
89643
- disabled: loading || inputValue === value || inputValue === "",
89644
- iconType: X,
89645
- onClick: () => setInputValue(value || ""),
89646
- cancel: true,
89647
- children: "Cancel"
89648
- }
89649
- )
89650
- ] }) })
89651
- ] }) })
89652
- ] }) });
89832
+ ),
89833
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89834
+ SwarmButton,
89835
+ {
89836
+ disabled: loading || inputValue === value || inputValue === "",
89837
+ iconType: X,
89838
+ onClick: () => setInputValue(value || ""),
89839
+ cancel: true,
89840
+ children: "Cancel"
89841
+ }
89842
+ )
89843
+ ] }) }) })
89844
+ ] });
89653
89845
  }
89654
89846
  function getPrettyDateString(date) {
89655
89847
  const string = date.toString();
@@ -89659,11 +89851,17 @@ const useStyles$d = makeStyles()((theme2) => ({
89659
89851
  header: {
89660
89852
  backgroundColor: theme2.palette.background.paper,
89661
89853
  marginBottom: theme2.spacing(0.25),
89662
- borderLeft: `${theme2.spacing(0.25)}px solid rgba(0,0,0,0)`,
89663
- wordBreak: "break-word"
89854
+ borderLeft: `${theme2.spacing(0.25)} solid rgba(0,0,0,0)`,
89855
+ wordBreak: "break-word",
89856
+ "&:hover": {
89857
+ backgroundColor: theme2.palette.background.paper
89858
+ },
89859
+ "&:focus-within": {
89860
+ backgroundColor: theme2.palette.background.paper
89861
+ }
89664
89862
  },
89665
89863
  headerOpen: {
89666
- borderLeft: `${theme2.spacing(0.25)}px solid ${theme2.palette.primary.main}`
89864
+ borderLeft: `${theme2.spacing(0.25)} solid ${theme2.palette.primary.main}`
89667
89865
  },
89668
89866
  openLinkIcon: {
89669
89867
  cursor: "pointer",
@@ -92313,14 +92511,17 @@ function StripedWrapper({ children }) {
92313
92511
  function AssetIcon({ icon }) {
92314
92512
  return /* @__PURE__ */ jsxRuntimeExports.jsx(StripedWrapper, { children: icon });
92315
92513
  }
92316
- const getPreviewElement = (previewUri, metadata) => {
92317
- if (metadata?.isVideo) {
92514
+ const getPreviewElement = (previewUri, metadata, type) => {
92515
+ const isVideoType = Boolean(type && /.*\.(mp4|webm|ogv)$/i.test(type));
92516
+ const isAudioType = Boolean(type && /.*\.(mp3|ogg|oga|wav|webm|m4a|aac|flac)$/i.test(type));
92517
+ const isImageType = Boolean(type && /.*\.(jpg|jpeg|png|gif|webp|svg|ico)$/i.test(type));
92518
+ if (metadata?.isVideo || isVideoType) {
92318
92519
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FitVideo, { src: previewUri, maxWidth: "250px", maxHeight: "175px" });
92319
92520
  }
92320
- if (metadata?.isAudio) {
92521
+ if (metadata?.isAudio || isAudioType) {
92321
92522
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FitAudio, { src: previewUri, maxWidth: "250px" });
92322
92523
  }
92323
- if (metadata?.isImage) {
92524
+ if (metadata?.isImage || isImageType) {
92324
92525
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FitImage, { maxWidth: "250px", maxHeight: "175px", alt: "Upload Preview", src: previewUri });
92325
92526
  }
92326
92527
  if (metadata?.isWebsite) {
@@ -92334,11 +92535,17 @@ const getPreviewElement = (previewUri, metadata) => {
92334
92535
  const getType = (metadata) => {
92335
92536
  if (metadata?.isWebsite) return "Website";
92336
92537
  if (metadata?.type === "folder") return "Folder";
92337
- return metadata?.type;
92538
+ let metadataType = metadata?.type || "unknown";
92539
+ let typeFromExtension;
92540
+ if (metadataType === "unknown" && metadata?.name) {
92541
+ const { mime } = guessMime(metadata.name);
92542
+ typeFromExtension = mime === "application/octet-stream" ? "file" : mime;
92543
+ }
92544
+ return typeFromExtension || metadataType;
92338
92545
  };
92339
92546
  function AssetPreview({ metadata, previewUri }) {
92340
- const previewElement = useMemo(() => getPreviewElement(previewUri, metadata), [metadata, previewUri]);
92341
92547
  const type = useMemo(() => getType(metadata), [metadata]);
92548
+ const previewElement = useMemo(() => getPreviewElement(previewUri, metadata, type), [metadata, type, previewUri]);
92342
92549
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 4, children: [
92343
92550
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { bgcolor: "background.paper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "row", children: [
92344
92551
  previewElement,
@@ -92483,13 +92690,13 @@ function Share() {
92483
92690
  const count = Object.keys(entries).length;
92484
92691
  const isVideo = Boolean(indexDocument2 && /.*\.(mp4|webm|ogv)$/i.test(indexDocument2));
92485
92692
  const isAudio = Boolean(indexDocument2 && /.*\.(mp3|ogg|oga|wav|webm|m4a|aac|flac)$/i.test(indexDocument2));
92486
- const isImage = Boolean(indexDocument2 && /.*\.(jpg|jpeg|png|gif|webp|svg)$/i.test(indexDocument2));
92693
+ const isImage = Boolean(indexDocument2 && /.*\.(jpg|jpeg|png|gif|webp|svg|ico)$/i.test(indexDocument2));
92487
92694
  if (isImage || isVideo || isAudio) {
92488
92695
  setPreview(`${apiUrl}/bzz/${hash2}`);
92489
92696
  }
92490
92697
  setMetadata({
92491
92698
  hash: hash2,
92492
- type: count > 1 ? "folder" : "unknown",
92699
+ type: count > 1 ? "folder" : getType(),
92493
92700
  name: indexDocument2 || hash2 || "",
92494
92701
  count,
92495
92702
  isWebsite: Boolean(indexDocument2 && /.*\.html?$/i.test(indexDocument2)),
@@ -92737,7 +92944,7 @@ function PostageStampAdvancedCreation({ onFinished }) {
92737
92944
  }
92738
92945
  }
92739
92946
  function getPrice(depth, amount) {
92740
- const hasInvalidInput = amount <= 0 || isNaN(depth) || depth < 17 || depth > 255;
92947
+ const hasInvalidInput = amount <= 0 || isNaN(depth) || depth < MIN_STAMP_DEPTH || depth > MAX_STAMP_DEPTH;
92741
92948
  if (hasInvalidInput) {
92742
92949
  return "-";
92743
92950
  }
@@ -92790,32 +92997,13 @@ function PostageStampAdvancedCreation({ onFinished }) {
92790
92997
  }
92791
92998
  setAmountInput(validAmountInput);
92792
92999
  }
92793
- function validateDepthInput(depthInput2) {
92794
- let validDepthInput = "0";
92795
- if (!depthInput2) {
92796
- setDepthError("Required field");
92797
- } else {
92798
- const depth = new BigNumber(depthInput2);
92799
- if (!depth.isInteger()) {
92800
- setDepthError("Depth must be an integer");
92801
- } else if (depth.isLessThan(17)) {
92802
- setDepthError("Minimal depth is 17");
92803
- } else if (depth.isGreaterThan(255)) {
92804
- setDepthError("Depth has to be at most 255");
92805
- } else {
92806
- setDepthError("");
92807
- validDepthInput = depthInput2;
92808
- }
92809
- }
92810
- setDepthInput(validDepthInput);
92811
- }
92812
93000
  function renderStampVolumesInfo() {
92813
93001
  const depth = parseInt(depthInput, 10);
92814
- if (depthError || isNaN(depth) || depth < 17 || depth > 255) {
93002
+ if (depthError || isNaN(depth) || depth < MIN_STAMP_DEPTH || depth > MAX_STAMP_DEPTH) {
92815
93003
  return "-";
92816
93004
  }
92817
93005
  const theoreticalMaximumVolume = getHumanReadableFileSize(getStampTheoreticalBytes(depth));
92818
- const effectiveVolume = getHumanReadableFileSize(getStampEffectiveBytes(depth));
93006
+ const effectiveVolume = getHumanReadableFileSize(getStampEffectiveBytes(depth, false, RedundancyLevel.OFF));
92819
93007
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, alignItems: "center", className: classes2.stampVolumeWrapper, children: [
92820
93008
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { children: [
92821
93009
  "Theoretical: ~",
@@ -92852,7 +93040,14 @@ function PostageStampAdvancedCreation({ onFinished }) {
92852
93040
  "."
92853
93041
  ] }) }),
92854
93042
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
92855
- /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmTextInput, { name: "depth", label: "Depth", onChange: (event) => validateDepthInput(event.target.value) }),
93043
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
93044
+ SwarmTextInput,
93045
+ {
93046
+ name: "depth",
93047
+ label: "Depth",
93048
+ onChange: (event) => validateDepthInput(event.target.value, setDepthError, setDepthInput)
93049
+ }
93050
+ ),
92856
93051
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 0.25, sx: { bgcolor: "#f6f6f6" }, p: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", alignItems: "center", children: [
92857
93052
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "Corresponding file size" }),
92858
93053
  renderStampVolumesInfo()
@@ -92873,7 +93068,7 @@ function PostageStampAdvancedCreation({ onFinished }) {
92873
93068
  SwarmSelect,
92874
93069
  {
92875
93070
  label: "Immutable",
92876
- value: "No",
93071
+ value: immutable ? "Yes" : "No",
92877
93072
  onChange: (event) => setImmutable(event.target.value === "Yes"),
92878
93073
  options: [
92879
93074
  { value: "Yes", label: "Yes" },
@@ -93336,7 +93531,7 @@ const bzzABI = [
93336
93531
  }
93337
93532
  ];
93338
93533
  async function getNetworkChainId(url) {
93339
- const provider = newGnosisProvider(url);
93534
+ const provider = newGnosisProviderForValidation(url);
93340
93535
  const network = await provider.getNetwork();
93341
93536
  return network.chainId;
93342
93537
  }
@@ -93379,7 +93574,7 @@ async function sendNativeTransaction(privateKey, to, value, jsonRpcProviderUrl,
93379
93574
  const feedData = await signer.provider.getFeeData();
93380
93575
  const gasPrice = externalGasPrice ?? DAI.fromWei(feedData.gasPrice?.toString() || "0");
93381
93576
  const transaction = await signer.sendTransaction({
93382
- to: to.toHex(),
93577
+ to: to.toChecksum(),
93383
93578
  value: BigInt(value.toWeiString()),
93384
93579
  gasPrice: BigInt(gasPrice.toWeiString()),
93385
93580
  gasLimit: BigInt(21e3),
@@ -93401,7 +93596,7 @@ async function sendBzzTransaction(privateKey, to, value, jsonRpcProviderUrl) {
93401
93596
  const feeData = await signer.provider.getFeeData();
93402
93597
  const gasPrice = feeData.gasPrice || BigInt(0);
93403
93598
  const bzz = new Contract(BZZ_TOKEN_ADDRESS, bzzABI, signer);
93404
- const transaction = await bzz.transfer(to.toChecksum(), value, { gasPrice });
93599
+ const transaction = await bzz.transfer(to.toChecksum(), value.toPLURBigInt(), { gasPrice });
93405
93600
  const receipt = await transaction.wait(1);
93406
93601
  if (!receipt) {
93407
93602
  throw new Error("Invalid receipt!");
@@ -121931,11 +122126,16 @@ function PostageStampStandardCreation({ onFinished }) {
121931
122126
  const { classes: classes2 } = useStyles$6();
121932
122127
  const { refresh } = useContext(Context$5);
121933
122128
  const { beeApi } = useContext(Context$8);
122129
+ const { chainState } = useContext(Context$7);
121934
122130
  const [depthInput, setDepthInput] = useState(getDepthForSize(Size.fromGigabytes(4)));
121935
122131
  const [amountInput, setAmountInput] = useState(getAmountForDuration(Duration.fromDays(30), 26500, 5));
121936
122132
  const [labelInput, setLabelInput] = useState("");
121937
122133
  const [submitting, setSubmitting] = useState(false);
121938
122134
  const [buttonValue, setButtonValue] = useState(4);
122135
+ const [depthError, setDepthError] = useState("");
122136
+ const [sliderValue, setSliderValue] = useState(30);
122137
+ const pricePerBlockDefault = 24e3;
122138
+ const currentPrice = chainState?.currentPrice ?? pricePerBlockDefault;
121939
122139
  const getBatchValue = (value) => {
121940
122140
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: { flex: 1 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
121941
122141
  Button$1,
@@ -121955,15 +122155,15 @@ function PostageStampStandardCreation({ onFinished }) {
121955
122155
  if (typeof newValue !== "number") {
121956
122156
  return;
121957
122157
  }
121958
- const amountValue = getAmountForDuration(Duration.fromDays(newValue), 26500, 5);
122158
+ const amountValue = getAmountForDuration(Duration.fromDays(newValue), currentPrice, 5);
121959
122159
  setAmountInput(amountValue);
122160
+ setSliderValue(newValue);
121960
122161
  }
121961
122162
  const { enqueueSnackbar } = useSnackbar();
121962
122163
  function getTtl(amount) {
121963
- const pricePerBlock = 24e3;
121964
122164
  return `${secondsToTimeString(
121965
- getStampDuration(amount, pricePerBlock, 5).toSeconds()
121966
- )} (with price of ${pricePerBlock} PLUR per block)`;
122165
+ getStampDuration(amount, currentPrice, 5).toSeconds()
122166
+ )} (with price of ${currentPrice} PLUR per block)`;
121967
122167
  }
121968
122168
  function getPrice(depth, amount) {
121969
122169
  const price = getStampCost(depth, amount);
@@ -121978,14 +122178,14 @@ function PostageStampStandardCreation({ onFinished }) {
121978
122178
  return;
121979
122179
  }
121980
122180
  setSubmitting(true);
121981
- const amount = BigInt(amountInput);
121982
- const depth = depthInput;
121983
- const options = {
121984
- waitForUsable: false,
121985
- label: labelInput || void 0,
121986
- immutableFlag: true
121987
- };
121988
- await beeApi.createPostageBatch(amount.toString(), depth, options);
122181
+ await beeApi.buyStorage(
122182
+ Size.fromGigabytes(buttonValue),
122183
+ Duration.fromDays(sliderValue),
122184
+ { label: labelInput, immutableFlag: true },
122185
+ void 0,
122186
+ false,
122187
+ RedundancyLevel.OFF
122188
+ );
121989
122189
  await refresh();
121990
122190
  onFinished();
121991
122191
  } catch (e2) {
@@ -121996,8 +122196,8 @@ function PostageStampStandardCreation({ onFinished }) {
121996
122196
  }
121997
122197
  function handleBatchSize(gigabytes) {
121998
122198
  setButtonValue(gigabytes);
121999
- const capacity = getDepthForSize(Size.fromGigabytes(gigabytes));
122000
- setDepthInput(capacity);
122199
+ const capacity = getDepthForSize(Size.fromGigabytes(gigabytes), false, RedundancyLevel.OFF);
122200
+ validateDepthInput(String(capacity), setDepthError, (v) => setDepthInput(Number(v)));
122001
122201
  }
122002
122202
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
122003
122203
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { children: [
@@ -122016,11 +122216,14 @@ function PostageStampStandardCreation({ onFinished }) {
122016
122216
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h2", children: "Batch name" }) }),
122017
122217
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmTextInput, { name: "depth", label: "Label", onChange: (e2) => setLabelInput(e2.target.value) }) }),
122018
122218
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h2", children: "Batch size" }) }),
122019
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [
122020
- getBatchValue(4),
122021
- getBatchValue(32),
122022
- getBatchValue(256)
122023
- ] }) }),
122219
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
122220
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [
122221
+ getBatchValue(4),
122222
+ getBatchValue(32),
122223
+ getBatchValue(256)
122224
+ ] }),
122225
+ depthError && /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: depthError })
122226
+ ] }),
122024
122227
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h2", children: "Data persistence" }) }),
122025
122228
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
122026
122229
  Slider,
@@ -122040,7 +122243,11 @@ function PostageStampStandardCreation({ onFinished }) {
122040
122243
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "Corresponding TTL (Time to live)" }),
122041
122244
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: amountInput ? getTtl(amountInput) : "-" })
122042
122245
  ] }) }),
122043
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", justifyContent: "right", mt: 0.5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { style: { fontSize: "10px", color: "rgba(0, 0, 0, 0.26)" }, children: "Current price of 24000 PLUR per block" }) })
122246
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", justifyContent: "right", mt: 0.5, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { style: { fontSize: "10px", color: "rgba(0, 0, 0, 0.26)" }, children: [
122247
+ "Current price of ",
122248
+ currentPrice,
122249
+ " PLUR per block"
122250
+ ] }) })
122044
122251
  ] }),
122045
122252
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, sx: { bgcolor: "#fcf2e8" }, p: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", children: [
122046
122253
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "Indicative Price" }),
@@ -122050,7 +122257,7 @@ function PostageStampStandardCreation({ onFinished }) {
122050
122257
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
122051
122258
  SwarmButton,
122052
122259
  {
122053
- disabled: submitting || !depthInput || !amountInput,
122260
+ disabled: submitting || !depthInput || Boolean(depthError) || !amountInput,
122054
122261
  onClick: submit,
122055
122262
  iconType: Check,
122056
122263
  loading: submitting,
@@ -159467,7 +159674,7 @@ function SideBar() {
159467
159674
  label: "File Manager",
159468
159675
  path: ROUTES.FILEMANAGER,
159469
159676
  icon: FileManagerIcon,
159470
- pathMatcherSubstring: "/filemanager/"
159677
+ pathMatcherSubstring: "/filemanager"
159471
159678
  },
159472
159679
  {
159473
159680
  label: "Account",