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

import iBlock from 'super/i-block/i-block';
import Cache from 'super/i-block/modules/cache';
import Block from 'super/i-block/modules/block';
import { ModVal, ModsTable, ModsNTable } from 'super/i-block/modules/mods';

export type Classes = Dictionary<
	string |
	Array<string | true> |
	true
>;

export type ClassesCacheNms =
	'base' |
	'blocks' |
	'els';

export type ClassesCacheValue =
	ReadonlyArray<string> |
	Readonly<Dictionary<string>>;

export const
	modsCache = Object.createDict<ModsNTable>();

export const classesCache = new Cache<ClassesCacheNms, ClassesCacheValue>([
	'base',
	'blocks',
	'els'
]);

export default class Provide {
	/**
	 * Component name
	 */
	get componentName(): string {
		return this.component.componentName;
	}

	/**
	 * Component instance
	 */
	protected readonly component: iBlock;

	/**
	 * @param component - component instance
	 */
	constructor(component: iBlock) {
		this.component = component;
	}

	/**
	 * Returns a full name of the specified component block
	 *
	 * @param [componentName]
	 * @param [modName]
	 * @param [modValue]
	 */
	fullBlockName(componentName: string = this.componentName, modName?: string, modValue?: unknown): string {
		return Block.prototype.getFullBlockName.call({name: componentName}, modName, modValue);
	}

	/**
	 * Returns a full name of the specified element
	 *
	 * @param componentName
	 * @param elName
	 * @param [modName]
	 * @param [modValue]
	 */
	fullElName(componentName: string, elName: string, modName?: string, modValue?: unknown): string;

	/**
	 * @param elName
	 * @param [modName]
	 * @param [modValue]
	 */
	fullElName(elName: string, modName?: string, modValue?: unknown): string;
	fullElName(componentName: string, elName: string, modName?: string, modValue?: unknown): string {
		if (!{2: true, 4: true}[arguments.length]) {
			modValue = modName;
			modName = elName;
			elName = componentName;<commit_msg>Improved .fullBlockName interface<commit_after>/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

import iBlock from 'super/i-block/i-block';
import Cache from 'super/i-block/modules/cache';
import Block from 'super/i-block/modules/block';
import { ModVal, ModsTable, ModsNTable } from 'super/i-block/modules/mods';

export type Classes = Dictionary<
	string |
	Array<string | true> |
	true
>;

export type ClassesCacheNms =
	'base' |
	'blocks' |
	'els';

export type ClassesCacheValue =
	ReadonlyArray<string> |
	Readonly<Dictionary<string>>;

export const
	modsCache = Object.createDict<ModsNTable>();

export const classesCache = new Cache<ClassesCacheNms, ClassesCacheValue>([
	'base',
	'blocks',
	'els'
]);

export default class Provide {
	/**
	 * Component name
	 */
	get componentName(): string {
		return this.component.componentName;
	}

	/**
	 * Component instance
	 */
	protected readonly component: iBlock;

	/**
	 * @param component - component instance
	 */
	constructor(component: iBlock) {
		this.component = component;
	}

	/**
	 * Returns a full name of the specified component block
	 *
	 * @param [modName]
	 * @param [modValue]
	 */
	fullBlockName(modName?: string, modValue?: unknown): string;

	/**
	 * @param [componentName]
	 * @param [modName]
	 * @param [modValue]
	 */
	fullBlockName(componentName?: string, modName?: string, modValue?: unknown): string;
	fullBlockName(componentName?: string, modName?: string | unknown, modValue?: unknown): string {
		if (arguments.length === 2) {
			modValue = modName;
			modName = componentName;
			componentName = undefined;
		}

		return Block.prototype.getFullBlockName.call({name: componentName || this.componentName}, modName, modValue);
	}

	/**
	 * Returns a full name of the specified element
	 *
	 * @param componentName
	 * @param elName
	 * @param [modName]
	 * @param [modValue]
	 */
	fullElName(componentName: string, elName: string, modName?: string, modValue?: unknown): string;

	/**
	 * @param elName
	 * @param [modName]
	 * @param [modValue]
	 */
	fullElName(elName: string, modName?: string, modValue?: unknown): string;
	fullElName(componentName: string, elName: string, modName?: string, modValue?: unknown): string {
		if (!{2: true, 4: true}[arguments.length]) {
			modValue = modName;
			modName = elName;
			elName = componentName;
{'fraction_non_alphanumeric': 0.13735046521931768, 'fraction_numerical': 0.0024368630926007973, 'mean_word_length': 4.225694444444445, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '2999104', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1410, 'n_words': 371}