// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.command.commands.world.chunk;

import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.server.core.command.system.CommandManager;
import com.hypixel.hytale.server.core.ui.builder.EventData;
import com.hypixel.hytale.protocol.packets.interface_.CustomUIEventBindingType;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage;
import com.hypixel.hytale.server.core.entity.entities.player.pages.CustomUIPage;
import com.hypixel.hytale.server.core.entity.entities.Player;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.server.core.Message;
import it.unimi.dsi.fastutil.longs.Long2IntMap;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import com.hypixel.hytale.server.core.universe.world.accessor.ChunkAccessor;
import com.hypixel.hytale.server.core.universe.world.accessor.LocalCachedChunkAccessor;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
import com.hypixel.hytale.server.core.universe.world.chunk.BlockChunk;
import com.hypixel.hytale.math.util.ChunkUtil;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.AbstractCommand;
import com.hypixel.hytale.codec.validation.Validator;
import com.hypixel.hytale.codec.validation.Validators;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgumentType;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
import com.hypixel.hytale.server.core.command.system.arguments.system.FlagArg;
import com.hypixel.hytale.server.core.command.system.arguments.system.DefaultArg;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;

public class ChunkTintCommand extends AbstractPlayerCommand
{
    private static final int BLUR_RADIUS = 5;
    private static final double BLUR_SIGMA = 1.5;
    @Nonnull
    private final RequiredArg<Integer> colorArg;
    @Nonnull
    private final DefaultArg<Integer> radiusArg;
    @Nonnull
    private final DefaultArg<Double> sigmaArg;
    @Nonnull
    private final FlagArg blurArg;
    
    public ChunkTintCommand() {
        super("tint", "server.commands.chunk.tint.desc");
        this.colorArg = this.withRequiredArg("color", "server.commands.chunk.tint.color.desc", ArgTypes.COLOR);
        this.radiusArg = this.withDefaultArg("radius", "server.commands.chunk.tint.radius.desc", ArgTypes.INTEGER, 5, "server.commands.chunk.tint.radius.default").addValidator((Validator<Integer>)Validators.greaterThan((DataType)0));
        this.sigmaArg = this.withDefaultArg("sigma", "server.commands.chunk.tint.sigma.desc", ArgTypes.DOUBLE, 1.5, "server.commands.chunk.tint.sigma.default").addValidator((Validator<Double>)Validators.greaterThan((DataType)0.0));
        this.blurArg = this.withFlagArg("blur", "server.commands.chunk.tint.blur.desc");
        this.addUsageVariant(new TintChunkPageCommand());
    }
    
    @Override
    protected void execute(@Nonnull final CommandContext context, @Nonnull final Store<EntityStore> store, @Nonnull final Ref<EntityStore> ref, @Nonnull final PlayerRef playerRef, @Nonnull final World world) {
        final int color = this.colorArg.get(context);
        final TransformComponent transformComponent = store.getComponent(ref, TransformComponent.getComponentType());
        assert transformComponent != null;
        final Vector3d position = transformComponent.getPosition();
        final int chunkX = MathUtil.floor(position.getX()) >> 5;
        final int chunkZ = MathUtil.floor(position.getZ()) >> 5;
        final ChunkStore chunkStore = world.getChunkStore();
        final Store<ChunkStore> chunkStoreStore = chunkStore.getStore();
        final LongOpenHashSet updateChunks = new LongOpenHashSet();
        int radius = 0;
        double sigma = 0.0;
        final long chunkIndex = ChunkUtil.indexChunk(chunkX, chunkZ);
        final Ref<ChunkStore> chunkRef = chunkStore.getChunkReference(chunkIndex);
        if (chunkRef != null && chunkRef.isValid()) {
            final BlockChunk blockChunk = chunkStoreStore.getComponent(chunkRef, BlockChunk.getComponentType());
            if (blockChunk != null) {
                for (int x = 0; x < 32; ++x) {
                    for (int z = 0; z < 32; ++z) {
                        blockChunk.setTint(x, z, color);
                    }
                }
                updateChunks.add(chunkIndex);
            }
            if (this.blurArg.provided(context)) {
                radius = this.radiusArg.get(context);
                sigma = this.sigmaArg.get(context);
                final double[] matrix = gaussianMatrix(sigma, radius);
                final int blockX = chunkX << 5;
                final int blockZ = chunkZ << 5;
                final Long2IntOpenHashMap newTintMap = new Long2IntOpenHashMap();
                final LocalCachedChunkAccessor accessor = LocalCachedChunkAccessor.atWorldCoords(world, blockX, blockZ, 32 + radius * 2);
                for (int x2 = -radius; x2 <= 32 + radius; ++x2) {
                    for (int z2 = -radius; z2 <= 32 + radius; ++z2) {
                        final int offsetX = blockX + x2;
                        final int offsetZ = blockZ + z2;
                        final int blurred = blur(accessor, radius, matrix, offsetX, offsetZ);
                        newTintMap.put(MathUtil.packLong(offsetX, offsetZ), blurred);
                    }
                }
                for (final Long2IntMap.Entry entry : newTintMap.long2IntEntrySet()) {
                    final long key = entry.getLongKey();
                    final int x3 = MathUtil.unpackLeft(key);
                    final int z3 = MathUtil.unpackRight(key);
                    final long chunkIndex2 = ChunkUtil.indexChunkFromBlock(x3, z3);
                    final Ref<ChunkStore> chunkRef2 = chunkStore.getChunkReference(chunkIndex2);
                    if (chunkRef2 != null && chunkRef2.isValid()) {
                        final BlockChunk blockChunk2 = chunkStoreStore.getComponent(chunkRef2, BlockChunk.getComponentType());
                        if (blockChunk2 == null) {
                            continue;
                        }
                        blockChunk2.setTint(x3, z3, entry.getIntValue());
                        updateChunks.add(chunkIndex2);
                    }
                }
            }
            updateChunks.forEach(chunkIndex -> world.getNotificationHandler().updateChunk(chunkIndex));
            if (this.blurArg.provided(context)) {
                context.sendMessage(Message.translation("server.commands.chunk.tint.success.blur").param("chunkX", chunkX).param("chunkZ", chunkZ).param("chunksAffected", updateChunks.size()).param("radius", radius).param("sigma", sigma));
            }
            else {
                context.sendMessage(Message.translation("server.commands.chunk.tint.success").param("chunkX", chunkX).param("chunkZ", chunkZ));
            }
            return;
        }
        context.sendMessage(Message.translation("server.general.chunkNotLoaded").param("chunkX", chunkX).param("chunkZ", chunkZ));
    }
    
    private static int blur(@Nonnull final ChunkAccessor<WorldChunk> chunkAccessor, final int radius, final double[] matrix, final int x, final int z) {
        double r = 0.0;
        double g = 0.0;
        double b = 0.0;
        for (int ix = -radius; ix <= radius; ++ix) {
            for (int iz = -radius; iz <= radius; ++iz) {
                final double factor = matrix[gaussianIndex(radius, ix, iz)];
                final int ax = x + ix;
                final int az = z + iz;
                final WorldChunk worldChunk = chunkAccessor.getChunk(ChunkUtil.indexChunkFromBlock(ax, az));
                if (worldChunk != null) {
                    final BlockChunk blockChunk = worldChunk.getBlockChunk();
                    if (blockChunk != null) {
                        final int c = blockChunk.getTint(ax, az);
                        r += (c >> 16 & 0xFF) * factor;
                        g += (c >> 8 & 0xFF) * factor;
                        b += (c & 0xFF) * factor;
                    }
                }
            }
        }
        return 0xFF000000 | MathUtil.floor(r) << 16 | MathUtil.floor(g) << 8 | MathUtil.floor(b);
    }
    
    private static double gaussian2d(final double sigma, final double x, final double y) {
        return 1.0 / (6.283185307179586 * sigma * sigma) * Math.pow(2.718281828459045, -(x * x + y * y) / (2.0 * sigma * sigma));
    }
    
    private static double[] gaussianMatrix(final double sigma, final int radius) {
        final int length = 2 * radius + 1;
        final double[] matrix = new double[length * length];
        for (int x = -radius; x <= radius; ++x) {
            for (int y = -radius; y <= radius; ++y) {
                final double value = gaussian2d(sigma, x, y);
                matrix[gaussianIndex(radius, x, y)] = value;
            }
        }
        double sum = 0.0;
        for (final double val : matrix) {
            sum += val;
        }
        for (int i = 0; i < matrix.length; ++i) {
            final double[] array2 = matrix;
            final int n = i;
            array2[n] /= sum;
        }
        return matrix;
    }
    
    private static int gaussianIndex(final int radius, int x, int y) {
        x += radius;
        y += radius;
        return x * (2 * radius + 1) + y;
    }
    
    static class TintChunkPageCommand extends AbstractPlayerCommand
    {
        TintChunkPageCommand() {
            super("server.commands.chunk.tint.get");
        }
        
        @Override
        protected void execute(@Nonnull final CommandContext context, @Nonnull final Store<EntityStore> store, @Nonnull final Ref<EntityStore> ref, @Nonnull final PlayerRef playerRef, @Nonnull final World world) {
            final Player playerComponent = store.getComponent(ref, Player.getComponentType());
            assert playerComponent != null;
            playerComponent.getPageManager().openCustomPage(ref, store, new TintChunkPage(playerRef));
        }
    }
    
    public static class TintChunkPage extends InteractiveCustomUIPage<TintChunkPageEventData>
    {
        TintChunkPage(@Nonnull final PlayerRef playerRef) {
            super(playerRef, CustomPageLifetime.CanDismiss, TintChunkPageEventData.CODEC);
        }
        
        @Override
        public void build(@Nonnull final Ref<EntityStore> ref, @Nonnull final UICommandBuilder commandBuilder, @Nonnull final UIEventBuilder eventBuilder, @Nonnull final Store<EntityStore> store) {
            commandBuilder.append("Pages/TintChunkPage.ui");
            eventBuilder.addEventBinding(CustomUIEventBindingType.ValueChanged, "#ColorPicker", new EventData().append("@Color", "#ColorPicker.Value").append("Submit", TintChunkPageAction.ColorChanged.name()), false);
            eventBuilder.addEventBinding(CustomUIEventBindingType.Activating, "#ApplyButton", new EventData().append("@Color", "#ColorPicker.Value").append("@Radius", "#Radius.Value").append("@BlurEnabled", "#BlurEnabledContainer #CheckBox.Value").append("@Sigma", "#Sigma.Value").append("@HexColor", "#HexColor.Value").append("Submit", TintChunkPageAction.Submit.name()), false);
        }
        
        @Override
        public void handleDataEvent(@Nonnull final Ref<EntityStore> ref, @Nonnull final Store<EntityStore> store, @Nonnull final TintChunkPageEventData data) {
            switch (data.getAction().ordinal()) {
                case 0: {
                    String color = data.getColor().substring(0, 7);
                    final int radiusStr = data.getRadius();
                    final int sigmaStr = data.getSigma();
                    if (!data.getKeyHexColor().isEmpty()) {
                        color = data.getKeyHexColor();
                        if (!color.startsWith("#")) {
                            color = "#" + color;
                        }
                    }
                    if (data.isBlurEnabled()) {
                        CommandManager.get().handleCommand(this.playerRef, "chunk tint " + color + " --blur --radius=" + radiusStr + " --sigma=" + sigmaStr);
                    }
                    else {
                        CommandManager.get().handleCommand(this.playerRef, "chunk tint " + color);
                    }
                    break;
                }
                case 1: {
                    final String color = data.getColor().substring(0, 7);
                    final UICommandBuilder commands = new UICommandBuilder();
                    commands.set("#HexColor.Value", color);
                    this.sendUpdate(commands);
                    break;
                }
            }
        }
        
        public enum TintChunkPageAction
        {
            Submit, 
            ColorChanged;
        }
        
        public static class TintChunkPageEventData
        {
            public static final String KEY_COLOR = "@Color";
            public static final String KEY_RADIUS = "@Radius";
            public static final String KEY_SIGMA = "@Sigma";
            public static final String KEY_BLUR_ENABLED = "@BlurEnabled";
            public static final String KEY_HEX_COLOR = "@HexColor";
            public static final String KEY_ACTION = "Submit";
            @Nonnull
            public static BuilderCodec<TintChunkPageEventData> CODEC;
            private String color;
            private int radius;
            private int sigma;
            private String hexColor;
            private boolean isBlurEnabled;
            private TintChunkPageAction action;
            
            public String getColor() {
                return this.color;
            }
            
            public int getRadius() {
                return this.radius;
            }
            
            public int getSigma() {
                return this.sigma;
            }
            
            public boolean isBlurEnabled() {
                return this.isBlurEnabled;
            }
            
            public String getKeyHexColor() {
                return this.hexColor;
            }
            
            public TintChunkPageAction getAction() {
                return this.action;
            }
            
            static {
                // 
                // This method could not be decompiled.
                // 
                // Original Bytecode:
                // 
                //     2: invokedynamic   BootstrapMethod #0, get:()Ljava/util/function/Supplier;
                //     7: invokestatic    com/hypixel/hytale/codec/builder/BuilderCodec.builder:(Ljava/lang/Class;Ljava/util/function/Supplier;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //    10: new             Lcom/hypixel/hytale/codec/KeyedCodec;
                //    13: dup            
                //    14: ldc             "@Color"
                //    16: getstatic       com/hypixel/hytale/codec/Codec.STRING:Lcom/hypixel/hytale/codec/codecs/simple/StringCodec;
                //    19: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
                //    22: invokedynamic   BootstrapMethod #1, accept:()Ljava/util/function/BiConsumer;
                //    27: invokedynamic   BootstrapMethod #2, apply:()Ljava/util/function/Function;
                //    32: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
                //    35: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //    38: new             Lcom/hypixel/hytale/codec/KeyedCodec;
                //    41: dup            
                //    42: ldc             "@Radius"
                //    44: getstatic       com/hypixel/hytale/codec/Codec.INTEGER:Lcom/hypixel/hytale/codec/codecs/simple/IntegerCodec;
                //    47: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
                //    50: invokedynamic   BootstrapMethod #3, accept:()Ljava/util/function/BiConsumer;
                //    55: invokedynamic   BootstrapMethod #4, apply:()Ljava/util/function/Function;
                //    60: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
                //    63: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //    66: new             Lcom/hypixel/hytale/codec/KeyedCodec;
                //    69: dup            
                //    70: ldc             "@Sigma"
                //    72: getstatic       com/hypixel/hytale/codec/Codec.INTEGER:Lcom/hypixel/hytale/codec/codecs/simple/IntegerCodec;
                //    75: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
                //    78: invokedynamic   BootstrapMethod #5, accept:()Ljava/util/function/BiConsumer;
                //    83: invokedynamic   BootstrapMethod #6, apply:()Ljava/util/function/Function;
                //    88: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
                //    91: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //    94: new             Lcom/hypixel/hytale/codec/KeyedCodec;
                //    97: dup            
                //    98: ldc             "@BlurEnabled"
                //   100: getstatic       com/hypixel/hytale/codec/Codec.BOOLEAN:Lcom/hypixel/hytale/codec/codecs/simple/BooleanCodec;
                //   103: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
                //   106: invokedynamic   BootstrapMethod #7, accept:()Ljava/util/function/BiConsumer;
                //   111: invokedynamic   BootstrapMethod #8, apply:()Ljava/util/function/Function;
                //   116: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
                //   119: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //   122: new             Lcom/hypixel/hytale/codec/KeyedCodec;
                //   125: dup            
                //   126: ldc             "@HexColor"
                //   128: getstatic       com/hypixel/hytale/codec/Codec.STRING:Lcom/hypixel/hytale/codec/codecs/simple/StringCodec;
                //   131: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
                //   134: invokedynamic   BootstrapMethod #9, accept:()Ljava/util/function/BiConsumer;
                //   139: invokedynamic   BootstrapMethod #10, apply:()Ljava/util/function/Function;
                //   144: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
                //   147: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //   150: new             Lcom/hypixel/hytale/codec/KeyedCodec;
                //   153: dup            
                //   154: ldc             "Submit"
                //   156: new             Lcom/hypixel/hytale/codec/codecs/EnumCodec;
                //   159: dup            
                //   160: ldc             Lcom/hypixel/hytale/server/core/command/commands/world/chunk/ChunkTintCommand$TintChunkPage$TintChunkPageAction;.class
                //   162: invokespecial   com/hypixel/hytale/codec/codecs/EnumCodec.<init>:(Ljava/lang/Class;)V
                //   165: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
                //   168: invokedynamic   BootstrapMethod #11, accept:()Ljava/util/function/BiConsumer;
                //   173: invokedynamic   BootstrapMethod #12, apply:()Ljava/util/function/Function;
                //   178: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
                //   181: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
                //   184: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.build:()Lcom/hypixel/hytale/codec/builder/BuilderCodec;
                //   187: putstatic       com/hypixel/hytale/server/core/command/commands/world/chunk/ChunkTintCommand$TintChunkPage$TintChunkPageEventData.CODEC:Lcom/hypixel/hytale/codec/builder/BuilderCodec;
                //   190: return         
                // 
                // The error that occurred was:
                // 
                // java.lang.UnsupportedOperationException: The requested operation is not supported.
                //     at com.strobel.util.ContractUtils.unsupported(ContractUtils.java:27)
                //     at com.strobel.assembler.metadata.TypeReference.getRawType(TypeReference.java:284)
                //     at com.strobel.assembler.metadata.TypeReference.getRawType(TypeReference.java:279)
                //     at com.strobel.assembler.metadata.TypeReference.makeGenericType(TypeReference.java:154)
                //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visitParameterizedType(TypeSubstitutionVisitor.java:225)
                //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visitParameterizedType(TypeSubstitutionVisitor.java:25)
                //     at com.strobel.assembler.metadata.ParameterizedType.accept(ParameterizedType.java:103)
                //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visit(TypeSubstitutionVisitor.java:40)
                //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visitMethod(TypeSubstitutionVisitor.java:314)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferCall(TypeAnalysis.java:2611)
                //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1040)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:782)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:778)
                //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1510)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:790)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferCall(TypeAnalysis.java:2689)
                //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1040)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:782)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:778)
                //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1510)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:790)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferCall(TypeAnalysis.java:2689)
                //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1040)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:782)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:778)
                //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1083)
                //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
                //     at com.strobel.decompiler.ast.TypeAnalysis.runInference(TypeAnalysis.java:684)
                //     at com.strobel.decompiler.ast.TypeAnalysis.runInference(TypeAnalysis.java:667)
                //     at com.strobel.decompiler.ast.TypeAnalysis.runInference(TypeAnalysis.java:373)
                //     at com.strobel.decompiler.ast.TypeAnalysis.run(TypeAnalysis.java:95)
                //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:344)
                //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:42)
                //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:206)
                //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:93)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:868)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:761)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:638)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:605)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:195)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:662)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:605)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:195)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:662)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:605)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:195)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:162)
                //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addType(AstBuilder.java:137)
                //     at com.strobel.decompiler.languages.java.JavaLanguage.buildAst(JavaLanguage.java:71)
                //     at com.strobel.decompiler.languages.java.JavaLanguage.decompileType(JavaLanguage.java:59)
                //     at com.strobel.decompiler.DecompilerDriver.decompileType(DecompilerDriver.java:333)
                //     at com.strobel.decompiler.DecompilerDriver.decompileJar(DecompilerDriver.java:254)
                //     at com.strobel.decompiler.DecompilerDriver.main(DecompilerDriver.java:129)
                // 
                throw new IllegalStateException("An error occurred while decompiling this method.");
            }
        }
    }
}
