'use strict';

const en = require('./internal-translation-controller-38f68a4c.js');
require('./global-slimmer-registry-7bbdb1f2.js');
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-1b8ecfb4.js');
require('./change-manager-72f643de.js');
require('./static-subject-title-5829a298.js');
require('./dynamic-slimmer-0050c489.js');
require('./misc-3d30df91.js');

const VegaTranslationRuntimeMetricsPayloadDefinition = [
  {
    payloadKey: 'IS_INIT_METHOD_CALLED',
    payloadDescription: 'Indicate if the method load of public API VegaTranslation.init is called',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'TranslationController' && methodName === 'init',
    /**
     * The function checks if the method name is loaded.
     *
     * @returns {boolean} A boolean value
     */
    payloadValue: () => {
      return true;
    },
  },
  {
    payloadKey: 'IS_CHANGE_LANGUAGE_METHOD_CALLED',
    payloadDescription: 'Indicate if the method load of public API VegaTranslation.changeLanguage is called',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'TranslationController' && methodName === 'changeLanguage',
    /**
     * The function checks if the method name is load.
     *
     * @returns {boolean} A boolean value
     */
    payloadValue: () => {
      return true;
    },
  },
];

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * Vega Translation Public API
 *
 * @vegaVersion 2.27.0
 */
class TranslationController {
  constructor() {
    this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(TranslationController, ['init', 'changeLanguage'], VegaTranslationRuntimeMetricsPayloadDefinition);
  }
  /**
   * Get current language
   *
   * @returns {string} current language
   * @vegaVersion 2.27.0
   */
  get currentLanguage() {
    return en.VegaInternalTranslation.currentLanguage;
  }
  /**
   * Initializes the translation controller with provided resources and language.
   *
   * @param {VegaTranslationConfig} config - Configuration object containing resources and initial language.
   * @vegaVersion 2.27.0
   */
  init(config) {
    en.VegaInternalTranslation.init(config);
  }
  /**
   * Changes the current language if it exists in the resources.
   *
   * @param {string} language - The language code to change to.
   * @vegaVersion 2.27.0
   */
  changeLanguage(language) {
    en.VegaInternalTranslation.changeLanguage(language);
  }
}
__decorate([
  createPublicApiRuntimeMetricsSlimmer.InjectVegaTelemetrySlimmer()
], TranslationController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
const VegaTranslation = new TranslationController();

exports.VegaTranslation = VegaTranslation;
