.class public final Lz5/ns1;
.super Lz5/a3;
.source ""


# instance fields
.field public A:J

.field public B:Z

.field public final v:Landroid/content/res/Resources;

.field public final w:Ljava/lang/String;

.field public x:Landroid/net/Uri;

.field public y:Landroid/content/res/AssetFileDescriptor;

.field public z:Ljava/io/InputStream;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lz5/a3;-><init>(Z)V

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    iput-object v0, p0, Lz5/ns1;->v:Landroid/content/res/Resources;

    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object p1

    iput-object p1, p0, Lz5/ns1;->w:Ljava/lang/String;

    return-void
.end method


# virtual methods
.method public final a([BII)I
    .registers 13

    if-nez p3, :cond_4

    const/4 p1, 0x0

    return p1

    :cond_4
    iget-wide v0, p0, Lz5/ns1;->A:J

    const-wide/16 v2, 0x0

    cmp-long v2, v0, v2

    const/4 v3, -0x1

    if-eqz v2, :cond_4f

    const-wide/16 v4, -0x1

    cmp-long v2, v0, v4

    const/16 v6, 0x7d0

    if-eqz v2, :cond_1b

    int-to-long v7, p3

    :try_start_16
    invoke-static {v0, v1, v7, v8}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v0

    long-to-int p3, v0

    :cond_1b
    iget-object v0, p0, Lz5/ns1;->z:Ljava/io/InputStream;

    sget v1, Lz5/r7;->a:I

    invoke-virtual {v0, p1, p2, p3}, Ljava/io/InputStream;->read([BII)I

    move-result p1
    :try_end_23
    .catch Ljava/io/IOException; {:try_start_16 .. :try_end_23} :catch_47

    if-ne p1, v3, :cond_39

    iget-wide p1, p0, Lz5/ns1;->A:J

    cmp-long p1, p1, v4

    if-nez p1, :cond_2c

    return v3

    :cond_2c
    new-instance p1, Lz5/ms1;

    new-instance p2, Ljava/io/EOFException;

    invoke-direct {p2}, Ljava/io/EOFException;-><init>()V

    const-string p3, "End of stream reached having not read sufficient data."

    invoke-direct {p1, p3, p2, v6}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw p1

    :cond_39
    iget-wide p2, p0, Lz5/ns1;->A:J

    cmp-long v0, p2, v4

    if-eqz v0, :cond_43

    int-to-long v0, p1

    sub-long/2addr p2, v0

    iput-wide p2, p0, Lz5/ns1;->A:J

    :cond_43
    invoke-virtual {p0, p1}, Lz5/a3;->m(I)V

    return p1

    :catch_47
    move-exception p1

    new-instance p2, Lz5/ms1;

    const/4 p3, 0x0

    invoke-direct {p2, p3, p1, v6}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw p2

    :cond_4f
    return v3
.end method

.method public final h(Lz5/a8;)J
    .registers 17

    move-object v1, p0

    move-object/from16 v0, p1

    iget-object v2, v0, Lz5/a8;->a:Landroid/net/Uri;

    iput-object v2, v1, Lz5/ns1;->x:Landroid/net/Uri;

    invoke-virtual {v2}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v3

    const-string v4, "rawresource"

    invoke-static {v4, v3}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z

    move-result v3

    const/16 v4, 0x7d5

    const/16 v5, 0x3ec

    const/4 v6, 0x1

    const/4 v7, 0x0

    if-nez v3, :cond_a8

    invoke-virtual {v2}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v3

    const-string v8, "android.resource"

    invoke-static {v8, v3}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z

    move-result v3

    if-eqz v3, :cond_3f

    invoke-virtual {v2}, Landroid/net/Uri;->getPathSegments()Ljava/util/List;

    move-result-object v3

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v3

    if-ne v3, v6, :cond_3f

    invoke-virtual {v2}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const-string v9, "\\d+"

    invoke-virtual {v3, v9}, Ljava/lang/String;->matches(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_3f

    goto :goto_a8

    :cond_3f
    invoke-virtual {v2}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v3

    invoke-static {v8, v3}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z

    move-result v3

    if-eqz v3, :cond_a0

    invoke-virtual {v2}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const-string v5, "/"

    invoke-virtual {v3, v5}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v5

    if-eqz v5, :cond_5c

    invoke-virtual {v3, v6}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v3

    :cond_5c
    invoke-virtual {v2}, Landroid/net/Uri;->getHost()Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v8

    if-eqz v8, :cond_69

    const-string v5, ""

    goto :goto_73

    :cond_69
    invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    const-string v8, ":"

    invoke-virtual {v5, v8}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    :goto_73
    invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/String;->length()I

    move-result v8

    if-eqz v8, :cond_86

    invoke-virtual {v5, v3}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    goto :goto_8b

    :cond_86
    new-instance v3, Ljava/lang/String;

    invoke-direct {v3, v5}, Ljava/lang/String;-><init>(Ljava/lang/String;)V

    :goto_8b
    iget-object v5, v1, Lz5/ns1;->v:Landroid/content/res/Resources;

    iget-object v8, v1, Lz5/ns1;->w:Ljava/lang/String;

    const-string v9, "raw"

    invoke-virtual {v5, v3, v9, v8}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v3

    if-eqz v3, :cond_98

    goto :goto_b3

    :cond_98
    new-instance v0, Lz5/ms1;

    const-string v2, "Resource not found."

    invoke-direct {v0, v2, v7, v4}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0

    :cond_a0
    new-instance v0, Lz5/ms1;

    const-string v2, "URI must either use scheme rawresource or android.resource"

    invoke-direct {v0, v2, v7, v5}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0

    :cond_a8
    :goto_a8
    :try_start_a8
    invoke-virtual {v2}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;

    move-result-object v3
    :try_end_ac
    .catch Ljava/lang/NumberFormatException; {:try_start_a8 .. :try_end_ac} :catch_17b

    invoke-static {v3}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    :try_start_af
    invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v3
    :try_end_b3
    .catch Ljava/lang/NumberFormatException; {:try_start_af .. :try_end_b3} :catch_17b

    :goto_b3
    invoke-virtual/range {p0 .. p1}, Lz5/a3;->c(Lz5/a8;)V

    :try_start_b6
    iget-object v5, v1, Lz5/ns1;->v:Landroid/content/res/Resources;

    invoke-virtual {v5, v3}, Landroid/content/res/Resources;->openRawResourceFd(I)Landroid/content/res/AssetFileDescriptor;

    move-result-object v3
    :try_end_bc
    .catch Landroid/content/res/Resources$NotFoundException; {:try_start_b6 .. :try_end_bc} :catch_173

    iput-object v3, v1, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    const/16 v4, 0x7d0

    if-eqz v3, :cond_162

    invoke-virtual {v3}, Landroid/content/res/AssetFileDescriptor;->getLength()J

    move-result-wide v8

    new-instance v2, Ljava/io/FileInputStream;

    invoke-virtual {v3}, Landroid/content/res/AssetFileDescriptor;->getFileDescriptor()Ljava/io/FileDescriptor;

    move-result-object v5

    invoke-direct {v2, v5}, Ljava/io/FileInputStream;-><init>(Ljava/io/FileDescriptor;)V

    iput-object v2, v1, Lz5/ns1;->z:Ljava/io/InputStream;

    const-wide/16 v10, -0x1

    cmp-long v5, v8, v10

    const/16 v12, 0x7d8

    if-eqz v5, :cond_e6

    :try_start_d9
    iget-wide v13, v0, Lz5/a8;->d:J

    cmp-long v13, v13, v8

    if-gtz v13, :cond_e0

    goto :goto_e6

    :cond_e0
    new-instance v0, Lz5/ms1;

    invoke-direct {v0, v7, v7, v12}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0

    :cond_e6
    :goto_e6
    invoke-virtual {v3}, Landroid/content/res/AssetFileDescriptor;->getStartOffset()J

    move-result-wide v13

    iget-wide v6, v0, Lz5/a8;->d:J

    add-long/2addr v6, v13

    invoke-virtual {v2, v6, v7}, Ljava/io/FileInputStream;->skip(J)J

    move-result-wide v6

    sub-long/2addr v6, v13

    iget-wide v13, v0, Lz5/a8;->d:J

    cmp-long v13, v6, v13

    if-nez v13, :cond_151

    const-wide/16 v13, 0x0

    if-nez v5, :cond_123

    invoke-virtual {v2}, Ljava/io/FileInputStream;->getChannel()Ljava/nio/channels/FileChannel;

    move-result-object v2

    invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->size()J

    move-result-wide v5

    cmp-long v5, v5, v13

    if-nez v5, :cond_10c

    iput-wide v10, v1, Lz5/ns1;->A:J

    move-wide v5, v10

    goto :goto_12b

    :cond_10c
    invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->size()J

    move-result-wide v5

    invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->position()J

    move-result-wide v7

    sub-long/2addr v5, v7

    iput-wide v5, v1, Lz5/ns1;->A:J

    cmp-long v2, v5, v13

    if-ltz v2, :cond_11c

    goto :goto_12b

    :cond_11c
    new-instance v0, Lz5/ms1;

    const/4 v2, 0x0

    invoke-direct {v0, v2, v2, v12}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0

    :cond_123
    sub-long v5, v8, v6

    iput-wide v5, v1, Lz5/ns1;->A:J
    :try_end_127
    .catch Lz5/ms1; {:try_start_d9 .. :try_end_127} :catch_160
    .catch Ljava/io/IOException; {:try_start_d9 .. :try_end_127} :catch_158

    cmp-long v2, v5, v13

    if-ltz v2, :cond_14b

    :goto_12b
    iget-wide v2, v0, Lz5/a8;->e:J

    cmp-long v4, v2, v10

    if-eqz v4, :cond_13b

    cmp-long v4, v5, v10

    if-eqz v4, :cond_139

    invoke-static {v5, v6, v2, v3}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v2

    :cond_139
    iput-wide v2, v1, Lz5/ns1;->A:J

    :cond_13b
    const/4 v2, 0x1

    iput-boolean v2, v1, Lz5/ns1;->B:Z

    invoke-virtual/range {p0 .. p1}, Lz5/a3;->i(Lz5/a8;)V

    iget-wide v2, v0, Lz5/a8;->e:J

    cmp-long v0, v2, v10

    if-eqz v0, :cond_148

    return-wide v2

    :cond_148
    iget-wide v2, v1, Lz5/ns1;->A:J

    return-wide v2

    :cond_14b
    :try_start_14b
    new-instance v0, Lz5/y5;

    invoke-direct {v0, v12}, Lz5/y5;-><init>(I)V

    throw v0

    :cond_151
    new-instance v0, Lz5/ms1;

    const/4 v2, 0x0

    invoke-direct {v0, v2, v2, v12}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0
    :try_end_158
    .catch Lz5/ms1; {:try_start_14b .. :try_end_158} :catch_160
    .catch Ljava/io/IOException; {:try_start_14b .. :try_end_158} :catch_158

    :catch_158
    move-exception v0

    new-instance v2, Lz5/ms1;

    const/4 v3, 0x0

    invoke-direct {v2, v3, v0, v4}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v2

    :catch_160
    move-exception v0

    throw v0

    :cond_162
    move-object v3, v7

    new-instance v0, Lz5/ms1;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    const-string v5, "Resource is compressed: "

    invoke-virtual {v5, v2}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v2, v3, v4}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0

    :catch_173
    move-exception v0

    move-object v3, v7

    new-instance v2, Lz5/ms1;

    invoke-direct {v2, v3, v0, v4}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v2

    :catch_17b
    move-object v3, v7

    new-instance v0, Lz5/ms1;

    const-string v2, "Resource identifier must be an integer."

    invoke-direct {v0, v2, v3, v5}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v0
.end method

.method public final zzi()Landroid/net/Uri;
    .registers 2

    iget-object v0, p0, Lz5/ns1;->x:Landroid/net/Uri;

    return-object v0
.end method

.method public final zzj()V
    .registers 6

    const/4 v0, 0x0

    iput-object v0, p0, Lz5/ns1;->x:Landroid/net/Uri;

    const/16 v1, 0x7d0

    const/4 v2, 0x0

    :try_start_6
    iget-object v3, p0, Lz5/ns1;->z:Ljava/io/InputStream;

    if-eqz v3, :cond_d

    invoke-virtual {v3}, Ljava/io/InputStream;->close()V
    :try_end_d
    .catch Ljava/io/IOException; {:try_start_6 .. :try_end_d} :catch_39
    .catchall {:try_start_6 .. :try_end_d} :catchall_37

    :cond_d
    iput-object v0, p0, Lz5/ns1;->z:Ljava/io/InputStream;

    :try_start_f
    iget-object v3, p0, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    if-eqz v3, :cond_16

    invoke-virtual {v3}, Landroid/content/res/AssetFileDescriptor;->close()V
    :try_end_16
    .catch Ljava/io/IOException; {:try_start_f .. :try_end_16} :catch_24
    .catchall {:try_start_f .. :try_end_16} :catchall_22

    :cond_16
    iput-object v0, p0, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    iget-boolean v0, p0, Lz5/ns1;->B:Z

    if-eqz v0, :cond_21

    iput-boolean v2, p0, Lz5/ns1;->B:Z

    invoke-virtual {p0}, Lz5/a3;->n()V

    :cond_21
    return-void

    :catchall_22
    move-exception v1

    goto :goto_2b

    :catch_24
    move-exception v3

    :try_start_25
    new-instance v4, Lz5/ms1;

    invoke-direct {v4, v0, v3, v1}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v4
    :try_end_2b
    .catchall {:try_start_25 .. :try_end_2b} :catchall_22

    :goto_2b
    iput-object v0, p0, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    iget-boolean v0, p0, Lz5/ns1;->B:Z

    if-eqz v0, :cond_36

    iput-boolean v2, p0, Lz5/ns1;->B:Z

    invoke-virtual {p0}, Lz5/a3;->n()V

    :cond_36
    throw v1

    :catchall_37
    move-exception v3

    goto :goto_40

    :catch_39
    move-exception v3

    :try_start_3a
    new-instance v4, Lz5/ms1;

    invoke-direct {v4, v0, v3, v1}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v4
    :try_end_40
    .catchall {:try_start_3a .. :try_end_40} :catchall_37

    :goto_40
    iput-object v0, p0, Lz5/ns1;->z:Ljava/io/InputStream;

    :try_start_42
    iget-object v4, p0, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    if-eqz v4, :cond_49

    invoke-virtual {v4}, Landroid/content/res/AssetFileDescriptor;->close()V
    :try_end_49
    .catch Ljava/io/IOException; {:try_start_42 .. :try_end_49} :catch_57
    .catchall {:try_start_42 .. :try_end_49} :catchall_55

    :cond_49
    iput-object v0, p0, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    iget-boolean v0, p0, Lz5/ns1;->B:Z

    if-eqz v0, :cond_54

    iput-boolean v2, p0, Lz5/ns1;->B:Z

    invoke-virtual {p0}, Lz5/a3;->n()V

    :cond_54
    throw v3

    :catchall_55
    move-exception v1

    goto :goto_5e

    :catch_57
    move-exception v3

    :try_start_58
    new-instance v4, Lz5/ms1;

    invoke-direct {v4, v0, v3, v1}, Lz5/ms1;-><init>(Ljava/lang/String;Ljava/lang/Throwable;I)V

    throw v4
    :try_end_5e
    .catchall {:try_start_58 .. :try_end_5e} :catchall_55

    :goto_5e
    iput-object v0, p0, Lz5/ns1;->y:Landroid/content/res/AssetFileDescriptor;

    iget-boolean v0, p0, Lz5/ns1;->B:Z

    if-nez v0, :cond_65

    goto :goto_6a

    :cond_65
    iput-boolean v2, p0, Lz5/ns1;->B:Z

    invoke-virtual {p0}, Lz5/a3;->n()V

    :goto_6a
    throw v1
.end method
