// Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
// 
//   CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
// 
// }
// 
// Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
// 
//   Buffer getCurrentBuffer();
// 
//   List<Base> getDrawables();
// 
//   void tearDown();
// 
//   void toggleFullScreen();
// 
//   void reflesh();
// 
//   SmoothValue getScale();
// 
//   void createNewBuffer();
// 
// }


import static in.tombo.kashiki.keybind.SupportKey.*;
import static java.awt.event.KeyEvent.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import in.tombo.kashiki.Editor;
    keybinds.put(strokes, action);
  }

  private Stroke getStroke(String key) {
    Matcher m = ACTION_PATTERN.matcher(key);
    if (!m.find()) {
      throw new RuntimeException("invalid config.");
    }
    String actionString = m.group(1);
    int code = CODE_MAPPING.get(actionString);
    if (key.startsWith("C-A-S-")) {
      return new Stroke(CTRL_ALT_SHIFT, code);
    } else if (key.startsWith("C-A-")) {
      return new Stroke(CTRL_ALT, code);
    } else if (key.startsWith("C-S-")) {
      return new Stroke(CTRL_SHIFT, code);
    } else if (key.startsWith("A-S-")) {
      return new Stroke(ALT_SHIFT, code);
    } else if (key.startsWith("C-")) {
      return new Stroke(CTRL, code);
    } else if (key.startsWith("A-")) {
      return new Stroke(ALT, code);
    } else if (key.startsWith("S-")) {
      return new Stroke(SHIFT, code);
    } else {
      return new Stroke(NONE, code);
    }
  }

  @Override
// Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
// 
//   CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
// 
// }
// 
// Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
// 
//   Buffer getCurrentBuffer();
// 
//   List<Base> getDrawables();
// 
//   void tearDown();
// 
//   void toggleFullScreen();
// 
//   void reflesh();
// 
//   SmoothValue getScale();
// 
//   void createNewBuffer();
// 
// }


// Path: src/main/java/in/tombo/kashiki/keybind/EmacsKeyListener.java
import static in.tombo.kashiki.keybind.SupportKey.*;
import static java.awt.event.KeyEvent.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import in.tombo.kashiki.Editor;

    keybinds.put(strokes, action);
  }

  private Stroke getStroke(String key) {
    Matcher m = ACTION_PATTERN.matcher(key);
    if (!m.find()) {
      throw new RuntimeException("invalid config.");
    }
    String actionString = m.group(1);
    int code = CODE_MAPPING.get(actionString);
    if (key.startsWith("C-A-S-")) {
      return new Stroke(CTRL_ALT_SHIFT, code);
    } else if (key.startsWith("C-A-")) {
      return new Stroke(CTRL_ALT, code);
    } else if (key.startsWith("C-S-")) {
      return new Stroke(CTRL_SHIFT, code);
    } else if (key.startsWith("A-S-")) {
      return new Stroke(ALT_SHIFT, code);
    } else if (key.startsWith("C-")) {
      return new Stroke(CTRL, code);
    } else if (key.startsWith("A-")) {
      return new Stroke(ALT, code);
    } else if (key.startsWith("S-")) {
      return new Stroke(SHIFT, code);
    } else {
      return new Stroke(NONE, code);
    }
  }

  @Override
  public void keyPressed(SupportKey supportKey, int keyCode, long when) {