'use strict';

const utils = require('../utils.cjs');

let reverse = false;
function setReverse(value) {
  reverse = value;
}
function replaceObjectNew({
  from,
  to
}) {
  const a = reverse ? to : from;
  const b = reverse ? from : to;
  return {
    [`new ${a}(__a)`]: `new ${b}(__a)`,
    [`new ${a}.__a`]: `new ${b}.__a`,
    [`new ${a}()`]: `new ${b}()`
  };
}
function replaceObjectCall({
  from,
  to
}) {
  const a = reverse ? to : from;
  const b = reverse ? from : to;
  return {
    [`${a}(__a)`]: `${b}(__a)`,
    [`${a}.__a`]: `${b}.__a`
  };
}
function replaceObject({
  from,
  to
}) {
  return {
    ...replaceObjectNew({
      from,
      to
    }),
    ...replaceObjectCall({
      from,
      to
    })
  };
}
function replaceObjects({
  objects
}) {
  const rules = [];
  for (const [from, to] of objects) {
    rules.push(replaceObject({
      from,
      to
    }));
  }
  return Object.assign({}, ...rules);
}
function replaceObjectMethods({
  methods
}) {
  const dictionary = reverse ? utils.invertMap(methods) : methods;
  return Object.fromEntries([...dictionary].map(([key, value]) => {
    return [`__a.${key}`, `__a.${value}`];
  }));
}
function replaceObjectProperties({
  properties
}) {
  const dictionary = reverse ? utils.invertMap(properties) : properties;
  return Object.fromEntries([...dictionary].map(([key, value]) => {
    return [`__a.${key}`, `__a.${value}`];
  }));
}
function replaceGlobalMethods({
  from,
  to,
  methods
}) {
  const dictionary = reverse ? utils.invertMap(methods) : methods;
  return Object.fromEntries([...dictionary].map(([key, value]) => {
    return [`${from}.${key}`, `${to}.${value}`];
  }));
}
function replaceInstanceof({
  from,
  to
}) {
  const a = reverse ? to : from;
  const b = reverse ? from : to;
  return {
    [`__a instanceof ${a}`]: `__a instanceof ${b}`
  };
}

const report$8 = () => "Converts Booleano methods to JavaScript";
const methods$7 = /* @__PURE__ */ new Map([]);
const objects$6 = /* @__PURE__ */ new Map([
  ["Booleano", "Boolean"]
]);
function replace$8() {
  return {
    ...replaceObjects({
      objects: objects$6
    }),
    ...replaceInstanceof({
      from: "Booleano",
      to: "Boolean"
    })
  };
}

const booleano = {
  __proto__: null,
  methods: methods$7,
  objects: objects$6,
  replace: replace$8,
  report: report$8
};

const report$7 = () => "Converts Cadena methods to JavaScript";
const methods$6 = /* @__PURE__ */ new Map([
  ["enPosicion", "at"],
  ["caracterEn", "charAt"],
  ["codigoDeCaracterEn", "charCodeAt"],
  ["puntoDeCodigoEn", "codePointAt"],
  ["concatenar", "concat"],
  ["terminaCon", "endsWith"],
  ["desdeCodigoDeCaracter", "fromCharCode"],
  ["desdePuntoDeCodigo", "fromCodePoint"],
  ["incluye", "includes"],
  ["indiceDe", "indexOf"],
  ["ultimoIndiceDe", "lastIndexOf"],
  ["compararLocalizada", "localeCompare"],
  ["coincidir", "match"],
  ["coincidirTodo", "matchAll"],
  ["normalizar", "normalize"],
  ["rellenarAlFinal", "padEnd"],
  ["rellenarAlComienzo", "padStart"],
  ["crudo", "raw"],
  ["repetir", "repeat"],
  ["reemplazar", "replace"],
  ["reemplazarTodo", "replaceAll"],
  ["buscarRegex", "search"],
  ["recortar", "slice"],
  ["dividir", "split"],
  ["comienzaCon", "startsWith"],
  ["subcadena", "substring"],
  ["aMinusculasLocalizada", "toLocaleLowerCase"],
  ["aMayusculasLocalizada", "toLocaleUpperCase"],
  ["aMinusculas", "toLowerCase"],
  ["aMayusculas", "toUpperCase"],
  ["aCadena", "toString"],
  ["recortarEspacios", "trim"],
  ["recortarEspaciosAlFinal", "trimEnd"],
  ["recortarEspaciosAlComienzo", "trimStart"],
  ["valorDe", "valueOf"]
]);
const properties = /* @__PURE__ */ new Map([
  ["longitud", "length"]
]);
const objects$5 = /* @__PURE__ */ new Map([
  ["Cadena", "String"]
]);
function replace$7() {
  return {
    ...replaceObjects({
      objects: objects$5
    }),
    ...replaceObjectMethods({
      methods: methods$6
    }),
    ...replaceObjectProperties({
      properties
    }),
    ...replaceInstanceof({
      from: "Cadena",
      to: "String"
    })
  };
}

const cadena = {
  __proto__: null,
  methods: methods$6,
  objects: objects$5,
  properties: properties,
  replace: replace$7,
  report: report$7
};

const report$6 = () => "Converts consola to console";
const methods$5 = /* @__PURE__ */ new Map([
  ["afirmar", "assert"],
  ["limpiar", "clear"],
  ["contar", "count"],
  ["reiniciarContador", "countReset"],
  ["depurar", "debug"],
  ["listar", "dir"],
  ["listarXml", "dirxml"],
  ["error", "error"],
  ["agrupar", "group"],
  ["agruparColapsado", "groupCollapsed"],
  ["finalizarAgrupacion", "groupEnd"],
  ["info", "info"],
  ["escribir", "log"],
  ["perfil", "profile"],
  ["finalizarPerfil", "profileEnd"],
  ["tabla", "table"],
  ["tiempo", "time"],
  ["finalizarTiempo", "timeEnd"],
  ["registrarTiempo", "timeLog"],
  ["marcaDeTiempo", "timeStamp"],
  ["rastrear", "trace"],
  ["advertencia", "warn"]
]);
function replace$6() {
  return {
    ...replaceGlobalMethods({
      from: "consola",
      to: "console",
      methods: methods$5
    })
  };
}

const consola = {
  __proto__: null,
  methods: methods$5,
  replace: replace$6,
  report: report$6
};

const report$5 = () => "Converts Fecha methods to JavaScript";
const methods$4 = /* @__PURE__ */ new Map([
  ["obtenerDia", "getDate"],
  ["obtenerDiaSemana", "getDay"],
  ["obtenerAnio", "getFullYear"],
  ["obtenerA\xF1o", "getFullYear"],
  ["obtenerHoras", "getHours"],
  ["obtenerMilisegundos", "getMilliseconds"],
  ["obtenerMinutos", "getMinutes"],
  ["obtenerMes", "getMonth"],
  ["obtenerSegundos", "getSeconds"],
  ["obtenerTiempo", "getTime"],
  ["obtenerDesfaseDeZonaHoraria", "getTimezoneOffset"],
  ["obtenerDiaUTC", "getUTCDate"],
  ["obtenerDiaSemanaUTC", "getUTCDay"],
  ["obtenerAnioUTC", "getUTCFullYear"],
  ["obtenerA\xF1oUTC", "getUTCFullYear"],
  ["obtenerHorasUTC", "getUTCHours"],
  ["obtenerMilisegundosUTC", "getUTCMilliseconds"],
  ["obtenerMinutosUTC", "getUTCMinutes"],
  ["obtenerMesUTC", "getUTCMonth"],
  ["obtenerSegundosUTC", "getUTCSeconds"],
  ["ahora", "now"],
  ["analizar", "parse"],
  ["establecerFecha", "setDate"],
  ["establecerAnio", "setFullYear"],
  ["establecerA\xF1o", "setFullYear"],
  ["establecerHoras", "setHours"],
  ["establecerMilisegundos", "setMilliseconds"],
  ["establecerMinutos", "setMinutes"],
  ["establecerMes", "setMonth"],
  ["establecerSegundos", "setSeconds"],
  ["establecerTiempo", "setTime"],
  ["establecerFechaUTC", "setUTCDate"],
  ["establecerAnioUTC", "setUTCFullYear"],
  ["establecerA\xF1oUTC", "setUTCFullYear"],
  ["establecerHorasUTC", "setUTCHours"],
  ["establecerMilisegundosUTC", "setUTCMilliseconds"],
  ["establecerMinutosUTC", "setUTCMinutes"],
  ["establecerMesUTC", "setUTCMonth"],
  ["establecerSegundosUTC", "setUTCSeconds"],
  ["aCadenaFecha", "toDateString"],
  ["aCadenaISO", "toISOString"],
  ["aJSON", "toJSON"],
  ["aCadenaFechaLocale", "toLocaleDateString"],
  ["aCadenaLocale", "toLocaleString"],
  ["aCadenaTiempoLocale", "toLocaleTimeString"],
  ["aCadena", "toString"],
  ["aCadenaTiempo", "toTimeString"],
  ["aCadenaUTC", "toUTCString"],
  ["UTC", "UTC"],
  ["valorDe", "valueOf"]
]);
const objects$4 = /* @__PURE__ */ new Map([
  ["Fecha", "Date"]
]);
function replace$5() {
  return {
    ...replaceObjects({
      objects: objects$4
    }),
    ...replaceObjectMethods({
      methods: methods$4
    }),
    ...replaceInstanceof({
      from: "Fecha",
      to: "Date"
    })
  };
}

const fecha = {
  __proto__: null,
  methods: methods$4,
  objects: objects$4,
  replace: replace$5,
  report: report$5
};

const report$4 = () => "Converts support functions to JavaScript";
const keywords$1 = /* @__PURE__ */ new Map([
  ["establecerTemporizador", "setTimeout"],
  ["establecerIntervalo", "setInterval"],
  ["esNuN", "isNaN"],
  ["interpretarEntero", "parseInt"]
  // TODO: Add more support functions.
]);
function replace$4() {
  return {
    ...Object.fromEntries(Array.from(keywords$1).map(([from, to]) => {
      return [from, () => {
        return to;
      }];
    }))
  };
}

const soporte = {
  __proto__: null,
  keywords: keywords$1,
  replace: replace$4,
  report: report$4
};

const report$3 = () => "Converts Mate methods to JavaScript";
const methods$3 = /* @__PURE__ */ new Map([
  ["absoluto", "abs"],
  ["arcocoseno", "acos"],
  ["arcocosenoHiperbolico", "acosh"],
  ["arcoseno", "asin"],
  ["arcosenoHiperbolico", "asinh"],
  ["arcotangente", "atan"],
  ["arcotangente2", "atan2"],
  ["arcotangenteHiperbolica", "atanh"],
  ["raizCubica", "cbrt"],
  ["redondearHaciaArriba", "ceil"],
  ["cerosALaIzquierdaEn32Bits", "clz32"],
  ["coseno", "cos"],
  ["cosenoHiperbolico", "cosh"],
  ["exponencial", "exp"],
  ["exponencialMenos1", "expm1"],
  ["redondearHaciaAbajo", "floor"],
  ["redondearAComaFlotante", "fround"],
  ["hipotenusa", "hypot"],
  ["multiplicacionEntera", "imul"],
  ["logaritmo", "log"],
  ["logaritmoBase10", "log10"],
  ["logaritmoDe1Mas", "log1p"],
  ["logaritmoBase2", "log2"],
  ["maximo", "max"],
  ["minimo", "min"],
  ["potencia", "pow"],
  ["aleatorio", "random"],
  ["redondear", "round"],
  ["signo", "sign"],
  ["seno", "sin"],
  ["senoHiperbolico", "sinh"],
  ["raizCuadrada", "sqrt"],
  ["tangente", "tan"],
  ["tangenteHiperbolica", "tanh"],
  ["truncar", "trunc"]
]);
const objects$3 = /* @__PURE__ */ new Map([
  ["Mate", "Math"]
]);
function replace$3() {
  return {
    ...replaceObjects({
      objects: objects$3
    }),
    ...replaceGlobalMethods({
      from: "Math",
      to: "Math",
      methods: methods$3
    })
  };
}

const mate = {
  __proto__: null,
  methods: methods$3,
  objects: objects$3,
  replace: replace$3,
  report: report$3
};

const report$2 = () => "Converts Matriz methods to JavaScript";
const methods$2 = /* @__PURE__ */ new Map([
  ["posicion", "at"],
  ["concatenar", "concat"],
  ["copiarDentro", "copyWithin"],
  ["entradas", "entries"],
  ["cada", "every"],
  ["llenar", "fill"],
  ["filtrar", "filter"],
  ["buscar", "find"],
  ["buscarIndice", "findIndex"],
  ["buscarUltimo", "findLast"],
  ["buscarUltimoIndice", "findLastIndex"],
  ["plano", "flat"],
  ["planoMapear", "flatMap"],
  ["paraCada", "forEach"],
  ["grupo", "group"],
  ["grupoAMapear", "groupToMap"],
  ["incluye", "includes"],
  ["indiceDe", "indexOf"],
  ["juntar", "join"],
  ["claves", "keys"],
  ["ultimoIndiceDe", "lastIndexOf"],
  ["mapear", "map"],
  ["sacar", "pop"],
  ["agregar", "push"],
  ["reducir", "reduce"],
  ["reducirDerecha", "reduceRight"],
  ["reverso", "reverse"],
  ["sacarPrimero", "shift"],
  ["rodaja", "slice"],
  ["algun", "some"],
  ["ordenar", "sort"],
  ["empalmar", "splice"],
  ["aCadenaLocalizada", "toLocaleString"],
  ["aCadena", "toString"],
  ["agregarInicio", "unshift"],
  ["valores", "values"],
  ["de", "of"]
]);
const objects$2 = /* @__PURE__ */ new Map([
  ["Matriz", "Array"],
  ["Arreglo", "Array"]
]);
function replace$2() {
  return {
    ...replaceObjects({
      objects: objects$2
    }),
    ...replaceObjectMethods({
      methods: methods$2
    }),
    ...replaceInstanceof({
      from: "Matriz",
      to: "Array"
    }),
    ...replaceInstanceof({
      from: "Arreglo",
      to: "Array"
    })
  };
}

const matriz = {
  __proto__: null,
  methods: methods$2,
  objects: objects$2,
  replace: replace$2,
  report: report$2
};

const report$1 = () => "Converts Numero methods to JavaScript";
const methods$1 = /* @__PURE__ */ new Map([
  ["esFinito", "isFinite"],
  ["esEntero", "isInteger"],
  ["esEnteroSeguro", "isSafeInteger"],
  ["interpretarDecimal", "parseFloat"],
  ["interpretarEntero", "parseInt"],
  ["aExponencial", "toExponential"],
  ["fijarDecimales", "toFixed"],
  ["aCadenaLocalizada", "toLocaleString"],
  ["aPrecision", "toPrecision"],
  ["aCadena", "toString"],
  ["valorDe", "valueOf"]
]);
const objects$1 = /* @__PURE__ */ new Map([
  ["Numero", "Number"],
  ["N\xFAmero", "Number"]
]);
function replace$1() {
  return {
    ...replaceObjects({
      objects: objects$1
    }),
    ...replaceObjectMethods({
      methods: methods$1
    }),
    ...replaceInstanceof({
      from: "Numero",
      to: "Number"
    })
  };
}

const numero = {
  __proto__: null,
  methods: methods$1,
  objects: objects$1,
  replace: replace$1,
  report: report$1
};

const report = () => "Converts Promesa methods to JavaScript";
const methods = /* @__PURE__ */ new Map([
  ["todos", "all"],
  ["todosTerminados", "allSettled"],
  ["cualquiera", "any"],
  ["capturar", "catch"],
  ["finalmente", "finally"],
  ["carrera", "race"],
  ["rechaza", "reject"],
  ["resuelve", "resolve"],
  ["luego", "then"]
]);
const objects = /* @__PURE__ */ new Map([
  ["Promesa", "Promise"]
]);
function replace() {
  return {
    ...replaceObjects({ objects }),
    ...replaceObjectMethods({
      methods
    })
  };
}

const promesa = {
  __proto__: null,
  methods: methods,
  objects: objects,
  replace: replace,
  report: report
};

const keywordControl = /* @__PURE__ */ new Map([
  ["capturar", "catch"],
  ["caso", "case"],
  ["con", "with"],
  ["continuar", "continue"],
  ["crear", "new"],
  ["desde", "from"],
  ["elegir", "switch"],
  ["esperar", "await"],
  ["exportar", "export"],
  ["hacer", "do"],
  ["importar", "import"],
  ["mientras", "while"],
  ["para", "for"],
  ["retornar", "return"],
  ["sino", "else"],
  ["osi", "else if"],
  ["si", "if"],
  ["constructor", "constructor"],
  ["eliminar", "delete"],
  ["extiende", "extends"],
  ["finalmente", "finally"],
  ["instanciaDe", "instanceof"],
  ["intentar", "try"],
  ["lanzar", "throw"],
  ["longitud", "length"],
  ["romper", "break"],
  ["simbolo", "symbol"],
  ["subcad", "substr"],
  ["tipoDe", "typeof"],
  ["vacio", "void"],
  ["producir", "yield"]
]);
const constantLanguage = /* @__PURE__ */ new Map([
  ["falso", "false"],
  ["nulo", "null"],
  ["verdadero", "true"],
  ["indefinido", "undefined"],
  ["Infinito", "Infinity"],
  ["NuN", "NaN"],
  ["ambienteGlobal", "globalThis"],
  ["esNuN", "isNaN"]
]);
const variableLanguage = /* @__PURE__ */ new Map([
  ["ambiente", "this"],
  ["super", "super"]
]);
const storageType = /* @__PURE__ */ new Map([
  ["asincrono", "async"],
  ["clase", "class"],
  ["const", "const"],
  ["global", "var"],
  ["var", "let"],
  ["porDefecto", "default"],
  // ['obtener', 'get'],
  // ['establecer', 'set'],
  ["funcion", "function"]
]);
const metaVariable = /* @__PURE__ */ new Map([
  ["de", "of"],
  ["en", "in"]
]);
const supportFunction = new Map([
  ["consola", "console"],
  ["depurador", "debugger"],
  // ['Fecha', 'Date'],
  ...objects$4,
  // ['Numero', 'Number'],
  ...objects$1,
  // ['Mate', 'Math'],
  ...objects$3,
  // ['Arreglo', 'Array'],
  // ['Matriz', 'Array'],
  ...objects$2,
  // ['Booleano', 'Boolean'],
  ...objects$6,
  // ['Cadena', 'String'],
  ...objects$5,
  ["Funcion", "Function"],
  // ['Promesa', 'Promise'],
  ...objects
]);
const keywords = new Map([
  ...keywordControl,
  ...constantLanguage,
  ...variableLanguage,
  ...storageType,
  ...metaVariable,
  ...supportFunction,
  ...keywords$1,
  ...methods,
  ...methods$4,
  ...methods$2,
  ...methods$3,
  ...methods$1,
  ...methods$5,
  ...methods$6
]);
function getDictionary(reverse = false) {
  if (reverse)
    return utils.invertMap(keywords);
  return keywords;
}

exports.booleano = booleano;
exports.cadena = cadena;
exports.consola = consola;
exports.constantLanguage = constantLanguage;
exports.fecha = fecha;
exports.getDictionary = getDictionary;
exports.keywordControl = keywordControl;
exports.keywords = keywords$1;
exports.keywords$1 = keywords;
exports.mate = mate;
exports.matriz = matriz;
exports.metaVariable = metaVariable;
exports.methods = methods;
exports.methods$1 = methods$4;
exports.methods$2 = methods$2;
exports.methods$3 = methods$3;
exports.methods$4 = methods$1;
exports.methods$5 = methods$5;
exports.methods$6 = methods$6;
exports.numero = numero;
exports.promesa = promesa;
exports.setReverse = setReverse;
exports.soporte = soporte;
exports.storageType = storageType;
exports.supportFunction = supportFunction;
exports.variableLanguage = variableLanguage;
