(credential) => {
        if (
          credentialRequest.claimType &&
          credentialRequest.claimValue &&
          credential.credentialSubject[credentialRequest.claimType] !== credentialRequest.claimValue
        ) {
          return false
        }

        if (
          credentialRequest.claimType &&
          !credentialRequest.claimValue &&
          credential.credentialSubject[credentialRequest.claimType] === undefined
        ) {
          return false
        }

        if (
          credentialRequest.issuers &&
          !credentialRequest.issuers.map((i) => i.did).includes(credential.issuer.id)
        ) {
          return false
        }
        if (
          credentialRequest.credentialContext &&
          !credential['@context'].includes(credentialRequest.credentialContext)
        ) {
          return false
        }

        if (credentialRequest.credentialType && !credential.type.includes(credentialRequest.credentialType)) {
          return false
        }

        return true
      }


(vc) => ({
          hash: blake2bHex(JSON.stringify(vc)),
          verifiableCredential: vc,
        })


/**
   * Creates a Selective disclosure request, encoded as a JWT.
   *
   * @remarks See {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | Selective Disclosure}
   *
   * @param args - The param object with the properties necessary to create the request. See {@link ISelectiveDisclosureRequest}
   * @param context - *RESERVED* This is filled by the framework when the method is called.
   *
   * @beta
   */
async createSelectiveDisclosureRequest(
    args: ICreateSelectiveDisclosureRequestArgs,
    context: IAgentContext<IDIDManager & IKeyManager>,
  ): Promise<string> {
    try {
      const identifier = await context.agent.didManagerGet({ did: args.data.issuer })
      const data: Partial<ISelectiveDisclosureRequest> = args.data
      delete data.issuer
      Debug('veramo:selective-disclosure:create-sdr')('Signing SDR with', identifier.did)

      const key = identifier.keys.find((k) => k.type === 'Secp256k1')
      if (!key) throw Error('Signing key not found')
      const signer = (data: string | Uint8Array) => {
        let dataString, encoding: 'base16' | undefined
        if (typeof data === 'string') {
          dataString = data
          encoding = undefined
        } else {
          ;(dataString = Buffer.from(data).toString('hex')), (encoding = 'base16')
        }
        return context.agent.keyManagerSign({ keyRef: key.kid, data: dataString, encoding })
      }
      const jwt = await createJWT(
        {
          type: 'sdr',
          ...data,
        },
        {
          signer,
          alg: 'ES256K',
          issuer: identifier.did,
        },
      )
      return jwt
    } catch (error) {
      return Promise.reject(error)
    }
  }


/**
   * Gathers the required credentials necessary to fulfill a Selective Disclosure Request.
   * It uses the {@link @veramo/data-store#IDataStoreORM} plugin to query the local database for
   * the required credentials.
   *
   * @param args - Contains the Request to be fulfilled and the DID of the subject
   * @param context - *RESERVED* This is filled by the framework when the method is called.
   *
   * @beta
   */
async getVerifiableCredentialsForSdr(
    args: IGetVerifiableCredentialsForSdrArgs,
    context: IAgentContext<IDataStoreORM>,
  ): Promise<ICredentialsForSdr[]> {
    const result: ICredentialsForSdr[] = []
    const findArgs: FindArgs<TClaimsColumns> = { where: [] }
    for (const credentialRequest of args.sdr.claims) {
      if (credentialRequest.claimType) {
        findArgs.where?.push({ column: 'type', value: [credentialRequest.claimType] })
      }

      if (credentialRequest.claimValue) {
        findArgs.where?.push({ column: 'value', value: [credentialRequest.claimValue] })
      }

      if (credentialRequest.issuers && credentialRequest.issuers.length > 0) {
        findArgs.where?.push({ column: 'issuer', value: credentialRequest.issuers.map((i) => i.did) })
      }

      if (credentialRequest.credentialType) {
        findArgs.where?.push({
          column: 'credentialType',
          value: ['%' + credentialRequest.credentialType + '%'],
          op: 'Like',
        })
      }

      if (credentialRequest.credentialContext) {
        findArgs.where?.push({
          column: 'context',
          value: ['%' + credentialRequest.credentialContext + '%'],
          op: 'Like',
        })
      }

      if (args.did || args.sdr.subject) {
        findArgs.where?.push({ column: 'subject', value: ['' + (args.did || args.sdr.subject)] })
      }

      const credentials = await context.agent.dataStoreORMGetVerifiableCredentialsByClaims(findArgs)

      result.push({
        ...credentialRequest,
        credentials,
      })
    }
    return result
  }


/**
   * Validates a
   * {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | Selective Disclosure response}
   * encoded as a `Presentation`
   *
   * @param args - Contains the request and the response `Presentation` that needs to be checked.
   * @param context - *RESERVED* This is filled by the framework when the method is called.
   *
   * @beta
   */
async validatePresentationAgainstSdr(
    args: IValidatePresentationAgainstSdrArgs,
    context: IAgentContext<{}>,
  ): Promise<IPresentationValidationResult> {
    let valid = true
    let claims = []
    for (const credentialRequest of args.sdr.claims) {
      let credentials = (args.presentation?.verifiableCredential || []).filter((credential) => {
        if (
          credentialRequest.claimType &&
          credentialRequest.claimValue &&
          credential.credentialSubject[credentialRequest.claimType] !== credentialRequest.claimValue
        ) {
          return false
        }

        if (
          credentialRequest.claimType &&
          !credentialRequest.claimValue &&
          credential.credentialSubject[credentialRequest.claimType] === undefined
        ) {
          return false
        }

        if (
          credentialRequest.issuers &&
          !credentialRequest.issuers.map((i) => i.did).includes(credential.issuer.id)
        ) {
          return false
        }
        if (
          credentialRequest.credentialContext &&
          !credential['@context'].includes(credentialRequest.credentialContext)
        ) {
          return false
        }

        if (credentialRequest.credentialType && !credential.type.includes(credentialRequest.credentialType)) {
          return false
        }

        return true
      })

      if (credentialRequest.essential === true && credentials.length == 0) {
        valid = false
      }

      claims.push({
        ...credentialRequest,
        credentials: credentials.map((vc) => ({
          hash: blake2bHex(JSON.stringify(vc)),
          verifiableCredential: vc,
        })),
      })
    }
    return { valid, claims }
  }


/**
   * Creates profile credentials
   *
   * @beta
   */
async createProfilePresentation(
    args: ICreateProfileCredentialsArgs,
    context: IAgentContext<ICredentialIssuer & IDIDManager>,
  ): Promise<VerifiablePresentation> {
    const identifier = await context.agent.didManagerGet({ did: args.holder })

    const credentials = []

    if (args.name) {
      const credential = await context.agent.createVerifiableCredential({
        credential: {
          issuer: { id: identifier.did },
          '@context': ['https://www.w3.org/2018/credentials/v1'],
          type: ['VerifiableCredential', 'Profile'],
          issuanceDate: new Date().toISOString(),
          credentialSubject: {
            id: identifier.did,
            name: args.name,
          },
        },
        proofFormat: 'jwt',
      })

      credentials.push(credential)
    }

    if (args.picture) {
      const credential = await context.agent.createVerifiableCredential({
        credential: {
          issuer: { id: identifier.did },
          '@context': ['https://www.w3.org/2018/credentials/v1'],
          type: ['VerifiableCredential', 'Profile'],
          issuanceDate: new Date().toISOString(),
          credentialSubject: {
            id: identifier.did,
            picture: args.picture,
          },
        },
        proofFormat: 'jwt',
      })

      credentials.push(credential)
    }

    if (args.url) {
      const credential = await context.agent.createVerifiableCredential({
        credential: {
          issuer: { id: identifier.did },
          '@context': ['https://www.w3.org/2018/credentials/v1'],
          type: ['VerifiableCredential', 'Profile'],
          issuanceDate: new Date().toISOString(),
          credentialSubject: {
            id: identifier.did,
            url: args.url,
          },
        },
        proofFormat: 'jwt',
      })

      credentials.push(credential)
    }

    const profile = await context.agent.createVerifiablePresentation({
      presentation: {
        verifier: args.holder ? [args.holder] : [],
        holder: identifier.did,
        '@context': ['https://www.w3.org/2018/credentials/v1'],
        type: ['VerifiablePresentation', 'Profile'],
        issuanceDate: new Date().toISOString(),
        verifiableCredential: credentials,
      },
      proofFormat: 'jwt',
      save: args.save,
    })

    if (args.verifier && args.send) {
      await context.agent.sendMessageDIDCommAlpha1({
        save: args.save,
        data: {
          from: identifier.did,
          to: args.verifier,
          type: 'jwt',
          body: profile.proof.jwt,
        },
      })
    }

    return profile
  }


() => (
  <Tooltip>A


() => (
  <Margins inline='neg-x8'>
    <Box>
      <Margins all


async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalPipes(new ValidationPipe());
  app.enableCors();
  await app.listen(3001);
}


(o) => !!o


(conf: SwaggerSettings) => {
      const {path = "/"} = conf;

      this.app.get(path, useCtxHandler(redirectMiddleware(path)));
      this.app.use(path, this.createRouter(conf, urls));
    }


(conf: SwaggerSettings) => {
        const {path = "/", fileName = "swagger.json", doc} = conf;

        let url = "/";

        if (host) {
          url = typeof host.port === "number" ? `${host.protocol}://${host.address}:${host.port}` : "";
        }

        this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${normalizePath(path, fileName)}`);
        this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
      }


(conf) => {
        displayLog(conf);
      }


(conf) => {
        const {outFile} = conf;

        if (this.env === Env.PROD || outFile) {
          const spec = this.swaggerService.getOpenAPISpec(conf);

          if (outFile) {
            return Fs.writeFile(outFile, JSON.stringify(spec, null, 2), {encoding: "utf8"}, () => {});
          }
        }
      }


(acc: any[], conf) => {
      const {path = "/", fileName = "swagger.json", doc, hidden} = conf;

      if (!hidden) {
        acc.push({url: normalizePath(path, fileName), name: doc || path});
      }

      return acc;
    }


(ctx: PlatformContext) => {
      ctx.response.status(200).body(this.swaggerService.getOpenAPISpec(conf));
    }


/**
 * @ignore
 */
@Module()
export class SwaggerModule implements BeforeRoutesInit, OnReady {
  @Inject()
  injector: InjectorService;

  @Inject()
  app: PlatformApplication;

  @Configuration()
  configuration: Configuration;

  @Inject()
  swaggerService: SwaggerService;

  @Constant("env")
  env: Env;

  private loaded = false;

  get settings() {
    return ([] as SwaggerSettings[]).concat(this.configuration.get<SwaggerSettings[]>("swagger")).filter((o) => !!o);
  }

  /**
   *
   */
  $beforeRoutesInit() {
    if (this.loaded) {
      return;
    }

    const urls: any[] = this.getUrls();

    this.settings.forEach((conf: SwaggerSettings) => {
      const {path = "/"} = conf;

      this.app.get(path, useCtxHandler(redirectMiddleware(path)));
      this.app.use(path, this.createRouter(conf, urls));
    });

    this.loaded = true;
  }

  $onReady() {
    // istanbul ignore next
    if (this.configuration.getBestHost) {
      const host = this.configuration.getBestHost();

      if (!host) {
        return;
      }

      const displayLog = (conf: SwaggerSettings) => {
        const {path = "/", fileName = "swagger.json", doc} = conf;

        let url = "/";

        if (host) {
          url = typeof host.port === "number" ? `${host.protocol}://${host.address}:${host.port}` : "";
        }

        this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${normalizePath(path, fileName)}`);
        this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
      };

      this.settings.forEach((conf) => {
        displayLog(conf);
      });
    }

    this.generateSpecFiles();
  }

  generateSpecFiles() {
    return Promise.all(
      this.settings.map((conf) => {
        const {outFile} = conf;

        if (this.env === Env.PROD || outFile) {
          const spec = this.swaggerService.getOpenAPISpec(conf);

          if (outFile) {
            return Fs.writeFile(outFile, JSON.stringify(spec, null, 2), {encoding: "utf8"}, () => {});
          }
        }
      })
    );
  }

  private getUrls() {
    return this.settings.reduce((acc: any[], conf) => {
      const {path = "/", fileName = "swagger.json", doc, hidden} = conf;

      if (!hidden) {
        acc.push({url: normalizePath(path, fileName), name: doc || path});
      }

      return acc;
    }, []);
  }

  /**
   *
   * @param conf
   * @param urls
   */
  private createRouter(conf: SwaggerSettings, urls: string[]) {
    const {disableSpec = false, fileName = "swagger.json", cssPath, jsPath, viewPath = join(__dirname, "../views/index.ejs")} = conf;
    const router = PlatformRouter.create(this.injector);

    if (!disableSpec) {
      router.get(normalizePath("/", fileName), useCtxHandler(this.middlewareSwaggerJson(conf)));
    }

    if (viewPath) {
      if (cssPath) {
        router.get("/main.css", useCtxHandler(cssMiddleware(cssPath)));
      }

      if (jsPath) {
        router.get("/main.js", useCtxHandler(jsMiddleware(jsPath)));
      }

      router.get("/", useCtxHandler(indexMiddleware(viewPath, {urls, ...conf})));
      router.statics("/", {root: swaggerUiPath});
    }

    return router;
  }

  private middlewareSwaggerJson(conf: SwaggerSettings) {
    return (ctx: PlatformContext) => {
      ctx.response.status(200).body(this.swaggerService.getOpenAPISpec(conf));
    };
  }
}


/**
   *
   */
$beforeRoutesInit() {
    if (this.loaded) {
      return;
    }

    const urls: any[] = this.getUrls();

    this.settings.forEach((conf: SwaggerSettings) => {
      const {path = "/"} = conf;

      this.app.get(path, useCtxHandler(redirectMiddleware(path)));
      this.app.use(path, this.createRouter(conf, urls));
    });

    this.loaded = true;
  }


$onReady() {
    // istanbul ignore next
    if (this.configuration.getBestHost) {
      const host = this.configuration.getBestHost();

      if (!host) {
        return;
      }

      const displayLog = (conf: SwaggerSettings) => {
        const {path = "/", fileName = "swagger.json", doc} = conf;

        let url = "/";

        if (host) {
          url = typeof host.port === "number" ? `${host.protocol}://${host.address}:${host.port}` : "";
        }

        this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${normalizePath(path, fileName)}`);
        this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
      };

      this.settings.forEach((conf) => {
        displayLog(conf);
      });
    }

    this.generateSpecFiles();
  }


generateSpecFiles() {
    return Promise.all(
      this.settings.map((conf) => {
        const {outFile} = conf;

        if (this.env === Env.PROD || outFile) {
          const spec = this.swaggerService.getOpenAPISpec(conf);

          if (outFile) {
            return Fs.writeFile(outFile, JSON.stringify(spec, null, 2), {encoding: "utf8"}, () => {});
          }
        }
      })
    );
  }


private getUrls() {
    return this.settings.reduce((acc: any[], conf) => {
      const {path = "/", fileName = "swagger.json", doc, hidden} = conf;

      if (!hidden) {
        acc.push({url: normalizePath(path, fileName), name: doc || path});
      }

      return acc;
    }, []);
  }


/**
   *
   * @param conf
   * @param urls
   */
private createRouter(conf: SwaggerSettings, urls: string[]) {
    const {disableSpec = false, fileName = "swagger.json", cssPath, jsPath, viewPath = join(__dirname, "../views/index.ejs")} = conf;
    const router = PlatformRouter.create(this.injector);

    if (!disableSpec) {
      router.get(normalizePath("/", fileName), useCtxHandler(this.middlewareSwaggerJson(conf)));
    }

    if (viewPath) {
      if (cssPath) {
        router.get("/main.css", useCtxHandler(cssMiddleware(cssPath)));
      }

      if (jsPath) {
        router.get("/main.js", useCtxHandler(jsMiddleware(jsPath)));
      }

      router.get("/", useCtxHandler(indexMiddleware(viewPath, {urls, ...conf})));
      router.statics("/", {root: swaggerUiPath});
    }

    return router;
  }


private middlewareSwaggerJson(conf: SwaggerSettings) {
    return (ctx: PlatformContext) => {
      ctx.response.status(200).body(this.swaggerService.getOpenAPISpec(conf));
    };
  }


export function makeReleaseConfig(
  input: {
    templates: types.FilePath[],
    prestartCommand: string,
    startCommand: string,
    stopCommand: string,
    configSources?: {[key: string]: types.FilePath},
  }
): ReleaseConfig {
  return {
    templates: input.templates,
    prestartCommand: input.prestartCommand,
    startCommand: input.startCommand,
    stopCommand: input.stopCommand,
    configSources: input.configSources === undefined ? {} : input.configSources,
  };
}


export function texprReleaseConfig(): ADL.ATypeExpr<ReleaseConfig> {
  return {value : {typeRef : {kind: "reference", value : snReleaseConfig}, parameters : []}};
}


/**
 * Configuration for a package to be customized
 * when unpacked
 */
export interface ReleaseConfig {
  templates: types.FilePath[];
  prestartCommand: string;
  startCommand: string;
  stopCommand: string;
  configSources: {[key: string]: types.FilePath};
}


// TODO: implement a singleton service adapter
interface ServiceAdapter {
    // getServiceName
}


() => {
  return null
}


props => {
  let firstActiveKey: string | null = null

  const items: ReactElement<ComponentProps<typeof SideBarItem>>[] = []

  React.Children.forEach(props.children, (child, index) => {
    if (!React.isValidElement(child)) return
    const key = child.key
    if (typeof key !== 'string') return
    if (index === 0) {
      firstActiveKey = key
    }
    items.push(child)
  })

  const [activeKey, setActiveKey] = usePropsValue({
    value: props.activeKey,
    defaultValue: props.defaultActiveKey ?? firstActiveKey,
    onChange: v => {
      if (v === null) return
      props.onChange?.(v)
    },
  })

  return withNativeProps(
    props,
    <div className={classPrefix}>
      {items.map(item => {
        const active = item.key === activeKey
        return withNativeProps(
          item.props,
          <div
            key={item.key}
            onClick={()


(child, index) => {
    if (!React.isValidElement(child)) return
    const key = child.key
    if (typeof key !== 'string') return
    if (index === 0) {
      firstActiveKey = key
    }
    items.push(child)
  }


v => {
      if (v === null) return
      props.onChange?.(v)
    }


item => {
        const active = item.key === activeKey
        return withNativeProps(
          item.props,
          <div
            key={item.key}
            onClick={()


export type SideBarItemProps = {
  title?: ReactNode
  disabled?: boolean
  badge?: ReactNode
} & NativeProps


export type SideBarProps = {
  activeKey?: string | null
  defaultActiveKey?: string | null
  onChange?: (key: string) => void
} & NativeProps<
  '--width' | '--height' | '--item-border-radius' | '--background-color'
>


classNames(`${classPrefix


() => {
  return Joi.array().items(
    Joi.object().keys({
      fieldname: schemas.fieldname().required(),
      filename: schemas.filename().required(),
      path: schemas.path().required(),
      mimetype: schemas.mimetype(UPLOAD_MIME_TYPE).required(),
      size: Joi.number().required(),
      owner: Joi.number().required()
    })
  )
}


() => ID


@ObjectType()
@Schema()
export class Application {
  @Field(() => ID)
  id!: string

  @Prop({ type: mongoose.Schema.Types.ObjectId, required: true })
  userId!: string

  @Field()
  @Prop({ required: true })
  createdAt!: number

  @Field({ nullable: true })
  @Prop()
  updatedAt?: number

  @Prop()
  deletedAt?: number

  @Field({ nullable: true })
  @Prop()
  name?: string

  @Field({ nullable: true })
  @Prop()
  script?: string
}


@ObjectType()
export class ApplicationDepartment {
  applicationId!: string

  @Field(() => ID)
  id!: string

  @Field({ nullable: true })
  parentId?: string

  @Field()
  name!: string
}


@ObjectType()
export class ApplicationUser {
  applicationId!: string

  @Field(() => ID)
  id!: string

  @Field()
  departmentId!: string

  @Field()
  name!: string
}


@ObjectType()
export class ApplicationDistrict {
  applicationId!: string

  @Field(() => ID)
  id!: string

  @Field({ nullable: true })
  parentId?: string

  @Field()
  name!: string
}


@customElement('klinklang-footer')
export class KlinklangFooter extends LitElement {
  static get styles (): CSSResultArray {
    return [
      typography,
      css`
        :host {
          display: block;
          max-width: 62.5rem;
          margin: 1rem auto;
        }
        .link {
          color: inherit;
          text-decoration: none;
        }
        .link:hover {
          text-decoration: underline;
        }
      `
    ]
  }

  render (): TemplateResult {
    return html`

        © 52Poké Wiki

    `
  }
}


interface HTMLElementTagNameMap {
    'klinklang-footer': KlinklangFooter
  }


render (): TemplateResult {
    return html`

        © 52Poké Wiki

    `
  }


export function install(dir = '.husky'): void {
  // Ensure that we're inside a git repository
  // If git command is not found, status is null and we should return.
  // That's why status value needs to be checked explicitly.
  if (git(['rev-parse']).status !== 0) {
    return
  }

  // Custom dir help
  const url = 'https://git.io/Jc3F9'

  // Ensure that we're not trying to install outside of cwd
  if (!p.resolve(process.cwd(), dir).startsWith(process.cwd())) {
    throw new Error(`.. not allowed (see ${url})`)
  }

  // Ensure that cwd is git top level
  if (!fs.existsSync('.git')) {
    throw new Error(`.git can't be found (see ${url})`)
  }

  try {
    // Create .husky/_
    fs.mkdirSync(p.join(dir, '_'), { recursive: true })

    // Create .husky/_/.gitignore
    fs.writeFileSync(p.join(dir, '_/.gitignore'), '*')

    // Copy husky.sh to .husky/_/husky.sh
    fs.copyFileSync(p.join(__dirname, '../husky.sh'), p.join(dir, '_/husky.sh'))

    // Configure repo
    const { error } = git(['config', 'core.hooksPath', dir])
    if (error) {
      throw error
    }
  } catch (e) {
    l('Git hooks failed to install')
    throw e
  }

  l('Git hooks installed')
}


export function set(file: string, cmd: string): void {
  const dir = p.dirname(file)
  if (!fs.existsSync(dir)) {
    throw new Error(
      `can't create hook, ${dir} directory doesn't exist (try running husky install)`,
    )
  }

  fs.writeFileSync(
    file,
    `#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

${cmd}
`,
    { mode: 0o0755 },
  )

  l(`created ${file}`)
}


export function add(file: string, cmd: string): void {
  if (fs.existsSync(file)) {
    fs.appendFileSync(file, `${cmd}\n`)
    l(`updated ${file}`)
  } else {
    set(file, cmd)
  }
}


export function uninstall(): void {
  git(['config', '--unset', 'core.hooksPath'])
}


(msg: string): void => console.log(`husky - ${msg}`)


(args: string[]): cp.SpawnSyncReturns<Buffer> =>
  cp.spawnSync('git', args, { stdio: 'inherit' })


() => {
  test('Should accept an initial game grid', () => {
    const grid = ['jefblpepre']
    const wordSearch = new WordSearch(grid)

    expect(wordSearch instanceof WordSearch).toEqual(true)
  })

  xtest('can accept a target search word', () => {
    const grid = ['jefblpepre']
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['glasnost'])).toEqual({ glasnost: undefined })
  })

  xtest('should locate a word written left to right', () => {
    const grid = ['clojurermt']
    const expectedResults = {
      clojure: {
        start: [1, 1],
        end: [1, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })

  xtest('can locate a left to right word in a different position', () => {
    const grid = ['mtclojurer']
    const expectedResults = {
      clojure: {
        start: [1, 3],
        end: [1, 9],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })

  xtest('can locate a different left to right word', () => {
    const grid = ['coffeelplx']
    const expectedResults = {
      coffee: {
        start: [1, 1],
        end: [1, 6],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
  })
  xtest('can locate that different left to right word in a different position', () => {
    const grid = ['xcoffeezlp']
    const expectedResults = {
      coffee: {
        start: [1, 2],
        end: [1, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
  })
}


() => {
    const grid = ['jefblpepre']
    const wordSearch = new WordSearch(grid)

    expect(wordSearch instanceof WordSearch).toEqual(true)
  }


() => {
    const grid = ['jefblpepre']
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['glasnost'])).toEqual({ glasnost: undefined })
  }


() => {
    const grid = ['clojurermt']
    const expectedResults = {
      clojure: {
        start: [1, 1],
        end: [1, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = ['mtclojurer']
    const expectedResults = {
      clojure: {
        start: [1, 3],
        end: [1, 9],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = ['coffeelplx']
    const expectedResults = {
      coffee: {
        start: [1, 1],
        end: [1, 6],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
  }


() => {
    const grid = ['xcoffeezlp']
    const expectedResults = {
      coffee: {
        start: [1, 2],
        end: [1, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
  }


() => {
  xtest('can locate a left to right word in a two line grid', () => {
    const grid = ['jefblpepre', 'clojurermt']

    const expectedResults = {
      clojure: {
        start: [2, 1],
        end: [2, 7],
      },
    }

    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })
  xtest('can locate a left to right word in a different position in a two line grid', () => {
    const grid = ['jefblpepre', 'tclojurerm']
    const expectedResults = {
      clojure: {
        start: [2, 2],
        end: [2, 8],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })
  xtest('can locate a left to right word in a three line grid', () => {
    const grid = ['camdcimgtc', 'jefblpepre', 'clojurermt']
    const expectedResults = {
      clojure: {
        start: [3, 1],
        end: [3, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })

  xtest('can locate a left to right word in a ten line grid', () => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]

    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })

  xtest('can locate a left to right word in a different position in a ten line grid', () => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'clojurermt',
      'jalaycalmp',
    ]

    const expectedResults = {
      clojure: {
        start: [9, 1],
        end: [9, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  })
  xtest('can locate a different left to right word in a ten line grid', () => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'clojurermt',
      'jalaycalmp',
    ]
    const expectedResults = {
      scree: {
        start: [7, 1],
        end: [7, 5],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['scree'])).toEqual(expectedResults)
  })
}


() => {
    const grid = ['jefblpepre', 'clojurermt']

    const expectedResults = {
      clojure: {
        start: [2, 1],
        end: [2, 7],
      },
    }

    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = ['jefblpepre', 'tclojurerm']
    const expectedResults = {
      clojure: {
        start: [2, 2],
        end: [2, 8],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = ['camdcimgtc', 'jefblpepre', 'clojurermt']
    const expectedResults = {
      clojure: {
        start: [3, 1],
        end: [3, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]

    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'clojurermt',
      'jalaycalmp',
    ]

    const expectedResults = {
      clojure: {
        start: [9, 1],
        end: [9, 7],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'clojurermt',
      'jalaycalmp',
    ]
    const expectedResults = {
      scree: {
        start: [7, 1],
        end: [7, 5],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['scree'])).toEqual(expectedResults)
  }


() => {
  xtest('can find two words written left to right', () => {
    const grid = [
      'aefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
      'xjavamtzlp',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      java: {
        start: [11, 2],
        end: [11, 5],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['java', 'clojure'])).toEqual(expectedResults)
  })
}


() => {
    const grid = [
      'aefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
      'xjavamtzlp',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      java: {
        start: [11, 2],
        end: [11, 5],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['java', 'clojure'])).toEqual(expectedResults)
  }


() => {
  xtest('should locate a single word written right to left', () => {
    const grid = ['rixilelhrs']
    const expectedResults = {
      elixir: {
        start: [1, 6],
        end: [1, 1],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['elixir'])).toEqual(expectedResults)
  })
  xtest('should locate multiple words written in different horizontal directions', () => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['elixir', 'clojure'])).toEqual(expectedResults)
  })
}


() => {
    const grid = ['rixilelhrs']
    const expectedResults = {
      elixir: {
        start: [1, 6],
        end: [1, 1],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['elixir'])).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(wordSearch.find(['elixir', 'clojure'])).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
      ecmascript: {
        start: [1, 10],
        end: [10, 10],
      },
    }
    const wordSearch = new WordSearch(grid)
    expect(wordSearch.find(['elixir', 'clojure', 'ecmascript'])).toEqual(
      expectedResults
    )
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
      ecmascript: {
        start: [1, 10],
        end: [10, 10],
      },
      rust: {
        start: [5, 9],
        end: [2, 9],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(
      wordSearch.find(['elixir', 'clojure', 'ecmascript', 'rust'])
    ).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
      ecmascript: {
        start: [1, 10],
        end: [10, 10],
      },
      rust: {
        start: [5, 9],
        end: [2, 9],
      },
      java: {
        start: [1, 1],
        end: [4, 4],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(
      wordSearch.find(['clojure', 'elixir', 'ecmascript', 'rust', 'java'])
    ).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]

    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
      ecmascript: {
        start: [1, 10],
        end: [10, 10],
      },
      rust: {
        start: [5, 9],
        end: [2, 9],
      },
      java: {
        start: [1, 1],
        end: [4, 4],
      },
      lua: {
        start: [9, 8],
        end: [7, 6],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(
      wordSearch.find([
        'clojure',
        'elixir',
        'ecmascript',
        'rust',
        'java',
        'lua',
      ])
    ).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]
    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
      ecmascript: {
        start: [1, 10],
        end: [10, 10],
      },
      rust: {
        start: [5, 9],
        end: [2, 9],
      },
      java: {
        start: [1, 1],
        end: [4, 4],
      },
      lua: {
        start: [9, 8],
        end: [7, 6],
      },
      lisp: {
        start: [6, 3],
        end: [3, 6],
      },
    }

    const wordSearch = new WordSearch(grid)

    expect(
      wordSearch.find([
        'clojure',
        'elixir',
        'ecmascript',
        'rust',
        'java',
        'lua',
        'lisp',
      ])
    ).toEqual(expectedResults)
  }


() => {
    const grid = [
      'jefblpepre',
      'camdcimgtc',
      'oivokprjsm',
      'pbwasqroua',
      'rixilelhrs',
      'wolcqlirpc',
      'screeaumgr',
      'alxhpburyi',
      'jalaycalmp',
      'clojurermt',
    ]

    const expectedResults = {
      clojure: {
        start: [10, 1],
        end: [10, 7],
      },
      elixir: {
        start: [5, 6],
        end: [5, 1],
      },
      ecmascript: {
        start: [1, 10],
        end: [10, 10],
      },
      rust: {
        start: [5, 9],
        end: [2, 9],
      },
      java: {
        start: [1, 1],
        end: [4, 4],
      },
      lua: {
        start: [9, 8],
        end: [7, 6],
      },
      lisp: {
        start: [6, 3],
        end: [3, 6],
      },
      ruby: {
        start: [6, 8],
        end: [9, 5],
      },
    }
    const wordSearch = new WordSearch(grid)

    expect(
      wordSearch.find([
        'clojure',
        'elixir',
        'ecmascript',
        'rust',
        'java',
        'lua',
        'lisp',
        'ruby',
      ])
    ).toEqual(expectedResults)
  }


data => { this.students = data }


error => console.log(error)


data => { this.ids = data }


data => { this.skills = data, this.sort(this.skills) }


data => { this.proffskills = data, this.sort(this.proffskills) }


data => { this.languages = data, this.sortLang(this.languages) }


data => {
            for (let i = 0; i < data.length; i++) {
              this.skillFk.push(data[i]);
            }
            this.checkSkillDupes(this.checkedSkill);
          }


data => {
            for (let i = 0; i < data.length; i++) {
              this.profskillFk.push(data[i]);
            }
            this.checkProfDupes(this.checkedProf);
          }


data => {
            for (let i = 0; i < data.length; i++) {
              this.languageFk.push(data[i]);
            }
            this.checkLangDupes(this.checkedLang);
          }


data => { this.students[i] = data[0] }


data => { this.students[k] = data[0], console.log(data), k++ }


data => { this.download(data[0].id) }


data => {
        const pos = this.students.map(elem => elem.id).indexOf(student.id);
        this.students.splice(pos, 1);
        this.toast.setMessage('item deleted successfully.', 'success');
      }


elem => elem.id


error => console.error


data => { this.studentjes += data, console.log(data) }


error => { console.log("gelukt") }


ngOnInit() {
    this.getStudents();
    this.getStudentsIds();
    this.getSkills();
    this.getLanguages();
    this.getProffskills();

  }


//Get all students -> add to students[]
getStudents() {
    this.studentService.getStudentsMysql().subscribe(
      data => { this.students = data },
      error => console.log(error)
    )
  }


//Get all the ids of the students -> add to ids[]
getStudentsIds() {
    this.studentService.getStudentsIdsMysql().subscribe(
      data => { this.ids = data },
      error => console.log(error)
    )
  }


//get all distinct skills of all students -> add to skills[]
//sort them alphabetically
getSkills() {
    this.skillService.getSkillsDistinct().subscribe(
      data => { this.skills = data, this.sort(this.skills) },
      error => console.log(error)
    )
  }


//get all disctinct professional skills of all students -> add to proffskills[]
getProffskills() {
    this.professionalService.getProfessionalDistinct().subscribe(
      data => { this.proffskills = data, this.sort(this.proffskills) },
      error => console.log(error)
    )
  }


//get all distinct languages -> add them to languages[]
getLanguages() {
    this.languageService.getLanguagesDistinct().subscribe(
      data => { this.languages = data, this.sortLang(this.languages) },
      error => console.log(error)
    )
  }


//sort array on skills alphabetically
sort(array) {
    array.sort(function (name1, name2) {
      if (name1.skill < name2.skill) {
        return -1;
      } else if (name1.skill > name2.skill) {
        return 1;
      } else {
        return 0;
      }
    });
  }


//sort array on language type alphabetically
sortLang(array) {
    array.sort(function (name1, name2) {
      if (name1.type < name2.type) {
        return -1;
      } else if (name1.type > name2.type) {
        return 1;
      } else {
        return 0;
      }
    });
  }


sortGradYear() {
    if (this.clickGrad == 0) {
      this.students.sort(function (name1, name2) {
        if (name1.gradYear < name2.gradYear) {
          return -1;
        } else if (name1.gradYear > name2.gradYear) {
          return 1;
        } else {
          return 0;
        }
      });
      this.clickGrad = 1;
    }
    else {
      this.students.sort(function (name1, name2) {
        if (name1.gradYear > name2.gradYear) {
          return -1;
        } else if (name1.gradYear < name2.gradYear) {
          return 1;
        } else {
          return 0;
        }
      });
      this.clickGrad = 0;
    }
  }


sortName() {
    if (this.clickName == 0) {
      this.students.sort(function (name1, name2) {
        if (name1.name < name2.name) {
          return -1;
        } else if (name1.name > name2.name) {
          return 1;
        } else {
          return 0;
        }
      });
      this.clickName = 1;
    }
    else {
      this.students.sort(function (name1, name2) {
        if (name1.name > name2.name) {
          return -1;
        } else if (name1.name < name2.name) {
          return 1;
        } else {
          return 0;
        }
      });
      this.clickName = 0;
    }
  }


sortDegree() {
    if (this.clickDegree == 0) {
      this.students.sort(function (name1, name2) {
        if (name1.degree < name2.degree) {
          return -1;
        } else if (name1.degree > name2.degree) {
          return 1;
        } else {
          return 0;
        }
      });
      this.clickDegree = 1;
    }
    else {
      this.students.sort(function (name1, name2) {
        if (name1.degree > name2.degree) {
          return -1;
        } else if (name1.degree < name2.degree) {
          return 1;
        } else {
          return 0;
        }
      });
      this.clickDegree = 0;
    }
  }


inputSkillCheck(e, skill) {
    if (e.target.checked) {
      this.checkedSkill++;
      this.skillsChecked[this.skillsChecked.length] = skill;
      if (skill != "") {
        this.skillService.getFkbySkill(skill).subscribe(
          data => {
            for (let i = 0; i < data.length; i++) {
              this.skillFk.push(data[i]);
            }
            this.checkSkillDupes(this.checkedSkill);
          },
          error => console.log(error)
        )
      }
    }
    else {
      this.checkedSkill--;
      for (let i = 0; i < this.skillsChecked.length; i++) {
        if (this.skillsChecked[i] == skill) {
          this.skillsChecked.splice(i, 1);

        }
      }

      for (let i = 0; i < this.skillFk.length; i++) {
        if (this.skillFk[i].skill.toLowerCase() == skill.toLowerCase()) {
          this.skillFk.splice(i, 1);
          i--;
        }
      }
      this.checkSkillDupes(this.checkedSkill);
    }
  }


checkSkillDupes(checked) {
    this.nieuwelijstSkillsFk = [];
    if (checked > 1) {

      let number = 0;

      for (let i = 0; i < this.skillFk.length; i++) {
        let random = this.skillFk[i];
        for (let j = 0; j < this.skillFk.length; j++) {
          if (this.skillFk[j].student_fk == random.student_fk) {
            number++;
          }
          if (number == checked) {
            if (this.nieuwelijstSkillsFk.length == 0) {
              this.nieuwelijstSkillsFk.push(random);

            }
            for (let k = 0; j < this.nieuwelijstSkillsFk.length; k++) {
              if (this.nieuwelijstSkillsFk[k] == random.student_fk) {
                break;
              }
              else {
                this.nieuwelijstSkillsFk.push(random);
              }
            }
          }
          if (j == (this.skillFk.length - 1)) {
            number = 0;
          }
        }
      }
    } else {
      this.nieuwelijstSkillsFk = this.skillFk;
    }
  }


inputProfskillCheck(e, skill) {
    if (e.target.checked) {
      this.checkedProf++;
      this.profSkillsChecked[this.profSkillsChecked.length] = skill;
      if (skill != "") {
        this.professionalService.getFkbySkill(skill).subscribe(
          data => {
            for (let i = 0; i < data.length; i++) {
              this.profskillFk.push(data[i]);
            }
            this.checkProfDupes(this.checkedProf);
          },
          error => console.log(error)
        )
      }
    }
    else {
      this.checkedProf--;
      for (let i = 0; i < this.profSkillsChecked.length; i++) {
        if (this.profSkillsChecked[i] == skill) {
          this.profSkillsChecked.splice(i, 1);

        }
      }

      for (let i = 0; i < this.profskillFk.length; i++) {
        if (this.profskillFk[i].skill.toLowerCase() == skill.toLowerCase()) {
          this.profskillFk.splice(i, 1);
          i--;
        }
      }
      this.checkProfDupes(this.checkedProf);
    }
  }


checkProfDupes(checked) {
    this.nieuwelijstProfskillsFk = [];
    if (checked > 1) {

      let number = 0;

      for (let i = 0; i < this.profskillFk.length; i++) {
        let random = this.profskillFk[i];
        for (let j = 0; j < this.profskillFk.length; j++) {
          if (this.profskillFk[j].student_fk == random.student_fk) {
            number++;
          }
          if (number == checked) {
            if (this.nieuwelijstProfskillsFk.length == 0) {
              this.nieuwelijstProfskillsFk.push(random);

            }
            for (let k = 0; j < this.nieuwelijstProfskillsFk.length; k++) {
              if (this.nieuwelijstProfskillsFk[k] == random.student_fk) {
                break;
              }
              else {
                this.nieuwelijstProfskillsFk.push(random);
              }
            }
          }
          if (j == (this.profskillFk.length - 1)) {
            number = 0;
          }
        }
      }
    } else {
      this.nieuwelijstProfskillsFk = this.profskillFk;
    }
  }


inputLangugageCheck(e, type) {
    if (e.target.checked) {
      this.checkedLang++;
      this.languageChecked[this.languageChecked.length] = type;
      if (type != "") {
        this.languageService.getFkbyLang(type).subscribe(
          data => {
            for (let i = 0; i < data.length; i++) {
              this.languageFk.push(data[i]);
            }
            this.checkLangDupes(this.checkedLang);
          },
          error => console.log(error)
        )
      }
    }
    else {
      this.checkedLang--;
      for (let i = 0; i < this.languageChecked.length; i++) {
        if (this.languageChecked[i] == type) {
          this.languageChecked.splice(i, 1);

        }
      }

      for (let i = 0; i < this.languageFk.length; i++) {
        if (this.languageFk[i].type.toLowerCase() == type.toLowerCase()) {
          this.languageFk.splice(i, 1);
          i--;
        }
      }
      this.checkLangDupes(this.checkedLang);
    }
  }


checkLangDupes(checked) {
    this.nieuwelijstLangFk = [];
    if (checked > 1) {

      let number = 0;

      for (let i = 0; i < this.languageFk.length; i++) {
        let random = this.languageFk[i];
        for (let j = 0; j < this.languageFk.length; j++) {
          if (this.languageFk[j].student_fk == random.student_fk) {
            number++;
          }
          if (number == checked) {
            if (this.nieuwelijstLangFk.length == 0) {
              this.nieuwelijstLangFk.push(random);

            }
            for (let k = 0; j < this.nieuwelijstLangFk.length; k++) {
              if (this.nieuwelijstLangFk[k] == random.student_fk) {
                break;
              }
              else {
                this.nieuwelijstLangFk.push(random);
              }
            }
          }
          if (j == (this.languageFk.length - 1)) {
            number = 0;
          }
        }
      }
    } else {
      this.nieuwelijstLangFk = this.languageFk;
    }

  }


//This method gives all the students back with the checked conditions.
advancedSearch() {

    //ADVANCED SEARCH

    if (this.nieuwelijstLangFk.length > 0 && this.nieuwelijstSkillsFk.length == 0 && this.nieuwelijstProfskillsFk.length == 0) {
      this.students = [];
      for (let i = 0; i < this.nieuwelijstLangFk.length; i++) {
        this.studentService.getStudentByIdMysql(this.nieuwelijstLangFk[i].student_fk).subscribe(
          data => { this.students[i] = data[0] },
          error => console.log(error)
        )

      }
    }
    else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length == 0 && this.nieuwelijstProfskillsFk.length == 0) {
      this.students = [];
      for (let i = 0; i < this.nieuwelijstSkillsFk.length; i++) {
        this.studentService.getStudentByIdMysql(this.nieuwelijstSkillsFk[i].student_fk).subscribe(
          data => { this.students[i] = data[0] },
          error => console.log(error)
        )

      }
    }
    else if (this.nieuwelijstProfskillsFk.length > 0 && this.nieuwelijstLangFk.length == 0 && this.nieuwelijstSkillsFk.length == 0) {
      this.students = [];
      for (let i = 0; i < this.nieuwelijstProfskillsFk.length; i++) {
        this.studentService.getStudentByIdMysql(this.nieuwelijstProfskillsFk[i].student_fk).subscribe(
          data => { this.students[i] = data[0] },
          error => console.log(error)
        )

      }
    }
    else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length > 0 && this.nieuwelijstProfskillsFk.length == 0) {
      this.students = [];
      let k = 0;
      for (let i = 0; i < this.nieuwelijstSkillsFk.length; i++) {
        let double = this.nieuwelijstSkillsFk[i].student_fk;
        for (let j = 0; j < this.nieuwelijstLangFk.length; j++) {
          if (double == this.nieuwelijstLangFk[j].student_fk) {
            this.studentService.getStudentByIdMysql(double).subscribe(
              data => { this.students[k] = data[0], console.log(data), k++ },
              error => console.log(error)
            )
          }
        }
      }
    }

    else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length == 0 && this.nieuwelijstProfskillsFk.length > 0) {
      this.students = [];
      let k = 0;
      for (let i = 0; i < this.nieuwelijstSkillsFk.length; i++) {
        let double = this.nieuwelijstSkillsFk[i].student_fk;
        for (let j = 0; j < this.nieuwelijstProfskillsFk.length; j++) {
          if (double == this.nieuwelijstProfskillsFk[j].student_fk) {
            this.studentService.getStudentByIdMysql(double).subscribe(
              data => { this.students[k] = data[0], console.log(data), k++ },
              error => console.log(error)
            )
          }
        }
      }
    }
    else if (this.nieuwelijstSkillsFk.length == 0 && this.nieuwelijstLangFk.length > 0 && this.nieuwelijstProfskillsFk.length > 0) {
      this.students = [];
      let k = 0;
      for (let i = 0; i < this.nieuwelijstLangFk.length; i++) {
        let double = this.nieuwelijstLangFk[i].student_fk;
        for (let j = 0; j < this.nieuwelijstProfskillsFk.length; j++) {
          if (double == this.nieuwelijstProfskillsFk[j].student_fk) {
            this.studentService.getStudentByIdMysql(double).subscribe(
              data => { this.students[k] = data[0], console.log(data), k++ },
              error => console.log(error)
            )
          }
        }
      }
    }

    else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length > 0 && this.nieuwelijstProfskillsFk.length > 0) {
      this.students = [];
      let k = 0;
      for (let i = 0; i < this.nieuwelijstLangFk.length; i++) {
        let double = this.nieuwelijstLangFk[i].student_fk;
        for (let j = 0; j < this.nieuwelijstProfskillsFk.length; j++) {
          if (double == this.nieuwelijstProfskillsFk[j].student_fk) {
            for (let m = 0; m < this.nieuwelijstSkillsFk.length; m++) {
              if (double == this.nieuwelijstSkillsFk[m].student_fk) {
                this.studentService.getStudentByIdMysql(double).subscribe(
                  data => { this.students[k] = data[0], console.log(data), k++ },
                  error => console.log(error)
                )
              }
            }

          }
        }
      }
    }

    else { alert("no students found") }

  }


clear() {
    window.location.reload();
  }


//Download the cv in searchBox
downloadCv(student) {

    if (student.cvChecked == true) {
      this.cvsService.getCvsByFk(student.id).subscribe(
        data => { this.download(data[0].id) },
        error => console.log(error)
      )
      window.open(`/api/download/25`);
    } else {
      alert("This students hasn't yet uploaded a CV.")
    }
  }


download(id) {
    this.refresh.next()
    if (id) {

      //  window.open(`/api/download/${id}`);
    }
  }


deleteStudent(student) {
    this.userService.deleteWholeUser(student).subscribe(
      data => {
        const pos = this.students.map(elem => elem.id).indexOf(student.id);
        this.students.splice(pos, 1);
        this.toast.setMessage('item deleted successfully.', 'success');
      },
      error => console.error
    );
  }


innerjoin() {

    for (let id of this.ids) {
      this.http.get(`/api/innerjoin/${id.id}`).subscribe(
        data => { this.studentjes += data, console.log(data) },
        error => { console.log("gelukt") }
      )
    }
  }


class IndexPage extends React.Component {

  render() {
    return (
      <MainLayout title="Evgeny Mironenko | Software Engineer"
                  description="Personal website by Evgeny Mironenko Senior Software Engineer.
                  Java, Kotlin, Spring, React, TypeScript. Currently based in Tallinn, Estonia."
                  keywords="Evgeny, Mironenko, Evgeny Mironenko, Software Engineer,
                  Software Developer, Java, Kotlin, Typescript, React"
                  isRoot={true}>

          <Navbar/>

<Typist messages={["Evgeny Mironenko"]}/>

Software Engineer & Proud Geek

Currently based in Tallinn, Estonia

              <ContactData contacts={contacts} email="miron4dev@gmail.com"/>

Tech I like to work with

              <Badges skills={skills}/>

      </MainLayout>
    );
  }
}


render() {
    return (
      <MainLayout title="Evgeny Mironenko | Software Engineer"
                  description="Personal website by Evgeny Mironenko Senior Software Engineer.
                  Java, Kotlin, Spring, React, TypeScript. Currently based in Tallinn, Estonia."
                  keywords="Evgeny, Mironenko, Evgeny Mironenko, Software Engineer,
                  Software Developer, Java, Kotlin, Typescript, React"
                  isRoot={true}>

          <Navbar/>

<Typist messages={["Evgeny Mironenko"]}/>

Software Engineer & Proud Geek

Currently based in Tallinn, Estonia

              <ContactData contacts={contacts} email="miron4dev@gmail.com"/>

Tech I like to work with

              <Badges skills={skills}/>

      </MainLayout>
    );
  }


/** Removes definitions with empty def and combine glosses with same lang. */
export function cleanDefinitions(defs: Definition[]): Definition[] {
  const nonempty = defs.filter((d) => d.text.length);
  const langs = [...new Set(nonempty.map((d) => d.language))];
  return langs.map((language) =>
    newDefinition(
      nonempty
        .filter((d) => d.language === language)
        .map((d) => d.text)
        .join(sep),
      language
    )
  );
}


/** Removes glosses with empty def and combine glosses with same lang. */
export function cleanGlosses(glosses: Gloss[]): Gloss[] {
  const nonempty = glosses.filter((g) => g.def.length);
  const langs = [...new Set(nonempty.map((g) => g.language))];
  return langs.map((language) =>
    newGloss(
      nonempty
        .filter((g) => g.language === language)
        .map((g) => g.def)
        .join(sep),
      language
    )
  );
}


/**
 * For sorting flags alphabetically by their text,
 * where a flag with .active=false is alphabetically last.
 */
export function compareFlags(a: Flag, b: Flag): number {
  return a.active && b.active
    ? a.text.localeCompare(b.text)
    : a.active
    ? -1
    : b.active
    ? 1
    : 0;
}


/**
 * Returns the text of the first gloss of a sense.
 * In the case that the array of glosses is empty, returns an empty string.
 */
export function firstGlossText(sense: Sense): string {
  return sense.glosses[0]?.def ?? "";
}


/**
 * Given a word-array, return a string-array with any language code found in
 * a definition or gloss of any sense.
 */
export function getAnalysisLangsFromWords(words: Word[]): string[] {
  return reduceMultiType<Word, string[]>(words, [], wordReducer);
}


function reduceMultiType<A, B>(
  toReduce: A[],
  initial: B,
  reducer: (accumulator: B, currentItem: A) => B
): B {
  let accumulated = initial;
  toReduce.forEach((item) => (accumulated = reducer(accumulated, item)));
  return accumulated;
}


function wordReducer(accumulator: string[], word: Word): string[] {
  const newLangs = word.senses
    .flatMap((s) => [...s.definitions, ...s.glosses])
    .map((dg) => dg.language);
  return [...new Set([...accumulator, ...newLangs])];
}


(d) => d.text.length


(d) => d.language


(language) =>
    newDefinition(
      nonempty
        .filter((d) => d.language === language)
        .map((d) => d.text)
        .join(sep),
      language
    )


(d) => d.language === language


(d) => d.text


(g) => g.def.length


(g) => g.language


(language) =>
    newGloss(
      nonempty
        .filter((g) => g.language === language)
        .map((g) => g.def)
        .join(sep),
      language
    )


(g) => g.language === language


(g) => g.def


(item) => (accumulated = reducer(accumulated, item))


(s) => [...s.definitions, ...s.glosses]


(dg) => dg.language


export class Event extends Deletable {
        public getType(): number;
        public getValue<T>(key: number): T;
        public getComponent(): APL.Component;
        public resolve();
        public resolveWithArg(arg: number);
        public resolveWithRect(x: number, y: number, width: number, height: number): void;
        public addTerminateCallback(callback: () => void);
        public isPending(): boolean;
        public isTerminated(): boolean;
        public isResolved(): boolean;
    }


public getType(): number;


public getValue<T>(key: number): T;


public getComponent(): APL.Component;


public resolve();


public resolveWithArg(arg: number);


public resolveWithRect(x: number, y: number, width: number, height: number): void;


public addTerminateCallback(callback: () => void);


public isPending(): boolean;


public isTerminated(): boolean;


public isResolved(): boolean;


export default class GuildService {
  async getGuildById(id: string): Promise<ServerModel> {
    return await Server.findOne({ id }, {}, { upsert: true }) as ServerModel;
  }

  async findByGuildIdAndUpdate(id: string, details: UpdateQuery<ServerModel>) {
    return await Server.findOneAndUpdate({ id }, details, { new: true });
  }
}


async getGuildById(id: string): Promise<ServerModel> {
    return await Server.findOne({ id }, {}, { upsert: true }) as ServerModel;
  }


async findByGuildIdAndUpdate(id: string, details: UpdateQuery<ServerModel>) {
    return await Server.findOneAndUpdate({ id }, details, { new: true });
  }


(err, ast) => {
      if (err) {
        this.error = err;
        this.correct.emit(false);
      } else {
        this.error = '';
        this.correct.emit(true);
      }
      this.saveChanges();
    }


@Component({
  selector: 'app-editor',
  templateUrl: './editor.component.html',
  styleUrls: ['./editor.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class EditorComponent implements OnInit {
  @ViewChild('textAreaElement') textAreaElement: ElementRef;
  htmlFormat = '';
  error = '';
  showEditor = true;
  @Input() content: string;
  @Output() correct = new EventEmitter();
  @Output() editor = new EventEmitter();
  lastState;
  nextState;

  ngOnInit(): void {
    this.htmlFormat = this.content;
    this.lastState = this.content;
    this.nextState = this.content;
  }

  insertElement(el, classes) {
    this.lastState = this.htmlFormat;
    const a = this.htmlFormat;
    const b = '<' + el + ' class=' + classes.join(',') + '>';
    const b2 = '</' + el + '>';
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    const posEnd = this.textAreaElement.nativeElement.selectionEnd;
    if (posStart === posEnd) {
      this.htmlFormat = [a.slice(0, posStart), b, b2, a.slice(posStart)].join('');
    } else {
      this.htmlFormat = [a.slice(0, posStart), b, a.slice(posStart, posEnd), b2, a.slice(posEnd)].join('');
    }
    this.nextState = this.htmlFormat;
    this.saveChanges();
  }

  insertImage(classes) {
    const src = prompt('Give src');
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n' , a.slice(posStart)].join('');
    this.saveChanges();
  }

  insertLink(classes) {
    const src = prompt('Give src');
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n' +
    'Link' , a.slice(posStart)].join('');
    this.saveChanges();
  }

  insertVideo(classes) {
    const src = prompt('Give src');
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n
',
      '',
      '
', a.slice(posStart)].join('');
    this.saveChanges();
  }

  insertList(el, classes) {
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n<' + el + ' class=' + classes.join(',') + '>\n',
      '
Item 1
' , '\n</' + el + '>', a.slice(posStart)].join('');
    this.saveChanges();
  }

  insertColumns(count, classes) {
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;

    this.htmlFormat = [a.slice(0, posStart), '\n
\n',
      '

\n'.repeat(count) , '
', a.slice(posStart)].join('');
    this.saveChanges();
  }

  undo() {
    this.nextState = this.htmlFormat;
    this.htmlFormat = this.lastState;
    this.saveChanges();
  }

  redo() {
    this.lastState = this.htmlFormat;
    this.htmlFormat = this.nextState;
    this.saveChanges();
  }

  typeTextarea(event) {
    HtmlValidator(this.htmlFormat, (err, ast) => {
      if (err) {
        this.error = err;
        this.correct.emit(false);
      } else {
        this.error = '';
        this.correct.emit(true);
      }
      this.saveChanges();
    });
  }

  saveChanges() {
    this.editor.emit(this.htmlFormat);
  }

  youtube_parser(url) {
    const regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
    const match = url.match(regExp);
    return (match && match[7].length === 11) ? match[7] : false;
  }
}


ngOnInit(): void {
    this.htmlFormat = this.content;
    this.lastState = this.content;
    this.nextState = this.content;
  }


insertElement(el, classes) {
    this.lastState = this.htmlFormat;
    const a = this.htmlFormat;
    const b = '<' + el + ' class=' + classes.join(',') + '>';
    const b2 = '</' + el + '>';
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    const posEnd = this.textAreaElement.nativeElement.selectionEnd;
    if (posStart === posEnd) {
      this.htmlFormat = [a.slice(0, posStart), b, b2, a.slice(posStart)].join('');
    } else {
      this.htmlFormat = [a.slice(0, posStart), b, a.slice(posStart, posEnd), b2, a.slice(posEnd)].join('');
    }
    this.nextState = this.htmlFormat;
    this.saveChanges();
  }


insertImage(classes) {
    const src = prompt('Give src');
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n<img class=' + classes.join(',') + ' src=\'', src, '\' />' , a.slice(posStart)].join('');
    this.saveChanges();
  }


insertLink(classes) {
    const src = prompt('Give src');
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n' +
    'Link' , a.slice(posStart)].join('');
    this.saveChanges();
  }


insertVideo(classes) {
    const src = prompt('Give src');
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n
',
      '',
      '
', a.slice(posStart)].join('');
    this.saveChanges();
  }


insertList(el, classes) {
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;
    this.htmlFormat = [a.slice(0, posStart), '\n<' + el + ' class=' + classes.join(',') + '>\n',
      '
Item 1
' , '\n</' + el + '>', a.slice(posStart)].join('');
    this.saveChanges();
  }


insertColumns(count, classes) {
    const a = this.htmlFormat;
    const posStart = this.textAreaElement.nativeElement.selectionStart;

    this.htmlFormat = [a.slice(0, posStart), '\n
\n',
      '

\n'.repeat(count) , '
', a.slice(posStart)].join('');
    this.saveChanges();
  }


undo() {
    this.nextState = this.htmlFormat;
    this.htmlFormat = this.lastState;
    this.saveChanges();
  }


redo() {
    this.lastState = this.htmlFormat;
    this.htmlFormat = this.nextState;
    this.saveChanges();
  }


typeTextarea(event) {
    HtmlValidator(this.htmlFormat, (err, ast) => {
      if (err) {
        this.error = err;
        this.correct.emit(false);
      } else {
        this.error = '';
        this.correct.emit(true);
      }
      this.saveChanges();
    });
  }


saveChanges() {
    this.editor.emit(this.htmlFormat);
  }


youtube_parser(url) {
    const regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
    const match = url.match(regExp);
    return (match && match[7].length === 11) ? match[7] : false;
  }


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

  private time: string;

  constructor() { }

  setTime(startDate: number) {
    const result = Date.now() - startDate;
    const hours = Math.floor((result % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    const minutes = Math.floor((result % (1000 * 60 * 60)) / (1000 * 60));
    const seconds = Math.floor((result % (1000 * 60)) / 1000);
    this.time = `${hours}:${minutes}:${seconds}`;
  }

  getTime(): string {
    localStorage.setItem('time', this.time.toString());
    return this.time;
  }
}


setTime(startDate: number) {
    const result = Date.now() - startDate;
    const hours = Math.floor((result % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    const minutes = Math.floor((result % (1000 * 60 * 60)) / (1000 * 60));
    const seconds = Math.floor((result % (1000 * 60)) / 1000);
    this.time = `${hours}:${minutes}:${seconds}`;
  }


getTime(): string {
    localStorage.setItem('time', this.time.toString());
    return this.time;
  }


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

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

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

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


() => {
    TestBed.configureTestingModule({
      declarations: [ArticlesViewComponent]
    }).compileComponents();
  }


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


async ({ api, store }: Ports) => {
  try {
    const { status, body: user } = await api.users.me.get();
    store.commit("setUser", user);
    return status === 200;
  } catch (error) {
    return false;
  }
}


() => {
  let service: LocalStoreService;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(LocalStoreService);
  });

  it("should be created", () => {
    expect(service).toBeTruthy();
  });
}


() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(LocalStoreService);
  }


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


export declare class MzTextareaPrefixDirective implements OnInit {
    private elementRef;
    private renderer;
    constructor(elementRef: ElementRef, renderer: Renderer);
    ngOnInit(): void;
}


ngOnInit(): void;


/**
 * Negative Guard validates a property is not a negative number
 */
class NegativeGuard implements Guard {
  /**
   * @inheritDoc
   */
  public guard<T = unknown>(property: T, errorMessage?: string, error?: Instantiable<Error>): T {
    Guarder.guard(NumberGuard, property, errorMessage, error)

    const int = parseInt(Guarder.empty(property).toString())

    if (int < 0) {
      this.throwError(errorMessage ?? 'Property not allowed to be negative number', error)
    }

    return property
  }

  private throwError(message: string, error?: Instantiable<Error>): never {
    if (error) {
      throw new error(message)
    }

    throw new ArgumentError(message)
  }
}


/**
   * @inheritDoc
   */
public guard<T = unknown>(property: T, errorMessage?: string, error?: Instantiable<Error>): T {
    Guarder.guard(NumberGuard, property, errorMessage, error)

    const int = parseInt(Guarder.empty(property).toString())

    if (int < 0) {
      this.throwError(errorMessage ?? 'Property not allowed to be negative number', error)
    }

    return property
  }


private throwError(message: string, error?: Instantiable<Error>): never {
    if (error) {
      throw new error(message)
    }

    throw new ArgumentError(message)
  }


() => {
  let service: ProductService;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(ProductService);
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });
}


() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(ProductService);
  }


(e: MouseEvent) => {
    console.log(e);
    this.hello.emit({ message: 'Hello Stencil!' });
  }


@Component({
  tag: 'app-hello',
  shadow: true,
})
export class AppHello {
  @Event() hello: EventEmitter<{ message: string }>;

  connectedCallback() {
    console.log(this);
  }

  onClick = (e: MouseEvent) => {
    console.log(e);
    this.hello.emit({ message: 'Hello Stencil!' });
  }

  render() {
    return (

Hello Stencil!

        <button onClick={this.onClick}>HELLO</button>

    )
  }
}


connectedCallback() {
    console.log(this);
  }


render() {
    return (

Hello Stencil!

        <button onClick={this.onClick}>HELLO</button>

    )
  }


export function setUser(user: IUser) {
    return {
        type: 'SET_USER',
        payload: user
    };
}


@Component({
  selector: 'app-view-summary',
  templateUrl: './summary.component.html',
  styleUrls: ['./summary.component.scss'],
})
export class SummaryComponent extends AbstractViewComponent<SummaryView> {
  title: string;
  isLoading = false;

  currentAction: Action;

  constructor(
    private actionService: ActionService,
    private viewService: ViewService
  ) {
    super();
  }

  update() {
    const view = this.v;
    this.title = this.viewService.viewTitleAsText(view);
  }

  identifyItem(index: number, item: SummaryItem): string {
    return `${index}-${item.header}`;
  }

  onPortLoad(isLoading: boolean) {
    this.isLoading = isLoading;
  }

  setAction(action: Action) {
    this.currentAction = action;
  }

  onActionSubmit(formGroup: FormGroup) {
    if (formGroup && formGroup.value) {
      this.actionService.perform(formGroup.value);
      this.currentAction = undefined;
    }
  }

  onActionCancel() {
    this.currentAction = undefined;
  }

  shouldShowFooter(): boolean {
    if (this.v && this.v.config.actions) {
      if (!this.currentAction && this.v.config.actions.length > 0) {
        return true;
      }
    }

    return false;
  }
}


update() {
    const view = this.v;
    this.title = this.viewService.viewTitleAsText(view);
  }


identifyItem(index: number, item: SummaryItem): string {
    return `${index}-${item.header}`;
  }


onPortLoad(isLoading: boolean) {
    this.isLoading = isLoading;
  }


setAction(action: Action) {
    this.currentAction = action;
  }


onActionSubmit(formGroup: FormGroup) {
    if (formGroup && formGroup.value) {
      this.actionService.perform(formGroup.value);
      this.currentAction = undefined;
    }
  }


onActionCancel() {
    this.currentAction = undefined;
  }


shouldShowFooter(): boolean {
    if (this.v && this.v.config.actions) {
      if (!this.currentAction && this.v.config.actions.length > 0) {
        return true;
      }
    }

    return false;
  }


/**
 * Creates a function that invokes func, with the this binding and arguments of the created function, while it's called less than n times.
 * Subsequent calls to the created function return the result of the last func invocation.
 * @param {number} n The number of calls at whichc func is no longer invoked.
 * @example
 *
 * let calls = 0;
 *
 * class MyClass {
 *   @Before(3)
 *   fn() {
 *     calls++;
 *   }
 * }
 *
 * const myClass = new MyClass();
 *
 * myClass.fn();
 * myClass.fn();
 * myClass.fn();
 * myClass.fn();
 *
 * calls === 2; // => true
 */
export function Before(n: number): LodashDecorator {
  return decorator(n);
}


() => {
    it('enforces the presense of a `focusElement`', async () => {
        iliadCustomElementsDefine('focusable-test', class extends Focusable {});
        try {
            const el = await fixture<Focusable>(
                html`
                    <focusable-test></focusable-test>
                `
            );
            await elementUpdated(el);
            const focusEl = el.focusElement;
            expect(focusEl).to.exist;
        } catch (error) {
            expect(() => {
                throw error;
            }).to.throw('Must implement focusElement getter!');
        }
    });
}


async () => {
        iliadCustomElementsDefine('focusable-test', class extends Focusable {});
        try {
            const el = await fixture<Focusable>(
                html`
                    <focusable-test></focusable-test>
                `
            );
            await elementUpdated(el);
            const focusEl = el.focusElement;
            expect(focusEl).to.exist;
        } catch (error) {
            expect(() => {
                throw error;
            }).to.throw('Must implement focusElement getter!');
        }
    }


() => {
                throw error;
            }


() =>
        import(
          './components/status-card/status-card' /* webpackChunkName: "object-service-status-card" */
        ).then((m) => m.default)


(m) => m.default


() =>
        import(
          './components/details-card/details-card' /* webpackChunkName: "object-service-details-card" */
        ).then((m) => m.DetailsCard)


(m) => m.DetailsCard


() =>
        import(
          './components/buckets-card/buckets-card' /* webpackChunkName: "object-service-buckets-card" */
        ).then((m) => m.BucketsCard)


(m) => m.BucketsCard


() =>
        import(
          './components/resource-providers-card/resource-providers-card' /* webpackChunkName: "object-service-resource-providers-card" */
        ).then((m) => m.ResourceProvidersCard)


(m) => m.ResourceProvidersCard


() =>
        import(
          './components/data-consumption-card/data-consumption-card' /* webpackChunkName: "object-service-data-consumption-card" */
        ).then((m) => m.default)


() =>
        import(
          './components/activity-card/activity-card' /* webpackChunkName: "object-service-activity-card" */
        ).then((m) => m.default)


() =>
        import(
          './components/object-data-reduction-card/object-data-reduction-card' /* webpackChunkName: "object-service-data-reduction-card" */
        ).then((m) => m.default)


() =>
        import(
          './components/object-bucket-page/object-bucket' /* webpackChunkName: "object-bucket-page" */
        ).then((m) => m.ObjectBucketsPage)


(m) => m.ObjectBucketsPage


() =>
        import(
          './components/object-bucket-page/object-bucket' /* webpackChunkName: "object-bucket-page" */
        ).then((m) => m.ObjectBucketDetailsPage)


(m) => m.ObjectBucketDetailsPage


() =>
        import(
          './components/object-bucket-claim-page/object-bucket-claim' /* webpackChunkName: "object-bucket-claim-page" */
        ).then((m) => m.ObjectBucketClaimsPage)


(m) => m.ObjectBucketClaimsPage


() =>
        import(
          './components/object-bucket-claim-page/object-bucket-claim' /* webpackChunkName: "object-bucket-claim-page" */
        ).then((m) => m.ObjectBucketClaimsDetailsPage)


(m) => m.ObjectBucketClaimsDetailsPage


() =>
        import(
          './components/object-bucket-claim-page/create-obc' /* webpackChunkName: "create-obc" */
        ).then((m) => m.CreateOBCPage)


(m) => m.CreateOBCPage


type ConsumedExtensions =
  | ModelFeatureFlag
  | ModelDefinition
  | DashboardsTab
  | DashboardsCard
  | ResourceNSNavItem
  | ResourceClusterNavItem
  | ResourceListPage
  | ResourceDetailsPage
  | YAMLTemplate
  | RoutePage;


async () => {
    // When loading Lish we avoid all this extra data loading
    if (window.location?.pathname?.match(/linodes\/[0-9]+\/lish/)) {
      return;
    }

    // Initial Requests: Things we need immediately (before rendering the app)
    const dataFetchingPromises: Promise<any>[] = [
      // Fetch user's account information
      queryClient.prefetchQuery({
        queryFn: getAccountInfo,
        queryKey: accountQueryKey,
      }),

      // Username and whether a user is restricted
      this.props.requestProfile(),

      // Is a user managed
      queryClient.prefetchQuery({
        queryKey: 'account-settings',
        queryFn: getAccountSettings,
      }),

      // Is this a large account? (should we use API or Redux-based search/pagination)
      this.props.checkAccountSize(),
    ];

    // Start events polling
    startEventsInterval();

    try {
      await Promise.all(dataFetchingPromises);
    } catch {
      /** We choose to do nothing, relying on the Redux error state. */
    } finally {
      this.props.markAppAsDoneLoading();
      this.makeSecondaryRequests();
    }
  }


async () => {
    try {
      await Promise.all([
        this.props.requestTypes(),
        this.props.requestNotifications(),
      ]);
    } catch {
      /** We choose to do nothing, relying on the Redux error state. */
    }
  }


() => {
    const { linodes, types } = this.props;

    // The types we already know about (from /types and /types-legacy).
    const knownTypeIds = types.map((thisType) => thisType.id);

    // The types of each Linode on the account.
    const linodeTypeIds = uniqBy((thisLinode) => thisLinode.type, linodes).map(
      (thisLinode) => thisLinode.type
    );

    // The difference between these two, i.e. the types we don't know about.
    const missingTypeIds = difference(linodeTypeIds, knownTypeIds);

    // For each type we don't know about, request it.
    missingTypeIds.forEach((thisMissingTypeId) => {
      if (thisMissingTypeId !== null) {
        this.props.requestLinodeType({
          typeId: thisMissingTypeId,
          isShadowPlan: true,
        });
      }
    });
  }


(thisType) => thisType.id


(thisLinode) => thisLinode.type


(thisMissingTypeId) => {
      if (thisMissingTypeId !== null) {
        this.props.requestLinodeType({
          typeId: thisMissingTypeId,
          isShadowPlan: true,
        });
      }
    }


(state) => ({
  isAuthenticated: Boolean(state.authentication.token),
  linodesLoading: state.__resources.linodes.loading,
  linodesLastUpdated: state.__resources.linodes.lastUpdated,
  linodes: Object.values(state.__resources.linodes.itemsById),
  pendingUpload: state.pendingUpload,
  types: state.__resources.types.entities,
  typesLastUpdated: state.__resources.types.lastUpdated,
})


(
  dispatch: ThunkDispatch<ApplicationState, undefined, Action<any>>
) => ({
  initSession: () => dispatch(handleInitTokens()),
  checkAccountSize: () => dispatch(checkAccountSize()),
  requestLinodes: () => dispatch(requestLinodes({})),
  requestNotifications: () => dispatch(requestNotifications()),
  requestTypes: () => dispatch(requestTypes()),
  requestRegions: () => dispatch(requestRegions()),
  requestProfile: () => dispatch(requestProfile()),
  markAppAsDoneLoading: () => dispatch(handleLoadingDone()),
  requestLinodeType: (options) => dispatch(requestLinodeType(options)),
})


() => dispatch(handleInitTokens())


() => dispatch(checkAccountSize())


() => dispatch(requestLinodes({}))


() => dispatch(requestNotifications())


() => dispatch(requestTypes())


() => dispatch(requestRegions())


() => dispatch(requestProfile())


() => dispatch(handleLoadingDone())


(options) => dispatch(requestLinodeType(options))


export class AuthenticationWrapper extends React.Component<CombinedProps> {
  state = {
    showChildren: false,
    hasEnsuredAllTypes: false,
  };

  static defaultProps = {
    isAuthenticated: false,
  };

  /**
   * We make a series of requests for data on app load. The flow is:
   * 1. App begins load; users see splash screen
   * 2. Initial requests (in makeInitialRequests) are made (account, profile, etc.)
   * 3. Initial requests complete; app is marked as done loading
   * 4. As splash screen goes away, secondary requests (in makeSecondaryRequests -- Linodes, types, regions)
   * are kicked off
   */
  makeInitialRequests = async () => {
    // When loading Lish we avoid all this extra data loading
    if (window.location?.pathname?.match(/linodes\/[0-9]+\/lish/)) {
      return;
    }

    // Initial Requests: Things we need immediately (before rendering the app)
    const dataFetchingPromises: Promise<any>[] = [
      // Fetch user's account information
      queryClient.prefetchQuery({
        queryFn: getAccountInfo,
        queryKey: accountQueryKey,
      }),

      // Username and whether a user is restricted
      this.props.requestProfile(),

      // Is a user managed
      queryClient.prefetchQuery({
        queryKey: 'account-settings',
        queryFn: getAccountSettings,
      }),

      // Is this a large account? (should we use API or Redux-based search/pagination)
      this.props.checkAccountSize(),
    ];

    // Start events polling
    startEventsInterval();

    try {
      await Promise.all(dataFetchingPromises);
    } catch {
      /** We choose to do nothing, relying on the Redux error state. */
    } finally {
      this.props.markAppAsDoneLoading();
      this.makeSecondaryRequests();
    }
  };

  /** Secondary Requests (non-blocking)
   * Make these once the user is past the
   * splash screen, since they aren't needed
   * for navigation, basic display, etc.
   */
  makeSecondaryRequests = async () => {
    try {
      await Promise.all([
        this.props.requestTypes(),
        this.props.requestNotifications(),
      ]);
    } catch {
      /** We choose to do nothing, relying on the Redux error state. */
    }
  };

  // Some special types aren't returned from /types or /types-legacy. They are
  // only available by hitting /types/:id directly. If there are Linodes with
  // these special types, we have to request each one.
  ensureAllTypes = () => {
    const { linodes, types } = this.props;

    // The types we already know about (from /types and /types-legacy).
    const knownTypeIds = types.map((thisType) => thisType.id);

    // The types of each Linode on the account.
    const linodeTypeIds = uniqBy((thisLinode) => thisLinode.type, linodes).map(
      (thisLinode) => thisLinode.type
    );

    // The difference between these two, i.e. the types we don't know about.
    const missingTypeIds = difference(linodeTypeIds, knownTypeIds);

    // For each type we don't know about, request it.
    missingTypeIds.forEach((thisMissingTypeId) => {
      if (thisMissingTypeId !== null) {
        this.props.requestLinodeType({
          typeId: thisMissingTypeId,
          isShadowPlan: true,
        });
      }
    });
  };

  componentDidMount() {
    const { initSession } = this.props;
    /**
     * set redux state to what's in local storage
     * or expire the tokens if the expiry time is in the past
     *
     * if nothing exists in local storage, we get shot off to login
     */
    initSession();

    /**
     * this is the case where we've just come back from login and need
     * to show the children onMount
     */
    if (this.props.isAuthenticated) {
      this.setState({ showChildren: true });

      this.makeInitialRequests();
    }
  }

  /**
   * handles for the case where we've refreshed the page
   * and redux has now been synced with what is in local storage
   */
  componentDidUpdate(prevProps: CombinedProps) {
    /** if we were previously not authenticated and now we are */
    if (
      !prevProps.isAuthenticated &&
      this.props.isAuthenticated &&
      !this.state.showChildren
    ) {
      this.makeInitialRequests();

      return this.setState({ showChildren: true });
    }

    /** basically handles for the case where our token is expired or we got a 401 error */
    if (
      prevProps.isAuthenticated &&
      !this.props.isAuthenticated &&
      // Do not redirect to Login if there is a pending image upload.
      !this.props.pendingUpload
    ) {
      redirectToLogin(location.pathname, location.search);
    }

    if (
      !this.state.hasEnsuredAllTypes &&
      this.props.typesLastUpdated > 0 &&
      this.props.linodesLastUpdated > 0
    ) {
      this.setState({ hasEnsuredAllTypes: true });
      this.ensureAllTypes();
    }
  }

  render() {
    const { children } = this.props;
    const { showChildren } = this.state;
    // eslint-disable-next-line
    return <React.Fragment>{showChildren ? children : null}</React.Fragment>;
  }
}


interface StateProps {
  isAuthenticated: boolean;
  linodesLoading: boolean;
  linodesLastUpdated: number;
  linodes: Linode[];
  pendingUpload: PendingUploadState;
  types: LinodeType[];
  typesLastUpdated: number;
}


interface DispatchProps {
  initSession: () => void;
  checkAccountSize: () => Promise<null>;
  requestLinodes: () => Promise<GetAllData<Linode>>;
  requestNotifications: () => Promise<GetAllData<Notification>>;
  requestTypes: () => Promise<LinodeType[]>;
  requestRegions: () => Promise<Region[]>;
  requestProfile: () => Promise<Profile>;
  markAppAsDoneLoading: () => void;
  requestLinodeType: (params: GetLinodeTypeParams) => void;
}


type CombinedProps = DispatchProps & StateProps;


componentDidMount() {
    const { initSession } = this.props;
    /**
     * set redux state to what's in local storage
     * or expire the tokens if the expiry time is in the past
     *
     * if nothing exists in local storage, we get shot off to login
     */
    initSession();

    /**
     * this is the case where we've just come back from login and need
     * to show the children onMount
     */
    if (this.props.isAuthenticated) {
      this.setState({ showChildren: true });

      this.makeInitialRequests();
    }
  }


/**
   * handles for the case where we've refreshed the page
   * and redux has now been synced with what is in local storage
   */
componentDidUpdate(prevProps: CombinedProps) {
    /** if we were previously not authenticated and now we are */
    if (
      !prevProps.isAuthenticated &&
      this.props.isAuthenticated &&
      !this.state.showChildren
    ) {
      this.makeInitialRequests();

      return this.setState({ showChildren: true });
    }

    /** basically handles for the case where our token is expired or we got a 401 error */
    if (
      prevProps.isAuthenticated &&
      !this.props.isAuthenticated &&
      // Do not redirect to Login if there is a pending image upload.
      !this.props.pendingUpload
    ) {
      redirectToLogin(location.pathname, location.search);
    }

    if (
      !this.state.hasEnsuredAllTypes &&
      this.props.typesLastUpdated > 0 &&
      this.props.linodesLastUpdated > 0
    ) {
      this.setState({ hasEnsuredAllTypes: true });
      this.ensureAllTypes();
    }
  }


render() {
    const { children } = this.props;
    const { showChildren } = this.state;
    // eslint-disable-next-line
    return <React.Fragment>{showChildren ? children : null}</React.Fragment>;
  }


function View_Checkbox_1(_l:any):i0.ɵViewDefinition {
  return i0.ɵvid(0,[(_l()(),i0.ɵeld(0,(null as any),(null as any),3,'label',[['class',
      'ui-chkbox-label']],[[1,'for',0]],[[(null as any),'click']],(_v,en,$event) => {
    var ad:boolean = true;
    var _co:any = _v.component;
    if (('click' === en)) {
      const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov((<any>_v.parent),7),true)) !== false);
      ad = (pd_0 && ad);
    }
    return ad;
  },(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass,[i0.IterableDiffers,
      i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{klass:[0,'klass'],ngClass:[1,
      'ngClass']},(null as any)),i0.ɵpod({'ui-label-active':0,'ui-label-disabled':1,
      'ui-label-focus':2}),(_l()(),i0.ɵted((null as any),['','']))],(_ck,_v) => {
    var _co:any = _v.component;
    const currVal_1:any = 'ui-chkbox-label';
    const currVal_2:any = _ck(_v,2,0,_co.checked,_co.disabled,_co.focused);
    _ck(_v,1,0,currVal_1,currVal_2);
  },(_ck,_v) => {
    var _co:any = _v.component;
    const currVal_0:any = _co.inputId;
    _ck(_v,0,0,currVal_0);
    const currVal_3:any = _co.label;
    _ck(_v,3,0,currVal_3);
  });
}


export function View_Checkbox_0(_l:any):i0.ɵViewDefinition {
  return i0.ɵvid(0,[(_l()(),i0.ɵted((null as any),['\n        '])),(_l()(),i0.ɵeld(0,
      (null as any),(null as any),19,'div',([] as any[]),(null as any),(null as any),
      (null as any),(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass,
      [i0.IterableDiffers,i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{klass:[0,
          'klass'],ngClass:[1,'ngClass']},(null as any)),i0.ɵdid(278528,(null as any),
      0,i2.NgStyle,[i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{ngStyle:[0,'ngStyle']},
      (null as any)),(_l()(),i0.ɵted((null as any),['\n            '])),(_l()(),i0.ɵeld(0,
      (null as any),(null as any),5,'div',[['class','ui-helper-hidden-accessible']],
      (null as any),(null as any),(null as any),(null as any),(null as any))),(_l()(),
      i0.ɵted((null as any),['\n                '])),(_l()(),i0.ɵeld(0,[['cb',1]],
      (null as any),2,'input',[['type','checkbox']],[[1,'id',0],[8,'name',0],[8,'value',
          0],[8,'checked',0],[8,'disabled',0],[1,'tabindex',0]],[[(null as any),'focus'],
          [(null as any),'blur'],[(null as any),'change']],(_v,en,$event) => {
        var ad:boolean = true;
        var _co:i1.Checkbox = _v.component;
        if (('focus' === en)) {
          const pd_0:any = ((<any>_co.onFocus($event)) !== false);
          ad = (pd_0 && ad);
        }
        if (('blur' === en)) {
          const pd_1:any = ((<any>_co.onBlur($event)) !== false);
          ad = (pd_1 && ad);
        }
        if (('change' === en)) {
          const pd_2:any = ((<any>_co.handleChange($event)) !== false);
          ad = (pd_2 && ad);
        }
        return ad;
      },(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass,[i0.IterableDiffers,
      i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{ngClass:[0,'ngClass']},(null as any)),
      i0.ɵpod({'ui-state-focus':0}),(_l()(),i0.ɵted((null as any),['\n            '])),
      (_l()(),i0.ɵted((null as any),['\n            '])),(_l()(),i0.ɵeld(0,(null as any),
          (null as any),7,'div',[['class','ui-chkbox-box ui-widget ui-corner-all ui-state-default']],
          (null as any),[[(null as any),'click']],(_v,en,$event) => {
            var ad:boolean = true;
            var _co:i1.Checkbox = _v.component;
            if (('click' === en)) {
              const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov(_v,7),true)) !== false);
              ad = (pd_0 && ad);
            }
            return ad;
          },(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass,
          [i0.IterableDiffers,i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{klass:[0,
              'klass'],ngClass:[1,'ngClass']},(null as any)),i0.ɵpod({'ui-state-active':0,
          'ui-state-disabled':1,'ui-state-focus':2}),(_l()(),i0.ɵted((null as any),
          ['\n                '])),(_l()(),i0.ɵeld(0,(null as any),(null as any),2,
          'span',[['class','ui-chkbox-icon ui-clickable']],(null as any),(null as any),
          (null as any),(null as any),(null as any))),i0.ɵdid(278528,(null as any),
          0,i2.NgClass,[i0.IterableDiffers,i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],
          {klass:[0,'klass'],ngClass:[1,'ngClass']},(null as any)),i0.ɵpod({'fa fa-check':0}),
      (_l()(),i0.ɵted((null as any),['\n            '])),(_l()(),i0.ɵted((null as any),
          ['\n        '])),(_l()(),i0.ɵted((null as any),['\n        '])),(_l()(),
          i0.ɵand(16777216,(null as any),(null as any),1,(null as any),View_Checkbox_1)),
      i0.ɵdid(16384,(null as any),0,i2.NgIf,[i0.ViewContainerRef,i0.TemplateRef],{ngIf:[0,
          'ngIf']},(null as any)),(_l()(),i0.ɵted((null as any),['\n    ']))],(_ck,
      _v) => {
    var _co:i1.Checkbox = _v.component;
    const currVal_0:any = _co.styleClass;
    const currVal_1:any = 'ui-chkbox ui-widget';
    _ck(_v,2,0,currVal_0,currVal_1);
    const currVal_2:any = _co.style;
    _ck(_v,3,0,currVal_2);
    const currVal_9:any = _ck(_v,9,0,_co.focused);
    _ck(_v,8,0,currVal_9);
    const currVal_10:any = 'ui-chkbox-box ui-widget ui-corner-all ui-state-default';
    const currVal_11:any = _ck(_v,14,0,_co.checked,_co.disabled,_co.focused);
    _ck(_v,13,0,currVal_10,currVal_11);
    const currVal_12:any = 'ui-chkbox-icon ui-clickable';
    const currVal_13:any = _ck(_v,18,0,_co.checked);
    _ck(_v,17,0,currVal_12,currVal_13);
    const currVal_14:any = _co.label;
    _ck(_v,23,0,currVal_14);
  },(_ck,_v) => {
    var _co:i1.Checkbox = _v.component;
    const currVal_3:any = _co.inputId;
    const currVal_4:any = _co.name;
    const currVal_5:any = _co.value;
    const currVal_6:any = _co.checked;
    const currVal_7:any = _co.disabled;
    const currVal_8:any = _co.tabindex;
    _ck(_v,7,0,currVal_3,currVal_4,currVal_5,currVal_6,currVal_7,currVal_8);
  });
}


export function View_Checkbox_Host_0(_l:any):i0.ɵViewDefinition {
  return i0.ɵvid(0,[(_l()(),i0.ɵeld(0,(null as any),(null as any),2,'p-checkbox',([] as any[]),
      (null as any),(null as any),(null as any),View_Checkbox_0,RenderType_Checkbox)),
      i0.ɵprd(5120,(null as any),i3.NG_VALUE_ACCESSOR,(p0_0:any) => {
        return [p0_0];
      },[i1.Checkbox]),i0.ɵdid(49152,(null as any),0,i1.Checkbox,[i0.ChangeDetectorRef],
          (null as any),(null as any))],(null as any),(null as any));
}


(_l:any) => {
      return i0.ɵmod([i0.ɵmpd(512,i0.ComponentFactoryResolver,i0.ɵCodegenComponentFactoryResolver,
          [[8,([] as any[])],[3,i0.ComponentFactoryResolver],i0.NgModuleRef]),i0.ɵmpd(4608,
          i2.NgLocalization,i2.NgLocaleLocalization,[i0.LOCALE_ID]),i0.ɵmpd(512,i2.CommonModule,
          i2.CommonModule,([] as any[])),i0.ɵmpd(512,i1.CheckboxModule,i1.CheckboxModule,
          ([] as any[]))]);
    }


(_v,en,$event) => {
    var ad:boolean = true;
    var _co:any = _v.component;
    if (('click' === en)) {
      const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov((<any>_v.parent),7),true)) !== false);
      ad = (pd_0 && ad);
    }
    return ad;
  }


(_ck,_v) => {
    var _co:any = _v.component;
    const currVal_1:any = 'ui-chkbox-label';
    const currVal_2:any = _ck(_v,2,0,_co.checked,_co.disabled,_co.focused);
    _ck(_v,1,0,currVal_1,currVal_2);
  }


(_ck,_v) => {
    var _co:any = _v.component;
    const currVal_0:any = _co.inputId;
    _ck(_v,0,0,currVal_0);
    const currVal_3:any = _co.label;
    _ck(_v,3,0,currVal_3);
  }