{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/fJInxpw1xqnGv4s2hrvv/1zTMvpnSxz19Aj6EI1TZ/cSsw0qAM4.js"],
  "sourcesContent": ["// Generated by Framer (99d1409)\nexport default function metadata(params,activeLocale){return{breakpoints:[{hash:\"1vco06w\",mediaQuery:\"(min-width: 1200px)\"},{hash:\"sip561\",mediaQuery:\"(min-width: 700px) and (max-width: 1199px)\"},{hash:\"ztgjbx\",mediaQuery:\"(max-width: 699px)\"}],customHTMLHeadEnd:\"<script>\\n\\n// URL de tu hoja de Google Sheets\\nvar googleSheetUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRVT5DZM4TsV1S595N2MyNtiJxTDrEfEi1Ch8znI7jpkSbvuB8JteoHYW_ikGvGCmnunalc-BPWizza/pub?gid=0&single=true&output=csv';\\n\\n  var googleSheetUrlFees = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRVT5DZM4TsV1S595N2MyNtiJxTDrEfEi1Ch8znI7jpkSbvuB8JteoHYW_ikGvGCmnunalc-BPWizza/pub?gid=894569628&single=true&output=csv';\\n\\n\\n// Funci\\xf3n para hacer la solicitud AJAX y obtener los datos\\nfunction fetchGoogleSheetData(url, callback) {\\n  var xhr = new XMLHttpRequest();\\n  xhr.onreadystatechange = function() {\\n    if (xhr.readyState === 4) {\\n      if(xhr.status === 200) {\\n        var rows = xhr.responseText.split(\\\"\\\\n\\\");\\n        callback(rows);\\n      } else {\\n        console.log(\\\"Error al cargar datos: \\\", xhr.status);\\n      }\\n    }\\n  };\\n  xhr.open('GET', url, true);\\n  xhr.send();\\n}\\n\\n// Funci\\xf3n para convertir los datos CSV en una tabla HTML\\nfunction createTableFromCSV(csvData) {\\n  var table = '<table>';\\n  \\n  // A\\xf1adir el encabezado de la tabla\\n  table += '<thead><tr>';\\n  var headers = csvData[0].split(\\\",\\\");\\n  headers.forEach(function(header) {\\n    table += '<th>' + header + '</th>';\\n  });\\n  table += '</tr></thead>';\\n  \\n  // A\\xf1adir el cuerpo de la tabla\\n  table += '<tbody>';\\n  for (var i = 1; i < csvData.length; i++) { // Empezar en 1 para saltar la fila de encabezado\\n    var row = csvData[i].split(\\\",\\\");\\n    table += '<tr>';\\n    row.forEach(function(cell) {\\n      table += '<td>' + cell + '</td>';\\n    });\\n    table += '</tr>';\\n  }\\n  table += '</tbody>';\\n  table += '</table>';\\n  return table;\\n}\\n\\n\\nfunction sortTable(containerId, thElement, columnIndex, type) {\\n  var table, rows, switching, i, x, y, xValue, yValue, shouldSwitch;\\n  table = document.querySelector(containerId).getElementsByTagName(\\\"table\\\")[0];\\n  switching = true;\\n  \\n  // Obtener la direcci\\xf3n de ordenaci\\xf3n actual del atributo del elemento th\\n  var dir = thElement.getAttribute(\\\"data-order\\\") || \\\"asc\\\";\\n\\n  while (switching) {\\n    switching = false;\\n    rows = table.getElementsByTagName(\\\"tbody\\\")[0].getElementsByTagName(\\\"tr\\\");\\n\\n    for (i = 0; i < (rows.length - 1); i++) {\\n      shouldSwitch = false;\\n      x = rows[i].getElementsByTagName(\\\"TD\\\")[columnIndex];\\n      y = rows[i + 1].getElementsByTagName(\\\"TD\\\")[columnIndex];\\n\\n      // Comprobar si las filas deben intercambiarse, bas\\xe1ndose en el tipo de dato\\n      if (type === 'number') {\\n        xValue = parseFloat(x.textContent.replace(/[^\\\\d.-]/g, ''));\\n        yValue = parseFloat(y.textContent.replace(/[^\\\\d.-]/g, ''));\\n      } else {\\n        xValue = x.textContent.toLowerCase();\\n        yValue = y.textContent.toLowerCase();\\n      }\\n\\n      // Determinar si se debe cambiar basado en la direcci\\xf3n de la ordenaci\\xf3n\\n      if ((dir === \\\"asc\\\" && xValue > yValue) || (dir === \\\"desc\\\" && xValue < yValue)) {\\n        shouldSwitch = true;\\n        break;\\n      }\\n    }\\n\\n    if (shouldSwitch) {\\n      rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\\n      switching = true;\\n    }\\n  }\\n\\n  // Alternar la direcci\\xf3n de la ordenaci\\xf3n para el pr\\xf3ximo clic\\n  thElement.setAttribute(\\\"data-order\\\", dir === \\\"asc\\\" ? \\\"desc\\\" : \\\"asc\\\");\\n}  \\n\\n\\n// Funci\\xf3n para obtener datos de Google Sheets\\nfunction fetchDataAndDisplay(url, containerId) {\\n    fetchGoogleSheetData(url, function(data) {\\n        var htmlTable = createTableFromCSV(data);\\n        document.querySelector(containerId).innerHTML = htmlTable;\\n\\n        addSortingEventListeners(containerId);\\n    });\\n}\\n\\n// A\\xf1ade eventos de clic para la ordenaci\\xf3n\\nfunction addSortingEventListeners(containerId) {\\n    document.querySelectorAll(containerId + ' th').forEach(function(thElement, columnIndex) {\\n        thElement.setAttribute(\\\"data-order\\\", \\\"asc\\\"); // Inicializar la direcci\\xf3n de ordenaci\\xf3n como 'asc'\\n        \\n        thElement.addEventListener('click', function() {\\n            var type = (columnIndex === 0 || columnIndex === 1) ? 'text' : 'number';\\n            sortTable(containerId, thElement, columnIndex, type);\\n        });\\n    });\\n}\\n\\n// Llamadas para mostrar las tablas\\nfetchDataAndDisplay(googleSheetUrl, '#data-container');\\nfetchDataAndDisplay(googleSheetUrlFees, '#data-container-fees');\\n  \\n</script>\\n\\n\",customHTMLHeadStart:'<!-- Canonical Attribute (SEO) -->\\n<link rel=\"canonical\" href=\"https://fintual.mx/afore/\">\\n<!-- Canonical Attribute (SEO) -->\\n\\n<meta name=\"twitter:site\" content=\"@fintual\">\\n\\n<script>\\n const BASE_URL = \"https://fintual.cl/api/real_assets/15734/days?date=\"\\n\\n  function formatDate(date) {\\n    return date.toJSON().split(\\'T\\')[0];\\n  }\\n\\n  function setPreviousDateByCount(date, daysCount) {\\n    const newDate = new Date(date);\\n\\n    newDate.setDate(date.getDate() - daysCount);\\n\\n    return newDate;\\n  }\\n\\n  async function getPrice(date) {\\n    const formattedDate = formatDate(date);\\n\\n    const url = BASE_URL + formattedDate;\\n\\n    const response = await fetch(url, { method: \\'GET\\' })\\n    const body = await response.json();\\n    const data = body.data;\\n\\n    if (data.length > 0) {\\n      return { date: date, price: data[0].attributes.price };\\n    }\\n\\n    return null;\\n  }\\n\\n  async function getLastPriceForDate(date) {\\n    let price = await getPrice(date);\\n\\n    while (!price) {\\n      date = setPreviousDateByCount(date, 1);\\n\\n      price = await getPrice(date);\\n    }\\n\\n    return price;\\n  }\\n\\n  async function annualizedMonthlyReturn() {\\n    const today = new Date();\\n    \\n    console.log(today);\\n\\n    const { date: endDate, price: endPrice } = await getLastPriceForDate(today);\\n    \\n   \tconsole.log(endDate);\\n    console.log(endPrice);\\n\\n\\n\\n    let aMonthBefore = new Date(endDate.getTime());\\n    aMonthBefore.setMonth(aMonthBefore.getMonth() - 1);\\n    \\n    const { date: startDate, price: startPrice } = await getLastPriceForDate(aMonthBefore);\\n\\n    console.log(startDate);\\n    console.log(startPrice);\\n    \\n    const daysCount = Math.ceil((endDate.getTime() - startDate.getTime()) / (3600 * 24 * 1000));\\n    const annualizedMonthlyReturn = (endPrice / startPrice) ** (360 / daysCount) - 1;\\n\t\\n    console.log(annualizedMonthlyReturn);\\n    \\n    return `${Math.round(annualizedMonthlyReturn * 10000) / 100}%`;\\n  }\\n\\n  async function returnEndDate() {\\n    const today = new Date();\\n\\n    const { date: endDate } = await getLastPriceForDate(today);\\n\\n    return formatDate(endDate);\\n  }\\n</script>\\n\\n',description:\"Aprende m\\xe1s sobre AFORES y descubre cu\\xe1l da mejor rendimiento en la tabla de rendimiento de AFORES de 2023.\",elements:{},framerSearch:{index:false},robots:\"max-image-preview:large\",serializationId:\"framer-AeNz4\",title:\"Tablas de AFORES | Tabla de rendimiento de AFORES 2023 - Fintual\",viewport:\"width=device-width\"};}export const metadataVersion=1;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"metadataVersion\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],
  "mappings": "yCAAAA,IACe,SAARC,E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