<commit_before>/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

import { ComponentMeta, ComponentParams } from 'core/component';
export const PARENT = {};

/**
 * Inherits parameters to the specified meta object from an other object
 * and returns a new component options
 *
 * @param meta
 * @param parentMeta
 */
export default function inheritMeta(
	meta: ComponentMeta,
	parentMeta: ComponentMeta
): ComponentParams {
	let
		p = meta.params;

	const {
		params,
		props,
		fields,
		systemFields,
		mods,
		computed,
		accessors,
		methods
	} = parentMeta;

	let
		provide,
		inject;

	///////////////////////
	// Provider inheritance
	///////////////////////

	// tslint:disable-next-line
	if (Object.isObject(<any>p.provide) && Object.isObject(<any>params.provide)) {
		provide = {...params.provide, ...p.provide};

	} else {
		provide = p.provide || params.provide;
	}

	/////////////////////
	// Inject inheritance
	/////////////////////

	const
		pIIsObj = Object.isObject(<any>params.inject),
		pIIsArr = !pIIsObj && Object.isArray(<any>params.inject),
		cIIsObj = Object.isObject(<any>p.inject),
		cIIsArr = !cIIsObj && Object.isArray(<any>p.inject);

	if (pIIsArr && cIIsArr) {
		inject = (<string[]>p.inject).union(<string[]>p.inject);

	} else if (pIIsObj && cIIsObj) {
		inject = {};

		for (let o = <Object>params.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			inject[key] = Object.isObject(el) ? {...el} : {from: el};
		}

		for (let o = <Object>p.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			// tslint:disable-next-line
			inject[key] = Object.assign(inject[key] || {}, Object.isObject(el) ? el : {from: el});
		}

	} else if (pIIsArr && cIIsObj) {
		inject = {};

		for (let o = <any[]>params.inject, i = 0; i < o.length; i++) {
			const key = o[i];
			inject[key] = {[key]: {from: key}};
		}

		for (let o = <Object>p.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			// tslint:disable-next-line
			inject[key] = Object.assign(inject[key] || {}, Object.isObject(el) ? el : {from: el});
		}

	} else if (pIIsObj && cIIsArr) {
		inject = {};

		for (let o = <Object>params.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			inject[key] = Object.isObject(el) ? {...el} : {from: el};
		}

		for (let o = <any[]>p.inject, i = 0; i < o.length; i++) {
			const key = o[i];

			// tslint:disable-next-line
			inject[key] = Object.assign(inject[key] || {}, {from: key});
		}

	} else  {
		inject = p.inject || params.inject;
	}

	/////////////////////////
	// Functional inheritance
	/////////////////////////

	let
		functional;

	// tslint:disable-next-line
	if (Object.isObject(<any>p.functional) && Object.isObject(<any>params.functional)) {
		functional = {...<Object>params.functional, ...<Object>p.functional};

	} else {
		functional = p.functional != null ? p.functional : params.functional;
	}

	///////////////////////////////////
	// Component parameters inheritance
	///////////////////////////////////

	p = meta.params = {
		...params,
		...p,
		mixins: {...params.mixins, ...p.mixins},<commit_msg>:art:<commit_after>/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

import { ComponentMeta, ComponentParams } from 'core/component';
export const PARENT = {};

/**
 * Inherits parameters to the specified meta object from an other object
 * and returns a new component options
 *
 * @param meta
 * @param parentMeta
 */
export default function inheritMeta(
	meta: ComponentMeta,
	parentMeta: ComponentMeta
): ComponentParams {
	let
		p = meta.params;

	const {
		params,
		props,
		fields,
		systemFields,
		mods,
		computed,
		accessors,
		methods
	} = parentMeta;

	let
		provide,
		inject;

	///////////////////////
	// Provider inheritance
	///////////////////////

	// tslint:disable-next-line
	if (Object.isObject(<any>p.provide) && Object.isObject(<any>params.provide)) {
		provide = {...params.provide, ...p.provide};

	} else {
		provide = p.provide || params.provide;
	}

	/////////////////////
	// Inject inheritance
	/////////////////////

	const
		pIIsObj = Object.isObject(<any>params.inject),
		pIIsArr = !pIIsObj && Object.isArray(<any>params.inject),
		cIIsObj = Object.isObject(<any>p.inject),
		cIIsArr = !cIIsObj && Object.isArray(<any>p.inject);

	if (pIIsArr && cIIsArr) {
		inject = (<string[]>p.inject).union(<string[]>p.inject);

	} else if (pIIsObj && cIIsObj) {
		inject = {};

		for (let o = <object>params.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			inject[key] = Object.isObject(el) ? {...el} : {from: el};
		}

		for (let o = <object>p.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			// tslint:disable-next-line
			inject[key] = Object.assign(inject[key] || {}, Object.isObject(el) ? el : {from: el});
		}

	} else if (pIIsArr && cIIsObj) {
		inject = {};

		for (let o = <any[]>params.inject, i = 0; i < o.length; i++) {
			const key = o[i];
			inject[key] = {[key]: {from: key}};
		}

		for (let o = <object>p.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			// tslint:disable-next-line
			inject[key] = Object.assign(inject[key] || {}, Object.isObject(el) ? el : {from: el});
		}

	} else if (pIIsObj && cIIsArr) {
		inject = {};

		for (let o = <object>params.inject, keys = Object.keys(o), i = 0; i < keys.length; i++) {
			const
				key = keys[i],
				el = o[key];

			inject[key] = Object.isObject(el) ? {...el} : {from: el};
		}

		for (let o = <any[]>p.inject, i = 0; i < o.length; i++) {
			const key = o[i];

			// tslint:disable-next-line
			inject[key] = Object.assign(inject[key] || {}, {from: key});
		}

	} else  {
		inject = p.inject || params.inject;
	}

	/////////////////////////
	// Functional inheritance
	/////////////////////////

	let
		functional;

	// tslint:disable-next-line
	if (Object.isObject(<any>p.functional) && Object.isObject(<any>params.functional)) {
		functional = {...<object>params.functional, ...<object>p.functional};

	} else {
		functional = p.functional != null ? p.functional : params.functional;
	}

	///////////////////////////////////
	// Component parameters inheritance
	///////////////////////////////////

	p = meta.params = {
		...params,
		...p,
		mixins: {...params.mixins, ...p.mixins},
{'fraction_non_alphanumeric': 0.23447664104080426, 'fraction_numerical': 0.0026611472501478417, 'mean_word_length': 2.40463009562154, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 39, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7633700', 'n_tokens_mistral': 2682, 'n_tokens_neox': 2355, 'n_words': 525}