/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.mime.PartIterator
 *  com.l7tech.message.Message
 *  com.l7tech.message.MimeKnob
 *  com.l7tech.policy.assertion.ext.message.knob.CustomPartsKnob
 *  com.l7tech.policy.assertion.ext.message.knob.CustomPartsKnob$Part
 *  org.jetbrains.annotations.NotNull
 */
package com.l7tech.server.custom.knob;

import com.l7tech.common.mime.PartIterator;
import com.l7tech.message.Message;
import com.l7tech.message.MimeKnob;
import com.l7tech.policy.assertion.ext.message.knob.CustomPartsKnob;
import com.l7tech.server.custom.knob.CustomMessageKnobBase;
import com.l7tech.server.custom.knob.a;
import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.jetbrains.annotations.NotNull;

/*
 * Exception performing whole class analysis ignored.
 */
public class CustomPartsKnobImpl
extends CustomMessageKnobBase
implements CustomPartsKnob {
    private final Message a;
    private static final String[] c;

    public CustomPartsKnobImpl(@NotNull Message message) {
        if (message == null) {
            CustomPartsKnobImpl.b(0);
        }
        String[] stringArray = c;
        this(stringArray[5], stringArray[7], message);
    }

    public CustomPartsKnobImpl(@NotNull String string, @NotNull String string2, @NotNull Message message) {
        if (string == null) {
            CustomPartsKnobImpl.b(1);
        }
        if (string2 == null) {
            CustomPartsKnobImpl.b(2);
        }
        if (message == null) {
            CustomPartsKnobImpl.b(3);
        }
        super(string, string2);
        this.a = message;
    }

    public Iterator<CustomPartsKnob.Part> iterator() throws NoSuchElementException {
        MimeKnob mimeKnob;
        MimeKnob mimeKnob2 = null;
        boolean bl2 = false;
        try {
            if (this.a.isInitialized() && (mimeKnob = (MimeKnob)this.a.getKnob(MimeKnob.class)) != null) {
                mimeKnob2 = mimeKnob.getParts();
                bl2 = mimeKnob.isBufferingDisallowed();
            }
        }
        catch (IOException iOException) {
            NoSuchElementException noSuchElementException = new NoSuchElementException(iOException.getMessage());
            noSuchElementException.initCause(iOException);
            throw noSuchElementException;
        }
        mimeKnob = mimeKnob2;
        boolean bl3 = bl2;
        return new a(this, (PartIterator)mimeKnob, bl3);
    }

    /*
     * Exception decompiling
     */
    private static /* synthetic */ void b(int var0) {
        /*
         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
         * 
         * org.benf.cfr.reader.util.ConfusedCFRException: Tried to end blocks [0[TRYBLOCK]], but top level block is 1[SWITCH]
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.processEndingBlocks(Op04StructuredStatement.java:435)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.buildNestedBlocks(Op04StructuredStatement.java:484)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op03SimpleStatement.createInitialStructuredBlock(Op03SimpleStatement.java:736)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:850)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1050)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
         *     at org.benf.cfr.reader.Main.main(Main.java:54)
         */
        throw new IllegalStateException("Decompilation failed");
    }

    private static NoSuchElementException a(NoSuchElementException noSuchElementException) {
        return noSuchElementException;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[8];
                var3_1 = 0;
                var2_2 = "\u0016p9LU\u0004V\u0006|%A\u0007\u001fp9\\F\nC>3g-ZJ\bH\u00065,@UMf<z>aR\u0001JRe+]F\u0000C\u0006p8\u000f\u0000HUU5%I\u0007HU\\09\u000fJ\u0018U\u00065$@SMD\u00175$ZK\u0001\u0004\u001ct'J1\u0011z'\u0000KZR\u0017v\"\u0000T\bT\u0004p8\u0000D\u0018U\u0006z'\u0000L\u0003I\u0010:\tZT\u0019I\u001fE+]S\u001em\u001cz(fJ\u001dJ\u000e?|'Jj\u0018J\u0006|\u001aNU\u0019U";
                var4_3 = "\u0016p9LU\u0004V\u0006|%A\u0007\u001fp9\\F\nC>3g-ZJ\bH\u00065,@UMf<z>aR\u0001JRe+]F\u0000C\u0006p8\u000f\u0000HUU5%I\u0007HU\\09\u000fJ\u0018U\u00065$@SMD\u00175$ZK\u0001\u0004\u001ct'J1\u0011z'\u0000KZR\u0017v\"\u0000T\bT\u0004p8\u0000D\u0018U\u0006z'\u0000L\u0003I\u0010:\tZT\u0019I\u001fE+]S\u001em\u001cz(fJ\u001dJ\u000e?|'Jj\u0018J\u0006|\u001aNU\u0019U".length();
                var1_4 = 11;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 48;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = CustomPartsKnobImpl.b(v0, CustomPartsKnobImpl.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "Vd<^KK\"'d?Rr\u0000R\u001ed\u0002VM\u0001MJn'DK\u001aSJ`7DL\u0014Y\u000f-9YP\u0017";
                    var4_3 = "Vd<^KK\"'d?Rr\u0000R\u001ed\u0002VM\u0001MJn'DK\u001aSJ`7DL\u0014Y\u000f-9YP\u0017".length();
                    var1_4 = 6;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 40;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = CustomPartsKnobImpl.b(v0, CustomPartsKnobImpl.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        CustomPartsKnobImpl.c = var5;
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x16);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 66;
                    case 1 -> 37;
                    case 2 -> 122;
                    case 3 -> 31;
                    case 4 -> 23;
                    case 5 -> 93;
                    default -> 22;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

