content: package kotlin.collections.builders;
  
  import java.io.Externalizable;
  import java.io.InvalidObjectException;
  import java.io.ObjectInput;
  import java.io.ObjectOutput;
  import java.util.Map;
  import kotlin.Metadata;
  import kotlin.collections.MapsKt;
  import kotlin.jvm.internal.DefaultConstructorMarker;
  import kotlin.jvm.internal.Intrinsics;
  
  @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u0000 \u000f2\u00020\u0001:\u0001\u000fB\u0007\b\u0016¢\u0006\u0002\u0010\u0002B\u0015\u0012\u000e\u0010\u0003\u001a\n\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u0004¢\u0006\u0002\u0010\u0005J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0016J\b\u0010\n\u001a\u00020\u000bH\u0002J\u0010\u0010\f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\u000eH\u0016R\u0016\u0010\u0003\u001a\n\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u0004X\u000e¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Lkotlin/collections/builders/SerializedMap;", "Ljava/io/Externalizable;", "()V", "map", "", "(Ljava/util/Map;)V", "readExternal", "", "input", "Ljava/io/ObjectInput;", "readResolve", "", "writeExternal", "output", "Ljava/io/ObjectOutput;", "Companion", "kotlin-stdlib"}, k = 1, mv = {1, 7, 1}, xi = 48)
  /* compiled from: MapBuilder.kt */
  final class SerializedMap implements Externalizable {
      public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
      private static final long serialVersionUID = 0;
      private Map<?, ?> map;
  
      @Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lkotlin/collections/builders/SerializedMap$Companion;", "", "()V", "serialVersionUID", "", "kotlin-stdlib"}, k = 1, mv = {1, 7, 1}, xi = 48)
      /* compiled from: MapBuilder.kt */
      public static final class Companion {
          private Companion() {
          }
  
          public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
              this();
          }
      }
  
      public SerializedMap() {
          this(MapsKt.emptyMap());
      }
  
      public SerializedMap(Map<?, ?> map2) {
          Intrinsics.checkNotNullParameter(map2, "map");
          this.map = map2;
      }
  
      private final Object readResolve() {
          return this.map;
      }
  
      public void readExternal(ObjectInput input) {
          Intrinsics.checkNotNullParameter(input, "input");
          byte readByte = input.readByte();
          if (readByte == 0) {
              int readInt = input.readInt();
              if (readInt >= 0) {
                  Map createMapBuilder = MapsKt.createMapBuilder(readInt);
                  Map map2 = createMapBuilder;
                  for (int i = 0; i < readInt; i++) {
                      int i2 = i;
                      map2.put(input.readObject(), input.readObject());
                  }
                  this.map = MapsKt.build(createMapBuilder);
                  return;
              }
              throw new InvalidObjectException("Illegal size value: " + readInt + '.');
          }
          throw new InvalidObjectException("Unsupported flags value: " + readByte);
      }
  
      public void writeExternal(ObjectOutput output) {
          Intrinsics.checkNotNullParameter(output, "output");
          output.writeByte(0);
          output.writeInt(this.map.size());
          for (Map.Entry next : this.map.entrySet()) {
              output.writeObject(next.getKey());
              output.writeObject(next.getValue());
          }
      }
  }
  