package com.ss.android.ugc.aweme.shortvideo.cut;

import X.07U;
import X.0Bt;
import X.0CB;
import X.0CH;
import X.1Bn;
import X.C09055Vv;
import X.C31126Is;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.shortvideo.cut.model.VideoSegment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class CutMultiVideoViewModel extends 0Bt implements C31126Is {
    public 1Bn<07U<Integer, Integer>> LIZ = new 1Bn<>();
    public 1Bn<Long> LIZIZ = new 1Bn<>();
    public 1Bn<Long> LIZJ = new 1Bn<>();
    public 1Bn<Float> LIZLLL = new 1Bn<>();
    public 1Bn<Void> LJ = new 1Bn<>();
    public 1Bn<VideoSegment> LJFF = new 1Bn<>();
    public 1Bn<07U<Integer, Integer>> LJI = new 1Bn<>();
    public 1Bn<Void> LJII = new 1Bn<>();
    public 1Bn<Void> LJIIIIZZ = new 1Bn<>();
    public 1Bn<C09055Vv> LJIIIZ = new 1Bn<>();
    public boolean LJIIJ;
    public int LJIIJJI;
    public long LJIIL;
    public long LJIILIIL = 0;
    public HashMap<String, Integer> LJIILJJIL = new HashMap<>();

    static {
        Covode.recordClassIndex(108471);
    }

    public void onStateChanged(0CH r1, 0CB r2) {
    }

    public final void LIZIZ() {
        this.LJ.setValue((Object) null);
    }

    public final void LIZJ() {
        this.LJII.setValue((Object) null);
    }

    public final void LIZLLL() {
        this.LJIIIIZZ.setValue((Object) null);
    }

    public final void LIZ() {
        this.LIZ.setValue(07U.LIZ(0, 0));
    }

    public final void LIZ(C09055Vv r2) {
        this.LJIIIZ.setValue(r2);
    }

    public final void LIZ(VideoSegment videoSegment) {
        this.LJFF.setValue(videoSegment);
    }

    public final void LIZ(String str) {
        this.LJIILJJIL.put(str, 1);
    }

    public final void LIZ(int i, int i2) {
        this.LJI.setValue(07U.LIZ(Integer.valueOf(i), Integer.valueOf(i2)));
    }

    public final void LIZ(long j, List<VideoSegment> list, float f) {
        int i;
        this.LIZJ.setValue(Long.valueOf(j));
        if (this.LIZ.getValue() != null) {
            i = ((Integer) ((07U) this.LIZ.getValue()).LIZIZ).intValue();
        } else {
            i = 0;
        }
        ArrayList arrayList = new ArrayList();
        for (int i2 = 0; i2 < list.size(); i2++) {
            if (!list.get(i2).LJIIIZ) {
                arrayList.add(list.get(i2));
            }
        }
        long j2 = 0;
        for (int i3 = 0; i3 < arrayList.size(); i3++) {
            VideoSegment videoSegment = (VideoSegment) arrayList.get(i3);
            j2 = (long) (((float) j2) + (((float) (videoSegment.LJ() - videoSegment.LIZLLL())) / (videoSegment.LJFF() * f)));
            if (j2 > j) {
                this.LIZ.setValue(07U.LIZ(Integer.valueOf(i), Integer.valueOf(i3)));
                return;
            }
        }
    }
}
