<commit_before>import { ReplaySubject } from 'rxjs/ReplaySubject'
import { Subject } from 'rxjs/Subject'
import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/map'

import { Service } from './Service'
import { webRTCBuilder } from '../Protobuf'
import { Channel } from '../Channel'
import { WebChannel } from './WebChannel'
import { WebRTC, CloseEvent } from '../polyfills'

const ID = 0

const CONNECTION_TIMEOUT = 10000

interface IceCandidate {
  candidate: string,
  sdpMid?: string,
  sdpMLineIndex?: number
}

interface OfferSent {
  offer?: string,
  iceCandidate?: IceCandidate
}

interface OfferReceived {
  offer?: string,
  iceCandidate?: IceCandidate,
  isError?: boolean,
  id: number
}

interface AnswerSent {
  answer?: string,
  iceCandidate?: IceCandidate
}

interface AnswerReceived {
  answer?: string,
  iceCandidate?: IceCandidate,
  isError?: boolean
}

/**
 * Service class responsible to establish `RTCDataChannel` between two clients via
 * signaling server or `WebChannel`.
 *
 */
export class WebRTCBuilder extends Service {
  private wc: WebChannel
  private rtcConfiguration: RTCConfiguration
  private clients: Map<number, [RTCPeerConnection, ReplaySubject<IceCandidate>]>

  constructor (wc, iceServers) {
    super(ID, webRTCBuilder.Message, wc._svcMsgStream)
    this.wc = wc
    this.rtcConfiguration = { iceServers }
    this.clients = new Map()<commit_msg>style(WebRTCBuilder): add missing types to constructor<commit_after>import { ReplaySubject } from 'rxjs/ReplaySubject'
import { Subject } from 'rxjs/Subject'
import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/map'

import { Service } from './Service'
import { webRTCBuilder } from '../Protobuf'
import { Channel } from '../Channel'
import { WebChannel } from './WebChannel'
import { WebRTC, CloseEvent } from '../polyfills'

const ID = 0

const CONNECTION_TIMEOUT = 10000

interface IceCandidate {
  candidate: string,
  sdpMid?: string,
  sdpMLineIndex?: number
}

interface OfferSent {
  offer?: string,
  iceCandidate?: IceCandidate
}

interface OfferReceived {
  offer?: string,
  iceCandidate?: IceCandidate,
  isError?: boolean,
  id: number
}

interface AnswerSent {
  answer?: string,
  iceCandidate?: IceCandidate
}

interface AnswerReceived {
  answer?: string,
  iceCandidate?: IceCandidate,
  isError?: boolean
}

/**
 * Service class responsible to establish `RTCDataChannel` between two clients via
 * signaling server or `WebChannel`.
 *
 */
export class WebRTCBuilder extends Service {
  private wc: WebChannel
  private rtcConfiguration: RTCConfiguration
  private clients: Map<number, [RTCPeerConnection, ReplaySubject<IceCandidate>]>

  constructor (wc: WebChannel, iceServers: RTCIceServer[]) {
    super(ID, webRTCBuilder.Message, wc._svcMsgStream)
    this.wc = wc
    this.rtcConfiguration = { iceServers }
    this.clients = new Map()
{'fraction_non_alphanumeric': 0.10564599930723935, 'fraction_numerical': 0.004156563907170073, 'mean_word_length': 4.596899224806202, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602610', 'n_tokens_mistral': 900, 'n_tokens_neox': 857, 'n_words': 250}