// Path: ChatUILib/src/main/java/com/simon816/chatui/lib/PlayerChatView.java
// public interface PlayerChatView {
// 
//     public Player getPlayer();
// 
//     public TopWindow getWindow();
// 
//     public boolean showWindow(TopWindow window);
// 
//     public boolean removeShownWindow();
// 
//     public void update();
// 
//     public boolean handleIncoming(Text message);
// 
//     public Optional<Text> transformOutgoing(CommandSource sender, Text originalOutgoing, ChatType type);
// 
//     public boolean handleCommand(String[] args);
// 
//     public void onRemove();
// 
//     public void initialize();
// 
// }
// 
// Path: ChatUILib/src/main/java/com/simon816/chatui/lib/PlayerContext.java
// public class PlayerContext {
// 
//     public final int height;
//     public final int width;
//     public final boolean forceUnicode;
// 
//     private final UUID playerUUID;
//     private final TextUtils utils;
// 
//     public PlayerContext(Player player, int width, int height, boolean forceUnicode, FontData fontData) {
//         this(player.getUniqueId(), width, height, forceUnicode, new TextUtils(fontData, forceUnicode, player.getUniqueId()));
//         checkArgument(height >= 1, "Height must be at least one");
//         checkArgument(width >= 1, "Width must be at least one");
//     }
// 
//     private PlayerContext(UUID playerUuid, int width, int height, boolean forceUnicode, TextUtils utils) {
//         this.playerUUID = playerUuid;
//         this.width = width;
//         this.height = height;
//         this.forceUnicode = forceUnicode;
//         this.utils = utils;
//     }
// 
//     public Player getPlayer() {
//         return Sponge.getServer().getPlayer(this.playerUUID).get();
//     }
// 
//     public TextUtils utils() {
//         return this.utils;
//     }
// 
//     public PlayerContext withHeight(int height) {
//         checkArgument(height >= 1, "Height must be at least one");
//         if (height == this.height) {
//             return this;
//         }
//         return new PlayerContext(this.playerUUID, this.width, height, this.forceUnicode, this.utils);
//     }
// 
//     public PlayerContext withWidth(int width) {
//         checkArgument(width >= 1, "Width must be at least one");
//         if (width == this.width) {
//             return this;
//         }
//         return new PlayerContext(this.playerUUID, width, this.height, this.forceUnicode, this.utils);
//     }
// 
//     public PlayerContext withUnicode(boolean forceUnicode) {
//         if (forceUnicode == this.forceUnicode) {
//             return this;
//         }
//         return new PlayerContext(this.playerUUID, this.width, this.height, forceUnicode,
//                 new TextUtils(this.utils.getFontData(), forceUnicode, this.playerUUID));
//     }
// 
//     @Override
//     public String toString() {
//         return MoreObjects.toStringHelper(this)
//                 .add("player", this.getPlayer())
//                 .add("width", this.width)
//                 .add("height", this.height)
//                 .add("forceUnicode", this.forceUnicode)
//                 .toString();
//     }
// 
// }
// 
// Path: ChatUILib/src/main/java/com/simon816/chatui/util/Utils.java
// public class Utils {
// 
//     public static CommandSource getRealSource(CommandSource source) {
//         while (source instanceof ProxySource) {
//             source = ((ProxySource) source).getOriginalSource();
//         }
//         return source;
//     }
// 
//     public static ClickAction<?> execClick(Consumer<PlayerChatView> handler) {
//         return TextActions.runCommand(ClickCallback.generateCommand(handler));
//     }
// 
//     public static ClickAction<?> execClick(Runnable action) {
//         return execClick(view -> {
//             action.run();
//             view.update();
//         });
//     }
// 
//     public static void sendMessageSplitLarge(PlayerContext ctx, Text text) {
//         String json = TextSerializers.JSON.serialize(text);
//         int size = Utf8.encodedLength(json);
//         if (size > 32767) {
//             List<Text> lines = ctx.utils().splitLines(text, ctx.width);
//             ctx.getPlayer().sendMessages(lines);
//         } else {
//             ctx.getPlayer().sendMessage(text);
//         }
//     }
// 
// }


import com.simon816.chatui.lib.PlayerChatView;
import com.simon816.chatui.lib.PlayerContext;
import com.simon816.chatui.util.Utils;
import it.unimi.dsi.fastutil.ints.Int2CharMap;
import it.unimi.dsi.fastutil.ints.Int2CharOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.ClickAction;
import org.spongepowered.api.text.format.TextColor;
import org.spongepowered.api.text.format.TextColors;
import java.util.function.Consumer;

package com.simon816.chatui.ui.canvas;



public class LineDrawingContext {

    private final Line[] lines;
    private final int width;
    private final char emptyChar;
    private final PixelMetadata emptyData;
    private final int emptyCharWidth;

    private PixelMetadata currentData;


// Path: ChatUILib/src/main/java/com/simon816/chatui/lib/PlayerChatView.java
// public interface PlayerChatView {
// 
//     public Player getPlayer();
// 
//     public TopWindow getWindow();
// 
//     public boolean showWindow(TopWindow window);
// 
//     public boolean removeShownWindow();
// 
//     public void update();
// 
//     public boolean handleIncoming(Text message);
// 
//     public Optional<Text> transformOutgoing(CommandSource sender, Text originalOutgoing, ChatType type);
// 
//     public boolean handleCommand(String[] args);
// 
//     public void onRemove();
// 
//     public void initialize();
// 
// }
// 
// Path: ChatUILib/src/main/java/com/simon816/chatui/lib/PlayerContext.java
// public class PlayerContext {
// 
//     public final int height;
//     public final int width;
//     public final boolean forceUnicode;
// 
//     private final UUID playerUUID;
//     private final TextUtils utils;
// 
//     public PlayerContext(Player player, int width, int height, boolean forceUnicode, FontData fontData) {
//         this(player.getUniqueId(), width, height, forceUnicode, new TextUtils(fontData, forceUnicode, player.getUniqueId()));
//         checkArgument(height >= 1, "Height must be at least one");
//         checkArgument(width >= 1, "Width must be at least one");
//     }
// 
//     private PlayerContext(UUID playerUuid, int width, int height, boolean forceUnicode, TextUtils utils) {
//         this.playerUUID = playerUuid;
//         this.width = width;
//         this.height = height;
//         this.forceUnicode = forceUnicode;
//         this.utils = utils;
//     }
// 
//     public Player getPlayer() {
//         return Sponge.getServer().getPlayer(this.playerUUID).get();
//     }
// 
//     public TextUtils utils() {
//         return this.utils;
//     }
// 
//     public PlayerContext withHeight(int height) {
//         checkArgument(height >= 1, "Height must be at least one");
//         if (height == this.height) {
//             return this;
//         }
//         return new PlayerContext(this.playerUUID, this.width, height, this.forceUnicode, this.utils);
//     }
// 
//     public PlayerContext withWidth(int width) {
//         checkArgument(width >= 1, "Width must be at least one");
//         if (width == this.width) {
//             return this;
//         }
//         return new PlayerContext(this.playerUUID, width, this.height, this.forceUnicode, this.utils);
//     }
// 
//     public PlayerContext withUnicode(boolean forceUnicode) {
//         if (forceUnicode == this.forceUnicode) {
//             return this;
//         }
//         return new PlayerContext(this.playerUUID, this.width, this.height, forceUnicode,
//                 new TextUtils(this.utils.getFontData(), forceUnicode, this.playerUUID));
//     }
// 
//     @Override
//     public String toString() {
//         return MoreObjects.toStringHelper(this)
//                 .add("player", this.getPlayer())
//                 .add("width", this.width)
//                 .add("height", this.height)
//                 .add("forceUnicode", this.forceUnicode)
//                 .toString();
//     }
// 
// }
// 
// Path: ChatUILib/src/main/java/com/simon816/chatui/util/Utils.java
// public class Utils {
// 
//     public static CommandSource getRealSource(CommandSource source) {
//         while (source instanceof ProxySource) {
//             source = ((ProxySource) source).getOriginalSource();
//         }
//         return source;
//     }
// 
//     public static ClickAction<?> execClick(Consumer<PlayerChatView> handler) {
//         return TextActions.runCommand(ClickCallback.generateCommand(handler));
//     }
// 
//     public static ClickAction<?> execClick(Runnable action) {
//         return execClick(view -> {
//             action.run();
//             view.update();
//         });
//     }
// 
//     public static void sendMessageSplitLarge(PlayerContext ctx, Text text) {
//         String json = TextSerializers.JSON.serialize(text);
//         int size = Utf8.encodedLength(json);
//         if (size > 32767) {
//             List<Text> lines = ctx.utils().splitLines(text, ctx.width);
//             ctx.getPlayer().sendMessages(lines);
//         } else {
//             ctx.getPlayer().sendMessage(text);
//         }
//     }
// 
// }


// Path: ChatUILib/src/main/java/com/simon816/chatui/ui/canvas/LineDrawingContext.java
import com.simon816.chatui.lib.PlayerChatView;
import com.simon816.chatui.lib.PlayerContext;
import com.simon816.chatui.util.Utils;
import it.unimi.dsi.fastutil.ints.Int2CharMap;
import it.unimi.dsi.fastutil.ints.Int2CharOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.ClickAction;
import org.spongepowered.api.text.format.TextColor;
import org.spongepowered.api.text.format.TextColors;
import java.util.function.Consumer;

package com.simon816.chatui.ui.canvas;



public class LineDrawingContext {

    private final Line[] lines;
    private final int width;
    private final char emptyChar;
    private final PixelMetadata emptyData;
    private final int emptyCharWidth;

    private PixelMetadata currentData;


    public LineDrawingContext(PlayerContext ctx, char emptyChar, PixelMetadata emptyData) {
