package peergos.shared.user;

import jsinterop.annotations.*;
import peergos.shared.*;
import peergos.shared.crypto.hash.*;
import peergos.shared.user.fs.*;

import java.util.*;
import java.util.concurrent.*;

@JsType
public interface TrieNode {

    CompletableFuture<Optional<FileWrapper>> getByPath(String path, Hasher hasher, NetworkAccess network);

    @JsIgnore
    CompletableFuture<Optional<FileWrapper>> getByPath(String path, Snapshot version, Hasher hasher, NetworkAccess network);

    CompletableFuture<Set<FileWrapper>> getChildren(String path, Hasher hasher, NetworkAccess network);

    @JsIgnore
    CompletableFuture<Set<FileWrapper>> getChildren(String path, Hasher hasher, Snapshot version, NetworkAccess network);

    Set<String> getChildNames();

    TrieNode put(String path, EntryPoint e);

    TrieNode putNode(String path, TrieNode t);

    TrieNode removeEntry(String path);

    Collection<TrieNode> getChildNodes();

    TrieNode getChildNode(String name);

    boolean isEmpty();

    static String canonicalise(String path) {
        return (path.startsWith("/") ? path.substring(1) : path).replaceAll("\\\\", "/");
    }
}

@@ -1052,16 +1052,61 @@
 path) %7B%0A
+        path = path.replaceAll(%22%5C%5C%5C%5C%22, %22/%22);%0A
         
@@ -1165,32 +1165,8 @@
 ath)
-.replaceAll(%22%5C%5C%5C%5C%22, %22/%22)
 ;%0A  

Fix TrieNode.canonicalise on Windows