() => {
    it('should promisify all the things', () => {
      assert(promisified);
    });

    it('should localize the zone instance', () => {
      assert.strictEqual(record.zone_, ZONE);
    });

    it('should localize the type', () => {
      assert.strictEqual(record.type, TYPE);
    });

    it('should localize the metadata', () => {
      assert.strictEqual(record.metadata, METADATA);
    });

    it('should assign the parsed metadata', () => {
      const parsedMetadata = record.toJSON();
      delete parsedMetadata.rrdatas;
      // tslint:disable-next-line:forin
      for (const prop in parsedMetadata) {
        assert.strictEqual(record[prop], parsedMetadata[prop]);
      }
    });

    it('should re-assign rrdatas to data', () => {
      const originalRrdatas = new Array<string>();

      const recordThatHadRrdatas = new Record(ZONE, TYPE, {
        rrdatas: originalRrdatas,
      });

      assert.strictEqual(recordThatHadRrdatas.rrdatas, undefined);
      assert.strictEqual(recordThatHadRrdatas.data, originalRrdatas);
    });
  }


() => {
      assert(promisified);
    }


() => {
      assert.strictEqual(record.zone_, ZONE);
    }


() => {
      assert.strictEqual(record.type, TYPE);
    }


() => {
      assert.strictEqual(record.metadata, METADATA);
    }


() => {
      const parsedMetadata = record.toJSON();
      delete parsedMetadata.rrdatas;
      // tslint:disable-next-line:forin
      for (const prop in parsedMetadata) {
        assert.strictEqual(record[prop], parsedMetadata[prop]);
      }
    }


() => {
      const originalRrdatas = new Array<string>();

      const recordThatHadRrdatas = new Record(ZONE, TYPE, {
        rrdatas: originalRrdatas,
      });

      assert.strictEqual(recordThatHadRrdatas.rrdatas, undefined);
      assert.strictEqual(recordThatHadRrdatas.data, originalRrdatas);
    }


() => {
    describe('a', () => {
      const aRecord = {
        ip: '0.0.0.0',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = aRecord.ip;

      it('should parse an A record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'a', aRecord);

        assert.strictEqual(record.type, 'A');
        assert.deepStrictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, aRecord.name);
        assert.strictEqual(record.metadata.ttl, aRecord.ttl);
      });
    });

    describe('aaaa', () => {
      const aaaaRecord = {
        ip: '2607:f8b0:400a:801::1005',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = aaaaRecord.ip;

      it('should parse an AAAA record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'aaaa', aaaaRecord);

        assert.strictEqual(record.type, 'AAAA');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, aaaaRecord.name);
        assert.strictEqual(record.metadata.ttl, aaaaRecord.ttl);
      });
    });

    describe('cname', () => {
      const cnameRecord = {
        alias: 'example.com.',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = cnameRecord.alias;

      it('should parse a CNAME record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'cname', cnameRecord);

        assert.strictEqual(record.type, 'CNAME');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, cnameRecord.name);
        assert.strictEqual(record.metadata.ttl, cnameRecord.ttl);
      });
    });

    describe('mx', () => {
      const mxRecord = {
        preference: 0,
        host: 'mail',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = mxRecord.preference + ' ' + mxRecord.host;

      it('should parse an MX record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'mx', mxRecord);

        assert.strictEqual(record.type, 'MX');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, mxRecord.name);
        assert.strictEqual(record.metadata.ttl, mxRecord.ttl);
      });
    });

    describe('ns', () => {
      const nsRecord = {
        host: 'example.com',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = nsRecord.host;

      it('should parse an NS record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'ns', nsRecord);

        assert.strictEqual(record.type, 'NS');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, nsRecord.name);
        assert.strictEqual(record.metadata.ttl, nsRecord.ttl);
      });
    });

    describe('soa', () => {
      const soaRecord = {
        mname: 'ns1.nameserver.net.',
        rname: 'hostmaster.mydomain.com.',
        serial: 86400,
        retry: 600,
        refresh: 3600,
        expire: 604800,
        minimum: 86400,
        name: 'name',
        ttl: 86400,
      };

      const expectedData = [
        soaRecord.mname,
        soaRecord.rname,
        soaRecord.serial,
        soaRecord.retry,
        soaRecord.refresh,
        soaRecord.expire,
        soaRecord.minimum,
      ].join(' ');

      it('should parse an SOA record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'soa', soaRecord);

        assert.strictEqual(record.type, 'SOA');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, soaRecord.name);
        assert.strictEqual(record.metadata.ttl, soaRecord.ttl);
      });
    });

    describe('spf', () => {
      const spfRecord = {
        data: '"v=spf1" "mx:example.com"',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = spfRecord.data;

      it('should parse an SPF record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'spf', spfRecord);

        assert.strictEqual(record.type, 'SPF');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, spfRecord.name);
        assert.strictEqual(record.metadata.ttl, spfRecord.ttl);
      });
    });

    describe('srv', () => {
      const srvRecord = {
        priority: 10,
        weight: 0,
        port: 5222,
        target: 'jabber',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = [
        srvRecord.priority,
        srvRecord.weight,
        srvRecord.port,
        srvRecord.target,
      ].join(' ');

      it('should parse an SRV record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'srv', srvRecord);

        assert.strictEqual(record.type, 'SRV');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, srvRecord.name);
        assert.strictEqual(record.metadata.ttl, srvRecord.ttl);
      });
    });

    describe('txt', () => {
      const txtRecord = {
        txt: 'txt-record-txt',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = txtRecord.txt;

      it('should parse a TXT record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'txt', txtRecord);

        assert.strictEqual(record.type, 'TXT');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, txtRecord.name);
        assert.strictEqual(record.metadata.ttl, txtRecord.ttl);
      });
    });
  }


() => {
      const aRecord = {
        ip: '0.0.0.0',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = aRecord.ip;

      it('should parse an A record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'a', aRecord);

        assert.strictEqual(record.type, 'A');
        assert.deepStrictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, aRecord.name);
        assert.strictEqual(record.metadata.ttl, aRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'a', aRecord);

        assert.strictEqual(record.type, 'A');
        assert.deepStrictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, aRecord.name);
        assert.strictEqual(record.metadata.ttl, aRecord.ttl);
      }


() => {
      const aaaaRecord = {
        ip: '2607:f8b0:400a:801::1005',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = aaaaRecord.ip;

      it('should parse an AAAA record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'aaaa', aaaaRecord);

        assert.strictEqual(record.type, 'AAAA');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, aaaaRecord.name);
        assert.strictEqual(record.metadata.ttl, aaaaRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'aaaa', aaaaRecord);

        assert.strictEqual(record.type, 'AAAA');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, aaaaRecord.name);
        assert.strictEqual(record.metadata.ttl, aaaaRecord.ttl);
      }


() => {
      const cnameRecord = {
        alias: 'example.com.',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = cnameRecord.alias;

      it('should parse a CNAME record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'cname', cnameRecord);

        assert.strictEqual(record.type, 'CNAME');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, cnameRecord.name);
        assert.strictEqual(record.metadata.ttl, cnameRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'cname', cnameRecord);

        assert.strictEqual(record.type, 'CNAME');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, cnameRecord.name);
        assert.strictEqual(record.metadata.ttl, cnameRecord.ttl);
      }


() => {
      const mxRecord = {
        preference: 0,
        host: 'mail',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = mxRecord.preference + ' ' + mxRecord.host;

      it('should parse an MX record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'mx', mxRecord);

        assert.strictEqual(record.type, 'MX');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, mxRecord.name);
        assert.strictEqual(record.metadata.ttl, mxRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'mx', mxRecord);

        assert.strictEqual(record.type, 'MX');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, mxRecord.name);
        assert.strictEqual(record.metadata.ttl, mxRecord.ttl);
      }


() => {
      const nsRecord = {
        host: 'example.com',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = nsRecord.host;

      it('should parse an NS record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'ns', nsRecord);

        assert.strictEqual(record.type, 'NS');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, nsRecord.name);
        assert.strictEqual(record.metadata.ttl, nsRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'ns', nsRecord);

        assert.strictEqual(record.type, 'NS');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, nsRecord.name);
        assert.strictEqual(record.metadata.ttl, nsRecord.ttl);
      }


() => {
      const soaRecord = {
        mname: 'ns1.nameserver.net.',
        rname: 'hostmaster.mydomain.com.',
        serial: 86400,
        retry: 600,
        refresh: 3600,
        expire: 604800,
        minimum: 86400,
        name: 'name',
        ttl: 86400,
      };

      const expectedData = [
        soaRecord.mname,
        soaRecord.rname,
        soaRecord.serial,
        soaRecord.retry,
        soaRecord.refresh,
        soaRecord.expire,
        soaRecord.minimum,
      ].join(' ');

      it('should parse an SOA record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'soa', soaRecord);

        assert.strictEqual(record.type, 'SOA');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, soaRecord.name);
        assert.strictEqual(record.metadata.ttl, soaRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'soa', soaRecord);

        assert.strictEqual(record.type, 'SOA');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, soaRecord.name);
        assert.strictEqual(record.metadata.ttl, soaRecord.ttl);
      }


() => {
      const spfRecord = {
        data: '"v=spf1" "mx:example.com"',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = spfRecord.data;

      it('should parse an SPF record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'spf', spfRecord);

        assert.strictEqual(record.type, 'SPF');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, spfRecord.name);
        assert.strictEqual(record.metadata.ttl, spfRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'spf', spfRecord);

        assert.strictEqual(record.type, 'SPF');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, spfRecord.name);
        assert.strictEqual(record.metadata.ttl, spfRecord.ttl);
      }


() => {
      const srvRecord = {
        priority: 10,
        weight: 0,
        port: 5222,
        target: 'jabber',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = [
        srvRecord.priority,
        srvRecord.weight,
        srvRecord.port,
        srvRecord.target,
      ].join(' ');

      it('should parse an SRV record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'srv', srvRecord);

        assert.strictEqual(record.type, 'SRV');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, srvRecord.name);
        assert.strictEqual(record.metadata.ttl, srvRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'srv', srvRecord);

        assert.strictEqual(record.type, 'SRV');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, srvRecord.name);
        assert.strictEqual(record.metadata.ttl, srvRecord.ttl);
      }


() => {
      const txtRecord = {
        txt: 'txt-record-txt',
        name: 'name',
        ttl: 86400,
      };

      const expectedData = txtRecord.txt;

      it('should parse a TXT record', () => {
        const record = Record.fromZoneRecord_(ZONE, 'txt', txtRecord);

        assert.strictEqual(record.type, 'TXT');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, txtRecord.name);
        assert.strictEqual(record.metadata.ttl, txtRecord.ttl);
      });
    }


() => {
        const record = Record.fromZoneRecord_(ZONE, 'txt', txtRecord);

        assert.strictEqual(record.type, 'TXT');
        assert.strictEqual(record.metadata.data, expectedData);
        assert.strictEqual(record.metadata.name, txtRecord.name);
        assert.strictEqual(record.metadata.ttl, txtRecord.ttl);
      }


() => {
    it('should call zone.deleteRecords', done => {
      record.zone_.deleteRecords = (records: Record[], callback: Function) => {
        assert.strictEqual(records, record);
        callback();
      };
      record.delete(done);
    });
  }


done => {
      record.zone_.deleteRecords = (records: Record[], callback: Function) => {
        assert.strictEqual(records, record);
        callback();
      };
      record.delete(done);
    }


(records: Record[], callback: Function) => {
        assert.strictEqual(records, record);
        callback();
      }


() => {
    it('should format the data for the API', () => {
      const expectedRecord = Object.assign({}, METADATA, {
        type: 'A',
        rrdatas: METADATA.data,
      });
      delete expectedRecord.data;

      assert.deepStrictEqual(record.toJSON(), expectedRecord);
    });
  }


() => {
      const expectedRecord = Object.assign({}, METADATA, {
        type: 'A',
        rrdatas: METADATA.data,
      });
      delete expectedRecord.data;

      assert.deepStrictEqual(record.toJSON(), expectedRecord);
    }


() => {
    it('should format the data for a zonefile', () => {
      const jsonRecord = Object.assign({}, METADATA, {
        type: TYPE,
        rrdatas: ['example.com.', 'example2.com.'],
      });

      record.toJSON = () => {
        return jsonRecord;
      };

      const expectedRecordString = [
        [
          jsonRecord.name,
          jsonRecord.ttl,
          'IN',
          TYPE,
          jsonRecord.rrdatas[0],
        ].join(' '),

        [
          jsonRecord.name,
          jsonRecord.ttl,
          'IN',
          TYPE,
          jsonRecord.rrdatas[1],
        ].join(' '),
      ].join('\n');

      // That's a bunch of silliness, but it generates simply:
      // name 86400 IN A example.com.
      // name 86400 IN A example2.com.

      assert.strictEqual(record.toString(), expectedRecordString);
    });
  }


() => {
      const jsonRecord = Object.assign({}, METADATA, {
        type: TYPE,
        rrdatas: ['example.com.', 'example2.com.'],
      });

      record.toJSON = () => {
        return jsonRecord;
      };

      const expectedRecordString = [
        [
          jsonRecord.name,
          jsonRecord.ttl,
          'IN',
          TYPE,
          jsonRecord.rrdatas[0],
        ].join(' '),

        [
          jsonRecord.name,
          jsonRecord.ttl,
          'IN',
          TYPE,
          jsonRecord.rrdatas[1],
        ].join(' '),
      ].join('\n');

      // That's a bunch of silliness, but it generates simply:
      // name 86400 IN A example.com.
      // name 86400 IN A example2.com.

      assert.strictEqual(record.toString(), expectedRecordString);
    }


() => {
        return jsonRecord;
      }


promisifyAll(esClass: Function, options: promisify.PromisifyAllOptions) {
    if (esClass.name !== 'Record') {
      return;
    }
    promisified = true;
    assert.deepStrictEqual(options.exclude, ['toJSON', 'toString']);
  }


deleteRecords() {}


@Component({
  selector: 'app-timer',
  template: `

Timers

      <app-child-timer #childTimer [name]="timer.name"></app-child-timer>

        <button (click)="childTimer.start()">Start</button>
        <button (click)="childTimer.stop()">Stop</button>

  `
})
export class TimerComponent {
  timerList = [
    { id: 1, name: 'Timer 1' },
    { id: 2, name: 'Timer 2' },
    { id: 4, name: 'Timer 3' },
  ];
}


class Log {
    constructor(options: { id: string });

    enable(enabled?: boolean): Log;

    warn(message: string): () => any;
    info(message: string): () => any;
    error(message: string): () => any;
  }


enable(enabled?: boolean): Log;


warn(message: string): () => any;


info(message: string): () => any;


error(message: string): () => any;


@Module({
  imports: [
    MongooseModule.forFeature([{ name: Platform.name, schema: PlatformSchema }]),
  ],
  controllers: [PlatformController],
  providers: [PlatformService],
  exports: [PlatformService]
})
export class PlatformModule {}


export default function getConsoleOutput(root: string, verbose: boolean, buffer: any): any;


data => { return new Page<Environment>().deserialize(data, Environment)}


() => throwError('Problem while fetching Environment')


data => new Environment().deserialize(data)


(error) => throwError(error)


data => data


@Injectable({
  providedIn: 'root'
})
export class EnvironmentService {

  constructor(
    private http: HttpClient,
    private httpHeaders: HttpHeadersService,
    private URLConstants: UrlConstantsService) {
  }

  public findAll(filter?: string, sortBy?: string, pageable?: Pageable | undefined): Observable<Page<Environment>> {
    return this.http.get<Page<Environment>>(this.URLConstants.environmentsUrl, {
      headers: this.httpHeaders.contentTypeApplication,
      params: this.httpHeaders.serializeParams(filter, sortBy, pageable)
    }).pipe(
      map(data => { return new Page<Environment>().deserialize(data, Environment)}),
      catchError(() => throwError('Problem while fetching Environment'))
    )
  }

  public show(id: Number): Observable<Environment> {
    return this.http.get<Environment>(this.URLConstants.environmentsUrl + "/" + id , {
      headers: this.httpHeaders.contentTypeApplication
    }).pipe(
      map(data => new Environment().deserialize(data)),
      catchError(() => throwError('Problem while fetching Environment'))
    )
  }

  public create(environment: Environment ) : Observable<Environment> {
    return this.http.post<Environment>(this.URLConstants.environmentsUrl, environment).pipe(
      map(data => new Environment().deserialize(data)),
      catchError((error) => throwError(error))
    )
  }

  public update(environment: Environment): Observable<any> {
    return this.http.put(this.URLConstants.environmentsUrl + "/"+ environment.id , environment.serialize()).pipe(
      map(data => data),
      catchError((error) => throwError(error))
    )
  }

  public delete(id: any): Observable<void> {
    return this.http.delete<void>(this.URLConstants.environmentsUrl + '/' + id,
      {headers: this.httpHeaders.contentTypeApplication}).pipe(
      map(data => data),
      catchError((error) => throwError(error))
    )
  }

  public bulkDestroy(ids: any[]): Observable<void> {
    let params = new HttpParams().set("ids[]", ids.toString());
    return this.http.delete<void>(this.URLConstants.environmentsUrl + "/bulk", {
      headers: this.httpHeaders.contentTypeApplication,
      params: params
    }).pipe(
      map(data => data),
      catchError((error) => throwError(error))
    );
  }

}


public findAll(filter?: string, sortBy?: string, pageable?: Pageable | undefined): Observable<Page<Environment>> {
    return this.http.get<Page<Environment>>(this.URLConstants.environmentsUrl, {
      headers: this.httpHeaders.contentTypeApplication,
      params: this.httpHeaders.serializeParams(filter, sortBy, pageable)
    }).pipe(
      map(data => { return new Page<Environment>().deserialize(data, Environment)}),
      catchError(() => throwError('Problem while fetching Environment'))
    )
  }


public show(id: Number): Observable<Environment> {
    return this.http.get<Environment>(this.URLConstants.environmentsUrl + "/" + id , {
      headers: this.httpHeaders.contentTypeApplication
    }).pipe(
      map(data => new Environment().deserialize(data)),
      catchError(() => throwError('Problem while fetching Environment'))
    )
  }


public create(environment: Environment ) : Observable<Environment> {
    return this.http.post<Environment>(this.URLConstants.environmentsUrl, environment).pipe(
      map(data => new Environment().deserialize(data)),
      catchError((error) => throwError(error))
    )
  }


public update(environment: Environment): Observable<any> {
    return this.http.put(this.URLConstants.environmentsUrl + "/"+ environment.id , environment.serialize()).pipe(
      map(data => data),
      catchError((error) => throwError(error))
    )
  }


public delete(id: any): Observable<void> {
    return this.http.delete<void>(this.URLConstants.environmentsUrl + '/' + id,
      {headers: this.httpHeaders.contentTypeApplication}).pipe(
      map(data => data),
      catchError((error) => throwError(error))
    )
  }


public bulkDestroy(ids: any[]): Observable<void> {
    let params = new HttpParams().set("ids[]", ids.toString());
    return this.http.delete<void>(this.URLConstants.environmentsUrl + "/bulk", {
      headers: this.httpHeaders.contentTypeApplication,
      params: params
    }).pipe(
      map(data => data),
      catchError((error) => throwError(error))
    );
  }


(): string =>
  Math.random()
    .toString(36)
    .substring(2, 8) +
  Math.random()
    .toString(36)
    .substring(2, 8)


(user) => {
      this.socioCortex = user.contactProvider.socioCortex;
    }


(data: any) => {
        this.snackBar.open('Update successful.', 'OK');
        this.socioCortex = data.contactProvider.socioCortex;
      }


(error) => {
        this.snackBar.open('Error while updating. Try again.', 'OK');

      }


@Component({
  selector: 'contact',
  templateUrl: 'contact.component.html',
  styleUrls: ['contact.component.css'],
  providers: [MatSnackBar]
})
export class ContactComponent {

  private socioCortex = {
    isEnabled: false,
    email: '',
    password: '',
    baseURL: ''
  };

  constructor(private userService: UserService, private snackBar: MatSnackBar) {}

  public ngOnInit() {
    this.userService.getUserInfo().subscribe((user) => {
      this.socioCortex = user.contactProvider.socioCortex;
    });
  }

  public updateSocioCortex() {
    console.log('her',this.socioCortex);
    this.userService.updateContactProviderSocioCortex(this.socioCortex)
      .subscribe((data: any) => {
        this.snackBar.open('Update successful.', 'OK');
        this.socioCortex = data.contactProvider.socioCortex;
      }, (error) => {
        this.snackBar.open('Error while updating. Try again.', 'OK');

      });
  }

}


public ngOnInit() {
    this.userService.getUserInfo().subscribe((user) => {
      this.socioCortex = user.contactProvider.socioCortex;
    });
  }


public updateSocioCortex() {
    console.log('her',this.socioCortex);
    this.userService.updateContactProviderSocioCortex(this.socioCortex)
      .subscribe((data: any) => {
        this.snackBar.open('Update successful.', 'OK');
        this.socioCortex = data.contactProvider.socioCortex;
      }, (error) => {
        this.snackBar.open('Error while updating. Try again.', 'OK');

      });
  }


@Component({
  selector: 'crm-confirm-dialog',
  templateUrl: './confirm-dialog.component.html',
  styleUrls: ['./confirm-dialog.component.scss']
})
export class ConfirmDialogComponent {

  public title: string;
  public message: string;
  public cancelButton = 'CANCEL';
  public acceptButton = 'ACCEPT';

  constructor(private dialogRef: MatDialogRef<ConfirmDialogComponent>) {}

  public onAccept(): void {
    this.dialogRef.close(true);
  }

  public onCancel(): void {
    this.dialogRef.close(false);
  }

}


public onAccept(): void {
    this.dialogRef.close(true);
  }


public onCancel(): void {
    this.dialogRef.close(false);
  }


class VueScreenSizeMixin extends Vue {

        $vssEvent: UIEvent;
        $vssWidth: number;
        $vssHeight: number;

        getScreenWidth(): number;
        getScreenHeight(): number;

        handleResize(event: UIEvent = null): void;

        $vssDestroyListener(): void;

    }


getScreenWidth(): number;


getScreenHeight(): number;


handleResize(event: UIEvent = null): void;


$vssDestroyListener(): void;


@Component({
  selector: 'app-month',
  templateUrl: './month.component.html',
  styleUrls: ['./month.component.css']
})
export class MonthComponent implements OnInit {
  constructor() { }
  private val: string;
  private name: string;
  ngOnInit() {
  }
}


// 对比版本号
// https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html
function compareVersion(v1: string, v2: string) {
  const v1Arr = v1.split(".");
  const v2Arr = v2.split(".");
  const len = Math.max(v1Arr.length, v2Arr.length);

  while (v1Arr.length < len) {
    v1Arr.push("0");
  }
  while (v2Arr.length < len) {
    v2Arr.push("0");
  }

  for (let i = 0; i < len; i++) {
    const num1 = parseInt(v1Arr[i], 10);
    const num2 = parseInt(v2Arr[i], 10);

    if (num1 > num2) {
      return 1;
    }
    if (num1 < num2) {
      return -1;
    }
  }

  return 0;
}


// 能否使用双向数据绑定
export function canIUseModel() {
  const system = getSystemInfoSync();
  return compareVersion(system.SDKVersion, "2.9.3") >= 0;
}


// 能否使用内置的表单行为
export function canIUseFormFieldButton() {
  const system = getSystemInfoSync();
  return compareVersion(system.SDKVersion, "2.10.3") >= 0;
}


// 能否全屏预览视频
export function canIUsePreviewMedia() {
  const system = getSystemInfoSync();
  return compareVersion(system.SDKVersion, "2.12.0") >= 0;
}


() => {
  const app = new App(source)
  const result = build(app)
  if (result) {
    renderSys.render(result)
  }
}


({
  className,
  backgroundImageSrc,
  ...props
}: AboutModalBoxHeroProps) => (
  <div
    style={backgroundImageSrc !== ''
      ? { [c_about_modal_box__hero_sm_BackgroundImage.name as string]: `url(${backgroundImageSrc})`}
      : {}


export interface AboutModalBoxHeroProps extends React.HTMLProps<HTMLDivElement> {
  /** additional classes added to the About Modal Hero  */
  className?: string;
  /** background image data or file path  */
  backgroundImageSrc?: string;
}


css(styles


(props: Properties): TemplateResult =>
    renderButtonSet(props)


(props: Properties): TemplateResult => {
    return html`

            ${renderButtonSet({
                ...props,
                content: html`
                    <sp-icon-help slot="icon"></sp-icon-help>
                    Help
                `,
            })}

            ${renderButtonSet({
                ...props,
                content: html`
                    ${bellIcon} Custom SVG
                `,
            })}

    `;
}


(): TemplateResult => {
    return html`
        <sp-button label="Edit" size="xl" variant=${variant}>
            <sp-icon slot="icon" size="s">
                ${HelpIcon({ hidden: true })} Testing
            </sp-icon>
        </sp-button>

For testing purposes only

            This is a test to ensure that sizing the icon will still work when
            it's in the scope of a parent element. You shouldn't normally do
            this as it deviates from the Spectrum design specification.

    `;
}


(props: Properties): TemplateResult => {
    return html`
        <style>
            sp-button {
                min-width: 300px;
            }
        </style>
        ${renderButtonSet(props)}
    `;
}


(props: Properties): TemplateResult =>
    renderButtonSet({
        ...props,
        href,
    })


(props: Properties): TemplateResult =>
    renderButtonSet({
        ...props,
        href,
        target: '_blank',
    })


interface Properties {
    content?: TemplateResult;
    disabled?: boolean;
    quiet?: boolean;
    variant?: 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';
}


/*
  We use type guards instead of `instanceof` as `instanceof` makes
  different parts of the compiler depend on the actual implementation of
  the model classes, which in turn depend on different parts of the compiler.
  Thus, `instanceof` leads to circular dependency problems.

  On the other hand, type guards only make different parts of the compiler
  depend on the type of the model classes, but not the actual implementation.
*/
export function isUnitModel(model: Model): model is UnitModel {
  return model && model.type === 'unit';
}


export function isFacetModel(model: Model): model is FacetModel {
  return model && model.type === 'facet';
}


export function isRepeatModel(model: Model): model is RepeatModel {
  return model && model.type === 'repeat';
}


export function isConcatModel(model: Model): model is ConcatModel {
  return model && model.type === 'concat';
}


export function isLayerModel(model: Model): model is LayerModel {
  return model && model.type === 'layer';
}


(mark: VgMarkGroup) => {
    // TODO: make this correct

    // for normal data references
    if (mark.from && mark.from.data) {
      mark.from.data = this.lookupDataSource(mark.from.data);
    }

    // for access to facet data
    if (mark.from && mark.from.facet && mark.from.facet.data) {
      mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);
    }

    return mark;
  }


(acc: U, cd: ChannelDef<string>, c: Channel) => {
        const fieldDef = getFieldDef(cd);
        if (fieldDef) {
          return f(acc, fieldDef, c);
        }
        return acc;
      }


(cd: ChannelDef<string>, c: Channel) => {
        const fieldDef = getFieldDef(cd);
        if (fieldDef) {
          f(fieldDef, c);
        }
      }


export class NameMap implements NameMapInterface {
  private nameMap: Dict<string>;

  constructor() {
    this.nameMap = {};
  }

  public rename(oldName: string, newName: string) {
    this.nameMap[oldName] = newName;
  }

  public has(name: string): boolean {
    return this.nameMap[name] !== undefined;
  }

  public get(name: string): string {
    // If the name appears in the _nameMap, we need to read its new name.
    // We have to loop over the dict just in case the new name also gets renamed.
    while (this.nameMap[name] && name !== this.nameMap[name]) {
      name = this.nameMap[name];
    }

    return name;
  }
}


/** Abstract class for UnitModel and FacetModel.  Both of which can contain fieldDefs as a part of its own specification. */
export abstract class ModelWithField extends Model {
  public abstract fieldDef(channel: SingleDefChannel): FieldDef<string>;

  /** Get "field" reference for Vega */
  public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) {
    const fieldDef = this.fieldDef(channel);

    if (!fieldDef) {
      return undefined;
    }

    return vgField(fieldDef, opt);
  }

  protected abstract getMapping(): {[key in Channel]?: any};

  public reduceFieldDef<T, U>(f: (acc: U, fd: FieldDef<string>, c: Channel) => U, init: T, t?: any) {
    return reduce(
      this.getMapping(),
      (acc: U, cd: ChannelDef<string>, c: Channel) => {
        const fieldDef = getFieldDef(cd);
        if (fieldDef) {
          return f(acc, fieldDef, c);
        }
        return acc;
      },
      init,
      t
    );
  }

  public forEachFieldDef(f: (fd: FieldDef<string>, c: Channel) => void, t?: any) {
    forEach(
      this.getMapping(),
      (cd: ChannelDef<string>, c: Channel) => {
        const fieldDef = getFieldDef(cd);
        if (fieldDef) {
          f(fieldDef, c);
        }
      },
      t
    );
  }
  public abstract channelHasField(channel: Channel): boolean;
}


/**
 * Composable Components that are intermediate results of the parsing phase of the
 * compilations.  The components represents parts of the specification in a form that
 * can be easily merged (during parsing for composite specs).
 * In addition, these components are easily transformed into Vega specifications
 * during the "assemble" phase, which is the last phase of the compilation step.
 */
export interface Component {
  data: DataComponent;

  layoutSize: LayoutSizeComponent;

  layoutHeaders: {
    row?: LayoutHeaderComponent;
    column?: LayoutHeaderComponent;
  };

  mark: VgMarkGroup[];
  scales: ScaleComponentIndex;
  projection: ProjectionComponent;
  selection: Dict<SelectionComponent>;

  /** Dictionary mapping channel to VgAxis definition */
  axes: AxisComponentIndex;

  /** Dictionary mapping channel to VgLegend definition */
  legends: LegendComponentIndex;

  resolve: Resolve;
}


export interface NameMapInterface {
  rename(oldname: string, newName: string): void;
  has(name: string): boolean;
  get(name: string): string;
}


public rename(oldName: string, newName: string) {
    this.nameMap[oldName] = newName;
  }


public has(name: string): boolean {
    return this.nameMap[name] !== undefined;
  }


public get(name: string): string {
    // If the name appears in the _nameMap, we need to read its new name.
    // We have to loop over the dict just in case the new name also gets renamed.
    while (this.nameMap[name] && name !== this.nameMap[name]) {
      name = this.nameMap[name];
    }

    return name;
  }


protected initSize(size: LayoutSizeIndex) {
    const {width, height} = size;
    if (width) {
      this.component.layoutSize.set('width', width, true);
    }

    if (height) {
      this.component.layoutSize.set('height', height, true);
    }
  }


public parse() {
    this.parseScale();

    this.parseLayoutSize(); // depends on scale
    this.renameTopLevelLayoutSize();

    this.parseSelection();
    this.parseProjection();
    this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.
    this.parseAxisAndHeader(); // depends on scale and layout size
    this.parseLegend(); // depends on scale, markDef
    this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.
  }


public abstract parseData(): void;


public abstract parseSelection(): void;


public parseScale() {
    parseScale(this);
  }


public parseProjection() {
    parseProjection(this);
  }


public abstract parseLayoutSize(): void;


/**
   * Rename top-level spec's size to be just width / height, ignoring model name.
   * This essentially merges the top-level spec's width/height signals with the width/height signals
   * to help us reduce redundant signals declaration.
   */
private renameTopLevelLayoutSize() {
    if (this.getName('width') !== 'width') {
      this.renameLayoutSize(this.getName('width'), 'width');
    }
    if (this.getName('height') !== 'height') {
      this.renameLayoutSize(this.getName('height'), 'height');
    }
  }


public abstract parseMarkGroup(): void;


public abstract parseAxisAndHeader(): void;


public parseLegend() {
    parseLegend(this);
  }


public abstract assembleSelectionTopLevelSignals(signals: any[]): any[];


public abstract assembleSelectionSignals(): any[];


public abstract assembleSelectionData(data: VgData[]): VgData[];


public assembleGroupStyle(): string {
    if (this.type === 'unit' || this.type === 'layer') {
      return 'cell';
    }
    return undefined;
  }


public assembleLayoutSize(): VgEncodeEntry {
    if (this.type === 'unit' || this.type === 'layer') {
      return {
        width: this.getSizeSignalRef('width'),
        height: this.getSizeSignalRef('height')
      };
    }
    return undefined;
  }


public assembleLayout(): VgLayout {
    if (!this.layout) {
      return undefined;
    }

    const {align, bounds, center, spacing = {}} = this.layout;

    return {
      padding: isNumber(spacing)
        ? spacing
        : {
            row: spacing.row || 10,
            column: spacing.column || 10
          },
      ...this.assembleDefaultLayout(),
      ...(align ? {align} : {}),
      ...(bounds ? {bounds} : {}),
      ...(center ? {center} : {})
    };
  }


protected assembleDefaultLayout(): VgLayout {
    return {};
  }


public abstract assembleLayoutSignals(): VgSignal[];


public assembleHeaderMarks(): VgMarkGroup[] {
    const {layoutHeaders} = this.component;
    let headerMarks = [];

    for (const channel of HEADER_CHANNELS) {
      if (layoutHeaders[channel].title) {
        headerMarks.push(getTitleGroup(this, channel));
      }
    }

    for (const channel of HEADER_CHANNELS) {
      headerMarks = headerMarks.concat(getHeaderGroups(this, channel));
    }
    return headerMarks;
  }


public abstract assembleMarks(): VgMarkGroup[];


public assembleAxes(): VgAxis[] {
    return assembleAxes(this.component.axes, this.config);
  }


public assembleLegends(): VgLegend[] {
    return assembleLegends(this);
  }


public assembleProjections(): VgProjection[] {
    return assembleProjections(this);
  }


public assembleTitle(): VgTitle {
    const {encoding, ...titleNoEncoding} = this.title || ({} as TitleParams);

    const title: VgTitle = {
      ...extractTitleConfig(this.config.title).nonMark,
      ...titleNoEncoding,
      ...(encoding ? {encode: {update: encoding}} : {})
    };

    if (title.text) {
      if (!contains(['unit', 'layer'], this.type)) {
        // As described in https://github.com/vega/vega-lite/issues/2875:
        // Due to vega/vega#960 (comment), we only support title's anchor for unit and layered spec for now.

        if (title.anchor && title.anchor !== 'start') {
          log.warn(log.message.cannotSetTitleAnchor(this.type));
        }
        title.anchor = 'start';
      }

      return keys(title).length > 0 ? title : undefined;
    }
    return undefined;
  }


/**
   * Assemble the mark group for this model.  We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.
   */
public assembleGroup(signals: VgSignal[] = []) {
    const group: VgMarkGroup = {};

    signals = signals.concat(this.assembleSelectionSignals());

    if (signals.length > 0) {
      group.signals = signals;
    }

    const layout = this.assembleLayout();
    if (layout) {
      group.layout = layout;
    }

    group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());

    // Only include scales if this spec is top-level or if parent is facet.
    // (Otherwise, it will be merged with upper-level's scope.)
    const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];
    if (scales.length > 0) {
      group.scales = scales;
    }

    const axes = this.assembleAxes();
    if (axes.length > 0) {
      group.axes = axes;
    }

    const legends = this.assembleLegends();
    if (legends.length > 0) {
      group.legends = legends;
    }

    return group;
  }


public hasDescendantWithFieldOnChannel(channel: Channel) {
    for (const child of this.children) {
      if (isUnitModel(child)) {
        if (child.channelHasField(channel)) {
          return true;
        }
      } else {
        if (child.hasDescendantWithFieldOnChannel(channel)) {
          return true;
        }
      }
    }
    return false;
  }


public getName(text: string) {
    return varName((this.name ? this.name + '_' : '') + text);
  }


/**
   * Request a data source name for the given data source type and mark that data source as required. This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().
   */
public requestDataName(name: DataSourceType) {
    const fullName = this.getName(name);

    // Increase ref count. This is critical because otherwise we won't create a data source.
    // We also increase the ref counts on OutputNode.getSource() calls.
    const refCounts = this.component.data.outputNodeRefCounts;
    refCounts[fullName] = (refCounts[fullName] || 0) + 1;

    return fullName;
  }


public getSizeSignalRef(sizeType: 'width' | 'height'): SignalRef {
    if (isFacetModel(this.parent)) {
      const channel = sizeType === 'width' ? 'x' : 'y';
      const scaleComponent = this.component.scales[channel];

      if (scaleComponent && !scaleComponent.merged) {
        // independent scale
        const type = scaleComponent.get('type');
        const range = scaleComponent.get('range');

        if (hasDiscreteDomain(type) && isVgRangeStep(range)) {
          const scaleName = scaleComponent.get('name');
          const domain = assembleDomain(this, channel);
          const field = getFieldFromDomain(domain);
          if (field) {
            const fieldRef = vgField({aggregate: 'distinct', field}, {expr: 'datum'});
            return {
              signal: sizeExpr(scaleName, scaleComponent, fieldRef)
            };
          } else {
            log.warn('Unknown field for ${channel}.  Cannot calculate view size.');
            return null;
          }
        }
      }
    }

    return {
      signal: this.layoutSizeNameMap.get(this.getName(sizeType))
    };
  }


/**
   * Lookup the name of the datasource for an output node. You probably want to call this in assemble.
   */
public lookupDataSource(name: string) {
    const node = this.component.data.outputNodes[name];

    if (!node) {
      // Name not found in map so let's just return what we got.
      // This can happen if we already have the correct name.
      return name;
    }

    return node.getSource();
  }


public getSizeName(oldSizeName: string): string {
    return this.layoutSizeNameMap.get(oldSizeName);
  }


public renameLayoutSize(oldName: string, newName: string) {
    this.layoutSizeNameMap.rename(oldName, newName);
  }


public renameScale(oldName: string, newName: string) {
    this.scaleNameMap.rename(oldName, newName);
  }


public renameProjection(oldName: string, newName: string) {
    this.projectionNameMap.rename(oldName, newName);
  }


/**
   * @return scale name for a given channel after the scale has been parsed and named.
   */
public scaleName(originalScaleName: Channel | string, parse?: boolean): string {
    if (parse) {
      // During the parse phase always return a value
      // No need to refer to rename map because a scale can't be renamed
      // before it has the original name.
      return this.getName(originalScaleName);
    }

    // If there is a scale for the channel, it should either
    // be in the scale component or exist in the name map
    if (
      // If there is a scale for the channel, there should be a local scale component for it
      (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||
      // in the scale name map (the scale get merged by its parent)
      this.scaleNameMap.has(this.getName(originalScaleName))
    ) {
      return this.scaleNameMap.get(this.getName(originalScaleName));
    }
    return undefined;
  }


/**
   * @return projection name after the projection has been parsed and named.
   */
public projectionName(parse?: boolean): string {
    if (parse) {
      // During the parse phase always return a value
      // No need to refer to rename map because a projection can't be renamed
      // before it has the original name.
      return this.getName('projection');
    }

    if (
      (this.component.projection && !this.component.projection.merged) ||
      this.projectionNameMap.has(this.getName('projection'))
    ) {
      return this.projectionNameMap.get(this.getName('projection'));
    }
    return undefined;
  }


/**
   * Traverse a model's hierarchy to get the scale component for a particular channel.
   */
public getScaleComponent(channel: ScaleChannel): ScaleComponent {
    /* istanbul ignore next: This is warning for debugging test */
    if (!this.component.scales) {
      throw new Error(
        'getScaleComponent cannot be called before parseScale().  Make sure you have called parseScale or use parseUnitModelWithScale().'
      );
    }

    const localScaleComponent = this.component.scales[channel];
    if (localScaleComponent && !localScaleComponent.merged) {
      return localScaleComponent;
    }
    return this.parent ? this.parent.getScaleComponent(channel) : undefined;
  }


/**
   * Traverse a model's hierarchy to get a particular selection component.
   */
public getSelectionComponent(variableName: string, origName: string): SelectionComponent {
    let sel = this.component.selection[variableName];
    if (!sel && this.parent) {
      sel = this.parent.getSelectionComponent(variableName, origName);
    }
    if (!sel) {
      throw new Error(log.message.selectionNotFound(origName));
    }
    return sel;
  }


public abstract fieldDef(channel: SingleDefChannel): FieldDef<string>;


/** Get "field" reference for Vega */
public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) {
    const fieldDef = this.fieldDef(channel);

    if (!fieldDef) {
      return undefined;
    }

    return vgField(fieldDef, opt);
  }


protected abstract getMapping(): {[key in Channel]?: any};


public reduceFieldDef<T, U>(f: (acc: U, fd: FieldDef<string>, c: Channel) => U, init: T, t?: any) {
    return reduce(
      this.getMapping(),
      (acc: U, cd: ChannelDef<string>, c: Channel) => {
        const fieldDef = getFieldDef(cd);
        if (fieldDef) {
          return f(acc, fieldDef, c);
        }
        return acc;
      },
      init,
      t
    );
  }


public forEachFieldDef(f: (fd: FieldDef<string>, c: Channel) => void, t?: any) {
    forEach(
      this.getMapping(),
      (cd: ChannelDef<string>, c: Channel) => {
        const fieldDef = getFieldDef(cd);
        if (fieldDef) {
          f(fieldDef, c);
        }
      },
      t
    );
  }


public abstract channelHasField(channel: Channel): boolean;


export class ExtendedHandler extends Handler {
	public constructor() {
		super({
			name: 'ru-RU',
			duration: {
				[TimeTypes.Year]: {
					1: 'год',
					DEFAULT: 'года'
				},
				[TimeTypes.Month]: {
					1: 'месяц',
					DEFAULT: 'месяца'
				},
				[TimeTypes.Week]: {
					1: 'неделя',
					DEFAULT: 'недели'
				},
				[TimeTypes.Day]: {
					1: 'день',
					DEFAULT: 'дня'
				},
				[TimeTypes.Hour]: {
					1: 'час',
					DEFAULT: 'часа'
				},
				[TimeTypes.Minute]: {
					1: 'минута',
					DEFAULT: 'минуты'
				},
				[TimeTypes.Second]: {
					1: 'секунда',
					DEFAULT: 'секунды'
				}
			}
		});
	}

	public ordinal(cardinal: number): string {
		return `${cardinal}-й`;
	}
}


public ordinal(cardinal: number): string {
		return `${cardinal}-й`;
	}


tslintRule => {
    return {
        rules: [
            {
                ...(tslintRule.ruleArguments.includes("exclude-class-expressions") && {
                    notices: ["Class expressions will no longer be ignored."],
                }),
                ...(tslintRule.ruleArguments.length !== 0 && {
                    ruleArguments: [tslintRule.ruleArguments[0]],
                }),
                ruleName: "max-classes-per-file",
            },
        ],
    };
}


@Console()
export class FixturesCommand {
  @Command({
    command: 'fixtures',
    description: 'Seed data in database',
  })
  async command() {
    await this.runMigrations();
    const fixtures = (await import(`./bank-${process.env.BANK_CODE}`)).default;
    for (const fixture of fixtures) {
      await this.createInDatabase(fixture.model, fixture.fields);
    }

    console.log(chalk.green('Data generated'));
  }

  async runMigrations() {
    const conn = getConnection('default');
    for (const migration of conn.migrations.reverse()) {
      await conn.undoLastMigration();
    }
  }

  async createInDatabase(model: any, data: any) {
    const repository = this.getRepository(model);
    const obj = repository.create(data);
    await repository.save(obj);
  }

  getRepository(model: any) {
    const conn = getConnection('default');
    return conn.getRepository(model);
  }
}


@Command({
    command: 'fixtures',
    description: 'Seed data in database',
  })
  async command() {
    await this.runMigrations();
    const fixtures = (await import(`./bank-${process.env.BANK_CODE}`)).default;
    for (const fixture of fixtures) {
      await this.createInDatabase(fixture.model, fixture.fields);
    }

    console.log(chalk.green('Data generated'));
  }


async runMigrations() {
    const conn = getConnection('default');
    for (const migration of conn.migrations.reverse()) {
      await conn.undoLastMigration();
    }
  }


async createInDatabase(model: any, data: any) {
    const repository = this.getRepository(model);
    const obj = repository.create(data);
    await repository.save(obj);
  }


getRepository(model: any) {
    const conn = getConnection('default');
    return conn.getRepository(model);
  }


() => {
  let component: EnrolledCoursesComponent;
  let fixture: ComponentFixture<EnrolledCoursesComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [ EnrolledCoursesComponent ]
    })
    .compileComponents();
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(EnrolledCoursesComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
}


async () => {
    await TestBed.configureTestingModule({
      declarations: [ EnrolledCoursesComponent ]
    })
    .compileComponents();
  }


() => {
    fixture = TestBed.createComponent(EnrolledCoursesComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  }


() => {
    expect(component).toBeTruthy();
  }


(response) => {
                                if (!response.ok) {
                                    throw new Error('Network response was not ok');
                                }
                                return response.text();
                            }


(d) => {
                                this.#langTracks[element.srclang] = this._getCuesFromText(d);
                                this._prepareTrack(i, element.srclang, trackUrl, element.default || false);

                                // Build only items that are successful
                                const selector = `.op-subtitles__option[data-value="captions-${
                                    this.#mediaTrackList[i].language
                                }"]`;
                                if (this.#menu && !this.#menu.querySelector(selector)) {
                                    const item = document.createElement('div');
                                    const label = labels?.lang ? labels.lang[this.#mediaTrackList[i].language] : null;
                                    item.className = 'op-settings__submenu-item';
                                    item.tabIndex = 0;
                                    item.setAttribute('role', 'menuitemradio');
                                    item.setAttribute(
                                        'aria-checked',
                                        this.#default === this.#mediaTrackList[i].language ? 'true' : 'false'
                                    );
                                    item.innerHTML = `<div class="op-settings__submenu-label op-subtitles__option"
                                        data-value="captions-${this.#mediaTrackList[i].language}">
                                        ${label || this.#mediaTrackList[i].label}
                                    </div>`;
                                    this.#menu.appendChild(item);
                                }
                            }


(): void => {
            if (this.#player.isMedia()) {
                if (this.#currentTrack) {
                    const currentCues = this.#langTracks[this.#currentTrack.language];
                    if (container && currentCues !== undefined) {
                        const index = this._search(currentCues, this.#player.getMedia().currentTime);
                        container.innerHTML = '';
                        if (index > -1 && this.#button.classList.contains('op-controls__captions--on')) {
                            this.#captions.classList.add('op-captions--on');
                            container.innerHTML = sanitize(currentCues[index].text, false);
                        } else {
                            this._hideCaptions();
                        }
                    }
                } else {
                    this._hideCaptions();
                }
            } else {
                this._hideCaptions();
            }
        }


(e: Event): void => {
            const button = e.target as HTMLDivElement;
            if (detachMenus) {
                const menus = this.#player.getContainer().querySelectorAll('.op-settings');
                for (let i = 0, total = menus.length; i < total; ++i) {
                    if (menus[i] !== this.#menu) {
                        menus[i].setAttribute('aria-hidden', 'true');
                    }
                }
                if (this.#menu.getAttribute('aria-hidden') === 'true') {
                    this.#menu.setAttribute('aria-hidden', 'false');
                } else {
                    this.#menu.setAttribute('aria-hidden', 'true');
                }
            } else {
                button.setAttribute('aria-pressed', 'true');
                if (button.classList.contains('op-controls__captions--on')) {
                    this._hideCaptions();
                    button.classList.remove('op-controls__captions--on');
                    button.setAttribute('data-active-captions', 'off');
                } else {
                    if (!this.#currentTrack) {
                        const [track] = this.#mediaTrackList;
                        this.#currentTrack = track;
                    }
                    this._displayCaptions();
                    button.classList.add('op-controls__captions--on');
                    button.setAttribute('data-active-captions', this.#currentTrack.language);
                }
            }
        }


(): void => {
            if (!IS_IOS && !IS_ANDROID && detachMenus) {
                const menus = this.#player.getContainer().querySelectorAll('.op-settings');
                for (let i = 0, total = menus.length; i < total; ++i) {
                    if (menus[i] !== this.#menu) {
                        menus[i].setAttribute('aria-hidden', 'true');
                    }
                }
                if (this.#menu.getAttribute('aria-hidden') === 'true') {
                    this.#menu.setAttribute('aria-hidden', 'false');
                }
            }
        }


(): void => {
            if (!IS_IOS && !IS_ANDROID && detachMenus) {
                const menus = this.#player.getContainer().querySelectorAll('.op-settings');
                for (let i = 0, total = menus.length; i < total; ++i) {
                    menus[i].setAttribute('aria-hidden', 'true');
                }
                if (this.#menu.getAttribute('aria-hidden') === 'false') {
                    this.#menu.setAttribute('aria-hidden', 'true');
                }
            }
        }


(e: Event): void => {
            const option = e.target as HTMLElement;
            if (option.closest(`#${this.#player.id}`) && option.classList.contains('op-subtitles__option')) {
                const langEl = option.getAttribute('data-value');
                const language = langEl ? langEl.replace('captions-', '') : '';
                const currentLang = Array.from(this.#mediaTrackList).filter((item) => item.language === language);
                this.#currentTrack = currentLang ? currentLang.pop() : undefined;
                if (detachMenus) {
                    if (this.#button.classList.contains('op-controls__captions--on')) {
                        this._hideCaptions();
                        this.#button.classList.remove('op-controls__captions--on');
                        this.#button.setAttribute('data-active-captions', 'off');
                    } else {
                        this._displayCaptions();
                        this.#button.classList.add('op-controls__captions--on');
                        this.#button.setAttribute('data-active-captions', language);
                    }
                    if (option.parentElement && option.parentElement.parentElement) {
                        const captions =
                            option.parentElement.parentElement.querySelectorAll('.op-settings__submenu-item');
                        for (let i = 0, total = captions.length; i < total; ++i) {
                            captions[i].setAttribute('aria-checked', 'false');
                        }
                    }
                    if (option.parentElement) {
                        option.parentElement.setAttribute('aria-checked', 'true');
                    }
                    this.#menu.setAttribute('aria-hidden', 'false');
                } else {
                    this._displayCaptions();
                    this.#button.setAttribute('data-active-captions', language);
                }
                const event = addEvent('captionschanged');
                this.#player.getElement().dispatchEvent(event);
            }
        }


(item) => item.language === language


(index) => {
            const j = parseInt(index, 10);
            const current = trackCues[j] as VTTCue;
            cues.push({
                endTime: current.endTime,
                identifier: current.id,
                settings: {},
                startTime: current.startTime,
                text: current.text,
            });
        }


(item) => item.language === this.#default


(el) => el.key !== track.language


destroy(): void {
        const { detachMenus } = this.#player.getOptions();
        if (typeof this.#events.global.click !== 'undefined') {
            document.removeEventListener('click', this.#events.global.click);
        }

        if (this.#hasTracks) {
            this.#button.removeEventListener('click', this.#events.button.click);
            if (detachMenus) {
                this.#button.removeEventListener('mouseover', this.#events.button.mouseover);
                this.#menu.removeEventListener('mouseover', this.#events.button.mouseover);
                this.#menu.removeEventListener('mouseout', this.#events.button.mouseout);
                this.#player.getElement().removeEventListener('controlshidden', this.#events.button.mouseout);
                this.#menu.remove();
            }
            this.#player.getElement().removeEventListener('timeupdate', this.#events.media.timeupdate);
            this.#button.remove();
            this.#captions.remove();
        }
    }


addSettings(): SettingsItem | unknown {
        const { detachMenus, labels } = this.#player.getOptions();
        if (detachMenus || this.#mediaTrackList.length <= 1) {
            return {};
        }
        const subitems = this._formatMenuItems();
        // Avoid implementing submenu for captions if only 2 options were available
        return subitems.length > 2
            ? {
                  className: 'op-subtitles__option',
                  default: this.#default || 'off',
                  key: 'captions',
                  name: labels?.captions || '',
                  subitems,
              }
            : {};
    }


private _getCuesFromText(vttText: string): Cue[] {
        const lines = vttText.split(/\r?\n/);
        const entries: Cue[] = [];
        const urlRegexp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/gi;
        let timePattern = '^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --> ';
        timePattern += '((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*?)$';
        const regexp = new RegExp(timePattern);

        let identifier;

        for (let i = 0, total = lines.length; i < total; i++) {
            const timeCode = regexp.exec(lines[i]);

            if (timeCode && i < lines.length) {
                if (i - 1 >= 0 && lines[i - 1] !== '') {
                    identifier = lines[i - 1];
                }
                i++;
                // grab all the (possibly multi-line) text that follows
                let cue = lines[i];
                i++;
                while (lines[i] !== '' && i < lines.length) {
                    cue = `${cue}\n${lines[i]}`;
                    i++;
                }
                cue = cue.trim().replace(urlRegexp, "$1");
                const initTime = timeToSeconds(timeCode[1]);

                entries.push({
                    endTime: timeToSeconds(timeCode[3]),
                    identifier: identifier || '',
                    settings: isJson(timeCode[5]) ? JSON.parse(timeCode[5]) : {},
                    startTime: initTime === 0 ? 0.2 : initTime,
                    text: cue,
                });
            }
            identifier = '';
        }
        return entries;
    }


private _getNativeCues(track: TextTrack): Cue[] {
        const cues: Cue[] = [];
        const trackCues = track.cues as TextTrackCueList;
        Object.keys(trackCues).forEach((index) => {
            const j = parseInt(index, 10);
            const current = trackCues[j] as VTTCue;
            cues.push({
                endTime: current.endTime,
                identifier: current.id,
                settings: {},
                startTime: current.startTime,
                text: current.text,
            });
        });
        return cues;
    }


private _displayCaptions(): void {
        if (!this.#captions || !this.#currentTrack || this.#currentTrack.cues === undefined) {
            return;
        }

        const container = this.#captions.querySelector('span');
        if (container) {
            container.innerHTML = '';
        }
        this.#player.getElement().addEventListener('timeupdate', this.#events.media.timeupdate, EVENT_OPTIONS);
    }


private _hideCaptions(): void {
        this.#captions.classList.remove('op-captions--on');
        if (!this.#currentTrack) {
            this.#button.classList.remove('op-controls__captions--on');
            this.#button.setAttribute('data-active-captions', 'off');
        }
    }


// Search using binary search algorithm (borrowed from https://www.geeksforgeeks.org/binary-search/)
private _search(tracks: Cue[], currentTime: number): number {
        let low = 0;
        let high = tracks.length - 1;
        while (low <= high) {
            const mid = (low + high) >> 1;
            const start = tracks[mid].startTime;
            const stop = tracks[mid].endTime;

            if (currentTime >= start && currentTime < stop) {
                return mid;
            }
            if (start < currentTime) {
                low = mid + 1;
            } else if (start > currentTime) {
                high = mid - 1;
            }
        }
        return -1;
    }


private _prepareTrack(index: number, language: string, trackUrl: string, showTrack = false): void {
        this.#trackUrlList[language] = trackUrl;
        this.#mediaTrackList[index].mode = 'disabled';
        if (showTrack) {
            this.#default = language;
            this.#button.classList.add('op-controls__captions--on');
            this.#button.setAttribute('data-active-captions', language);
            this.#currentTrack = Array.from(this.#mediaTrackList)
                .filter((item) => item.language === this.#default)
                .pop();
            this._displayCaptions();
            if (!this.#player.getContainer().classList.contains('op-captions--detected')) {
                this.#player.getContainer().classList.add('op-captions--detected');
            }
        }
    }


private _formatMenuItems(): SettingsSubItem[] {
        const { labels } = this.#player.getOptions();
        let items = [{ key: 'off', label: labels?.off || '' }];
        // Build object based on available languages
        for (let i = 0, total = this.#mediaTrackList.length; i < total; i++) {
            const track = this.#mediaTrackList[i];
            const label = labels?.lang ? labels.lang[track.language] : null;
            // Override language item if duplicated when passing list of items
            items = items.filter((el) => el.key !== track.language);
            items.push({ key: track.language, label: label || this.#mediaTrackList[i].label });
        }

        return items;
    }


export class VisibilityVertexRectilinear extends VisibilityVertex {
  constructor(point: Point) {
    super(point)
  }

  VertexEntries: VertexEntry[]
  SetVertexEntry(entry: VertexEntry) {
    if (this.VertexEntries == null) {
      this.VertexEntries = new Array(4)
    }

    this.VertexEntries[CompassVector.ToIndex(entry.Direction)] = entry
  }

  RemoveVertexEntries() {
    this.VertexEntries = null
  }
}


SetVertexEntry(entry: VertexEntry) {
    if (this.VertexEntries == null) {
      this.VertexEntries = new Array(4)
    }

    this.VertexEntries[CompassVector.ToIndex(entry.Direction)] = entry
  }


RemoveVertexEntries() {
    this.VertexEntries = null
  }


() => OFormComponent


@Component({
  moduleId: module.id,
  selector: 'o-nif-input',
  templateUrl: './o-nif-input.component.html',
  styleUrls: ['./o-nif-input.component.scss'],
  inputs: DEFAULT_INPUTS_O_NIF_INPUT,
  outputs: DEFAULT_OUTPUTS_O_NIF_INPUT,
  encapsulation: ViewEncapsulation.None
})
export class ONIFInputComponent extends OTextInputComponent implements OnInit {

  public static DEFAULT_INPUTS_O_NIF_INPUT = DEFAULT_INPUTS_O_NIF_INPUT;
  public static DEFAULT_OUTPUTS_O_NIF_INPUT = DEFAULT_OUTPUTS_O_NIF_INPUT;

  constructor(
    @Optional() @Inject(forwardRef(() => OFormComponent)) form: OFormComponent,
    elRef: ElementRef,
    injector: Injector) {
    super(form, elRef, injector);
  }

  resolveValidators(): ValidatorFn[] {
    let validators: ValidatorFn[] = super.resolveValidators();
    //Inject NIF validator
    validators.push(OValidators.nifValidator);
    return validators;
  }

}


@NgModule({
  declarations: [ONIFInputComponent],
  imports: [OSharedModule, CommonModule, OTextInputModule],
  exports: [ONIFInputComponent, OTextInputModule]
})
export class ONIFInputModule {
}


resolveValidators(): ValidatorFn[] {
    let validators: ValidatorFn[] = super.resolveValidators();
    //Inject NIF validator
    validators.push(OValidators.nifValidator);
    return validators;
  }


function HamburgerBtn({
  displayMobileMenu,
  children,
  onClick
}: {
  displayMobileMenu: boolean;
  children: Array<JSX.Element> | JSX.Element;
  onClick: Function;
}): JSX.Element {
  const Styled = styled("div", {
    ":hover": {
      color: colors.primary
    },
    color: colors.white,
    display: "none!important",
    [media.mediaHeaderWide]: {
      display: "flex!important",
      ...(displayMobileMenu ? { display: "none!important" } : {})
    },
    [media.mediaHeaderDeskTopMin]: {
      display: "flex!important",
      ...(displayMobileMenu ? { display: "none!important" } : {})
    },
    cursor: "pointer",
    justifyContent: "center",
    alignItems: "center"
  });
  return (
    <Styled
      // @ts-ignore
      onClick={onClick}
    >
      {children}
    </Styled>
  );
}


function CrossBtn({
  displayMobileMenu,
  children
}: {
  displayMobileMenu: boolean;
  children: Array<JSX.Element> | JSX.Element;
}): JSX.Element {
  const Styled = styled("div", {
    ":hover": {
      color: colors.primary
    },
    color: colors.white,
    display: "none!important",
    [media.mediaHeaderWide]: {
      display: "none!important",
      ...(displayMobileMenu ? { display: "flex!important" } : {})
    },
    [media.mediaHeaderDeskTopMin]: {
      display: "none!important",
      ...(displayMobileMenu ? { display: "flex!important" } : {})
    },
    cursor: "pointer",
    justifyContent: "center",
    alignItems: "center",
    padding: "5px"
  });
  return <Styled>{children}</Styled>;
}


() => {
  return (
    <Row className="language-switcher" style={{ marginLeft: "1em" }}


(props: {
  onSwitch(s: boolean): void;
  toEthAddress: boolean;
}) => {
  const [toEthAddress, setShowIoAddress] = useState(props.toEthAddress);

  // @ts-ignore
  const convertAddress = e => {
    setShowIoAddress(!toEthAddress);
    props.onSwitch(!toEthAddress);
    e.stopPropagation();
  };

  return (
    <AddressSwitcherContainer onClick={convertAddress}>
      {/* tslint:disable-next-line:use-simple-attributes */}
      <AddressSwitcherItem
        style={{ background: toEthAddress ? "" : "#50B1A0" }}


e => {
    setShowIoAddress(!toEthAddress);
    props.onSwitch(!toEthAddress);
    e.stopPropagation();
  }


({ name, url }) => ({
    name: t(name),
    path: url
  })


(state: {
    base: {
      userId?: string;
      locale: string;
      grafanaLink: string;
      toEthAddress: boolean;
    };
  }) => ({
    loggedIn: Boolean(state.base.userId),
    locale: state.base.locale,
    grafanaLink: state.base.grafanaLink,
    toEthAddress: state.base.toEthAddress
  })


() => {
        if (
          document.documentElement &&
          document.documentElement.clientWidth > PALM_WIDTH
        ) {
          this.setState({
            displayMobileMenu: false
          });
        }
      }


() => {
      this.setState({
        displayMobileMenu: true
      });
    }


() => {
      this.setState({
        displayMobileMenu: false
      });
    }


(hasShadow: boolean) => {
      return (
        <TopbarExtMenu
          hasShadow={hasShadow}
          name={t("topbar.tools")}
          routes={[
            {
              name: t("topbar.explorer_playground"),
              path: "/explorer-playground/"
            },
            {
              name: t("topbar.analytics_playground"),
              path: "https://analytics.iotexscan.io/"
            },
            {
              name: t("topbar.submit_a_bug_report"),
              path: "https://github.com/iotexproject/iotex-explorer/issues/new"
            },
            {
              name: t("topbar.address_converter"),
              path: "https://member.iotex.io/tools/address-convert"
            }
          ]}
          onClick={this.hideMobileMenu}
        />


(hasShadow: boolean) => {
      return (
        <TopbarExtMenu
          hasShadow={hasShadow}
          name={t("topbar.wallet")}
          routes={[
            {
              name: t("topbar.wallet.ioPayMobile"),
              path: "https://iopay.iotex.io"
            },
            {
              name: t("topbar.wallet.ioPayDesktop"),
              path: "https://iopay.iotex.io/desktop"
            },
            {
              name: t("topbar.wallet.web"),
              path: "https://iotexscan.io/wallet"
            }
          ]}
          onClick={this.hideMobileMenu}
        />
      );
    }


(hasShadow: boolean) => {
      return (
        <TopbarExtMenu
          hasShadow={hasShadow}
          name={t("topbar.dashboard")}
          routes={[
            { name: t("topbar.dashboard"), path: "/" },
            { name: t("topbar.actions"), path: "/action" },
            { name: t("topbar.blocks"), path: "/block" },
            { name: t("topbar.accounts"), path: "/account" }
          ]}
          onClick={this.hideMobileMenu}
        />
      );
    }


(hasShadow: boolean) => {
      return (
        <TopbarExtMenu
          hasShadow={hasShadow}
          name={t("topbar.tokensMenu")}
          routes={[
            { name: t("topbar.tokens"), path: "/tokens" },
            { name: t("topbar.xrc20Transfer"), path: "/tokentxns" },
            { name: t("topbar.xrc721Tokens"), path: "/xrc721-tokens" },
            { name: t("topbar.xrc721Transfer"), path: "/xrc721-tokentxns" }
          ]}
          onClick={this.hideMobileMenu}
        />
      );
    }


(hasShadow: boolean) => {
      return (
        <TopbarExtMenu
          hasShadow={hasShadow}
          name={t(CHAIN_MENU_ITEM.label)}
          routes={CHAIN_MENU_ITEM.items}
          onClick={this.hideMobileMenu}
        />
      );
    }


() => {
      if (!this.state.displayMobileMenu) {
        return null;
      }

      const { location } = this.props;

      return (
        <OutsideClickHandler onOutsideClick={this.hideMobileMenu}>
          <Dropdown>
            {this.renderBlockchain(true)}
            {this.renderToken(true)}
            {this.renderTools(true)}
            <StyledExternalLink
              href="https://member.iotex.io"
              target="_blank"
              onClick={this.hideMobileMenu}
            >
              {t("topbar.voting")}
            </StyledExternalLink>
            <StyledLink to="/wallet/transfer" onClick={this.hideMobileMenu}>
              {t("topbar.wallet")}
            </StyledLink>
            {this.renderNetSelector(true)}
            <div
              style={{
                display: "flex",
                alignItems: "center",
                width: "100%",
                marginTop: "12px"
              }}
            >
              <V2Entry
                href={`https://v2.iotexscan.io${location.pathname}${location.search}`}
              >
                v2 beta
              </V2Entry>
            </div>
          </Dropdown>
        </OutsideClickHandler>
      );
    }


(_: React.CSSProperties) => ({
  flexDirection: "row",
  display: "flex",
  boxSizing: "border-box"
})


type State = {
  displayMobileMenu: boolean;
};


type Props = {
  loggedIn: boolean;
  locale: string;
  grafanaLink: string;
  toEthAddress: boolean;
  // tslint:disable:no-any
  location: any;
} & DispatchProp;


public componentDidMount(): void {
      window.addEventListener("resize", () => {
        if (
          document.documentElement &&
          document.documentElement.clientWidth > PALM_WIDTH
        ) {
          this.setState({
            displayMobileMenu: false
          });
        }
      });
    }


t("topbar.tools")


t("topbar.wallet")


t("topbar.dashboard")


t("topbar.tokensMenu")


t("topbar.voting")


assetURL(
                    locale


export interface IPokemon{
    name:string;
    level:number;
    attack:number;
    defense:number;
    health:number;
}


() => {
  const [placement, setPlacement] = React.useState<PlacementType>('top');
  const [hasArrow, setArrow] = React.useState<boolean>(true);
  const [styleText, setStyleText] = React.useState<string>(`{
    "background":"#fff",
    "width":"200px"
  }`);
  let style = {};
  try {
    style = JSON.parse(styleText);
  } catch (error) {
    console.log(error);
  }
  console.log(style, styleText);
  return (
    <div style={{ position: 'relative' }}


e => {
              setPlacement(e.target.value);
            }


export type PlacementType = 'top' | 'bottom' | 'right' | 'left';


export interface IClientConfig extends ClientOptions {
  token: string
  clientID: string,
  devGuildID: string,
  developers: string[],
}


export class QueriesDto {

  @ApiProperty()
  Name: string;

  @ApiProperty()
  Question: string;

}


@Component({
    selector: 'fd-fixed-card-layout-item',
    template: `<ng-content></ng-content>`,
    changeDetection: ChangeDetectionStrategy.OnPush,
    host: {
        style: 'display: block'
    }
})
export class FixedCardLayoutItemComponent implements FocusableOption {
    /** @hidden */
    @HostBinding()
    tabindex = 0;

    constructor(private _elementRef: ElementRef) {}

    /** Set focus on the element. */
    focus(): void {
        this._elementRef.nativeElement.focus();
    }
}


/** Set focus on the element. */
focus(): void {
        this._elementRef.nativeElement.focus();
    }


row => this.selection.select(row)


result => {
        this.paginationModel.itemsLength = result.data;
      }


data => {
          if (data.data != null || data.data != undefined) {
            let datalist: any[] = data.data;
            for (let i = 0; i < datalist.length; i++) {
              this.EquipmentNameList.push({
                id: datalist[i].id,
                itemName: datalist[i].description
              })
            }
          }
        }


result => {
      this.isLoading = false;
      this.geteMaterialByEquipmentTypCode();
    }


err => {
        this.isLoading = false;
      }


(result) => {
        //this.dataSourceFilterData = [];
        //this.allmaterialPropertyDetail = [];
        this.geteMaterialByEquipmentTypCode();

      }


(reason) => {
        //this.allmaterialPropertyDetail = [];
      }


result => {
        this.dataSource.data = result.data;
      }


@Component({
  selector: 'app-define-equipment-material',
  templateUrl: './define-equipment-material.component.html',
  styleUrls: ['./define-equipment-material.component.css']
})
export class DefineEquipmentMaterialComponent implements OnInit, AfterViewInit, OnChanges {

  displayedColumns = ['selectRow', 'MaterialDescription', 'Characteristics', 'CharacteristicsValue', 'UOM'];
  dataSource;// = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
  selection = new SelectionModel<EquipmentTypeMaterialPropertyDetailModel>(true, []);
  paginationModel: EquipmentTypeMaterialPropertyDetailModel = new EquipmentTypeMaterialPropertyDetailModel();
  copyEquipmentPropertyModel: CopyEquipmentPropertyModel = new CopyEquipmentPropertyModel()
  @ViewChild(MatPaginator) paginator: MatPaginator;
  @ViewChild(MatSort) sort: MatSort;
  @Input() sendDataToChild: string;
  @Input() sendMatIDToChild: number;
  filterValue: string;
  EquipmentNameList = [];
  selectedEquipmentName = [];
  equipmentModel:EquipmentViewModel = new EquipmentViewModel()
  isLoading = true;

  ngAfterViewInit() {
    this.paginator.showFirstLastButtons = true;
  }

  applyFilter(filterValue: string) {
    filterValue = filterValue.trim(); // Remove whitespace
    filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
    this.dataSource.filter = filterValue;
  }

  /** Whether the number of selected elements matches the total number of rows. */
  isAllSelected() {
    const numSelected = this.selection.selected.length;
    const numRows = this.dataSource.data.length;
    return numSelected === numRows;
  }

  /** Selects all rows if they are not all selected; otherwise clear selection. */
  masterToggle() {
    this.isAllSelected() ?
      this.selection.clear() :
      this.dataSource.data.forEach(row => this.selection.select(row));
  }

  modalRef: NgbModalRef;

  customSort(event) {
    if (event.active != 'selectRow') {
      this.paginationModel.sortColumn = event.active;
      this.paginationModel.sortOrder = event.direction.toLocaleUpperCase();
      this.geteMaterialByEquipmentTypCode();
    }
  }
  onPaginationEvent(event) {
    this.filterValue = "";
    this.paginationModel.pageNo = event.pageIndex + 1;
    this.paginationModel.pageSize = event.pageSize;
    this.geteMaterialByEquipmentTypCode();
  }

  constructor(
    public equipmentService: EquipmentService,
    public modalService: NgbModal,
    private toastr: ToastrService,
    private authenticationService: AuthService
  ) { }

  settingsA = {};
  countA = 3;

  countB = 3;

 ngOnInit() {
    //this.selectRow = 'selectRow';
   this.paginationModel.clientID = this.authenticationService.currentUserValue.ClientId;
   this.equipmentModel.clientId = this.authenticationService.currentUserValue.ClientId;
   this.equipmentModel.pageSize = 0;
   this.dataSource = new MatTableDataSource<EquipmentTypeMaterialPropertyDetailModel>();
   this.getEquipmentListDD();
   this.settingsA = {
     singleSelection: false,
     text: "Select",
     enableSearchFilter: true,
     addNewItemOnFilter: true,
     badgeShowLimit: 2,
     noDataLabel: "No Data Available"
   };
  }

 async ngOnChanges() {
    this.paginationModel.clientID = this.authenticationService.currentUserValue.ClientId;
    this.paginationModel.equipmentTypeCode = this.sendDataToChild;
    this.paginationModel.equipmentTypeID = this.sendMatIDToChild;
    await this.getPageSize();
    this.geteMaterialByEquipmentTypCode();
  }

  async getPageSize() {
    await this.equipmentService.totalMatCharCount(this.paginationModel)
      .toPromise().then(result => {
        this.paginationModel.itemsLength = result.data;
      });
    // default page size
    this.paginationModel.pageSize = await this.equipmentService.getDefaultPageSize();
    this.paginationModel.pageSizeOptions.push(this.paginationModel.pageSize);
  }

  getEquipmentListDD() {
    this.equipmentService.getEquipmentList(this.equipmentModel)
        .subscribe(data => {
          if (data.data != null || data.data != undefined) {
            let datalist: any[] = data.data;
            for (let i = 0; i < datalist.length; i++) {
              this.EquipmentNameList.push({
                id: datalist[i].id,
                itemName: datalist[i].description
              })
            }
          }
        });
  }

  onItemSelect(item: any) {
    this.isLoading = true;
    this.copyEquipmentPropertyModel.EquipmentCodeGlobal = this.sendDataToChild;
    this.copyEquipmentPropertyModel.EquipmentCodeDropDown = item.itemName.replace(/\s/g, "");
    this.copyEquipmentPropertyModel.ClientID = this.authenticationService.currentUserValue.ClientId;
    this.equipmentService.getEquipmentPropertyFromOtherEquipment(this.copyEquipmentPropertyModel).subscribe(result => {
      this.isLoading = false;
      this.geteMaterialByEquipmentTypCode();
    },
      err => {
        this.isLoading = false;
      },
    );
  }

  btn: any
  btn1: any
  btn2: any
  btn3: any
  btn4: any

  openeditMaterial(action)
  {

    if (action === "addNew") {
      this.modalRef = this.modalService.open(EditDefineEquipmentMaterialComponent, { size: 'xl', backdrop: 'static' });
      (<EditDefineEquipmentMaterialComponent>this.modalRef.componentInstance).dataToTakeAsInput = this.sendDataToChild;
      this.modalRef.result.then((result) => {
        //this.dataSourceFilterData = [];
        //this.allmaterialPropertyDetail = [];
        this.geteMaterialByEquipmentTypCode();

      }), (reason) => {
        //this.allmaterialPropertyDetail = [];
      };
      this.btn = 'btn1'
    }
    else if (action === "delete") {
      this.btn = 'btn2'
    }
    else if (action === "export") {
      this.btn = 'btn3'
    }
    else if (action === "import") {
      this.modalRef = this.modalService.open(ImportExcelComponent, { size: 'md', backdrop: 'static' });
      this.btn = 'btn3'
    }
  }

  geteMaterialByEquipmentTypCode() {
    this.selection.clear();
    this.paginationModel.filterOn = this.filterValue;
    this.equipmentService.getMaterialsPropertyByEquipmentCode(this.paginationModel)
      .subscribe(result => {
        this.dataSource.data = result.data;
      });
  }
}


ngAfterViewInit() {
    this.paginator.showFirstLastButtons = true;
  }


applyFilter(filterValue: string) {
    filterValue = filterValue.trim(); // Remove whitespace
    filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
    this.dataSource.filter = filterValue;
  }


/** Whether the number of selected elements matches the total number of rows. */
isAllSelected() {
    const numSelected = this.selection.selected.length;
    const numRows = this.dataSource.data.length;
    return numSelected === numRows;
  }


/** Selects all rows if they are not all selected; otherwise clear selection. */
masterToggle() {
    this.isAllSelected() ?
      this.selection.clear() :
      this.dataSource.data.forEach(row => this.selection.select(row));
  }


customSort(event) {
    if (event.active != 'selectRow') {
      this.paginationModel.sortColumn = event.active;
      this.paginationModel.sortOrder = event.direction.toLocaleUpperCase();
      this.geteMaterialByEquipmentTypCode();
    }
  }


onPaginationEvent(event) {
    this.filterValue = "";
    this.paginationModel.pageNo = event.pageIndex + 1;
    this.paginationModel.pageSize = event.pageSize;
    this.geteMaterialByEquipmentTypCode();
  }


ngOnInit() {
    //this.selectRow = 'selectRow';
   this.paginationModel.clientID = this.authenticationService.currentUserValue.ClientId;
   this.equipmentModel.clientId = this.authenticationService.currentUserValue.ClientId;
   this.equipmentModel.pageSize = 0;
   this.dataSource = new MatTableDataSource<EquipmentTypeMaterialPropertyDetailModel>();
   this.getEquipmentListDD();
   this.settingsA = {
     singleSelection: false,
     text: "Select",
     enableSearchFilter: true,
     addNewItemOnFilter: true,
     badgeShowLimit: 2,
     noDataLabel: "No Data Available"
   };
  }


async ngOnChanges() {
    this.paginationModel.clientID = this.authenticationService.currentUserValue.ClientId;
    this.paginationModel.equipmentTypeCode = this.sendDataToChild;
    this.paginationModel.equipmentTypeID = this.sendMatIDToChild;
    await this.getPageSize();
    this.geteMaterialByEquipmentTypCode();
  }


async getPageSize() {
    await this.equipmentService.totalMatCharCount(this.paginationModel)
      .toPromise().then(result => {
        this.paginationModel.itemsLength = result.data;
      });
    // default page size
    this.paginationModel.pageSize = await this.equipmentService.getDefaultPageSize();
    this.paginationModel.pageSizeOptions.push(this.paginationModel.pageSize);
  }


getEquipmentListDD() {
    this.equipmentService.getEquipmentList(this.equipmentModel)
        .subscribe(data => {
          if (data.data != null || data.data != undefined) {
            let datalist: any[] = data.data;
            for (let i = 0; i < datalist.length; i++) {
              this.EquipmentNameList.push({
                id: datalist[i].id,
                itemName: datalist[i].description
              })
            }
          }
        });
  }


onItemSelect(item: any) {
    this.isLoading = true;
    this.copyEquipmentPropertyModel.EquipmentCodeGlobal = this.sendDataToChild;
    this.copyEquipmentPropertyModel.EquipmentCodeDropDown = item.itemName.replace(/\s/g, "");
    this.copyEquipmentPropertyModel.ClientID = this.authenticationService.currentUserValue.ClientId;
    this.equipmentService.getEquipmentPropertyFromOtherEquipment(this.copyEquipmentPropertyModel).subscribe(result => {
      this.isLoading = false;
      this.geteMaterialByEquipmentTypCode();
    },
      err => {
        this.isLoading = false;
      },
    );
  }


openeditMaterial(action)
  {

    if (action === "addNew") {
      this.modalRef = this.modalService.open(EditDefineEquipmentMaterialComponent, { size: 'xl', backdrop: 'static' });
      (<EditDefineEquipmentMaterialComponent>this.modalRef.componentInstance).dataToTakeAsInput = this.sendDataToChild;
      this.modalRef.result.then((result) => {
        //this.dataSourceFilterData = [];
        //this.allmaterialPropertyDetail = [];
        this.geteMaterialByEquipmentTypCode();

      }), (reason) => {
        //this.allmaterialPropertyDetail = [];
      };
      this.btn = 'btn1'
    }
    else if (action === "delete") {
      this.btn = 'btn2'
    }
    else if (action === "export") {
      this.btn = 'btn3'
    }
    else if (action === "import") {
      this.modalRef = this.modalService.open(ImportExcelComponent, { size: 'md', backdrop: 'static' });
      this.btn = 'btn3'
    }
  }


geteMaterialByEquipmentTypCode() {
    this.selection.clear();
    this.paginationModel.filterOn = this.filterValue;
    this.equipmentService.getMaterialsPropertyByEquipmentCode(this.paginationModel)
      .subscribe(result => {
        this.dataSource.data = result.data;
      });
  }


type User = {
  id: number
  name: string
  email: string
}


export class ConversationDto {
  @IsNotEmpty()
  readonly name: string;

  @IsNotEmpty()
  @IsEnum(CONVERSATION_TYPES, {
    message: `Conversation type must be only: ${CONVERSATION_TYPES.PRIVATE} or ${CONVERSATION_TYPES.GENERAL}`,
  })
  readonly type: string;
}


()=> AuthDTO


() => AuthDTO


@Resolver(()=> AuthDTO)
export class AuthResolver {
    constructor(
        private readonly userService: UserService,
        private readonly authService: AuthService
    ) {

    }

    @Mutation(() => AuthDTO)
    public async userLogin(@Args() args: CreateAuthArgs ) : Promise<AuthDTO[] | any> {
        try {
            const condition = {...args, banDit: false }
            console.log("authConfig.secretKeys.jwt", authConfig.secretKeys.jwt)
            console.log("condition", condition)
            const resultLogin = await this.authService.login(condition)
            console.log("resultLogin", resultLogin)
            if(resultLogin){
                return resultLogin;
            }else {
                throw new HttpException(" LOgin Fieled", 403)
            }
        } catch(error) {
            throw new HttpException(" LOgin Fieled", 403)
        }
    }

}


@Mutation(() => AuthDTO)
    public async userLogin(@Args() args: CreateAuthArgs ) : Promise<AuthDTO[] | any> {
        try {
            const condition = {...args, banDit: false }
            console.log("authConfig.secretKeys.jwt", authConfig.secretKeys.jwt)
            console.log("condition", condition)
            const resultLogin = await this.authService.login(condition)
            console.log("resultLogin", resultLogin)
            if(resultLogin){
                return resultLogin;
            }else {
                throw new HttpException(" LOgin Fieled", 403)
            }
        } catch(error) {
            throw new HttpException(" LOgin Fieled", 403)
        }
    }


(focused: boolean) => {
        if (focused) document.body.classList.remove("blur")
        else document.body.classList.add("blur")
    }


(fullscreen: boolean) => {
        if (fullscreen) document.body.classList.remove("not-fullscreen")
        else document.body.classList.add("not-fullscreen")
    }


(type: WindowStateListenerType, state: boolean) => {
        switch (type) {
            case WindowStateListenerType.Maximized:
                this.setState({ maximized: state })
                break
            case WindowStateListenerType.Fullscreen:
                this.setBodyFullscreenState(state)
                break
            case WindowStateListenerType.Focused:
                this.setBodyFocusState(state)
                break
        }
    }


(e: KeyboardEvent | IObjectWithKey) => {
        if (!this.props.state.settings.display) {
            switch (e.key) {
                case "F1":
                    this.props.menu()
                    break
                case "F2":
                    this.props.search()
                    break
                case "F5":
                    this.fetch()
                    break
                case "F6":
                    this.props.markAllRead()
                    break
                case "F7":
                    if (!this.props.itemShown) this.props.logs()
                    break
                case "F8":
                    if (!this.props.itemShown) this.props.views()
                    break
                case "F9":
                    if (!this.props.itemShown) this.props.settings()
                    break
            }
        }
    }


() => {
        window.utils.minimizeWindow()
    }


() => {
        window.utils.maximizeWindow()
        this.setState({ maximized: !this.state.maximized })
    }


() => {
        window.utils.closeWindow()
    }


() => this.props.state.sourceInit && this.props.state.feedInit
        && !this.props.state.syncing && !this.props.state.fetchingItems


() => !this.canFetch() ? " fetching" : ""


() => {
        const classNames = new Array<string>()
        if (this.props.state.settings.display) classNames.push("hide-btns")
        if (this.props.state.menu) classNames.push("menu-on")
        if (this.props.itemShown) classNames.push("item-on")
        return classNames.join(" ")
    }


() => {
        if (this.canFetch()) this.props.fetch()
    }


() => {
        if (this.props.state.contextMenu.event !== "#view-toggle") {
            this.props.views()
        }
    }


() => {
        return this.props.state.fetchingTotal > 0
            ? this.props.state.fetchingProgress / this.props.state.fetchingTotal
            : null
    }


class Nav extends React.Component<NavProps, NavState> {
    constructor(props) {
        super(props)
        this.setBodyFocusState(window.utils.isFocused())
        this.setBodyFullscreenState(window.utils.isFullscreen())
        window.utils.addWindowStateListener(this.windowStateListener)
        this.state = {
            maximized: window.utils.isMaximized()
        }
    }

    setBodyFocusState = (focused: boolean) => {
        if (focused) document.body.classList.remove("blur")
        else document.body.classList.add("blur")
    }

    setBodyFullscreenState = (fullscreen: boolean) => {
        if (fullscreen) document.body.classList.remove("not-fullscreen")
        else document.body.classList.add("not-fullscreen")
    }

    windowStateListener = (type: WindowStateListenerType, state: boolean) => {
        switch (type) {
            case WindowStateListenerType.Maximized:
                this.setState({ maximized: state })
                break
            case WindowStateListenerType.Fullscreen:
                this.setBodyFullscreenState(state)
                break
            case WindowStateListenerType.Focused:
                this.setBodyFocusState(state)
                break
        }
    }

    navShortcutsHandler = (e: KeyboardEvent | IObjectWithKey) => {
        if (!this.props.state.settings.display) {
            switch (e.key) {
                case "F1":
                    this.props.menu()
                    break
                case "F2":
                    this.props.search()
                    break
                case "F5":
                    this.fetch()
                    break
                case "F6":
                    this.props.markAllRead()
                    break
                case "F7":
                    if (!this.props.itemShown) this.props.logs()
                    break
                case "F8":
                    if (!this.props.itemShown) this.props.views()
                    break
                case "F9":
                    if (!this.props.itemShown) this.props.settings()
                    break
            }
        }
    }

    componentDidMount() {
        document.addEventListener("keydown", this.navShortcutsHandler)
        if (window.utils.platform === "darwin") window.utils.addTouchBarEventsListener(this.navShortcutsHandler)
    }
    componentWillUnmount() {
        document.removeEventListener("keydown", this.navShortcutsHandler)
    }

    minimize = () => {
        window.utils.minimizeWindow()
    }
    maximize = () => {
        window.utils.maximizeWindow()
        this.setState({ maximized: !this.state.maximized })
    }
    close = () => {
        window.utils.closeWindow()
    }

    canFetch = () => this.props.state.sourceInit && this.props.state.feedInit
        && !this.props.state.syncing && !this.props.state.fetchingItems
    fetching = () => !this.canFetch() ? " fetching" : ""
    getClassNames = () => {
        const classNames = new Array<string>()
        if (this.props.state.settings.display) classNames.push("hide-btns")
        if (this.props.state.menu) classNames.push("menu-on")
        if (this.props.itemShown) classNames.push("item-on")
        return classNames.join(" ")
    }

    fetch = () => {
        if (this.canFetch()) this.props.fetch()
    }

    views = () => {
        if (this.props.state.contextMenu.event !== "#view-toggle") {
            this.props.views()
        }
    }

    getProgress = () => {
        return this.props.state.fetchingTotal > 0
            ? this.props.state.fetchingProgress / this.props.state.fetchingTotal
            : null
    }

    render() {
        return (

                        <Icon iconName={window.utils.platform === "darwin" ? "SidePanel" : "GlobalNavButton"} />

                {this.props.state.title}
                <div className="btn-group" style={{float:"right"}}


type NavProps = {
    state: AppState
    itemShown: boolean
    menu: () => void
    search: () => void
    markAllRead: () => void
    fetch: () => void
    logs: () => void
    views: () => void
    settings: () => void
}


type NavState = {
    maximized: boolean,
}


componentDidMount() {
        document.addEventListener("keydown", this.navShortcutsHandler)
        if (window.utils.platform === "darwin") window.utils.addTouchBarEventsListener(this.navShortcutsHandler)
    }


componentWillUnmount() {
        document.removeEventListener("keydown", this.navShortcutsHandler)
    }