package org.jetbrains.debugger;

import com.intellij.util.CommonProcessors;
import com.intellij.util.Processor;
import com.intellij.util.Url;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.concurrency.Promise;
import org.jetbrains.debugger.values.FunctionValue;

public interface ScriptManager {
  String VM_SCHEME = "vm";

  @NotNull
  Promise<String> getSource(@NotNull Script script);

  boolean hasSource(Script script);

  boolean containsScript(@NotNull Script script);

  /**
   * Demands that script text should be replaced with a new one if possible. VM may get resumed after this command
   */
  @NotNull
  Promise<?> setSourceOnRemote(@NotNull Script script, @NotNull CharSequence newSource, boolean preview);

  void forEachScript(@NotNull Processor<Script> scriptProcessor);

  @Nullable
  Script forEachScript(@NotNull CommonProcessors.FindProcessor<Script> scriptProcessor);

  @NotNull
  Promise<Script> getScript(@NotNull FunctionValue function);

  @Nullable("if call frame script is native (at least in Google Chrome)")
  Script getScript(@NotNull CallFrame frame);

  @Nullable
  Script findScriptByUrl(@NotNull String rawUrl);

  @Nullable
  Script findScriptByUrl(@NotNull Url url);

  @Nullable
  Script findScriptById(@NotNull String id);

  @Nullable
  Promise<Void> getScriptSourceMapPromise(@NotNull Script script);
}
@@ -23,17 +23,16 @@
 debugger
-;
 %0A%0Aimport
@@ -66,17 +66,16 @@
 ocessors
-;
 %0Aimport 
@@ -101,17 +101,16 @@
 rocessor
-;
 %0Aimport 
@@ -134,94 +134,8 @@
 .Url
-;%0Aimport org.jetbrains.annotations.NotNull;%0Aimport org.jetbrains.annotations.Nullable;
 %0Aimp
@@ -171,17 +171,16 @@
 .Promise
-;
 %0Aimport 
@@ -226,18 +226,10 @@
 alue
-;
 %0A%0A
-public 
 inte
@@ -254,64 +254,14 @@
 r %7B%0A
-  String VM_SCHEME = %22vm%22;%0A%0A  @NotNull%0A  Promise%3CString%3E
+%0A  fun
  get
@@ -271,42 +271,46 @@
 rce(
-@NotNull S
+s
 cript
- s
+: S
 cript)
-;%0A%0A  boolea
+: Promise%3CString%3E%0A%0A  fu
 n ha
@@ -321,33 +321,38 @@
 rce(
-S
+s
 cript
- s
+: S
 cript)
-;%0A%0A  boolea
+: Boolean%0A%0A  fu
 n co
@@ -368,32 +368,32 @@
 ipt(
-@NotNull S
+s
 cript
- s
+: S
 cript)
-;
+: Boolean
 %0A%0A  
@@ -523,29 +523,11 @@
 /%0A  
-@NotNull%0A  Promise%3C?%3E
+fun
  set
@@ -545,40 +545,34 @@
 ote(
-@NotNull S
+s
 cript
- s
+: S
 cript, 
-@NotNull
+newSource:
  Cha
@@ -584,149 +584,134 @@
 ence
- newSource, boolean preview);%0A%0A  void forEachScript(@NotNull Processor%3CScript%3E scriptProcessor);%0A%0A  @Nullable%0A  Script forEachScript(@NotNull
+, preview: Boolean): Promise%3C*%3E%0A%0A  fun forEachScript(scriptProcessor: Processor%3CScript%3E)%0A%0A  fun forEachScript(scriptProcessor:
  Com
@@ -749,184 +749,84 @@
 ipt%3E
- s
+): S
 cript
-Processor);%0A%0A  @NotNull%0A  Promise%3CScript%3E getScript(@NotNull FunctionValue function);%0A%0A  @Nullable(%22if call frame script is native (at least in Google Chrome)%22)%0A  Script
+?%0A%0A  fun getScript(function: FunctionValue): Promise%3CScript%3E%0A%0A  fun
  get
@@ -832,24 +832,22 @@
 tScript(
-@NotNull
+frame:
  CallFra
@@ -852,272 +852,265 @@
 rame
- frame);%0A%0A  @Nullable%0A  Script findScriptByUrl(@NotNull String rawUrl);%0A%0A  @Nullable%0A  Script findScriptByUrl(@NotNull Url url);%0A%0A  @Nullable%0A  Script findScriptById(@NotNull String id);%0A%0A  @Nullable%0A  Promise%3CVoid%3E getScriptSourceMapPromise(@NotNull Script script);
+): Script?%0A%0A  fun findScriptByUrl(rawUrl: String): Script?%0A%0A  fun findScriptByUrl(url: Url): Script?%0A%0A  fun findScriptById(id: String): Script?%0A%0A  fun getScriptSourceMapPromise(script: Script): Promise%3CVoid%3E?%0A%0A  companion object %7B%0A    val VM_SCHEME = %22vm%22%0A  %7D
 %0A%7D

convert ScriptManager to kotlin