ar-poncho 2.0.295 → 2.0.296

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/poncho.js CHANGED
@@ -288,7 +288,7 @@ function ponchoTable(opt) {
288
288
  * @summary PonchoTable con filtros dependientes
289
289
  *
290
290
  * @author Agustín Bouillet <bouilleta@jefatura.gob.ar>
291
- * @requires
291
+ * @requires jQuery
292
292
  * @see https://github.com/argob/poncho/blob/master/src/demo/poncho-maps/readme-poncho-maps.md
293
293
  * @see https://datatables.net
294
294
  *
@@ -321,6 +321,8 @@ const ponchoTableDependant = opt => {
321
321
  var gapi_data;
322
322
  var filtersList = [];
323
323
  var filtro = {};
324
+ var orderFilter = (opt.hasOwnProperty("orderFilter") && opt.orderFilter ?
325
+ true : false);
324
326
  var asFilter = {};
325
327
  var allowedTags = ["*"];
326
328
  let markdownOptions = {
@@ -349,14 +351,26 @@ const ponchoTableDependant = opt => {
349
351
  /**
350
352
  * Ordena alfanuméricamente
351
353
  * @example
352
- * // ["Arroa", "zorro"]
353
- * ["zorro", "Arroz"].sort(sortAlphaNumeric)
354
+ * // ["Arroz", "zorro"]
355
+ * ["zorro", "Arroz"].sort(_sortAlphaNumeric)
354
356
  * @return {object}
355
357
  */
356
358
  const sortAlphaNumeric = (a, b) => {
357
359
  return a.toString().localeCompare(b.toString(), "es", {numeric: true});
358
360
  };
359
361
 
362
+ /**
363
+ * De acuerdo a las opciones del usuario, ordena el listado o lo deja
364
+ * en la secuencia en la que llega.
365
+ *
366
+ * @summary Alias de sortAlphaNumeric
367
+ * @param {object} a
368
+ * @param {object} b
369
+ * @returns {object}
370
+ */
371
+ const _sortAlphaNumeric = (a, b) => (orderFilter ?
372
+ sortAlphaNumeric(a, b) : null);
373
+
360
374
  /**
361
375
  * Resultados únicos
362
376
  *
@@ -500,7 +514,7 @@ const ponchoTableDependant = opt => {
500
514
  const columna = filtro[f][0].columna ? filtro[f][0].columna : 0;
501
515
  const list_filter = filtro[f]
502
516
  .map(e => e.value)
503
- .sort(sortAlphaNumeric);
517
+ .sort(_sortAlphaNumeric);
504
518
 
505
519
  const tplCol = document.createElement("div");
506
520
 
@@ -661,7 +675,7 @@ const ponchoTableDependant = opt => {
661
675
  }
662
676
 
663
677
  const uniqueEntries = distinct(entiresByFilter);
664
- uniqueEntries.sort(sortAlphaNumeric);
678
+ uniqueEntries.sort(_sortAlphaNumeric);
665
679
  filter = filter.replace("filtro-", "");
666
680
  filters[filter] = [];
667
681
  uniqueEntries.forEach(entry => {
@@ -727,7 +741,7 @@ const ponchoTableDependant = opt => {
727
741
  }).filter(f => f);
728
742
 
729
743
  const uniqueList = distinct(filterList);
730
- uniqueList.sort(sortAlphaNumeric);
744
+ uniqueList.sort(_sortAlphaNumeric);
731
745
  return uniqueList;
732
746
  };
733
747
 
@@ -773,7 +787,7 @@ const ponchoTableDependant = opt => {
773
787
  }).filter(f => f);
774
788
 
775
789
  const uniqueList = distinct(items);
776
- uniqueList.sort(sortAlphaNumeric);
790
+ uniqueList.sort(_sortAlphaNumeric);
777
791
  return uniqueList;
778
792
  };
779
793
 
@@ -1 +1 @@
1
- const ponchoColor=e=>{let t;switch(e.toLocaleLowerCase()){case"celeste":case"info":t="#2897d4";break;case"verde":case"success":t="#2e7d33";break;case"rojo":case"danger":t="#c62828";break;case"amarillo":case"warning":t="#f9a822";break;case"azul":case"primary":t="#0072bb";break;case"negro":case"black":t="#333";break;case"uva":t="#6a1b99";break;case"gris":case"muted":t="#525252";break;case"grisintermedio":case"gris-area":case"gray":t="#f2f2f2";break;case"celesteargentina":case"celeste-argentina":t="#37bbed";break;case"fucsia":t="#ec407a";break;case"arandano":t="#c2185b";break;case"cielo":t="#039be5";break;case"verdin":t="#6ea100";break;case"lima":t="#cddc39";break;case"maiz":case"maíz":t="#ffce00";break;case"tomate":t="#ef5350";break;case"naranjaoscuro":case"naranja":t="#EF6C00";break;case"verdeazulado":case"verde-azulado":t="#008388";break;case"escarapela":t="#2cb9ee";break;case"lavanda":t="#9284be";break;case"mandarina":t="#f79525";break;case"palta":t="#50b7b2";break;case"cereza":t="#ed3d8f";break;case"limon":t="#d7df23";break;case"verdejade":case"verde-jade":t="#066";break;case"verdealoe":case"verde-aloe":t="#4fbb73";break;case"verdecemento":case"verde-cemento":t="#b4beba";break;default:t=e}return t},replaceSpecialChars=e=>{if(!e)return"";var t="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż",s="aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz";const a=t+t.toUpperCase(),r=s+s.toUpperCase();t=new RegExp(a.split("").join("|"),"g");return e.toString().replace(t,e=>r.charAt(a.indexOf(e)))},slugify=e=>{if(!e)return e;const t="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;";var s=new RegExp(t.split("").join("|"),"g");return e.toString().toLowerCase().replace(/\s+/g,"-").replace(s,e=>"aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------".charAt(t.indexOf(e))).replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")};async function fetch_json(e,t="GET"){e=await fetch(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"}});if(e.ok)return e.json();throw new Error("HTTP error! status: "+e.status)}const secureHTML=(e,t=[])=>{var s;return!t.some(e=>"*"===e)&&(e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;"),0<t.length)?(s=new RegExp("&lt;("+t.join("|")+")(.*?)&gt;","g"),t=new RegExp("&lt;/("+t.join("|")+")(.*?)&gt;","g"),e.replace(s,"<$1$2>").replace(t,"</$1>")):e},getScroll=()=>{var e,t;return null!=window.pageYOffset?[pageXOffset,pageYOffset]:(e=(t=document).documentElement,t=t.body,[e.scrollLeft||t.scrollLeft||0,e.scrollTop||t.scrollTop||0])};function ponchoTable(e){return ponchoTableLegacyPatch(),ponchoTableDependant(e)}ponchoTableLegacyPatch=()=>{document.querySelectorAll("select[id=ponchoTableFiltro]").forEach(e=>{var e=e.parentElement,t=document.createElement("div");t.id="ponchoTableFiltro",t.classList.add("row"),e.parentElement.appendChild(t),e.remove()})};const ponchoTableDependant=u=>{var m,_=[],b={},g={},y=["*"];let v={tables:!0,simpleLineBreaks:!0,extensions:["details","images","alerts","numbers","ejes","button","target","bootstrap-tables","video"]};document.querySelector("#ponchoTable").classList.add("state-loading"),jQuery.fn.DataTable.isDataTable("#ponchoTable")&&jQuery("#ponchoTable").DataTable().destroy();const k=(e,t)=>e.toString().localeCompare(t.toString(),"es",{numeric:!0}),C=e=>[...new Set(e)],x=(e=0,t,s,a=!1)=>{var r=document.createElement("option");return r.value=s.toString().trim(),r.dataset.column=e,r.textContent=t.toString().trim(),a&&r.setAttribute("selected","selected"),r},l=e=>e.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=e=>e<=0?0:e,s=()=>[...document.querySelectorAll("[data-filter]")].map(e=>e.value),w=()=>!("undefined"==typeof showdown||!showdown.hasOwnProperty("Converter")),j=e=>e.every(e=>{try{return showdown.extension(e),!0}catch(e){return!1}}),S=(e,t)=>{var s=document.createElement("a");return s.setAttribute("aria-label",e),s.classList.add("btn","btn-primary","btn-sm","margin-btn"),s.target="_blank",s.href=t,s.textContent=e,s.setAttribute("rel","noopener noreferrer"),s.outerHTML},E=e=>{var t=e.split("/"),t=new Date(t[2],t[1]-1,t[0]),s=document.createElement("span");return s.style.display="none",s.textContent=t.toISOString().split("T")[0],s.outerHTML+e},p=e=>replaceSpecialChars(e.toLowerCase()),n=(n,l,c)=>{l=l==_.length?l-1:l;const d=s();var e=m.entries.flatMap(e=>{t=n,s=e,a=c,r=d;var t,s,a,r,o=[...Array(h(t+1)).keys()].map(e=>s[_[h(t-1)]]==r[h(t-1)]&&s[_[h(t)]]==a||""==r[h(t-1)]).every(e=>e);if(e[_[h(l-1)]]==c&&o){const i=e[_[h(l)]];return L(l,b)?T(l).filter(e=>p(i).includes(p(e))):i}}).filter(e=>e),e=C(e);return e.sort(k),e},L=e=>{var t=Object.keys(b);return!!g.hasOwnProperty("filtro-"+t[e])},T=e=>{var t=Object.keys(b);return g.hasOwnProperty("filtro-"+t[e])?g["filtro-"+t[e]]:[]},a=(t,a)=>{var r=Object.keys(b);const o=s();for(let s=t+1;s<=r.length&&r.length!=s;s++){let e=n(t,s,a);0==e.length&&(e=((s,a,r)=>{var e=m.entries.flatMap(e=>{const t=e[_[h(a)]];return(e[_[h(s)]]==r||""==r)&&(L(a,b)?T(a).filter(e=>p(t).includes(p(e))):t)}).filter(e=>e),e=C(e);return e.sort(k),e})(t,s,a));const i=document.querySelector("#"+r[s]);i.innerHTML="",i.appendChild(x(s,"Todos","",!0)),e.forEach(e=>{var t;e.trim()&&(t=o[s]==e,i.appendChild(x(s,e,e,t)))})}},t=()=>{return window.location.hash.replace("#","")||!1},A=()=>{var e=jQuery.fn.DataTable.ext.type.search;e.string=e=>e?"string"==typeof e?replaceSpecialChars(e):e:"",e.html=e=>e?"string"==typeof e?replaceSpecialChars(e.replace(/<.*?>/g,"")):e:"";let n=jQuery("#ponchoTable").DataTable({lengthChange:!1,autoWidth:!1,pageLength:u.cantidadItems,columnDefs:[{type:"html-num",targets:u.tipoNumero},{targets:u.ocultarColumnas,visible:!1}],ordering:u.orden,order:[[u.ordenColumna-1,u.ordenTipo]],dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'i>><'row'<'col-sm-12'tr>><'row'<'col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8'p>>",language:{sProcessing:"Procesando...",sLengthMenu:"Mostrar _MENU_ registros",sZeroRecords:"No se encontraron resultados",sEmptyTable:"Ningún dato disponible en esta tabla",sInfo:"_TOTAL_ resultados",sInfoEmpty:"No hay resultados",sInfoFiltered:"",sInfoPostFix:"",sSearch:"Buscar:",sUrl:"",sInfoThousands:".",sLoadingRecords:"Cargando...",oPaginate:{sFirst:"<<",sLast:">>",sNext:">",sPrevious:"<"},oAria:{sSortAscending:": Activar para ordenar la columna de manera ascendente",sSortDescending:": Activar para ordenar la columna de manera descendente",paginate:{first:"Ir a la primera página",previous:"Ir a la página anterior",next:"Ir a la página siguiente",last:"Ir a la última página"}}}});jQuery("#ponchoTableSearch").keyup(function(){n.search(jQuery.fn.DataTable.ext.type.search.string(this.value)).draw()}),jQuery("#ponchoTable_filter").parent().parent().remove(),1<document.querySelectorAll("#ponchoTableFiltro option").length&&(document.querySelector("#ponchoTableFiltroCont").style.display="block"),jQuery("select[data-filter]").change(function(){var e=jQuery(this).find("option:selected").data("column"),t=jQuery(this).find("option:selected").val();a(e,t),n.columns().search("").columns().search("").draw();const o=Object.keys(b),i=s();i.forEach((e,t)=>{s=o[t];var s=Object.keys(m.headers).indexOf("filtro-"+s),a=l(i[t]),r=l(replaceSpecialChars(i[t]));L(t,b)?n.columns(s).search(p(i[t])):n.columns(s).search(i[t]?`^(${a}|${r})$`:"",!0,!1,!0)}),n.draw()}),u.hasOwnProperty("hash")&&u.hash&&(e=(e=t())?decodeURIComponent(e):"",document.querySelector("#ponchoTableSearch").value=e,n.search(jQuery.fn.DataTable.ext.type.search.string(e)).draw())},r=e=>{(m=e).entries="function"==typeof u.refactorEntries&&null!==u.refactorEntries?u.refactorEntries(m.entries):m.entries,m.headers=(u.hasOwnProperty("headers")&&u.headers?u:m).headers,_=Object.keys(m.headers).filter(e=>e.startsWith("filtro-")),g=u.asFilter?u.asFilter(m.entries):{},b=((r,o)=>{let i={};return o.forEach((t,s)=>{let e=[];e=g.hasOwnProperty(o[s])?g[o[s]]:r.entries.map(e=>e[t]);var a=C(e);a.sort(k),t=t.replace("filtro-",""),i[t]=[],a.forEach(e=>{i[t].push({columna:s,value:e})})}),i})(m,_),u.hasOwnProperty("filterContClassList")&&u.filterContClassList&&((e=document.getElementById("ponchoTableFiltroCont")).removeAttribute("class"),e.classList.add(...u.filterContClassList)),u.hasOwnProperty("searchContClassList")&&u.searchContClassList&&((e=document.getElementById("ponchoTableSearchCont")).removeAttribute("class"),e.classList.add(...u.searchContClassList));{var i=m;(e=document.querySelector("#ponchoTable thead")).innerHTML="";const c=document.createElement("tr"),d=(Object.keys(i.headers).forEach((e,t)=>{var s=document.createElement("th");s.textContent=i.headers[e],s.setAttribute("scope","col"),c.appendChild(s)}),e.appendChild(c),(e=document.querySelector("#ponchoTable caption")).innerHTML="",e.textContent=u.tituloTabla,document.querySelector("#ponchoTable tbody"));d.innerHTML="",i.entries.forEach((r,e)=>{if(Object.values(r).some(e=>e.trim())){r="function"==typeof u.customEntry&&null!==u.customEntry?u.customEntry(r):r;const o=d.insertRow();o.id="id_"+e;let a;w()&&(e=u.hasOwnProperty("markdownOptions")?u.markdownOptions:v,a=j(e.extensions)?e:{}),Object.keys(i.headers).forEach(e=>{filas=r[e],e.startsWith("btn-")&&""!=filas?filas=S(e.replace("btn-","").replace("-"," "),filas):e.startsWith("fecha-")&&""!=filas&&(filas=E(filas));var t=o.insertCell(),s=(t.dataset.title=i.headers[e],""==filas&&(t.className="hidden-xs"),u.hasOwnProperty("allowedTags")?u.allowedTags:y),s=e.startsWith("btn-")&&""!=filas?[...s,"a"]:s,e=secureHTML(filas,s);w()?(s=new showdown.Converter(a),t.innerHTML=s.makeHtml(e)):t.innerHTML=e})}})}var t=m,s=document.querySelector("#ponchoTableFiltro");for(f in s.innerHTML="",b){const h=b[f][0].columna||0;var a,r=b[f].map(e=>e.value).sort(k),o=document.createElement("div"),n=(u.hasOwnProperty("filterClassList")?(a="string"==typeof u.filterClassList?u.filterClassList.split(" "):u.filterClassList,o.classList.add(...a)):(a=Math.floor(12/Object.keys(b).length),o.classList.add("col-sm-12","col-md-"+a)),document.createElement("div")),l=(n.className="form-group",document.createElement("label"));l.setAttribute("for",f),l.textContent=t.headers["filtro-"+f];const p=document.createElement("select");p.classList.add("form-control"),p.dataset.filter=1,p.name=f,p.id=f,p.appendChild(x(h,"Todos","",!0)),r.forEach(e=>{e&&p.appendChild(x(h,e,e,!1))}),n.appendChild(l),n.appendChild(p),o.appendChild(n),s.appendChild(o)}document.querySelector("#ponchoTableSearchCont").style.display="block",document.querySelector("#ponchoTable").classList.remove("state-loading"),A()},o=e=>{jQuery.getJSON(e,function(e){var t=new GapiSheetData;m=t.json_data(e),r(m)})};if(u.jsonData){var e=Object.fromEntries(Object.keys(u.jsonData[0]).map(e=>[e,e])),e={entries:u.jsonData,headers:e};r(e)}else if(u.jsonUrl)o(u.jsonUrl);else if(u.hojaNombre&&u.idSpread){e=(new GapiSheetData).url(u.hojaNombre,u.idSpread);o(e)}else{if(!u.hojaNumero||!u.idSpread)throw"¡Error! No hay datos suficientes para crear la tabla.";{var i=u.hojaNumero;const c=new GapiSheetData;e=["https://sheets.googleapis.com/v4/spreadsheets/",u.idSpread,"/?alt=json&key=",c.gapi_key].join("");jQuery.getJSON(e,function(e){e=e.sheets[i-1].properties.title,e=c.url(e,u.idSpread);o(e)})}}};var content_popover=document.getElementById("content-popover");function popshow(){content_popover.classList.toggle("hidden")}function pophidde(){content_popover.classList.add("hidden")}var ponchoUbicacion=function(e){var s,a,r,o,t="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geoprovincias.json",i="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geolocalidades.json",n=jQuery('input[name="submitted['+e.provincia+']"]'),l=jQuery('input[name="submitted['+e.localidad+']"]');function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e,t,s,a=!1,r=!1,o=!1){var i=jQuery("<select></select>").attr("id",t).attr("name",e).addClass("form-control form-select").prop("required",a);return r&&i.append("<option value=''>Seleccione una opción</option>"),jQuery.each(s,function(e,t){let s="";o==t.nombre&&(s='selected="selected"'),i.append("<option value='"+t.id+"' "+s+">"+t.nombre+"</option>")}),i}function h(e,t){var s=l.prop("required");return n.val()?d("sLocalidades","sLocalidades",e.filter(function(e){return String(e.provincia.id)==String(t)}).map(function(e){return e.departamento.nombre&&(e.nombre=c(e.departamento.nombre.toLowerCase())+" - "+c(e.nombre.toLowerCase())),e}).sort(function(e,t){e=e.nombre.toUpperCase(),t=t.nombre.toUpperCase();return e.localeCompare(t)}),s,emptyOption=!!l.val(),l.val()):d("sLocalidades","sLocalidades",[],s,!0,!1)}t=e.urlProvincias||t,i=e.urlLocalidades||i,jQuery.getJSON(t,function(e){var t;s=[],e.results.forEach(function(e,t){s.push(e)}),e=[],e=(t=s).sort(function(e,t){e=e.nombre.toUpperCase(),t=t.nombre.toUpperCase();return e.localeCompare(t)}),t=n.prop("required"),(r=d("sProvincias","sProvincias",e,t,!0,n.val())).on("change",function(e){var t;n.val(""),l.val(""),o.children("option:not(:first)").remove(),""!=r.val()&&(n.val(r.find(":selected").text()),t=h(a,r.val()).find("option"),o.append(t),o.val(""))}),n.after(r),jQuery(r).select2()}),jQuery.getJSON(i,function(e){a=[],e.results.forEach(function(e,t){a.push(e)}),(o=h(a,r.val())).on("change",function(e){l.val(""),""!=o.val()&&l.val(o.find(":selected").text())}),l.after(o),jQuery(o).select2()}),n.hide(),l.hide()};function ponchoChart(t){"use strict";var e;function _e(e){return"HeatMap"==e?"heatmap":"Mixed"==e?"mixed":"Stacked Bar"==e?"bar":"Horizontal Bar"==e?"horizontalBar":"Area"==e?"line":"Pie"==e?"pie":"Bar"==e?"bar":"Line"==e?"line":""}function be(e){var t="";switch(e){case"celeste":case"info":t="#2897d4";break;case"verde":case"success":t="#2e7d33";break;case"rojo":case"danger":t="#c62828";break;case"amarillo":case"warning":t="#f9a822";break;case"azul":case"primary":t="#0072bb";break;case"negro":case"black":t="#333";break;case"uva":t="#6a1b99";break;case"gris":case"muted":t="#525252";break;case"grisintermedio":case"gris-area":case"gray":t="#f2f2f2";break;case"celesteargentina":case"celeste-argentina":t="#37bbed";break;case"fucsia":t="#ec407a";break;case"arandano":t="#c2185b";break;case"cielo":t="#039be5";break;case"verdin":t="#6ea100";break;case"lima":t="#cddc39";break;case"maiz":case"maíz":t="#ffce00";break;case"tomate":t="#ef5350";break;case"naranjaoscuro":case"naranja":t="#EF6C00";break;case"verdeazulado":case"verde-azulado":t="#008388";break;case"escarapela":t="#2cb9ee";break;case"lavanda":t="#9284be";break;case"mandarina":t="#f79525";break;case"palta":t="#50b7b2";break;case"cereza":t="#ed3d8f";break;case"limon":t="#d7df23";break;case"verdejade":case"verde-jade":t="#066";break;case"verdealoe":case"verde-aloe":t="#4fbb73";break;case"verdecemento":case"verde-cemento":t="#b4beba";break;default:console.log("No existe color "+e)}return t}function ge(e){var e=e.toString().replace(".",","),t=e.split(","),s=new Intl.NumberFormat("es-AR",{maximumFractionDigits:2}).format(t[0]);return e=1<t.length?s.concat(",",t[1].substr(0,2)):s}function s(e,a){var F,t,s,H,r,o,z,N,B,i,n,G,D,l,c,$,Q,R,d,h,U,p,V,u,W,m,f=[],_=[],b=[],J=[],g=[],y=[],v=[],k=[],C=0,x="",Y=[],w=0,j=[],Z=[],X=0,S=a.posicionLeyendas||"top",E="",E=void 0===a.mostrarLeyendas||a.mostrarLeyendas,L="",L=void 0===a.mostrarTotalStacked||a.mostrarTotalStacked,T=_e(a.tipoGrafico),A=e.values;if(jQuery.each(Object.keys(A[0]),function(e,t){var s;"eje-y"==A[0][e].substr(0,5)?(s=(s=A[0][e].split("-"))[0]+s[1],_.push(s),b.push(e)):"nombre-corto"==A[0][e]&&"heatmap"==T&&(X=e)}),jQuery.each(A,function(r,e){var a;0==r&&jQuery.each(b,function(e,t){var s=A[r][b[e]].split("-"),a=s[0]+s[1];v[a]=[],J.push(s[2]),"mixed"==T&&(3<s.length&&("barra"==s[3]||"linea"==s[3])?Y.push(s[3]):(0==e&&Y.push("barra"),1==e&&Y.push("linea")))}),1==r&&jQuery.each(b,function(e,t){"pie"==T||"heatmap"==T?f.push(A[r][b[e]]):(y.push(A[r][b[e]]),C+=1)}),1<r&&(a=!1,jQuery.each(b,function(e,t){var s=A[0][b[e]].split("-"),s=s[0]+s[1];"pie"==T?v[s].push(A[r][b[e]]):"heatmap"==T?(0==a&&(y.push(A[r][0]),a=!0,C+=1),e!=X&&v[s].push(A[r][b[e]]),e+2==X&&(void 0===A[r][e+2]?Z.push("*"):Z.push(A[r][e+2]))):(0==a&&(f.push(A[r][0]),a=!0),v[s].push(A[r][b[e]]))}))}),"pie"==T?(F=[],jQuery.each(Object.keys(_),function(e,t){e=_[e];v.hasOwnProperty(e)&&F.push(v[e])}),k=F):1==C&&jQuery.each(Object.keys(_),function(e,t){e=_[e];v.hasOwnProperty(e)&&(k=v[e])}),"mixed"!=T||0<(t=a.porcentajesMixed||"").length&&(j=t.split(",")),x=1==a.porcentajes?"line"==T&&1<C?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"}},mode:"index",intersect:!1}:"pie"==T?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.labels[e.index]+": "+s+"%"}}}:"Stacked Bar"==a.tipoGrafico?1==L?{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"},footer:(e,t)=>{e=e.reduce((e,t)=>e+parseFloat(t.yLabel),0);return"Total: "+new Intl.NumberFormat("es-AR",{maximumFractionDigits:2}).format(e)+"%"}}}:{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"}}}:{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"}}}:"line"==T&&1<C?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s}},mode:"index",intersect:!1}:"pie"==T?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.labels[e.index]+": "+s}}}:"Stacked Bar"==a.tipoGrafico&&1<C?1==L?{enabled:!0,mode:"index",intersect:!1,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s},footer:(e,t)=>{e=e.reduce((e,t)=>e+parseFloat(t.yLabel),0);return"Total: "+new Intl.NumberFormat("es-AR",{maximumFractionDigits:2}).format(e)}}}:{enabled:!0,mode:"index",intersect:!1,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s}}}:{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s}}},"pie"==T&&(J.forEach(function(e,t,s){g.push(be(e))}),console.log("etiquetas --\x3e "+f),console.log("datos --\x3e "+k),console.log("colores --\x3e "+g),t=f,L=k,B=T,i=g,s=a.idComponenteGrafico,G=S,D=x,n=E,s=document.getElementById(s),new Chart(s,{type:B,data:{labels:t,datasets:[{data:L,borderColor:i,backgroundColor:i,borderWidth:2}]},options:{legend:{display:n,position:G},responsive:!0,tooltips:D}})),1==C&&(console.log("etiquetas --\x3e "+f),console.log("datos --\x3e "+k),s=be(J[0]),console.log("color --\x3e "+s),"Line"==a.tipoGrafico&&(B=f,L=k,i=T,n=s,G=y[0],D=a.ejeYenCero,l=a.idComponenteGrafico,c=S,$=x,Q=E,l=document.getElementById(l),new Chart(l,{type:i,data:{labels:B,datasets:[{data:L,borderColor:n,backgroundColor:n,borderWidth:2,lineTension:0,fill:!1,label:G}]},options:{legend:{display:Q,position:c},tooltips:$,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:D}}]}}})),"bar"!=T&&"Area"!=a.tipoGrafico||(l=f,L=k,Q=T,c=s,$=y[0],H=a.ejeYenCero,r=a.idComponenteGrafico,o=S,z=x,N=E,r=document.getElementById(r),new Chart(r,{type:Q,data:{labels:l,datasets:[{data:L,borderColor:c,backgroundColor:c,borderWidth:2,lineTension:0,label:$}]},options:{legend:{display:N,position:o},tooltips:z,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:H}}]}}})),"horizontalBar"==T&&(r=f,L=k,N=T,o=s,z=y[0],H=a.ejeYenCero,O=a.idComponenteGrafico,re=S,oe=x,ee=E,O=document.getElementById(O),new Chart(O,{type:N,data:{labels:r,datasets:[{data:L,borderColor:o,backgroundColor:o,borderWidth:2,lineTension:0,label:z}]},options:{legend:{display:ee,position:re},tooltips:oe,responsive:!0,scales:{xAxes:[{ticks:{beginAtZero:H}}]}}}))),1<C)if("heatmap"==T)if(void 0!==a.heatMapColors&&""!=a.heatMapColors&&void 0!==a.heatMapColorsRange&&""!=a.heatMapColorsRange){for(var K=[],O="labelFila",L="labelColumna",ee="labelValor",te=(void 0!==a.datosTooltip&&0<a.datosTooltip.length&&(void 0!==a.datosTooltip[0]&&void 0!==a.datosTooltip[0].labelFila&&(O=a.datosTooltip[0].labelFila),void 0!==a.datosTooltip[1]&&void 0!==a.datosTooltip[1].labelColumna&&(L=a.datosTooltip[1].labelColumna),void 0!==a.datosTooltip[2]&&void 0!==a.datosTooltip[2].labelValor&&(ee=a.datosTooltip[2].labelValor)),jQuery.each(Object.keys(_),function(e,t){e=_[e];v.hasOwnProperty(e)&&(k=v[e],K.push(k))}),[]),I=0;I<y.length;I++){for(var e=[],se=0;se<f.length;se++){k={x:f[se],y:parseInt(K[se][I])};e.push(k)}te.push({name:("*"!=Z[I]?Z:y)[I],data:e})}for(var ae=[],I=0;I<a.heatMapColorsRange.length-1;I++){e={from:a.heatMapColorsRange[I],to:a.heatMapColorsRange[I+1],color:be(a.heatMapColors[I])};ae.push(e)}var re="",re=void 0===a.mostrarEjeY||a.mostrarEjeY,oe=te,ie=a.idComponenteGrafico,ne=y,le=ae,ce=O,de=L,he=ee,L=a.tituloGrafico,M=re,pe=S,ue=E,ie=document.getElementById(ie),me=(new ApexCharts(ie,{series:oe,chart:{height:650,type:"heatmap"},dataLabels:{enabled:!1},title:{text:L},tooltip:{custom:function({series:e,seriesIndex:t,dataPointIndex:s,w:a}){e=ge(e[t][s]);return'<div class="arrow_box"><span>'+ce+": "+ne[t]+"<br>"+de+": "+a.globals.labels[s]+"<br>"+he+": "+e+"</span></div>"}},plotOptions:{heatmap:{shadeIntensity:.5,radius:0,useFillColorAsStroke:!1,colorScale:{ranges:le}}},yaxis:{show:M},legend:{show:ue,position:pe},responsive:[{breakpoint:1e3,options:{yaxis:{show:!1},legend:{show:ue,position:"top"}}}]}).render(),document.getElementsByClassName("apexcharts-toolbar"));for(let e=0;e<me.length;e++)me[e].style.display="none"}else void 0!==a.heatMapColors&&""!=a.heatMapColors||console.log("Completar vector con valores para los colores"),void 0!==a.heatMapColorsRange&&""!=a.heatMapColorsRange||console.log("Completar vector con el rango de valores para los colores");else{var P=[],q=0,fe=(J.forEach(function(e,t,s){g.push(be(e))}),console.log("colores --\x3e "+g),0);jQuery.each(Object.keys(_),function(e,t){var s,e=_[e];v.hasOwnProperty(e)&&(k=v[e],console.log("datos --\x3e "+k),"Line"==a.tipoGrafico?s={label:y[q],data:k,borderColor:g[q],fill:!1,borderWidth:2,lineTension:0,backgroundColor:g[q]}:"Bar"==a.tipoGrafico||"Area"==a.tipoGrafico||"Horizontal Bar"==a.tipoGrafico||"Stacked Bar"==a.tipoGrafico?s={label:y[q],data:k,borderColor:g[q],backgroundColor:g[q],borderWidth:2,lineTension:0}:"Mixed"==a.tipoGrafico&&("barra"==(e=Y[fe])?s={label:y[q],data:k,backgroundColor:g[q],yAxisID:"left-y-axis",type:"bar"}:"linea"==e&&(s={label:y[q],data:k,borderColor:g[q],backgroundColor:g[q],type:"line",yAxisID:"right-y-axis",fill:!1})),P.push(s),q+=1,fe+=1)}),"mixed"==T&&(2==j.length?w=2:1==j.length?"eje-y1"==j[0]?w=0:"eje-y2"==j[0]&&(w=1):w=3),console.log("etiquetas --\x3e "+f),console.log("toltip --\x3e"+JSON.stringify(x)),"Stacked Bar"==a.tipoGrafico?(ie=f,L=T,le=P,M=a.idComponenteGrafico,pe=a.ejeYenCero,ue=S,j=x,W=E,M=document.getElementById(M),new Chart(M,{type:L,data:{labels:ie,datasets:le},options:{legend:{display:W,position:ue,labels:{textAlign:"center"}},tooltips:j,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:pe},stacked:!0}],xAxes:[{stacked:!0}]}}})):"Mixed"==a.tipoGrafico?(L=f,W="bar",j=P,d=a.idComponenteGrafico,h=a.ejeYenCero,U=S,p=w,w=y[0],V=y[1],u=E,d=document.getElementById(d),new Chart(d,{type:W,data:{labels:L,datasets:j},options:{legend:{display:u,position:U,labels:{textAlign:"center"}},tooltips:{enabled:!0,mode:"single",callbacks:{label:function(e,t){var s="",a=((2==p||e.datasetIndex==p)&&(s="%"),ge(e.yLabel));return t.datasets[e.datasetIndex].label+": "+a+" "+s}}},responsive:!0,scales:{yAxes:[{id:"left-y-axis",type:"linear",position:"left",ticks:{beginAtZero:h,callback:function(e){return e+(1!=p&&2!=p?"":"%")}},scaleLabel:{display:!0,labelString:V,fontColor:"black"}},{id:"right-y-axis",type:"linear",position:"right",ticks:{beginAtZero:h,callback:function(e){return e+(0!=p&&2!=p?"":"%")}},scaleLabel:{display:!0,labelString:w,fontColor:"black"}}]}}})):"Horizontal Bar"==a.tipoGrafico?(d=f,L=T,j=P,u=a.idComponenteGrafico,U=a.ejeYenCero,V=S,h=x,w=E,u=document.getElementById(u),new Chart(u,{type:L,data:{labels:d,datasets:j},options:{legend:{display:w,position:V,labels:{textAlign:"center"}},tooltips:h,responsive:!0,maintainAspectRatio:!0,scales:{xAxes:[{ticks:{beginAtZero:U}}]}}})):(L=f,j=T,w=P,m=a.idComponenteGrafico,R=a.ejeYenCero,S=S,x=x,E=E,m=document.getElementById(m),new Chart(m,{type:j,data:{labels:L,datasets:w},options:{legend:{display:E,position:S,labels:{textAlign:"center"}},tooltips:x,responsive:!0,maintainAspectRatio:!0,scales:{yAxes:[{ticks:{beginAtZero:R}}]}}}))}""!=a.tituloGrafico&&void 0!==a.tituloGrafico&&(m=a.idTagTituloGrafico,j=a.tituloGrafico,document.getElementById(m)&&(document.getElementById(m).innerHTML=j))}!function(e){var t=!1;(e.idSpread&&e.hojaNombre||e.jsonUrl||e.jsonInput)&&void 0!==e.tipoGrafico&&""!=e.tipoGrafico&&void 0!==e.idComponenteGrafico&&""!=e.idComponenteGrafico&&""!=_e(e.tipoGrafico)&&(t=!0);return t}(t)?(void 0!==t.idSpread&&""!=t.idSpread||console.log("Completar valor para la opción de Configuración idSpread"),void 0!==t.hojaNombre&&""!=t.hojaNombre||console.log("Completar valor para la opción de Configuración hojaNombre"),void 0!==t.tipoGrafico&&""!=t.tipoGrafico||console.log("Completar valor para la opción de Configuración tipoGrafico"),void 0!==t.idComponenteGrafico&&""!=t.idComponenteGrafico||console.log("Completar valor para la opción de Configuración idComponenteGrafico"),""==_e(t.tipoGrafico)&&console.log("Ingrese un tipo de gafico válido")):t.jsonInput?(console.log(t.jsonInput),s(jQuery.parseJSON(t.jsonInput),t)):(e=t.jsonUrl||"https://sheets.googleapis.com/v4/spreadsheets/"+t.idSpread+"/values/"+t.hojaNombre+"?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",jQuery.getJSON(e,function(e){s(e,t)}))}const gapi_legacy=e=>{const o=e.values[0],i=/ |\/|_/gi;let n=[];return e.values.forEach((e,t)=>{if(0<t){var s={};for(const r in o){var a=e.hasOwnProperty(r)?e[r].trim():"";s["gsx$"+o[r].toLowerCase().replace(i,"")]={$t:a}}n.push(s)}}),{feed:{entry:n}}};class PonchoMap{constructor(e,t){var s={error_reporting:!1,no_info:!1,title:!1,id:"id",template:!1,template_structure:{container_classlist:["info-container"],title_classlist:["h4","text-primary","m-t-0"],definition_list_classlist:["definition-list"],term_classlist:["h6","m-b-0"],definition_classlist:[],definition_list_tag:"dl",term_tag:"dt",definition_tag:"dd"},allowed_tags:[],template_innerhtml:!1,template_markdown:!1,markdown_options:{tables:!0,simpleLineBreaks:!0,extensions:["details","images","alerts","numbers","ejes","button","target","bootstrap-tables","video"]},render_slider:!0,scope:"",slider:!1,scroll:!1,hash:!1,headers:{},header_icons:[],content_selector:!1,map_selector:"map",anchor_delay:0,slider_selector:".slider",map_view:[-40.44,-63.59],map_anchor_zoom:16,map_zoom:4,min_zoom:2,reset_zoom:!0,latitud:"latitud",longitud:"longitud",marker:"azul",tooltip:!1,tooltip_options:{direction:"auto",className:"leaflet-tooltip-own"},marker_cluster_options:{spiderfyOnMaxZoom:!1,showCoverageOnHover:!1,zoomToBoundsOnClick:!0,maxClusterRadius:45,spiderfyDistanceMultiplier:3,spiderLegPolylineOptions:{weight:1,color:"#666",opacity:.5,"fill-opacity":.5}},accesible_menu_extras:[{text:"Ayudá a mejorar el mapa",anchor:"https://www.argentina.gob.ar/sugerencias"}]},a=Object.assign({},s,t);this.error_reporting=a.error_reporting,this.scope=a.scope,this.render_slider=a.render_slider,this.template=a.template,this.template_structure={...s.template_structure,...t.template_structure},this.template_innerhtml=a.template_innerhtml,this.template_markdown=a.template_markdown,this.markdown_options=a.markdown_options,this.allowed_tags=a.allowed_tags,this.map_selector=a.map_selector,this.headers=this.setHeaders(a.headers),this.header_icons=a.header_icons,this.hash=a.hash,this.scroll=a.scroll,this.map_view=a.map_view,this.anchor_delay=a.anchor_delay,this.map_zoom=a.map_zoom,this.min_zoom=a.min_zoom,this.map_anchor_zoom=a.map_anchor_zoom,this.tooltip_options=a.tooltip_options,this.tooltip=a.tooltip,this.marker_cluster_options=a.marker_cluster_options,this.marker_color=a.marker,this.id=a.id,this.title=a.title,this.latitude=a.latitud,this.longitude=a.longitud,this.slider=a.slider,this.no_info=a.no_info,this.reset_zoom=a.reset_zoom,this.slider_selector=this._selectorName(a.slider_selector),this.selected_marker,this.scope_selector=`[data-scope="${this.scope}"]`,this.scope_sufix="--"+this.scope,this.content_selector=a.content_selector||".js-content"+this.scope_sufix,this.data=this.formatInput(e),this.geometryTypes=["Point","LineString","Polygon","MultiPoint","MultiLineString"],this.featureStyle={stroke:"dodgerblue","stroke-opacity":1,"stroke-width":2,"fill-opacity":.5},this.accesible_menu_search=[],this.accesible_menu_filter=[],this.accesible_menu_extras=a.accesible_menu_extras,this.geojson,this.map=new L.map(this.map_selector,{renderer:L.svg()}).setView(this.map_view,this.map_zoom),new L.tileLayer("https://mapa-ign.argentina.gob.ar/osm/{z}/{x}/{-y}.png",{attribution:'Contribuidores: <a href="https://www.ign.gob.ar/AreaServicios/Argenmap/Introduccion" target="_blank">Instituto Geográfico Nacional</a>, <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>'}).addTo(this.map),this.markers=new L.markerClusterGroup(this.marker_cluster_options)}isGeoJSON=e=>"FeatureCollection"===e?.type;get entries(){return this.data.features}get geoJSON(){return this.featureCollection(this.entries)}formatInput=e=>{e.length<1&&this.errorMessage("No se puede visualizar el mapa, el documento está vacío","warning");let t;return t=this.isGeoJSON(e)?e:(e=this.features(e),this.featureCollection(e)),this._setIdIfNotExists(t)};errorMessage=(e=!1,t="danger")=>{document.querySelectorAll("#js-error-message"+this.scope_sufix).forEach(e=>e.remove());var s=document.createElement("div"),a=(s.id="js-error-message"+this.scope_sufix,s.classList.add("poncho-map--message",t),document.createElement("h2")),r=(a.classList.add("h6","title"),a.textContent="¡Se produjo un error!",document.createElement("pre")),o=(r.textContent=e,document.createElement("a"));throw o.href="https://github.com/argob/poncho/blob/master/src/demo/poncho-maps/readme-poncho-maps.md",o.target="_blank",o.textContent="Ayuda sobre las opciones de PonchoMap",o.className="small",o.title="Abre el enlace en una nueva ventana",s.appendChild(a),s.appendChild(r),s.appendChild(o),this.error_reporting&&(a=document.querySelector(this.scope_selector+".poncho-map")).parentNode.insertBefore(s,a),"danger"==t&&document.getElementById(this.map_selector).remove(),console.log(this.critical_error),e};feature=e=>{var t=e[this.latitude],s=e[this.longitude];return[t,s].forEach(e=>{isNaN(Number(e))&&this.errorMessage("El archivo contiene errores en la definición de latitud y longitud.\n "+e)}),delete e[this.latitude],delete e[this.longitude],{type:"Feature",properties:e,geometry:{type:"Point",coordinates:[s,t]}}};featureCollection=e=>({type:"FeatureCollection",features:e});features=e=>e.map(this.feature);_setIdIfNotExists=e=>{var t;return e.features.filter((e,t)=>0===t).every(e=>e.properties.hasOwnProperty("id"))||(t=e.features.map((e,t)=>{var t=t+1,s=this.title&&e.properties[this.title]?"-"+slugify(e.properties[this.title]):"";return e.properties.id=t+s,e}),e.features=t),e};addHash=e=>{if(!this.hash||this.no_info)return null;window.location.hash="#"+e};entry=t=>this.entries.find(e=>e.properties[this.id]==t);searchEntries=(t,e)=>{return e=void 0===e?this.geoJSON:e,t?e.filter(e=>{if(this.searchEntry(t,e.properties))return e}):e};searchEntry=(e,t)=>{for(const r of[...new Set([this.title,...this.search_fields])].filter(e=>e))if(t.hasOwnProperty(r)){var s=replaceSpecialChars(e).toUpperCase(),a=replaceSpecialChars(t[r]).toString().toUpperCase();try{if(a.includes(s))return t}catch(e){console.error(e)}}return null};_selectorName=e=>e.replace(/^(\.|\#)/,"");scrollCenter=()=>{var e=document.getElementById(this.map_selector),t=e.getBoundingClientRect(),e=(e.offsetLeft+e.offsetWidth)/2,t=t.top+window.scrollY;window.scrollTo({top:t,left:e,behavior:"smooth"})};_clearContent=()=>document.querySelector(".js-content"+this.scope_sufix).innerHTML="";toggleSlider=()=>{this.no_info||(document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>{e.classList.toggle(this.slider_selector+"--in")}),document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>{e.style.display=this.isSliderOpen()?"block":"none"}))};_focusOnFeature=t=>{this.map.eachLayer(e=>{e?.options?.id==t&&(e?._path?e._path.focus():e?._icon&&e._icon.focus())})};_clickToggleSlider=()=>document.querySelectorAll(".js-close-slider"+this.scope_sufix).forEach(e=>e.addEventListener("click",()=>{this._clearContent(),this.toggleSlider(),this._focusOnFeature(e.dataset.entryId)}));isSliderOpen=()=>{let t=[];return document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>{e.classList.contains(this.slider_selector+"--in")&&t.push(!0)}),t.some(e=>e)};setContent=t=>{if(!this.no_info){this._focusOnSlider(),this.isSliderOpen()||this.toggleSlider();const s="function"==typeof this.template?this.template(this,t):this.defaultTemplate(this,t);document.querySelectorAll(this.content_selector).forEach(e=>{e.innerHTML=s}),document.querySelectorAll(".js-close-slider"+this.scope_sufix).forEach(e=>{e.dataset.entryId=t[this.id]})}};_focusOnSlider=()=>{var e;this.no_info||(this.isSliderOpen()?document.querySelector(".js-close-slider"+this.scope_sufix).focus():(e=document.querySelector(".js-slider"+this.scope_sufix))&&e.addEventListener("animationend",()=>{document.querySelector(".js-close-slider"+this.scope_sufix).focus()}))};setHeaders=e=>{var t;return[this.template_structure,this.template_structure.mixing].every(e=>e)?(t=this.template_structure.mixing.reduce((e,t)=>{if([t.key].every(e=>e))return{...e,[t.key]:t.header||""}},{}),{...e,...t}):e};header=e=>this.headers.hasOwnProperty(e)?this.headers[e]:e;_renderSlider=()=>{var e,t,s,a;this.render_slider&&!this.no_info&&(document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>e.remove()),(e=document.createElement("button")).classList.add("btn","btn-xs","btn-secondary","btn-close","js-close-slider"+this.scope_sufix),e.title="Cerrar panel",e.setAttribute("role","button"),e.setAttribute("aria-label","Cerrar panel de información"),e.innerHTML='<span class="sr-only">Cerrar</span>✕',(t=document.createElement("a")).setAttribute("tabindex",0),t.id="js-anchor-slider"+this.scope_sufix,(s=document.createElement("div")).classList.add("content-container"),(a=document.createElement("div")).classList.add("content","js-content"+this.scope_sufix),a.tabIndex=0,s.appendChild(a),(a=document.createElement("div")).style.display="none",a.setAttribute("role","region"),a.setAttribute("aria-live","polite"),a.setAttribute("aria-label","Panel de información"),a.classList.add("slider","js-slider"+this.scope_sufix),a.id="slider"+this.scope_sufix,a.appendChild(e),a.appendChild(t),a.appendChild(s),document.querySelector(this.scope_selector+".poncho-map").appendChild(a))};_showSlider=(e,t)=>{e.hasOwnProperty("_latlng")?this.map.setView(e._latlng,this.map_anchor_zoom):this.map.fitBounds(e.getBounds()),e.fireEvent("click")};_showPopup=e=>{e.hasOwnProperty("_latlng")?this.markers.zoomToShowLayer(e,()=>{e.openPopup()}):(this.map.fitBounds(e.getBounds()),e.openPopup())};removeHash=()=>history.replaceState(null,null," ");hasHash=()=>{return window.location.hash.replace("#","")||!1};gotoHashedEntry=()=>{var e=this.hasHash();e&&this.gotoEntry(e)};gotoEntry=t=>{const s=this.entry(t),a=(e,t,s)=>{e.options.hasOwnProperty("id")&&e.options.id==t&&(this._setSelectedMarker(t,e),this.hash&&this.addHash(t),this.slider&&this.hash?this._showSlider(e,s):this._showPopup(e))};this.markers.eachLayer(e=>a(e,t,s)),this.map.eachLayer(e=>{e.hasOwnProperty("feature")&&"Point"!=e.feature.geometry.type&&a(e,t,s)})};_setClickeable=s=>{s.on("keypress click",t=>{document.querySelectorAll(".marker--active").forEach(e=>e.classList.remove("marker--active")),["_icon","_path"].forEach(e=>{t.sourceTarget.hasOwnProperty(e)&&t.sourceTarget[e].classList.add("marker--active")});var e=this.entries.find(e=>e.properties[this.id]==s.options.id);this.setContent(e.properties)})};isFeature=e=>!!e.hasOwnProperty("feature");_clickeableFeatures=()=>{this.reset_zoom&&this.map.eachLayer(e=>{this.isFeature(e)&&"Point"!=e.feature.geometry.type&&"MultiPoint"!=e.feature.geometry.type&&this._setClickeable(e)})};_clickeableMarkers=()=>{this.no_info||this.markers.eachLayer(this._setClickeable)};_urlHash=()=>{const t=e=>{e.on("click",()=>{this.addHash(e.options.id)})};this.markers.eachLayer(t),this.map.eachLayer(e=>{e.hasOwnProperty("feature")&&"Point"!=e.feature.geometry.type&&"MultiPoint"!=e.feature.geometry.type&&t(e)})};removeListElement=(e,t)=>{t=e.indexOf(t);return-1<t&&e.splice(t,1),e};_templateTitle=e=>{if(!e.hasOwnProperty(this.title))return!1;var t=this.template_structure,s=!!t.hasOwnProperty("title")&&t.title,a=this.title||!1;if(t.hasOwnProperty("title")&&"boolean"==typeof t.title)return!1;if(!s&&!a)return!1;s=s||a;let r;t?.header?((a=document.createElement("div")).innerHTML=this._mdToHtml(t.header(this,e)),this.template_innerhtml&&(a.innerHTML=t.header(this,e)),r=a):((r=document.createElement("h2")).classList.add(...t.title_classlist),r.textContent=e[s]);a=document.createElement("header");return a.className="header",a.appendChild(r),a};_templateList=e=>{var t=this.template_structure,s=Object.keys(e);let a=s;if(t.hasOwnProperty("values")&&0<t?.values?.length)a=t.values;else if(t.hasOwnProperty("exclude")&&0<t.exclude.length)for(const r of t.exclude)a=this.removeListElement(s,r);return a};_mdToHtml=e=>{var t,s;return this.template_markdown&&this._markdownEnable()?(t=new showdown.Converter(this.markdown_options),s=secureHTML(e,this.allowed_tags),t.makeHtml((""+s).trim())):e};_markdownEnable=()=>!("undefined"==typeof showdown||!showdown.hasOwnProperty("Converter"));_templateMixing=r=>{if(this.template_structure.hasOwnProperty("mixing")&&0<this.template_structure.mixing.length){var e=this.template_structure.mixing;let a={};return e.forEach(e=>{var{values:e,separator:t=", ",key:s}=e;void 0===s&&this.errorMessage("Mixing requiere un valor en el atributo «key».","warning"),a[s]=e.map(e=>e in r?r[e]:e.toString()).filter(e=>e).join(t)}),Object.assign({},r,a)}return r};_setType=(e,t=!1,s=!1)=>"function"==typeof e?e(this,t,s):e;_lead=e=>{var t,s,a,r;if(this.template_structure.hasOwnProperty("lead"))return this.template_structure.lead.hasOwnProperty("key")||this.errorMessage("Lead requiere un valor en el atributo «key».","warning"),{key:a=!1,css:t="small",style:r=!1}=this.template_structure.lead,(s=document.createElement("p")).textContent=e[a],(a=this._setType(r,e))&&s.setAttribute("style",a),(r=this._setType(t,e))&&s.classList.add(...r.split(" ")),s};_termIcon=(e,t)=>{var s=this.header_icons.find(e=>e.key==t);if(s){var{css:s=!1,style:a=!1,html:r=!1}=s,r=this._setType(r,e,t),a=this._setType(a,e,t),s=this._setType(s,e,t);if(s)return(e=document.createElement("i")).setAttribute("aria-hidden","true"),e.classList.add(...s.split(" ")),a&&e.setAttribute("style",a),e;if(r)return(s=document.createElement("template")).innerHTML=r,s.content}return!1};defaultTemplate=(e,t)=>{t=this._templateMixing(t);var s,a,r=this["template_structure"],o=this._templateList(t),i=this._templateTitle(t),n=document.createElement("article"),l=(n.classList.add(...r.container_classlist),document.createElement(r.definition_list_tag));l.classList.add(...r.definition_list_classlist),l.style.fontSize="1rem";for(const c of o)t.hasOwnProperty(c)&&t[c]&&((s=document.createElement(r.term_tag)).classList.add(...r.term_classlist),(a=this._termIcon(t,c))&&(s.appendChild(a),s.insertAdjacentText("beforeend"," ")),s.insertAdjacentText("beforeend",this.header(c)),(a=document.createElement(r.definition_tag)).classList.add(...r.definition_classlist),a.textContent=t[c],this.template_markdown?a.innerHTML=this._mdToHtml(t[c]):this.template_innerhtml&&(a.innerHTML=secureHTML(t[c],this.allowed_tags)),""!=this.header(c)&&l.appendChild(s),l.appendChild(a));o=this._lead(t);return o&&n.appendChild(o),i&&n.appendChild(i),n.appendChild(l),n.outerHTML};icon=(e="azul")=>new L.icon({iconUrl:"https://www.argentina.gob.ar/sites/default/files/"+`marcador-${e}.svg`,iconSize:[29,40],iconAnchor:[14,40],popupAnchor:[0,-37]});resetView=()=>this.map.setView(this.map_view,this.map_zoom);fitBounds=()=>{try{this.map.fitBounds(this.geojson.getBounds())}catch(e){console.error(e)}};_resetViewButton=()=>{this.reset_zoom&&(document.querySelectorAll(".js-reset-view"+this.scope_sufix).forEach(e=>e.remove()),document.querySelectorAll(this.scope_selector+" .leaflet-control-zoom-in").forEach(e=>{var t=document.createElement("i"),s=(t.classList.add("fa","fa-expand"),t.setAttribute("aria-hidden","true"),document.createElement("a"));s.classList.add("js-reset-view"+this.scope_sufix,"leaflet-control-zoom-reset"),s.href="#",s.title="Zoom para ver todo el mapa",s.setAttribute("role","button"),s.setAttribute("aria-label","Zoom para ver todo el mapa"),s.appendChild(t),s.onclick=e=>{e.preventDefault(),this.resetView()},e.after(s)}))};marker=e=>{var t;return this.marker_color&&"boolean"!=typeof this.marker_color?"string"==typeof this.marker_color?this.icon(this.marker_color):"string"==typeof this.marker_color(this,e)?(t=this.marker_color(this,e),this.icon(t)):"function"==typeof this.marker_color?this.marker_color(this,e):void 0:null};_clearLayers=()=>{this.markers.clearLayers(),this.map.eachLayer(e=>{this.isFeature(e)&&this.map.removeLayer(e)})};markersMap=e=>{var r=this;this._clearLayers(),this.geojson=new L.geoJson(e,{pointToLayer:function(e,t){var e=e["properties"],s=r.marker(e),a={},s=(a.id=e[r.id],s&&(a.icon=s),r.title&&(a.alt=e[r.title]),new L.marker(t,a));return r.map.options.minZoom=r.min_zoom,r.markers.addLayer(s),r.tooltip&&e[r.title]&&s.bindTooltip(e[r.title],r.tooltip_options),r.no_info||r.slider||(t="function"==typeof r.template?r.template(r,e):r.defaultTemplate(r,e),s.bindPopup(t)),r.markers},onEachFeature:function(e,t){var{properties:s,geometry:a}=e;t.options.id=s[r.id],e.properties.name=s[r.title],r.tooltip&&s[r.title]&&"Point"!=a.type&&"MultiPoint"!=a.type&&t.bindTooltip(s[r.title],r.tooltip_options),r.no_info||r.slider||"Point"==a.type||"MultiPoint"==a.type||(e="function"==typeof r.template?r.template(r,s):r.defaultTemplate(r,s),t.bindPopup(e))},style:function(e){const s=e["properties"];e=(e,t=!1)=>s.hasOwnProperty(e)?s[e]:t||r.featureStyle[e];return{color:e("stroke-color",e("stroke")),strokeOpacity:e("stroke-opacity"),weight:e("stroke-width"),fillColor:e("stroke"),opacity:e("stroke-opacity"),fillOpacity:e("fill-opacity")}}}),this.geojson.addTo(this.map)};_setSelectedMarker=(e,t)=>{e={entry:this.entry(e),marker:t};return this.selected_marker=e};_selectedMarker=()=>{this.map.eachLayer(t=>{this.isFeature(t)&&t.on("click",e=>{this._setSelectedMarker(t.options.id,t)})})};_hiddenSearchInput=()=>{const t=document.createElement("input");t.type="hidden",t.name="js-search-input"+this.scope_sufix,t.setAttribute("disabled","disabled"),t.id="js-search-input"+this.scope_sufix,document.querySelectorAll(this.scope_selector+".poncho-map").forEach(e=>e.appendChild(t))};_setFetureAttributes=()=>{const t=(e,t)=>{e.hasOwnProperty(t)&&(e[t].setAttribute("aria-label",e?.feature?.properties?.[this.title]),e[t].setAttribute("role","button"),e[t].setAttribute("tabindex",0),e[t].dataset.entryId=e?.feature?.properties?.[this.id],e[t].dataset.leafletId=e._leaflet_id)};this.map.eachLayer(e=>t(e,"_path"))};_accesibleAnchors=()=>{var e=[[this.scope_selector+" .leaflet-map-pane","leaflet-map-pane"+this.scope_sufix,[["role","region"]]],[this.scope_selector+" .leaflet-control-zoom","leaflet-control-zoom"+this.scope_sufix,[["aria-label","Herramientas de zoom"],["role","region"]]]];return e.forEach(e=>{const t=document.querySelector(e[0]);t.id=e[1],e[2].forEach(e=>t.setAttribute(e[0],e[1]))}),e};_accesibleMenu=()=>{document.querySelectorAll(this.scope_selector+" .accesible-nav").forEach(e=>e.remove());var e=this._accesibleAnchors(),e=[...e=[{text:"Ir a los marcadores del mapa",anchor:"#"+e[0][1]},{text:"Ajustar marcadores al mapa",anchor:"#",class:"js-fit-bounds"},{text:"Ir al panel de zoom",anchor:"#"+e[1][1]}],...this.accesible_menu_filter,...this.accesible_menu_search,...this.accesible_menu_extras],t=document.createElement("i");t.classList.add("icono-arg-sitios-accesibles","accesible-nav__icon"),t.setAttribute("aria-hidden","true");const s=document.createElement("div"),a=(s.classList.add("accesible-nav","top"),s.id="accesible-nav"+this.scope_sufix,s.setAttribute("aria-label","Menú para el mapa"),s.setAttribute("role","navigation"),s.tabIndex=0,document.createElement("ul"));e.forEach((e,t)=>{var s=document.createElement("a"),e=(s.textContent=e.text,s.tabIndex=0,s.href=e.anchor,e.hasOwnProperty("class")&&""!=e.class&&s.classList.add(...e.class.split(" ")),document.createElement("li"));e.appendChild(s),a.appendChild(e)}),s.appendChild(t),s.appendChild(a);e=document.createElement("a");e.textContent="Ir a la navegación del mapa",e.href="#accesible-nav"+this.scope_sufix,e.id="accesible-return-nav"+this.scope_sufix;const r=document.createElement("div");r.classList.add("accesible-nav","bottom"),r.appendChild(t.cloneNode(!0)),r.appendChild(e),document.querySelectorAll(""+this.scope_selector).forEach(e=>{e.insertBefore(s,e.children[0]),e.appendChild(r)}),this.fit()};fit=()=>document.querySelectorAll(this.scope_selector+" .js-fit-bounds").forEach(e=>{e.onclick=e=>{e.preventDefault(),this.fitBounds()}});render=()=>{this._hiddenSearchInput(),this._resetViewButton(),this.markersMap(this.entries),this._selectedMarker(),this.slider&&(this._renderSlider(),this._clickeableFeatures(),this._clickeableMarkers(),this._clickToggleSlider()),this.hash&&this._urlHash(),this.scroll&&this.hasHash()&&this.scrollCenter(),setTimeout(this.gotoHashedEntry,this.anchor_delay),this._setFetureAttributes(),this._accesibleMenu()}}class PonchoMapFilter extends PonchoMap{constructor(e,t){super(e,t);e=Object.assign({},{filters:[],filters_visible:!1,filters_info:!1,search_fields:[],messages:{reset:' <a href="#" class="{{reset_search}}" title="Restablece el mapa a su estado inicial">Restablecer mapa</a>',initial:"Hay {{total_results}} puntos en el mapa.",no_results_by_term:"No encontramos resultados para tu búsqueda.",no_results:"No s + this.messages.resete encontraron entradas.",results:"{{total_results}} resultados coinciden con tu búsqueda.",one_result:"{{total_results}} resultado coincide con tu búsqueda.",has_filters:'<i title="¡Advertencia!" aria-hidden="true" class="fa fa-warning text-danger"></i> Se están usando filtros.'}},t);this.filters=e.filters,this.filters_info=e.filters_info,this.filters_visible=e.filters_visible,this.valid_fields=["checkbox","radio"],this.search_fields=e.search_fields,this.messages=e.messages,this.accesible_menu_filter=[{text:"Ir al panel de filtros",anchor:"#filtrar-busqueda"+this.scope_sufix}]}tplParser=(e,a)=>Object.keys(a).reduce(function(e,t){var s=new RegExp("\\{\\{\\s{0,2}"+t+"\\s{0,2}\\}\\}","gm");return e=e.replace(s,a[t])},e);_helpText=e=>{var t=document.querySelectorAll(this.scope_selector+" .js-poncho-map__help");const a={total_results:e.length,total_entries:this.entries.length,total_filtered_entries:this.filtered_entries.length,filter_class:"js-close-filter"+this.scope_sufix,anchor:"#",term:this.inputSearchValue,reset_search:"js-poncho-map-reset"+this.scope_sufix};t.forEach(e=>{e.innerHTML="";var t=document.createElement("ul"),s=(t.classList.add("m-b-0","list-unstyled"),t.setAttribute("aria-live","polite"),e=>{var t=document.createElement("li");return t.innerHTML=e,t});a.total_entries===a.total_results?t.appendChild(s(this.tplParser(this.messages.initial,a))):a.total_results<1?t.appendChild(s(this.tplParser(this.messages.no_results_by_term+this.messages.reset,a))):""===this.inputSearchValue&&a.total_results<1?t.appendChild(s(this.tplParser(this.messages.no_results+this.messages.reset,a))):1==a.total_results?t.appendChild(s(this.tplParser(this.messages.one_result+this.messages.reset,a))):1<a.total_results&&t.appendChild(s(this.tplParser(this.messages.results+this.messages.reset,a))),this.usingFilters(),e.appendChild(t)})};_filterPosition=e=>{e=/^([\w\-]+?)(?:__([0-9]+))(?:__([0-9]+))?$/gm.exec(e);return e?[e[1],e[2]]:null};isFilterOpen=()=>document.querySelector(".js-poncho-map-filters"+this.scope_sufix).classList.contains("filter--in");toggleFilter=()=>{document.querySelector(".js-poncho-map-filters"+this.scope_sufix).classList.toggle("filter--in")};_filterContainerHeight=()=>{var e=document.querySelector(".js-filter-container"+this.scope_sufix),t=document.querySelector(".js-close-filter"+this.scope_sufix),e=e.offsetParent.offsetHeight-e.offsetTop-t.offsetHeight-20,t=document.querySelector(".js-poncho-map-filters"+this.scope_sufix),e=(t.style.maxHeight=e+"px",t.offsetHeight-45),t=document.querySelector(".js-filters"+this.scope_sufix);t.style.height=e+"px",t.style.overflow="auto"};_clickToggleFilter=()=>document.querySelectorAll(".js-close-filter"+this.scope_sufix).forEach(e=>e.onclick=e=>{e.preventDefault(),this.toggleFilter(),this._filterContainerHeight()});_setFilter=e=>{const[t,s="checked"]=e;e=this.entries.map(e=>{if(e.properties.hasOwnProperty(t))return e.properties[t]}).filter(e=>e),e=[...new Set(e)].map(e=>[t,e,[e],s]);return e.sort((e,t)=>{e=e[1].toUpperCase(),t=t[1].toUpperCase();return t<e?1:e<t?-1:0}),e};_fieldsToUse=e=>{var{fields:e=!1,field:t=!1}=e,e=(e||t||this.errorMessage("Filters requiere el uso del atributo `field` o `fields`.","warning"),e||this._setFilter(t));return e};_fields=(e,t)=>{var s=document.createElement("div"),a=(s.classList.add("field-list","p-b-1"),this._fieldsToUse(e));for(const c in a){var r=a[c],o=document.createElement("input"),i=(o.type=this.valid_fields.includes(e.type)?e.type:"checkbox",o.id=`id__${r[0]}__${t}__`+c,"radio"==e.type?o.name=r[0]+"__"+t:o.name=r[0]+`__${t}__`+c,o.className="form-check-input",o.value=c,void 0!==r[3]&&"checked"==r[3]&&o.setAttribute("checked","checked"),document.createElement("label")),n=(i.style.marginLeft=".33rem",i.textContent=r[1],i.className="form-check-label",i.setAttribute("for",`id__${r[0]}__${t}__`+c),document.createElement("span")),r=(n.dataset.info=r[0]+`__${t}__`+c,i.appendChild(n),document.createElement("div"));r.className="form-check",r.appendChild(o),r.appendChild(i),s.appendChild(r)}var l=document.createElement("div");return l.appendChild(s),l};_filterButton=()=>{var e=document.createElement("i"),t=(e.setAttribute("aria-hidden","true"),e.classList.add("fa","fa-filter"),document.createElement("span")),s=(t.textContent="Abre o cierra el filtro de búsqueda",t.classList.add("sr-only"),document.createElement("button")),e=(s.classList.add("btn","btn-secondary","btn-filter","js-close-filter"+this.scope_sufix),s.id="filtrar-busqueda"+this.scope_sufix,s.appendChild(e),s.appendChild(t),s.setAttribute("role","button"),s.setAttribute("aria-label","Abre o cierra el filtro de búsqueda"),s.setAttribute("aria-controls","poncho-map-filters"+this.scope_sufix),document.createElement("div"));e.classList.add("js-filter-container"+this.scope_sufix,"filter-container"),this.reset_zoom&&e.classList.add("filter-container--zoom-expand"),e.appendChild(s),document.querySelector(".poncho-map"+this.scope_selector).appendChild(e)};_filterContainer=()=>{var e=document.createElement("div"),t=(e.className="js-filters"+this.scope_sufix,document.createElement("button")),s=(t.classList.add("btn","btn-xs","btn-secondary","btn-close","js-close-filter"+this.scope_sufix),t.title="Cerrar panel",t.setAttribute("role","button"),t.setAttribute("aria-label","Cerrar panel de filtros"),t.innerHTML='<span class="sr-only">Cerrar </span>✕',document.createElement("form"));s.classList.add("js-formulario"+this.scope_sufix),s.appendChild(t),s.appendChild(e);const a=document.createElement("div");a.classList.add("js-poncho-map-filters"+this.scope_sufix,"poncho-map-filters"),a.setAttribute("role","region"),a.setAttribute("aria-live","polite"),a.setAttribute("aria-label","Panel de filtros"),a.id="poncho-map-filters"+this.scope_sufix,this.filters_visible&&a.classList.add("filter--in"),a.appendChild(s),document.querySelectorAll(".js-filter-container"+this.scope_sufix).forEach(e=>e.appendChild(a))};_checkUncheckButtons=e=>{var t=document.createElement("button"),s=(t.classList.add("js-select-items","select-items__button"),t.textContent="Marcar todos",t.dataset.field=e.field[0],t.dataset.value=1,document.createElement("button")),e=(s.classList.add("js-select-items","select-items__button"),s.textContent="Desmarcar todos",s.dataset.field=e.field[0],s.dataset.value=0,document.createElement("div"));return e.classList.add("select-items"),e.appendChild(t),e.appendChild(s),e};_createFilters=e=>{const r=document.querySelector(".js-filters"+this.scope_sufix);e.forEach((e,t)=>{var s=document.createElement("legend"),a=(s.textContent=e.legend,s.classList.add("m-b-1","text-primary","h6"),document.createElement("fieldset"));a.appendChild(s),e.hasOwnProperty("check_uncheck_all")&&e.check_uncheck_all&&a.appendChild(this._checkUncheckButtons(e)),a.appendChild(this._fields(e,t)),r.appendChild(a)})};formFilters=()=>{var e;return this.filters.length<1?[]:(e=document.querySelector(".js-formulario"+this.scope_sufix),e=new FormData(e),Array.from(e).map(e=>{var t=this._filterPosition(e[0]);return[parseInt(t[1]),parseInt(e[1]),t[0]]}))};defaultFiltersConfiguration=()=>{return this.filters.map((e,s)=>{return this._fieldsToUse(e).map((e,t)=>[s,t,e[0],"undefinded"!=typeof e[3]&&"checked"==e[3]])}).flat()};usingFilters=()=>{return this.defaultFiltersConfiguration().every(e=>document.querySelector(`#id__${e[2]}__${e[0]}__`+e[1]).checked)};_resetFormFilters=()=>{this.defaultFiltersConfiguration().forEach(e=>{document.querySelector(`#id__${e[2]}__${e[0]}__`+e[1]).checked=e[3]})};get inputSearchValue(){var e=document.querySelector("#js-search-input"+this.scope_sufix).value.trim();return""!==e&&e}_countOccurrences=(e,s,a)=>{return e.reduce((e,t)=>s.some(e=>t.properties[a].includes(e))?e+1:e,0)};totals=()=>{return this.formFilters().map(e=>{var t=this._fieldsToUse(this.filters[e[0]])[e[1]];return[t[1],this._countOccurrences(this.filtered_entries,t[2],t[0]),...e]})};_totalsInfo=()=>{if(!this.filters_info)return"";this.totals().forEach(e=>{var t=document.querySelector(""+this.scope_selector+` [data-info="${e[4]}__${e[2]}__${e[3]}"]`),s=e[1]<2?"":"s",a=document.createElement("i"),r=(a.style.cursor="help",a.style.opacity=".75",a.style.marginLeft=".5em",a.style.marginRight=".25em",a.classList.add("fa","fa-info-circle","small","text-info"),a.title=e[1]+" resultado"+s,a.setAttribute("aria-hidden","true"),document.createElement("span")),e=(r.className="sr-only",r.style.fontWeight="400",r.textContent=e[1]+` elemento${s}.`,document.createElement("small"));e.appendChild(a),e.appendChild(r),t.appendChild(e)})};_validateEntry=(t,s)=>{var a=this.filters.length,r=[];for(let e=0;e<a;e++)r.push(this._validateGroup(t,(t=>s.filter(e=>e[0]==t))(e)));return r.every(e=>e)};_search=(t,e,s)=>{const a=this._fieldsToUse(this.filters[e])[s];return a[2].filter(e=>e).some(e=>{if(t.hasOwnProperty(a[0]))return t[a[0]].includes(e)})};_validateGroup=(t,e)=>{return e.map(e=>this._search(t,e[0],e[1])).some(e=>e)};_filterData=()=>{var e=this.formFilters(),t=this.entries.filter(e=>this._validateEntry(e.properties,this.formFilters())),t=this.searchEntries(this.inputSearchValue,t);return t=this.filters.length<1||0<e.length?t:[],this.filtered_entries=t};_filteredData=e=>{e=void 0!==e?this.entries:this._filterData(),this.markersMap(e),this._selectedMarker(),this._helpText(e),this._resetSearch(),this._clickToggleFilter(),this.slider&&(this._renderSlider(),this._clickeableMarkers(),this._clickeableFeatures(),this._clickToggleSlider()),this.hash&&this._urlHash(),this._setFetureAttributes(),this._accesibleMenu()};_clearSearchInput=()=>document.querySelectorAll("#js-search-input"+this.scope_sufix).forEach(e=>e.value="");_resetSearch=()=>{document.querySelectorAll(".js-poncho-map-reset"+this.scope_sufix).forEach(e=>{e.onclick=e=>{e.preventDefault(),this._resetFormFilters(),this._filteredData(this.entries),this._clearSearchInput(),this.resetView()}})};filterChange=t=>document.querySelectorAll(".js-filters"+this.scope_sufix).forEach(e=>{e.onchange=t});checkUncheckFilters=()=>{document.querySelectorAll(this.scope_selector+" .js-select-items").forEach(t=>{t.onclick=e=>{e.preventDefault(),document.querySelectorAll(`${this.scope_selector} [id^=id__${t.dataset.field}]`).forEach(e=>{e.checked=parseInt(t.dataset.value)}),this._filteredData()}})};render=()=>{this._hiddenSearchInput(),this._resetViewButton(),0<this.filters.length&&(this._filterButton(),this._filterContainer(),this._createFilters(this.filters)),this._filteredData(),this._totalsInfo(),this.scroll&&this.hasHash()&&this.scrollCenter(),this.checkUncheckFilters(),this.filterChange(e=>{e.preventDefault(),this._filteredData()}),setTimeout(this.gotoHashedEntry,this.anchor_delay),this.filters_visible&&this._filterContainerHeight()}}class PonchoMapSearch{constructor(e,t){var s={scope:!1,placeholder:"Su búsqueda",search_fields:e.search_fields,sort:!0,sort_reverse:!1,sort_key:"text",datalist:!0},s=(this.instance=e,Object.assign({},s,t));this.text=e.title||!1,this.datalist=s.datalist,this.placeholder=s.placeholder,this.scope=s.scope,this.scope_sufix="--"+this.scope,this.sort=s.sort,this.sort_reverse=s.sort_reverse,this.search_scope_selector=this.scope?`[data-scope="${this.scope}"]`:"",this.instance.search_fields=s.search_fields,this.instance.accesible_menu_search=[{text:"Hacer una búsqueda",anchor:"#id-poncho-map-search"+this.scope_sufix}]}sortData=(e,a)=>{e=e.sort((e,t)=>{var s=e=>{this.instance.removeAccents(e).toUpperCase()};return s(e[a]),s(t[a]),s(e[a]),s(t[a]),0});return this.sort_reverse?e.reverse():e};_triggerSearch=()=>{const t=document.querySelector(this.search_scope_selector+" .js-poncho-map-search__input");t.id="id-poncho-map-search"+this.scope_sufix,document.querySelectorAll(this.search_scope_selector+" .js-poncho-map-search__submit").forEach(e=>{e.onclick=e=>{e.preventDefault();document.querySelector("#js-search-input"+this.instance.scope_sufix).value=t.value;e=t.value;this._renderSearch(e)}})};_keyup=()=>{document.querySelectorAll(this.search_scope_selector+" .js-poncho-map-search__input").forEach(e=>{const t=document.querySelector("#js-search-input"+this.instance.scope_sufix);e.onkeyup=()=>{t.value=e.value},e.onkeydown=()=>{t.value=e.value}})};_placeHolder=()=>{if(!this.placeholder)return"";document.querySelectorAll(this.search_scope_selector+" .js-poncho-map-search__input").forEach(e=>e.placeholder=this.placeholder.toString())};_renderSearch=e=>{var t=this.instance._filterData();this.instance.markersMap(t),this.instance.slider&&(this.instance._renderSlider(),this.instance._clickeableFeatures(),this.instance._clickeableMarkers(),this.instance._clickToggleSlider()),this.instance.hash&&this.instance._urlHash(),this.instance.resetView(),1==t.length?this.instance.gotoEntry(t[0].properties[this.instance.id]):""!=e.trim()&&(this.instance.removeHash(),setTimeout(this.instance.fitBounds,this.instance.anchor_delay)),this.instance._helpText(t),this.instance._resetSearch(),this.instance._clickToggleFilter(),this.instance._setFetureAttributes(),this.instance._accesibleMenu()};_addDataListOptions=()=>{if(!this.datalist)return null;document.querySelectorAll(this.search_scope_selector+" .js-porcho-map-search__list,"+` ${this.search_scope_selector} .js-poncho-map-search__list`).forEach(s=>{s.innerHTML="";var e=document.querySelector(this.search_scope_selector+" .js-poncho-map-search__input"),t="id-datalist"+this.scope_sufix;e.setAttribute("list",t),s.id=t,this.instance.filtered_entries.forEach(e=>{var t;e.properties[this.text]&&s.appendChild((e=e.properties[this.text],(t=document.createElement("option")).value=e,t))})})};_searchRegion=()=>{var e=document.querySelector(this.search_scope_selector);e.setAttribute("role","region"),e.setAttribute("aria-label","Buscador")};render=()=>{this._placeHolder(),this._triggerSearch(),this._addDataListOptions(),this.instance.filterChange(e=>{e.preventDefault(),this.instance._filteredData(),this._addDataListOptions()}),this._searchRegion(),this._keyup(),this.instance._accesibleMenu()}}class GapiSheetData{constructor(e){e=Object.assign({},{gapi_key:"AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",gapi_uri:"https://sheets.googleapis.com/v4/spreadsheets/"},e);this.gapi_key=e.gapi_key,this.gapi_uri=e.gapi_uri}url=(e,t,s)=>{return["https://sheets.googleapis.com/v4/spreadsheets/",t,"/values/",e,"?key=",void 0!==s?s:this.gapi_key,"&alt=json"].join("")};json_data=e=>{e=this.feed(e);return{feed:e,entries:this.entries(e),headers:this.headers(e)}};feed=(e,o=!0)=>{const i=e.values[0],n=/ |\/|_/gi;let l=[];return e.values.forEach((e,t)=>{if(0<t){var s,a={};for(s in i){var r=e.hasOwnProperty(s)?e[s].trim():"";o?a[""+i[s].toLowerCase().replace(n,"")]=r:a[""+i[s].replace(n,"")]=r}l.push(a)}}),l};gapi_feed_row=(e,t="-",s=!0)=>{const a=s?"filtro-":"";s=Object.entries(e);let r={};return s.map(e=>{return r[e[0].replace("gsx$","").replace(a,"").replace(/-/g,t)]=e[1].$t}),r};entries=e=>e.filter((e,t)=>0<t);headers=e=>e.find((e,t)=>0==t)}
1
+ const ponchoColor=e=>{let t;switch(e.toLocaleLowerCase()){case"celeste":case"info":t="#2897d4";break;case"verde":case"success":t="#2e7d33";break;case"rojo":case"danger":t="#c62828";break;case"amarillo":case"warning":t="#f9a822";break;case"azul":case"primary":t="#0072bb";break;case"negro":case"black":t="#333";break;case"uva":t="#6a1b99";break;case"gris":case"muted":t="#525252";break;case"grisintermedio":case"gris-area":case"gray":t="#f2f2f2";break;case"celesteargentina":case"celeste-argentina":t="#37bbed";break;case"fucsia":t="#ec407a";break;case"arandano":t="#c2185b";break;case"cielo":t="#039be5";break;case"verdin":t="#6ea100";break;case"lima":t="#cddc39";break;case"maiz":case"maíz":t="#ffce00";break;case"tomate":t="#ef5350";break;case"naranjaoscuro":case"naranja":t="#EF6C00";break;case"verdeazulado":case"verde-azulado":t="#008388";break;case"escarapela":t="#2cb9ee";break;case"lavanda":t="#9284be";break;case"mandarina":t="#f79525";break;case"palta":t="#50b7b2";break;case"cereza":t="#ed3d8f";break;case"limon":t="#d7df23";break;case"verdejade":case"verde-jade":t="#066";break;case"verdealoe":case"verde-aloe":t="#4fbb73";break;case"verdecemento":case"verde-cemento":t="#b4beba";break;default:t=e}return t},replaceSpecialChars=e=>{if(!e)return"";var t="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż",s="aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz";const a=t+t.toUpperCase(),r=s+s.toUpperCase();t=new RegExp(a.split("").join("|"),"g");return e.toString().replace(t,e=>r.charAt(a.indexOf(e)))},slugify=e=>{if(!e)return e;const t="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;";var s=new RegExp(t.split("").join("|"),"g");return e.toString().toLowerCase().replace(/\s+/g,"-").replace(s,e=>"aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------".charAt(t.indexOf(e))).replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")};async function fetch_json(e,t="GET"){e=await fetch(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"}});if(e.ok)return e.json();throw new Error("HTTP error! status: "+e.status)}const secureHTML=(e,t=[])=>{var s;return!t.some(e=>"*"===e)&&(e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;"),0<t.length)?(s=new RegExp("&lt;("+t.join("|")+")(.*?)&gt;","g"),t=new RegExp("&lt;/("+t.join("|")+")(.*?)&gt;","g"),e.replace(s,"<$1$2>").replace(t,"</$1>")):e},getScroll=()=>{var e,t;return null!=window.pageYOffset?[pageXOffset,pageYOffset]:(e=(t=document).documentElement,t=t.body,[e.scrollLeft||t.scrollLeft||0,e.scrollTop||t.scrollTop||0])};function ponchoTable(e){return ponchoTableLegacyPatch(),ponchoTableDependant(e)}ponchoTableLegacyPatch=()=>{document.querySelectorAll("select[id=ponchoTableFiltro]").forEach(e=>{var e=e.parentElement,t=document.createElement("div");t.id="ponchoTableFiltro",t.classList.add("row"),e.parentElement.appendChild(t),e.remove()})};const ponchoTableDependant=u=>{var m,_=[],b={},s=!(!u.hasOwnProperty("orderFilter")||!u.orderFilter),g={},y=["*"];let v={tables:!0,simpleLineBreaks:!0,extensions:["details","images","alerts","numbers","ejes","button","target","bootstrap-tables","video"]};document.querySelector("#ponchoTable").classList.add("state-loading"),jQuery.fn.DataTable.isDataTable("#ponchoTable")&&jQuery("#ponchoTable").DataTable().destroy();const k=(e,t)=>{return s?(t=t,e.toString().localeCompare(t.toString(),"es",{numeric:!0})):null},C=e=>[...new Set(e)],x=(e=0,t,s,a=!1)=>{var r=document.createElement("option");return r.value=s.toString().trim(),r.dataset.column=e,r.textContent=t.toString().trim(),a&&r.setAttribute("selected","selected"),r},l=e=>e.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=e=>e<=0?0:e,p=()=>[...document.querySelectorAll("[data-filter]")].map(e=>e.value),w=()=>!("undefined"==typeof showdown||!showdown.hasOwnProperty("Converter")),j=e=>e.every(e=>{try{return showdown.extension(e),!0}catch(e){return!1}}),S=(e,t)=>{var s=document.createElement("a");return s.setAttribute("aria-label",e),s.classList.add("btn","btn-primary","btn-sm","margin-btn"),s.target="_blank",s.href=t,s.textContent=e,s.setAttribute("rel","noopener noreferrer"),s.outerHTML},E=e=>{var t=e.split("/"),t=new Date(t[2],t[1]-1,t[0]),s=document.createElement("span");return s.style.display="none",s.textContent=t.toISOString().split("T")[0],s.outerHTML+e},L=e=>replaceSpecialChars(e.toLowerCase()),n=(n,l,c)=>{l=l==_.length?l-1:l;const d=p();var e=m.entries.flatMap(e=>{t=n,s=e,a=c,r=d;var t,s,a,r,o=[...Array(h(t+1)).keys()].map(e=>s[_[h(t-1)]]==r[h(t-1)]&&s[_[h(t)]]==a||""==r[h(t-1)]).every(e=>e);if(e[_[h(l-1)]]==c&&o){const i=e[_[h(l)]];return T(l,b)?A(l).filter(e=>L(i).includes(L(e))):i}}).filter(e=>e),e=C(e);return e.sort(k),e},T=e=>{var t=Object.keys(b);return!!g.hasOwnProperty("filtro-"+t[e])},A=e=>{var t=Object.keys(b);return g.hasOwnProperty("filtro-"+t[e])?g["filtro-"+t[e]]:[]},a=(t,a)=>{var r=Object.keys(b);const o=p();for(let s=t+1;s<=r.length&&r.length!=s;s++){let e=n(t,s,a);0==e.length&&(e=((s,a,r)=>{var e=m.entries.flatMap(e=>{const t=e[_[h(a)]];return(e[_[h(s)]]==r||""==r)&&(T(a,b)?A(a).filter(e=>L(t).includes(L(e))):t)}).filter(e=>e),e=C(e);return e.sort(k),e})(t,s,a));const i=document.querySelector("#"+r[s]);i.innerHTML="",i.appendChild(x(s,"Todos","",!0)),e.forEach(e=>{var t;e.trim()&&(t=o[s]==e,i.appendChild(x(s,e,e,t)))})}},t=()=>{return window.location.hash.replace("#","")||!1},O=()=>{var e=jQuery.fn.DataTable.ext.type.search;e.string=e=>e?"string"==typeof e?replaceSpecialChars(e):e:"",e.html=e=>e?"string"==typeof e?replaceSpecialChars(e.replace(/<.*?>/g,"")):e:"";let n=jQuery("#ponchoTable").DataTable({lengthChange:!1,autoWidth:!1,pageLength:u.cantidadItems,columnDefs:[{type:"html-num",targets:u.tipoNumero},{targets:u.ocultarColumnas,visible:!1}],ordering:u.orden,order:[[u.ordenColumna-1,u.ordenTipo]],dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'i>><'row'<'col-sm-12'tr>><'row'<'col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8'p>>",language:{sProcessing:"Procesando...",sLengthMenu:"Mostrar _MENU_ registros",sZeroRecords:"No se encontraron resultados",sEmptyTable:"Ningún dato disponible en esta tabla",sInfo:"_TOTAL_ resultados",sInfoEmpty:"No hay resultados",sInfoFiltered:"",sInfoPostFix:"",sSearch:"Buscar:",sUrl:"",sInfoThousands:".",sLoadingRecords:"Cargando...",oPaginate:{sFirst:"<<",sLast:">>",sNext:">",sPrevious:"<"},oAria:{sSortAscending:": Activar para ordenar la columna de manera ascendente",sSortDescending:": Activar para ordenar la columna de manera descendente",paginate:{first:"Ir a la primera página",previous:"Ir a la página anterior",next:"Ir a la página siguiente",last:"Ir a la última página"}}}});jQuery("#ponchoTableSearch").keyup(function(){n.search(jQuery.fn.DataTable.ext.type.search.string(this.value)).draw()}),jQuery("#ponchoTable_filter").parent().parent().remove(),1<document.querySelectorAll("#ponchoTableFiltro option").length&&(document.querySelector("#ponchoTableFiltroCont").style.display="block"),jQuery("select[data-filter]").change(function(){var e=jQuery(this).find("option:selected").data("column"),t=jQuery(this).find("option:selected").val();a(e,t),n.columns().search("").columns().search("").draw();const o=Object.keys(b),i=p();i.forEach((e,t)=>{s=o[t];var s=Object.keys(m.headers).indexOf("filtro-"+s),a=l(i[t]),r=l(replaceSpecialChars(i[t]));T(t,b)?n.columns(s).search(L(i[t])):n.columns(s).search(i[t]?`^(${a}|${r})$`:"",!0,!1,!0)}),n.draw()}),u.hasOwnProperty("hash")&&u.hash&&(e=(e=t())?decodeURIComponent(e):"",document.querySelector("#ponchoTableSearch").value=e,n.search(jQuery.fn.DataTable.ext.type.search.string(e)).draw())},r=e=>{(m=e).entries="function"==typeof u.refactorEntries&&null!==u.refactorEntries?u.refactorEntries(m.entries):m.entries,m.headers=(u.hasOwnProperty("headers")&&u.headers?u:m).headers,_=Object.keys(m.headers).filter(e=>e.startsWith("filtro-")),g=u.asFilter?u.asFilter(m.entries):{},b=((r,o)=>{let i={};return o.forEach((t,s)=>{let e=[];e=g.hasOwnProperty(o[s])?g[o[s]]:r.entries.map(e=>e[t]);var a=C(e);a.sort(k),t=t.replace("filtro-",""),i[t]=[],a.forEach(e=>{i[t].push({columna:s,value:e})})}),i})(m,_),u.hasOwnProperty("filterContClassList")&&u.filterContClassList&&((e=document.getElementById("ponchoTableFiltroCont")).removeAttribute("class"),e.classList.add(...u.filterContClassList)),u.hasOwnProperty("searchContClassList")&&u.searchContClassList&&((e=document.getElementById("ponchoTableSearchCont")).removeAttribute("class"),e.classList.add(...u.searchContClassList));{var i=m;(e=document.querySelector("#ponchoTable thead")).innerHTML="";const c=document.createElement("tr"),d=(Object.keys(i.headers).forEach((e,t)=>{var s=document.createElement("th");s.textContent=i.headers[e],s.setAttribute("scope","col"),c.appendChild(s)}),e.appendChild(c),(e=document.querySelector("#ponchoTable caption")).innerHTML="",e.textContent=u.tituloTabla,document.querySelector("#ponchoTable tbody"));d.innerHTML="",i.entries.forEach((r,e)=>{if(Object.values(r).some(e=>e.trim())){r="function"==typeof u.customEntry&&null!==u.customEntry?u.customEntry(r):r;const o=d.insertRow();o.id="id_"+e;let a;w()&&(e=u.hasOwnProperty("markdownOptions")?u.markdownOptions:v,a=j(e.extensions)?e:{}),Object.keys(i.headers).forEach(e=>{filas=r[e],e.startsWith("btn-")&&""!=filas?filas=S(e.replace("btn-","").replace("-"," "),filas):e.startsWith("fecha-")&&""!=filas&&(filas=E(filas));var t=o.insertCell(),s=(t.dataset.title=i.headers[e],""==filas&&(t.className="hidden-xs"),u.hasOwnProperty("allowedTags")?u.allowedTags:y),s=e.startsWith("btn-")&&""!=filas?[...s,"a"]:s,e=secureHTML(filas,s);w()?(s=new showdown.Converter(a),t.innerHTML=s.makeHtml(e)):t.innerHTML=e})}})}var t=m,s=document.querySelector("#ponchoTableFiltro");for(f in s.innerHTML="",b){const h=b[f][0].columna||0;var a,r=b[f].map(e=>e.value).sort(k),o=document.createElement("div"),n=(u.hasOwnProperty("filterClassList")?(a="string"==typeof u.filterClassList?u.filterClassList.split(" "):u.filterClassList,o.classList.add(...a)):(a=Math.floor(12/Object.keys(b).length),o.classList.add("col-sm-12","col-md-"+a)),document.createElement("div")),l=(n.className="form-group",document.createElement("label"));l.setAttribute("for",f),l.textContent=t.headers["filtro-"+f];const p=document.createElement("select");p.classList.add("form-control"),p.dataset.filter=1,p.name=f,p.id=f,p.appendChild(x(h,"Todos","",!0)),r.forEach(e=>{e&&p.appendChild(x(h,e,e,!1))}),n.appendChild(l),n.appendChild(p),o.appendChild(n),s.appendChild(o)}document.querySelector("#ponchoTableSearchCont").style.display="block",document.querySelector("#ponchoTable").classList.remove("state-loading"),O()},o=e=>{jQuery.getJSON(e,function(e){var t=new GapiSheetData;m=t.json_data(e),r(m)})};if(u.jsonData){var e=Object.fromEntries(Object.keys(u.jsonData[0]).map(e=>[e,e])),e={entries:u.jsonData,headers:e};r(e)}else if(u.jsonUrl)o(u.jsonUrl);else if(u.hojaNombre&&u.idSpread){e=(new GapiSheetData).url(u.hojaNombre,u.idSpread);o(e)}else{if(!u.hojaNumero||!u.idSpread)throw"¡Error! No hay datos suficientes para crear la tabla.";{var i=u.hojaNumero;const c=new GapiSheetData;e=["https://sheets.googleapis.com/v4/spreadsheets/",u.idSpread,"/?alt=json&key=",c.gapi_key].join("");jQuery.getJSON(e,function(e){e=e.sheets[i-1].properties.title,e=c.url(e,u.idSpread);o(e)})}}};var content_popover=document.getElementById("content-popover");function popshow(){content_popover.classList.toggle("hidden")}function pophidde(){content_popover.classList.add("hidden")}var ponchoUbicacion=function(e){var s,a,r,o,t="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geoprovincias.json",i="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geolocalidades.json",n=jQuery('input[name="submitted['+e.provincia+']"]'),l=jQuery('input[name="submitted['+e.localidad+']"]');function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e,t,s,a=!1,r=!1,o=!1){var i=jQuery("<select></select>").attr("id",t).attr("name",e).addClass("form-control form-select").prop("required",a);return r&&i.append("<option value=''>Seleccione una opción</option>"),jQuery.each(s,function(e,t){let s="";o==t.nombre&&(s='selected="selected"'),i.append("<option value='"+t.id+"' "+s+">"+t.nombre+"</option>")}),i}function h(e,t){var s=l.prop("required");return n.val()?d("sLocalidades","sLocalidades",e.filter(function(e){return String(e.provincia.id)==String(t)}).map(function(e){return e.departamento.nombre&&(e.nombre=c(e.departamento.nombre.toLowerCase())+" - "+c(e.nombre.toLowerCase())),e}).sort(function(e,t){e=e.nombre.toUpperCase(),t=t.nombre.toUpperCase();return e.localeCompare(t)}),s,emptyOption=!!l.val(),l.val()):d("sLocalidades","sLocalidades",[],s,!0,!1)}t=e.urlProvincias||t,i=e.urlLocalidades||i,jQuery.getJSON(t,function(e){var t;s=[],e.results.forEach(function(e,t){s.push(e)}),e=[],e=(t=s).sort(function(e,t){e=e.nombre.toUpperCase(),t=t.nombre.toUpperCase();return e.localeCompare(t)}),t=n.prop("required"),(r=d("sProvincias","sProvincias",e,t,!0,n.val())).on("change",function(e){var t;n.val(""),l.val(""),o.children("option:not(:first)").remove(),""!=r.val()&&(n.val(r.find(":selected").text()),t=h(a,r.val()).find("option"),o.append(t),o.val(""))}),n.after(r),jQuery(r).select2()}),jQuery.getJSON(i,function(e){a=[],e.results.forEach(function(e,t){a.push(e)}),(o=h(a,r.val())).on("change",function(e){l.val(""),""!=o.val()&&l.val(o.find(":selected").text())}),l.after(o),jQuery(o).select2()}),n.hide(),l.hide()};function ponchoChart(t){"use strict";var e;function _e(e){return"HeatMap"==e?"heatmap":"Mixed"==e?"mixed":"Stacked Bar"==e?"bar":"Horizontal Bar"==e?"horizontalBar":"Area"==e?"line":"Pie"==e?"pie":"Bar"==e?"bar":"Line"==e?"line":""}function be(e){var t="";switch(e){case"celeste":case"info":t="#2897d4";break;case"verde":case"success":t="#2e7d33";break;case"rojo":case"danger":t="#c62828";break;case"amarillo":case"warning":t="#f9a822";break;case"azul":case"primary":t="#0072bb";break;case"negro":case"black":t="#333";break;case"uva":t="#6a1b99";break;case"gris":case"muted":t="#525252";break;case"grisintermedio":case"gris-area":case"gray":t="#f2f2f2";break;case"celesteargentina":case"celeste-argentina":t="#37bbed";break;case"fucsia":t="#ec407a";break;case"arandano":t="#c2185b";break;case"cielo":t="#039be5";break;case"verdin":t="#6ea100";break;case"lima":t="#cddc39";break;case"maiz":case"maíz":t="#ffce00";break;case"tomate":t="#ef5350";break;case"naranjaoscuro":case"naranja":t="#EF6C00";break;case"verdeazulado":case"verde-azulado":t="#008388";break;case"escarapela":t="#2cb9ee";break;case"lavanda":t="#9284be";break;case"mandarina":t="#f79525";break;case"palta":t="#50b7b2";break;case"cereza":t="#ed3d8f";break;case"limon":t="#d7df23";break;case"verdejade":case"verde-jade":t="#066";break;case"verdealoe":case"verde-aloe":t="#4fbb73";break;case"verdecemento":case"verde-cemento":t="#b4beba";break;default:console.log("No existe color "+e)}return t}function ge(e){var e=e.toString().replace(".",","),t=e.split(","),s=new Intl.NumberFormat("es-AR",{maximumFractionDigits:2}).format(t[0]);return e=1<t.length?s.concat(",",t[1].substr(0,2)):s}function s(e,a){var F,t,s,H,r,o,z,N,B,i,n,G,D,l,c,$,Q,R,d,h,U,p,V,u,W,m,f=[],_=[],b=[],J=[],g=[],y=[],v=[],k=[],C=0,x="",Y=[],w=0,j=[],Z=[],X=0,S=a.posicionLeyendas||"top",E="",E=void 0===a.mostrarLeyendas||a.mostrarLeyendas,L="",L=void 0===a.mostrarTotalStacked||a.mostrarTotalStacked,T=_e(a.tipoGrafico),A=e.values;if(jQuery.each(Object.keys(A[0]),function(e,t){var s;"eje-y"==A[0][e].substr(0,5)?(s=(s=A[0][e].split("-"))[0]+s[1],_.push(s),b.push(e)):"nombre-corto"==A[0][e]&&"heatmap"==T&&(X=e)}),jQuery.each(A,function(r,e){var a;0==r&&jQuery.each(b,function(e,t){var s=A[r][b[e]].split("-"),a=s[0]+s[1];v[a]=[],J.push(s[2]),"mixed"==T&&(3<s.length&&("barra"==s[3]||"linea"==s[3])?Y.push(s[3]):(0==e&&Y.push("barra"),1==e&&Y.push("linea")))}),1==r&&jQuery.each(b,function(e,t){"pie"==T||"heatmap"==T?f.push(A[r][b[e]]):(y.push(A[r][b[e]]),C+=1)}),1<r&&(a=!1,jQuery.each(b,function(e,t){var s=A[0][b[e]].split("-"),s=s[0]+s[1];"pie"==T?v[s].push(A[r][b[e]]):"heatmap"==T?(0==a&&(y.push(A[r][0]),a=!0,C+=1),e!=X&&v[s].push(A[r][b[e]]),e+2==X&&(void 0===A[r][e+2]?Z.push("*"):Z.push(A[r][e+2]))):(0==a&&(f.push(A[r][0]),a=!0),v[s].push(A[r][b[e]]))}))}),"pie"==T?(F=[],jQuery.each(Object.keys(_),function(e,t){e=_[e];v.hasOwnProperty(e)&&F.push(v[e])}),k=F):1==C&&jQuery.each(Object.keys(_),function(e,t){e=_[e];v.hasOwnProperty(e)&&(k=v[e])}),"mixed"!=T||0<(t=a.porcentajesMixed||"").length&&(j=t.split(",")),x=1==a.porcentajes?"line"==T&&1<C?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"}},mode:"index",intersect:!1}:"pie"==T?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.labels[e.index]+": "+s+"%"}}}:"Stacked Bar"==a.tipoGrafico?1==L?{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"},footer:(e,t)=>{e=e.reduce((e,t)=>e+parseFloat(t.yLabel),0);return"Total: "+new Intl.NumberFormat("es-AR",{maximumFractionDigits:2}).format(e)+"%"}}}:{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"}}}:{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s+"%"}}}:"line"==T&&1<C?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s}},mode:"index",intersect:!1}:"pie"==T?{enabled:!0,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.labels[e.index]+": "+s}}}:"Stacked Bar"==a.tipoGrafico&&1<C?1==L?{enabled:!0,mode:"index",intersect:!1,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s},footer:(e,t)=>{e=e.reduce((e,t)=>e+parseFloat(t.yLabel),0);return"Total: "+new Intl.NumberFormat("es-AR",{maximumFractionDigits:2}).format(e)}}}:{enabled:!0,mode:"index",intersect:!1,callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s}}}:{enabled:!0,mode:"index",callbacks:{label:function(e,t){var s=ge(t.datasets[e.datasetIndex].data[e.index]);return t.datasets[e.datasetIndex].label+": "+s}}},"pie"==T&&(J.forEach(function(e,t,s){g.push(be(e))}),console.log("etiquetas --\x3e "+f),console.log("datos --\x3e "+k),console.log("colores --\x3e "+g),t=f,L=k,B=T,i=g,s=a.idComponenteGrafico,G=S,D=x,n=E,s=document.getElementById(s),new Chart(s,{type:B,data:{labels:t,datasets:[{data:L,borderColor:i,backgroundColor:i,borderWidth:2}]},options:{legend:{display:n,position:G},responsive:!0,tooltips:D}})),1==C&&(console.log("etiquetas --\x3e "+f),console.log("datos --\x3e "+k),s=be(J[0]),console.log("color --\x3e "+s),"Line"==a.tipoGrafico&&(B=f,L=k,i=T,n=s,G=y[0],D=a.ejeYenCero,l=a.idComponenteGrafico,c=S,$=x,Q=E,l=document.getElementById(l),new Chart(l,{type:i,data:{labels:B,datasets:[{data:L,borderColor:n,backgroundColor:n,borderWidth:2,lineTension:0,fill:!1,label:G}]},options:{legend:{display:Q,position:c},tooltips:$,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:D}}]}}})),"bar"!=T&&"Area"!=a.tipoGrafico||(l=f,L=k,Q=T,c=s,$=y[0],H=a.ejeYenCero,r=a.idComponenteGrafico,o=S,z=x,N=E,r=document.getElementById(r),new Chart(r,{type:Q,data:{labels:l,datasets:[{data:L,borderColor:c,backgroundColor:c,borderWidth:2,lineTension:0,label:$}]},options:{legend:{display:N,position:o},tooltips:z,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:H}}]}}})),"horizontalBar"==T&&(r=f,L=k,N=T,o=s,z=y[0],H=a.ejeYenCero,O=a.idComponenteGrafico,re=S,oe=x,ee=E,O=document.getElementById(O),new Chart(O,{type:N,data:{labels:r,datasets:[{data:L,borderColor:o,backgroundColor:o,borderWidth:2,lineTension:0,label:z}]},options:{legend:{display:ee,position:re},tooltips:oe,responsive:!0,scales:{xAxes:[{ticks:{beginAtZero:H}}]}}}))),1<C)if("heatmap"==T)if(void 0!==a.heatMapColors&&""!=a.heatMapColors&&void 0!==a.heatMapColorsRange&&""!=a.heatMapColorsRange){for(var K=[],O="labelFila",L="labelColumna",ee="labelValor",te=(void 0!==a.datosTooltip&&0<a.datosTooltip.length&&(void 0!==a.datosTooltip[0]&&void 0!==a.datosTooltip[0].labelFila&&(O=a.datosTooltip[0].labelFila),void 0!==a.datosTooltip[1]&&void 0!==a.datosTooltip[1].labelColumna&&(L=a.datosTooltip[1].labelColumna),void 0!==a.datosTooltip[2]&&void 0!==a.datosTooltip[2].labelValor&&(ee=a.datosTooltip[2].labelValor)),jQuery.each(Object.keys(_),function(e,t){e=_[e];v.hasOwnProperty(e)&&(k=v[e],K.push(k))}),[]),I=0;I<y.length;I++){for(var e=[],se=0;se<f.length;se++){k={x:f[se],y:parseInt(K[se][I])};e.push(k)}te.push({name:("*"!=Z[I]?Z:y)[I],data:e})}for(var ae=[],I=0;I<a.heatMapColorsRange.length-1;I++){e={from:a.heatMapColorsRange[I],to:a.heatMapColorsRange[I+1],color:be(a.heatMapColors[I])};ae.push(e)}var re="",re=void 0===a.mostrarEjeY||a.mostrarEjeY,oe=te,ie=a.idComponenteGrafico,ne=y,le=ae,ce=O,de=L,he=ee,L=a.tituloGrafico,M=re,pe=S,ue=E,ie=document.getElementById(ie),me=(new ApexCharts(ie,{series:oe,chart:{height:650,type:"heatmap"},dataLabels:{enabled:!1},title:{text:L},tooltip:{custom:function({series:e,seriesIndex:t,dataPointIndex:s,w:a}){e=ge(e[t][s]);return'<div class="arrow_box"><span>'+ce+": "+ne[t]+"<br>"+de+": "+a.globals.labels[s]+"<br>"+he+": "+e+"</span></div>"}},plotOptions:{heatmap:{shadeIntensity:.5,radius:0,useFillColorAsStroke:!1,colorScale:{ranges:le}}},yaxis:{show:M},legend:{show:ue,position:pe},responsive:[{breakpoint:1e3,options:{yaxis:{show:!1},legend:{show:ue,position:"top"}}}]}).render(),document.getElementsByClassName("apexcharts-toolbar"));for(let e=0;e<me.length;e++)me[e].style.display="none"}else void 0!==a.heatMapColors&&""!=a.heatMapColors||console.log("Completar vector con valores para los colores"),void 0!==a.heatMapColorsRange&&""!=a.heatMapColorsRange||console.log("Completar vector con el rango de valores para los colores");else{var P=[],q=0,fe=(J.forEach(function(e,t,s){g.push(be(e))}),console.log("colores --\x3e "+g),0);jQuery.each(Object.keys(_),function(e,t){var s,e=_[e];v.hasOwnProperty(e)&&(k=v[e],console.log("datos --\x3e "+k),"Line"==a.tipoGrafico?s={label:y[q],data:k,borderColor:g[q],fill:!1,borderWidth:2,lineTension:0,backgroundColor:g[q]}:"Bar"==a.tipoGrafico||"Area"==a.tipoGrafico||"Horizontal Bar"==a.tipoGrafico||"Stacked Bar"==a.tipoGrafico?s={label:y[q],data:k,borderColor:g[q],backgroundColor:g[q],borderWidth:2,lineTension:0}:"Mixed"==a.tipoGrafico&&("barra"==(e=Y[fe])?s={label:y[q],data:k,backgroundColor:g[q],yAxisID:"left-y-axis",type:"bar"}:"linea"==e&&(s={label:y[q],data:k,borderColor:g[q],backgroundColor:g[q],type:"line",yAxisID:"right-y-axis",fill:!1})),P.push(s),q+=1,fe+=1)}),"mixed"==T&&(2==j.length?w=2:1==j.length?"eje-y1"==j[0]?w=0:"eje-y2"==j[0]&&(w=1):w=3),console.log("etiquetas --\x3e "+f),console.log("toltip --\x3e"+JSON.stringify(x)),"Stacked Bar"==a.tipoGrafico?(ie=f,L=T,le=P,M=a.idComponenteGrafico,pe=a.ejeYenCero,ue=S,j=x,W=E,M=document.getElementById(M),new Chart(M,{type:L,data:{labels:ie,datasets:le},options:{legend:{display:W,position:ue,labels:{textAlign:"center"}},tooltips:j,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:pe},stacked:!0}],xAxes:[{stacked:!0}]}}})):"Mixed"==a.tipoGrafico?(L=f,W="bar",j=P,d=a.idComponenteGrafico,h=a.ejeYenCero,U=S,p=w,w=y[0],V=y[1],u=E,d=document.getElementById(d),new Chart(d,{type:W,data:{labels:L,datasets:j},options:{legend:{display:u,position:U,labels:{textAlign:"center"}},tooltips:{enabled:!0,mode:"single",callbacks:{label:function(e,t){var s="",a=((2==p||e.datasetIndex==p)&&(s="%"),ge(e.yLabel));return t.datasets[e.datasetIndex].label+": "+a+" "+s}}},responsive:!0,scales:{yAxes:[{id:"left-y-axis",type:"linear",position:"left",ticks:{beginAtZero:h,callback:function(e){return e+(1!=p&&2!=p?"":"%")}},scaleLabel:{display:!0,labelString:V,fontColor:"black"}},{id:"right-y-axis",type:"linear",position:"right",ticks:{beginAtZero:h,callback:function(e){return e+(0!=p&&2!=p?"":"%")}},scaleLabel:{display:!0,labelString:w,fontColor:"black"}}]}}})):"Horizontal Bar"==a.tipoGrafico?(d=f,L=T,j=P,u=a.idComponenteGrafico,U=a.ejeYenCero,V=S,h=x,w=E,u=document.getElementById(u),new Chart(u,{type:L,data:{labels:d,datasets:j},options:{legend:{display:w,position:V,labels:{textAlign:"center"}},tooltips:h,responsive:!0,maintainAspectRatio:!0,scales:{xAxes:[{ticks:{beginAtZero:U}}]}}})):(L=f,j=T,w=P,m=a.idComponenteGrafico,R=a.ejeYenCero,S=S,x=x,E=E,m=document.getElementById(m),new Chart(m,{type:j,data:{labels:L,datasets:w},options:{legend:{display:E,position:S,labels:{textAlign:"center"}},tooltips:x,responsive:!0,maintainAspectRatio:!0,scales:{yAxes:[{ticks:{beginAtZero:R}}]}}}))}""!=a.tituloGrafico&&void 0!==a.tituloGrafico&&(m=a.idTagTituloGrafico,j=a.tituloGrafico,document.getElementById(m)&&(document.getElementById(m).innerHTML=j))}!function(e){var t=!1;(e.idSpread&&e.hojaNombre||e.jsonUrl||e.jsonInput)&&void 0!==e.tipoGrafico&&""!=e.tipoGrafico&&void 0!==e.idComponenteGrafico&&""!=e.idComponenteGrafico&&""!=_e(e.tipoGrafico)&&(t=!0);return t}(t)?(void 0!==t.idSpread&&""!=t.idSpread||console.log("Completar valor para la opción de Configuración idSpread"),void 0!==t.hojaNombre&&""!=t.hojaNombre||console.log("Completar valor para la opción de Configuración hojaNombre"),void 0!==t.tipoGrafico&&""!=t.tipoGrafico||console.log("Completar valor para la opción de Configuración tipoGrafico"),void 0!==t.idComponenteGrafico&&""!=t.idComponenteGrafico||console.log("Completar valor para la opción de Configuración idComponenteGrafico"),""==_e(t.tipoGrafico)&&console.log("Ingrese un tipo de gafico válido")):t.jsonInput?(console.log(t.jsonInput),s(jQuery.parseJSON(t.jsonInput),t)):(e=t.jsonUrl||"https://sheets.googleapis.com/v4/spreadsheets/"+t.idSpread+"/values/"+t.hojaNombre+"?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",jQuery.getJSON(e,function(e){s(e,t)}))}const gapi_legacy=e=>{const o=e.values[0],i=/ |\/|_/gi;let n=[];return e.values.forEach((e,t)=>{if(0<t){var s={};for(const r in o){var a=e.hasOwnProperty(r)?e[r].trim():"";s["gsx$"+o[r].toLowerCase().replace(i,"")]={$t:a}}n.push(s)}}),{feed:{entry:n}}};class PonchoMap{constructor(e,t){var s={error_reporting:!1,no_info:!1,title:!1,id:"id",template:!1,template_structure:{container_classlist:["info-container"],title_classlist:["h4","text-primary","m-t-0"],definition_list_classlist:["definition-list"],term_classlist:["h6","m-b-0"],definition_classlist:[],definition_list_tag:"dl",term_tag:"dt",definition_tag:"dd"},allowed_tags:[],template_innerhtml:!1,template_markdown:!1,markdown_options:{tables:!0,simpleLineBreaks:!0,extensions:["details","images","alerts","numbers","ejes","button","target","bootstrap-tables","video"]},render_slider:!0,scope:"",slider:!1,scroll:!1,hash:!1,headers:{},header_icons:[],content_selector:!1,map_selector:"map",anchor_delay:0,slider_selector:".slider",map_view:[-40.44,-63.59],map_anchor_zoom:16,map_zoom:4,min_zoom:2,reset_zoom:!0,latitud:"latitud",longitud:"longitud",marker:"azul",tooltip:!1,tooltip_options:{direction:"auto",className:"leaflet-tooltip-own"},marker_cluster_options:{spiderfyOnMaxZoom:!1,showCoverageOnHover:!1,zoomToBoundsOnClick:!0,maxClusterRadius:45,spiderfyDistanceMultiplier:3,spiderLegPolylineOptions:{weight:1,color:"#666",opacity:.5,"fill-opacity":.5}},accesible_menu_extras:[{text:"Ayudá a mejorar el mapa",anchor:"https://www.argentina.gob.ar/sugerencias"}]},a=Object.assign({},s,t);this.error_reporting=a.error_reporting,this.scope=a.scope,this.render_slider=a.render_slider,this.template=a.template,this.template_structure={...s.template_structure,...t.template_structure},this.template_innerhtml=a.template_innerhtml,this.template_markdown=a.template_markdown,this.markdown_options=a.markdown_options,this.allowed_tags=a.allowed_tags,this.map_selector=a.map_selector,this.headers=this.setHeaders(a.headers),this.header_icons=a.header_icons,this.hash=a.hash,this.scroll=a.scroll,this.map_view=a.map_view,this.anchor_delay=a.anchor_delay,this.map_zoom=a.map_zoom,this.min_zoom=a.min_zoom,this.map_anchor_zoom=a.map_anchor_zoom,this.tooltip_options=a.tooltip_options,this.tooltip=a.tooltip,this.marker_cluster_options=a.marker_cluster_options,this.marker_color=a.marker,this.id=a.id,this.title=a.title,this.latitude=a.latitud,this.longitude=a.longitud,this.slider=a.slider,this.no_info=a.no_info,this.reset_zoom=a.reset_zoom,this.slider_selector=this._selectorName(a.slider_selector),this.selected_marker,this.scope_selector=`[data-scope="${this.scope}"]`,this.scope_sufix="--"+this.scope,this.content_selector=a.content_selector||".js-content"+this.scope_sufix,this.data=this.formatInput(e),this.geometryTypes=["Point","LineString","Polygon","MultiPoint","MultiLineString"],this.featureStyle={stroke:"dodgerblue","stroke-opacity":1,"stroke-width":2,"fill-opacity":.5},this.accesible_menu_search=[],this.accesible_menu_filter=[],this.accesible_menu_extras=a.accesible_menu_extras,this.geojson,this.map=new L.map(this.map_selector,{renderer:L.svg()}).setView(this.map_view,this.map_zoom),new L.tileLayer("https://mapa-ign.argentina.gob.ar/osm/{z}/{x}/{-y}.png",{attribution:'Contribuidores: <a href="https://www.ign.gob.ar/AreaServicios/Argenmap/Introduccion" target="_blank">Instituto Geográfico Nacional</a>, <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>'}).addTo(this.map),this.markers=new L.markerClusterGroup(this.marker_cluster_options)}isGeoJSON=e=>"FeatureCollection"===e?.type;get entries(){return this.data.features}get geoJSON(){return this.featureCollection(this.entries)}formatInput=e=>{e.length<1&&this.errorMessage("No se puede visualizar el mapa, el documento está vacío","warning");let t;return t=this.isGeoJSON(e)?e:(e=this.features(e),this.featureCollection(e)),this._setIdIfNotExists(t)};errorMessage=(e=!1,t="danger")=>{document.querySelectorAll("#js-error-message"+this.scope_sufix).forEach(e=>e.remove());var s=document.createElement("div"),a=(s.id="js-error-message"+this.scope_sufix,s.classList.add("poncho-map--message",t),document.createElement("h2")),r=(a.classList.add("h6","title"),a.textContent="¡Se produjo un error!",document.createElement("pre")),o=(r.textContent=e,document.createElement("a"));throw o.href="https://github.com/argob/poncho/blob/master/src/demo/poncho-maps/readme-poncho-maps.md",o.target="_blank",o.textContent="Ayuda sobre las opciones de PonchoMap",o.className="small",o.title="Abre el enlace en una nueva ventana",s.appendChild(a),s.appendChild(r),s.appendChild(o),this.error_reporting&&(a=document.querySelector(this.scope_selector+".poncho-map")).parentNode.insertBefore(s,a),"danger"==t&&document.getElementById(this.map_selector).remove(),console.log(this.critical_error),e};feature=e=>{var t=e[this.latitude],s=e[this.longitude];return[t,s].forEach(e=>{isNaN(Number(e))&&this.errorMessage("El archivo contiene errores en la definición de latitud y longitud.\n "+e)}),delete e[this.latitude],delete e[this.longitude],{type:"Feature",properties:e,geometry:{type:"Point",coordinates:[s,t]}}};featureCollection=e=>({type:"FeatureCollection",features:e});features=e=>e.map(this.feature);_setIdIfNotExists=e=>{var t;return e.features.filter((e,t)=>0===t).every(e=>e.properties.hasOwnProperty("id"))||(t=e.features.map((e,t)=>{var t=t+1,s=this.title&&e.properties[this.title]?"-"+slugify(e.properties[this.title]):"";return e.properties.id=t+s,e}),e.features=t),e};addHash=e=>{if(!this.hash||this.no_info)return null;window.location.hash="#"+e};entry=t=>this.entries.find(e=>e.properties[this.id]==t);searchEntries=(t,e)=>{return e=void 0===e?this.geoJSON:e,t?e.filter(e=>{if(this.searchEntry(t,e.properties))return e}):e};searchEntry=(e,t)=>{for(const r of[...new Set([this.title,...this.search_fields])].filter(e=>e))if(t.hasOwnProperty(r)){var s=replaceSpecialChars(e).toUpperCase(),a=replaceSpecialChars(t[r]).toString().toUpperCase();try{if(a.includes(s))return t}catch(e){console.error(e)}}return null};_selectorName=e=>e.replace(/^(\.|\#)/,"");scrollCenter=()=>{var e=document.getElementById(this.map_selector),t=e.getBoundingClientRect(),e=(e.offsetLeft+e.offsetWidth)/2,t=t.top+window.scrollY;window.scrollTo({top:t,left:e,behavior:"smooth"})};_clearContent=()=>document.querySelector(".js-content"+this.scope_sufix).innerHTML="";toggleSlider=()=>{this.no_info||(document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>{e.classList.toggle(this.slider_selector+"--in")}),document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>{e.style.display=this.isSliderOpen()?"block":"none"}))};_focusOnFeature=t=>{this.map.eachLayer(e=>{e?.options?.id==t&&(e?._path?e._path.focus():e?._icon&&e._icon.focus())})};_clickToggleSlider=()=>document.querySelectorAll(".js-close-slider"+this.scope_sufix).forEach(e=>e.addEventListener("click",()=>{this._clearContent(),this.toggleSlider(),this._focusOnFeature(e.dataset.entryId)}));isSliderOpen=()=>{let t=[];return document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>{e.classList.contains(this.slider_selector+"--in")&&t.push(!0)}),t.some(e=>e)};setContent=t=>{if(!this.no_info){this._focusOnSlider(),this.isSliderOpen()||this.toggleSlider();const s="function"==typeof this.template?this.template(this,t):this.defaultTemplate(this,t);document.querySelectorAll(this.content_selector).forEach(e=>{e.innerHTML=s}),document.querySelectorAll(".js-close-slider"+this.scope_sufix).forEach(e=>{e.dataset.entryId=t[this.id]})}};_focusOnSlider=()=>{var e;this.no_info||(this.isSliderOpen()?document.querySelector(".js-close-slider"+this.scope_sufix).focus():(e=document.querySelector(".js-slider"+this.scope_sufix))&&e.addEventListener("animationend",()=>{document.querySelector(".js-close-slider"+this.scope_sufix).focus()}))};setHeaders=e=>{var t;return[this.template_structure,this.template_structure.mixing].every(e=>e)?(t=this.template_structure.mixing.reduce((e,t)=>{if([t.key].every(e=>e))return{...e,[t.key]:t.header||""}},{}),{...e,...t}):e};header=e=>this.headers.hasOwnProperty(e)?this.headers[e]:e;_renderSlider=()=>{var e,t,s,a;this.render_slider&&!this.no_info&&(document.querySelectorAll(".js-slider"+this.scope_sufix).forEach(e=>e.remove()),(e=document.createElement("button")).classList.add("btn","btn-xs","btn-secondary","btn-close","js-close-slider"+this.scope_sufix),e.title="Cerrar panel",e.setAttribute("role","button"),e.setAttribute("aria-label","Cerrar panel de información"),e.innerHTML='<span class="sr-only">Cerrar</span>✕',(t=document.createElement("a")).setAttribute("tabindex",0),t.id="js-anchor-slider"+this.scope_sufix,(s=document.createElement("div")).classList.add("content-container"),(a=document.createElement("div")).classList.add("content","js-content"+this.scope_sufix),a.tabIndex=0,s.appendChild(a),(a=document.createElement("div")).style.display="none",a.setAttribute("role","region"),a.setAttribute("aria-live","polite"),a.setAttribute("aria-label","Panel de información"),a.classList.add("slider","js-slider"+this.scope_sufix),a.id="slider"+this.scope_sufix,a.appendChild(e),a.appendChild(t),a.appendChild(s),document.querySelector(this.scope_selector+".poncho-map").appendChild(a))};_showSlider=(e,t)=>{e.hasOwnProperty("_latlng")?this.map.setView(e._latlng,this.map_anchor_zoom):this.map.fitBounds(e.getBounds()),e.fireEvent("click")};_showPopup=e=>{e.hasOwnProperty("_latlng")?this.markers.zoomToShowLayer(e,()=>{e.openPopup()}):(this.map.fitBounds(e.getBounds()),e.openPopup())};removeHash=()=>history.replaceState(null,null," ");hasHash=()=>{return window.location.hash.replace("#","")||!1};gotoHashedEntry=()=>{var e=this.hasHash();e&&this.gotoEntry(e)};gotoEntry=t=>{const s=this.entry(t),a=(e,t,s)=>{e.options.hasOwnProperty("id")&&e.options.id==t&&(this._setSelectedMarker(t,e),this.hash&&this.addHash(t),this.slider&&this.hash?this._showSlider(e,s):this._showPopup(e))};this.markers.eachLayer(e=>a(e,t,s)),this.map.eachLayer(e=>{e.hasOwnProperty("feature")&&"Point"!=e.feature.geometry.type&&a(e,t,s)})};_setClickeable=s=>{s.on("keypress click",t=>{document.querySelectorAll(".marker--active").forEach(e=>e.classList.remove("marker--active")),["_icon","_path"].forEach(e=>{t.sourceTarget.hasOwnProperty(e)&&t.sourceTarget[e].classList.add("marker--active")});var e=this.entries.find(e=>e.properties[this.id]==s.options.id);this.setContent(e.properties)})};isFeature=e=>!!e.hasOwnProperty("feature");_clickeableFeatures=()=>{this.reset_zoom&&this.map.eachLayer(e=>{this.isFeature(e)&&"Point"!=e.feature.geometry.type&&"MultiPoint"!=e.feature.geometry.type&&this._setClickeable(e)})};_clickeableMarkers=()=>{this.no_info||this.markers.eachLayer(this._setClickeable)};_urlHash=()=>{const t=e=>{e.on("click",()=>{this.addHash(e.options.id)})};this.markers.eachLayer(t),this.map.eachLayer(e=>{e.hasOwnProperty("feature")&&"Point"!=e.feature.geometry.type&&"MultiPoint"!=e.feature.geometry.type&&t(e)})};removeListElement=(e,t)=>{t=e.indexOf(t);return-1<t&&e.splice(t,1),e};_templateTitle=e=>{if(!e.hasOwnProperty(this.title))return!1;var t=this.template_structure,s=!!t.hasOwnProperty("title")&&t.title,a=this.title||!1;if(t.hasOwnProperty("title")&&"boolean"==typeof t.title)return!1;if(!s&&!a)return!1;s=s||a;let r;t?.header?((a=document.createElement("div")).innerHTML=this._mdToHtml(t.header(this,e)),this.template_innerhtml&&(a.innerHTML=t.header(this,e)),r=a):((r=document.createElement("h2")).classList.add(...t.title_classlist),r.textContent=e[s]);a=document.createElement("header");return a.className="header",a.appendChild(r),a};_templateList=e=>{var t=this.template_structure,s=Object.keys(e);let a=s;if(t.hasOwnProperty("values")&&0<t?.values?.length)a=t.values;else if(t.hasOwnProperty("exclude")&&0<t.exclude.length)for(const r of t.exclude)a=this.removeListElement(s,r);return a};_mdToHtml=e=>{var t,s;return this.template_markdown&&this._markdownEnable()?(t=new showdown.Converter(this.markdown_options),s=secureHTML(e,this.allowed_tags),t.makeHtml((""+s).trim())):e};_markdownEnable=()=>!("undefined"==typeof showdown||!showdown.hasOwnProperty("Converter"));_templateMixing=r=>{if(this.template_structure.hasOwnProperty("mixing")&&0<this.template_structure.mixing.length){var e=this.template_structure.mixing;let a={};return e.forEach(e=>{var{values:e,separator:t=", ",key:s}=e;void 0===s&&this.errorMessage("Mixing requiere un valor en el atributo «key».","warning"),a[s]=e.map(e=>e in r?r[e]:e.toString()).filter(e=>e).join(t)}),Object.assign({},r,a)}return r};_setType=(e,t=!1,s=!1)=>"function"==typeof e?e(this,t,s):e;_lead=e=>{var t,s,a,r;if(this.template_structure.hasOwnProperty("lead"))return this.template_structure.lead.hasOwnProperty("key")||this.errorMessage("Lead requiere un valor en el atributo «key».","warning"),{key:a=!1,css:t="small",style:r=!1}=this.template_structure.lead,(s=document.createElement("p")).textContent=e[a],(a=this._setType(r,e))&&s.setAttribute("style",a),(r=this._setType(t,e))&&s.classList.add(...r.split(" ")),s};_termIcon=(e,t)=>{var s=this.header_icons.find(e=>e.key==t);if(s){var{css:s=!1,style:a=!1,html:r=!1}=s,r=this._setType(r,e,t),a=this._setType(a,e,t),s=this._setType(s,e,t);if(s)return(e=document.createElement("i")).setAttribute("aria-hidden","true"),e.classList.add(...s.split(" ")),a&&e.setAttribute("style",a),e;if(r)return(s=document.createElement("template")).innerHTML=r,s.content}return!1};defaultTemplate=(e,t)=>{t=this._templateMixing(t);var s,a,r=this["template_structure"],o=this._templateList(t),i=this._templateTitle(t),n=document.createElement("article"),l=(n.classList.add(...r.container_classlist),document.createElement(r.definition_list_tag));l.classList.add(...r.definition_list_classlist),l.style.fontSize="1rem";for(const c of o)t.hasOwnProperty(c)&&t[c]&&((s=document.createElement(r.term_tag)).classList.add(...r.term_classlist),(a=this._termIcon(t,c))&&(s.appendChild(a),s.insertAdjacentText("beforeend"," ")),s.insertAdjacentText("beforeend",this.header(c)),(a=document.createElement(r.definition_tag)).classList.add(...r.definition_classlist),a.textContent=t[c],this.template_markdown?a.innerHTML=this._mdToHtml(t[c]):this.template_innerhtml&&(a.innerHTML=secureHTML(t[c],this.allowed_tags)),""!=this.header(c)&&l.appendChild(s),l.appendChild(a));o=this._lead(t);return o&&n.appendChild(o),i&&n.appendChild(i),n.appendChild(l),n.outerHTML};icon=(e="azul")=>new L.icon({iconUrl:"https://www.argentina.gob.ar/sites/default/files/"+`marcador-${e}.svg`,iconSize:[29,40],iconAnchor:[14,40],popupAnchor:[0,-37]});resetView=()=>this.map.setView(this.map_view,this.map_zoom);fitBounds=()=>{try{this.map.fitBounds(this.geojson.getBounds())}catch(e){console.error(e)}};_resetViewButton=()=>{this.reset_zoom&&(document.querySelectorAll(".js-reset-view"+this.scope_sufix).forEach(e=>e.remove()),document.querySelectorAll(this.scope_selector+" .leaflet-control-zoom-in").forEach(e=>{var t=document.createElement("i"),s=(t.classList.add("fa","fa-expand"),t.setAttribute("aria-hidden","true"),document.createElement("a"));s.classList.add("js-reset-view"+this.scope_sufix,"leaflet-control-zoom-reset"),s.href="#",s.title="Zoom para ver todo el mapa",s.setAttribute("role","button"),s.setAttribute("aria-label","Zoom para ver todo el mapa"),s.appendChild(t),s.onclick=e=>{e.preventDefault(),this.resetView()},e.after(s)}))};marker=e=>{var t;return this.marker_color&&"boolean"!=typeof this.marker_color?"string"==typeof this.marker_color?this.icon(this.marker_color):"string"==typeof this.marker_color(this,e)?(t=this.marker_color(this,e),this.icon(t)):"function"==typeof this.marker_color?this.marker_color(this,e):void 0:null};_clearLayers=()=>{this.markers.clearLayers(),this.map.eachLayer(e=>{this.isFeature(e)&&this.map.removeLayer(e)})};markersMap=e=>{var r=this;this._clearLayers(),this.geojson=new L.geoJson(e,{pointToLayer:function(e,t){var e=e["properties"],s=r.marker(e),a={},s=(a.id=e[r.id],s&&(a.icon=s),r.title&&(a.alt=e[r.title]),new L.marker(t,a));return r.map.options.minZoom=r.min_zoom,r.markers.addLayer(s),r.tooltip&&e[r.title]&&s.bindTooltip(e[r.title],r.tooltip_options),r.no_info||r.slider||(t="function"==typeof r.template?r.template(r,e):r.defaultTemplate(r,e),s.bindPopup(t)),r.markers},onEachFeature:function(e,t){var{properties:s,geometry:a}=e;t.options.id=s[r.id],e.properties.name=s[r.title],r.tooltip&&s[r.title]&&"Point"!=a.type&&"MultiPoint"!=a.type&&t.bindTooltip(s[r.title],r.tooltip_options),r.no_info||r.slider||"Point"==a.type||"MultiPoint"==a.type||(e="function"==typeof r.template?r.template(r,s):r.defaultTemplate(r,s),t.bindPopup(e))},style:function(e){const s=e["properties"];e=(e,t=!1)=>s.hasOwnProperty(e)?s[e]:t||r.featureStyle[e];return{color:e("stroke-color",e("stroke")),strokeOpacity:e("stroke-opacity"),weight:e("stroke-width"),fillColor:e("stroke"),opacity:e("stroke-opacity"),fillOpacity:e("fill-opacity")}}}),this.geojson.addTo(this.map)};_setSelectedMarker=(e,t)=>{e={entry:this.entry(e),marker:t};return this.selected_marker=e};_selectedMarker=()=>{this.map.eachLayer(t=>{this.isFeature(t)&&t.on("click",e=>{this._setSelectedMarker(t.options.id,t)})})};_hiddenSearchInput=()=>{const t=document.createElement("input");t.type="hidden",t.name="js-search-input"+this.scope_sufix,t.setAttribute("disabled","disabled"),t.id="js-search-input"+this.scope_sufix,document.querySelectorAll(this.scope_selector+".poncho-map").forEach(e=>e.appendChild(t))};_setFetureAttributes=()=>{const t=(e,t)=>{e.hasOwnProperty(t)&&(e[t].setAttribute("aria-label",e?.feature?.properties?.[this.title]),e[t].setAttribute("role","button"),e[t].setAttribute("tabindex",0),e[t].dataset.entryId=e?.feature?.properties?.[this.id],e[t].dataset.leafletId=e._leaflet_id)};this.map.eachLayer(e=>t(e,"_path"))};_accesibleAnchors=()=>{var e=[[this.scope_selector+" .leaflet-map-pane","leaflet-map-pane"+this.scope_sufix,[["role","region"]]],[this.scope_selector+" .leaflet-control-zoom","leaflet-control-zoom"+this.scope_sufix,[["aria-label","Herramientas de zoom"],["role","region"]]]];return e.forEach(e=>{const t=document.querySelector(e[0]);t.id=e[1],e[2].forEach(e=>t.setAttribute(e[0],e[1]))}),e};_accesibleMenu=()=>{document.querySelectorAll(this.scope_selector+" .accesible-nav").forEach(e=>e.remove());var e=this._accesibleAnchors(),e=[...e=[{text:"Ir a los marcadores del mapa",anchor:"#"+e[0][1]},{text:"Ajustar marcadores al mapa",anchor:"#",class:"js-fit-bounds"},{text:"Ir al panel de zoom",anchor:"#"+e[1][1]}],...this.accesible_menu_filter,...this.accesible_menu_search,...this.accesible_menu_extras],t=document.createElement("i");t.classList.add("icono-arg-sitios-accesibles","accesible-nav__icon"),t.setAttribute("aria-hidden","true");const s=document.createElement("div"),a=(s.classList.add("accesible-nav","top"),s.id="accesible-nav"+this.scope_sufix,s.setAttribute("aria-label","Menú para el mapa"),s.setAttribute("role","navigation"),s.tabIndex=0,document.createElement("ul"));e.forEach((e,t)=>{var s=document.createElement("a"),e=(s.textContent=e.text,s.tabIndex=0,s.href=e.anchor,e.hasOwnProperty("class")&&""!=e.class&&s.classList.add(...e.class.split(" ")),document.createElement("li"));e.appendChild(s),a.appendChild(e)}),s.appendChild(t),s.appendChild(a);e=document.createElement("a");e.textContent="Ir a la navegación del mapa",e.href="#accesible-nav"+this.scope_sufix,e.id="accesible-return-nav"+this.scope_sufix;const r=document.createElement("div");r.classList.add("accesible-nav","bottom"),r.appendChild(t.cloneNode(!0)),r.appendChild(e),document.querySelectorAll(""+this.scope_selector).forEach(e=>{e.insertBefore(s,e.children[0]),e.appendChild(r)}),this.fit()};fit=()=>document.querySelectorAll(this.scope_selector+" .js-fit-bounds").forEach(e=>{e.onclick=e=>{e.preventDefault(),this.fitBounds()}});render=()=>{this._hiddenSearchInput(),this._resetViewButton(),this.markersMap(this.entries),this._selectedMarker(),this.slider&&(this._renderSlider(),this._clickeableFeatures(),this._clickeableMarkers(),this._clickToggleSlider()),this.hash&&this._urlHash(),this.scroll&&this.hasHash()&&this.scrollCenter(),setTimeout(this.gotoHashedEntry,this.anchor_delay),this._setFetureAttributes(),this._accesibleMenu()}}class PonchoMapFilter extends PonchoMap{constructor(e,t){super(e,t);e=Object.assign({},{filters:[],filters_visible:!1,filters_info:!1,search_fields:[],messages:{reset:' <a href="#" class="{{reset_search}}" title="Restablece el mapa a su estado inicial">Restablecer mapa</a>',initial:"Hay {{total_results}} puntos en el mapa.",no_results_by_term:"No encontramos resultados para tu búsqueda.",no_results:"No s + this.messages.resete encontraron entradas.",results:"{{total_results}} resultados coinciden con tu búsqueda.",one_result:"{{total_results}} resultado coincide con tu búsqueda.",has_filters:'<i title="¡Advertencia!" aria-hidden="true" class="fa fa-warning text-danger"></i> Se están usando filtros.'}},t);this.filters=e.filters,this.filters_info=e.filters_info,this.filters_visible=e.filters_visible,this.valid_fields=["checkbox","radio"],this.search_fields=e.search_fields,this.messages=e.messages,this.accesible_menu_filter=[{text:"Ir al panel de filtros",anchor:"#filtrar-busqueda"+this.scope_sufix}]}tplParser=(e,a)=>Object.keys(a).reduce(function(e,t){var s=new RegExp("\\{\\{\\s{0,2}"+t+"\\s{0,2}\\}\\}","gm");return e=e.replace(s,a[t])},e);_helpText=e=>{var t=document.querySelectorAll(this.scope_selector+" .js-poncho-map__help");const a={total_results:e.length,total_entries:this.entries.length,total_filtered_entries:this.filtered_entries.length,filter_class:"js-close-filter"+this.scope_sufix,anchor:"#",term:this.inputSearchValue,reset_search:"js-poncho-map-reset"+this.scope_sufix};t.forEach(e=>{e.innerHTML="";var t=document.createElement("ul"),s=(t.classList.add("m-b-0","list-unstyled"),t.setAttribute("aria-live","polite"),e=>{var t=document.createElement("li");return t.innerHTML=e,t});a.total_entries===a.total_results?t.appendChild(s(this.tplParser(this.messages.initial,a))):a.total_results<1?t.appendChild(s(this.tplParser(this.messages.no_results_by_term+this.messages.reset,a))):""===this.inputSearchValue&&a.total_results<1?t.appendChild(s(this.tplParser(this.messages.no_results+this.messages.reset,a))):1==a.total_results?t.appendChild(s(this.tplParser(this.messages.one_result+this.messages.reset,a))):1<a.total_results&&t.appendChild(s(this.tplParser(this.messages.results+this.messages.reset,a))),this.usingFilters(),e.appendChild(t)})};_filterPosition=e=>{e=/^([\w\-]+?)(?:__([0-9]+))(?:__([0-9]+))?$/gm.exec(e);return e?[e[1],e[2]]:null};isFilterOpen=()=>document.querySelector(".js-poncho-map-filters"+this.scope_sufix).classList.contains("filter--in");toggleFilter=()=>{document.querySelector(".js-poncho-map-filters"+this.scope_sufix).classList.toggle("filter--in")};_filterContainerHeight=()=>{var e=document.querySelector(".js-filter-container"+this.scope_sufix),t=document.querySelector(".js-close-filter"+this.scope_sufix),e=e.offsetParent.offsetHeight-e.offsetTop-t.offsetHeight-20,t=document.querySelector(".js-poncho-map-filters"+this.scope_sufix),e=(t.style.maxHeight=e+"px",t.offsetHeight-45),t=document.querySelector(".js-filters"+this.scope_sufix);t.style.height=e+"px",t.style.overflow="auto"};_clickToggleFilter=()=>document.querySelectorAll(".js-close-filter"+this.scope_sufix).forEach(e=>e.onclick=e=>{e.preventDefault(),this.toggleFilter(),this._filterContainerHeight()});_setFilter=e=>{const[t,s="checked"]=e;e=this.entries.map(e=>{if(e.properties.hasOwnProperty(t))return e.properties[t]}).filter(e=>e),e=[...new Set(e)].map(e=>[t,e,[e],s]);return e.sort((e,t)=>{e=e[1].toUpperCase(),t=t[1].toUpperCase();return t<e?1:e<t?-1:0}),e};_fieldsToUse=e=>{var{fields:e=!1,field:t=!1}=e,e=(e||t||this.errorMessage("Filters requiere el uso del atributo `field` o `fields`.","warning"),e||this._setFilter(t));return e};_fields=(e,t)=>{var s=document.createElement("div"),a=(s.classList.add("field-list","p-b-1"),this._fieldsToUse(e));for(const c in a){var r=a[c],o=document.createElement("input"),i=(o.type=this.valid_fields.includes(e.type)?e.type:"checkbox",o.id=`id__${r[0]}__${t}__`+c,"radio"==e.type?o.name=r[0]+"__"+t:o.name=r[0]+`__${t}__`+c,o.className="form-check-input",o.value=c,void 0!==r[3]&&"checked"==r[3]&&o.setAttribute("checked","checked"),document.createElement("label")),n=(i.style.marginLeft=".33rem",i.textContent=r[1],i.className="form-check-label",i.setAttribute("for",`id__${r[0]}__${t}__`+c),document.createElement("span")),r=(n.dataset.info=r[0]+`__${t}__`+c,i.appendChild(n),document.createElement("div"));r.className="form-check",r.appendChild(o),r.appendChild(i),s.appendChild(r)}var l=document.createElement("div");return l.appendChild(s),l};_filterButton=()=>{var e=document.createElement("i"),t=(e.setAttribute("aria-hidden","true"),e.classList.add("fa","fa-filter"),document.createElement("span")),s=(t.textContent="Abre o cierra el filtro de búsqueda",t.classList.add("sr-only"),document.createElement("button")),e=(s.classList.add("btn","btn-secondary","btn-filter","js-close-filter"+this.scope_sufix),s.id="filtrar-busqueda"+this.scope_sufix,s.appendChild(e),s.appendChild(t),s.setAttribute("role","button"),s.setAttribute("aria-label","Abre o cierra el filtro de búsqueda"),s.setAttribute("aria-controls","poncho-map-filters"+this.scope_sufix),document.createElement("div"));e.classList.add("js-filter-container"+this.scope_sufix,"filter-container"),this.reset_zoom&&e.classList.add("filter-container--zoom-expand"),e.appendChild(s),document.querySelector(".poncho-map"+this.scope_selector).appendChild(e)};_filterContainer=()=>{var e=document.createElement("div"),t=(e.className="js-filters"+this.scope_sufix,document.createElement("button")),s=(t.classList.add("btn","btn-xs","btn-secondary","btn-close","js-close-filter"+this.scope_sufix),t.title="Cerrar panel",t.setAttribute("role","button"),t.setAttribute("aria-label","Cerrar panel de filtros"),t.innerHTML='<span class="sr-only">Cerrar </span>✕',document.createElement("form"));s.classList.add("js-formulario"+this.scope_sufix),s.appendChild(t),s.appendChild(e);const a=document.createElement("div");a.classList.add("js-poncho-map-filters"+this.scope_sufix,"poncho-map-filters"),a.setAttribute("role","region"),a.setAttribute("aria-live","polite"),a.setAttribute("aria-label","Panel de filtros"),a.id="poncho-map-filters"+this.scope_sufix,this.filters_visible&&a.classList.add("filter--in"),a.appendChild(s),document.querySelectorAll(".js-filter-container"+this.scope_sufix).forEach(e=>e.appendChild(a))};_checkUncheckButtons=e=>{var t=document.createElement("button"),s=(t.classList.add("js-select-items","select-items__button"),t.textContent="Marcar todos",t.dataset.field=e.field[0],t.dataset.value=1,document.createElement("button")),e=(s.classList.add("js-select-items","select-items__button"),s.textContent="Desmarcar todos",s.dataset.field=e.field[0],s.dataset.value=0,document.createElement("div"));return e.classList.add("select-items"),e.appendChild(t),e.appendChild(s),e};_createFilters=e=>{const r=document.querySelector(".js-filters"+this.scope_sufix);e.forEach((e,t)=>{var s=document.createElement("legend"),a=(s.textContent=e.legend,s.classList.add("m-b-1","text-primary","h6"),document.createElement("fieldset"));a.appendChild(s),e.hasOwnProperty("check_uncheck_all")&&e.check_uncheck_all&&a.appendChild(this._checkUncheckButtons(e)),a.appendChild(this._fields(e,t)),r.appendChild(a)})};formFilters=()=>{var e;return this.filters.length<1?[]:(e=document.querySelector(".js-formulario"+this.scope_sufix),e=new FormData(e),Array.from(e).map(e=>{var t=this._filterPosition(e[0]);return[parseInt(t[1]),parseInt(e[1]),t[0]]}))};defaultFiltersConfiguration=()=>{return this.filters.map((e,s)=>{return this._fieldsToUse(e).map((e,t)=>[s,t,e[0],"undefinded"!=typeof e[3]&&"checked"==e[3]])}).flat()};usingFilters=()=>{return this.defaultFiltersConfiguration().every(e=>document.querySelector(`#id__${e[2]}__${e[0]}__`+e[1]).checked)};_resetFormFilters=()=>{this.defaultFiltersConfiguration().forEach(e=>{document.querySelector(`#id__${e[2]}__${e[0]}__`+e[1]).checked=e[3]})};get inputSearchValue(){var e=document.querySelector("#js-search-input"+this.scope_sufix).value.trim();return""!==e&&e}_countOccurrences=(e,s,a)=>{return e.reduce((e,t)=>s.some(e=>t.properties[a].includes(e))?e+1:e,0)};totals=()=>{return this.formFilters().map(e=>{var t=this._fieldsToUse(this.filters[e[0]])[e[1]];return[t[1],this._countOccurrences(this.filtered_entries,t[2],t[0]),...e]})};_totalsInfo=()=>{if(!this.filters_info)return"";this.totals().forEach(e=>{var t=document.querySelector(""+this.scope_selector+` [data-info="${e[4]}__${e[2]}__${e[3]}"]`),s=e[1]<2?"":"s",a=document.createElement("i"),r=(a.style.cursor="help",a.style.opacity=".75",a.style.marginLeft=".5em",a.style.marginRight=".25em",a.classList.add("fa","fa-info-circle","small","text-info"),a.title=e[1]+" resultado"+s,a.setAttribute("aria-hidden","true"),document.createElement("span")),e=(r.className="sr-only",r.style.fontWeight="400",r.textContent=e[1]+` elemento${s}.`,document.createElement("small"));e.appendChild(a),e.appendChild(r),t.appendChild(e)})};_validateEntry=(t,s)=>{var a=this.filters.length,r=[];for(let e=0;e<a;e++)r.push(this._validateGroup(t,(t=>s.filter(e=>e[0]==t))(e)));return r.every(e=>e)};_search=(t,e,s)=>{const a=this._fieldsToUse(this.filters[e])[s];return a[2].filter(e=>e).some(e=>{if(t.hasOwnProperty(a[0]))return t[a[0]].includes(e)})};_validateGroup=(t,e)=>{return e.map(e=>this._search(t,e[0],e[1])).some(e=>e)};_filterData=()=>{var e=this.formFilters(),t=this.entries.filter(e=>this._validateEntry(e.properties,this.formFilters())),t=this.searchEntries(this.inputSearchValue,t);return t=this.filters.length<1||0<e.length?t:[],this.filtered_entries=t};_filteredData=e=>{e=void 0!==e?this.entries:this._filterData(),this.markersMap(e),this._selectedMarker(),this._helpText(e),this._resetSearch(),this._clickToggleFilter(),this.slider&&(this._renderSlider(),this._clickeableMarkers(),this._clickeableFeatures(),this._clickToggleSlider()),this.hash&&this._urlHash(),this._setFetureAttributes(),this._accesibleMenu()};_clearSearchInput=()=>document.querySelectorAll("#js-search-input"+this.scope_sufix).forEach(e=>e.value="");_resetSearch=()=>{document.querySelectorAll(".js-poncho-map-reset"+this.scope_sufix).forEach(e=>{e.onclick=e=>{e.preventDefault(),this._resetFormFilters(),this._filteredData(this.entries),this._clearSearchInput(),this.resetView()}})};filterChange=t=>document.querySelectorAll(".js-filters"+this.scope_sufix).forEach(e=>{e.onchange=t});checkUncheckFilters=()=>{document.querySelectorAll(this.scope_selector+" .js-select-items").forEach(t=>{t.onclick=e=>{e.preventDefault(),document.querySelectorAll(`${this.scope_selector} [id^=id__${t.dataset.field}]`).forEach(e=>{e.checked=parseInt(t.dataset.value)}),this._filteredData()}})};render=()=>{this._hiddenSearchInput(),this._resetViewButton(),0<this.filters.length&&(this._filterButton(),this._filterContainer(),this._createFilters(this.filters)),this._filteredData(),this._totalsInfo(),this.scroll&&this.hasHash()&&this.scrollCenter(),this.checkUncheckFilters(),this.filterChange(e=>{e.preventDefault(),this._filteredData()}),setTimeout(this.gotoHashedEntry,this.anchor_delay),this.filters_visible&&this._filterContainerHeight()}}class PonchoMapSearch{constructor(e,t){var s={scope:!1,placeholder:"Su búsqueda",search_fields:e.search_fields,sort:!0,sort_reverse:!1,sort_key:"text",datalist:!0},s=(this.instance=e,Object.assign({},s,t));this.text=e.title||!1,this.datalist=s.datalist,this.placeholder=s.placeholder,this.scope=s.scope,this.scope_sufix="--"+this.scope,this.sort=s.sort,this.sort_reverse=s.sort_reverse,this.search_scope_selector=this.scope?`[data-scope="${this.scope}"]`:"",this.instance.search_fields=s.search_fields,this.instance.accesible_menu_search=[{text:"Hacer una búsqueda",anchor:"#id-poncho-map-search"+this.scope_sufix}]}sortData=(e,a)=>{e=e.sort((e,t)=>{var s=e=>{this.instance.removeAccents(e).toUpperCase()};return s(e[a]),s(t[a]),s(e[a]),s(t[a]),0});return this.sort_reverse?e.reverse():e};_triggerSearch=()=>{const t=document.querySelector(this.search_scope_selector+" .js-poncho-map-search__input");t.id="id-poncho-map-search"+this.scope_sufix,document.querySelectorAll(this.search_scope_selector+" .js-poncho-map-search__submit").forEach(e=>{e.onclick=e=>{e.preventDefault();document.querySelector("#js-search-input"+this.instance.scope_sufix).value=t.value;e=t.value;this._renderSearch(e)}})};_keyup=()=>{document.querySelectorAll(this.search_scope_selector+" .js-poncho-map-search__input").forEach(e=>{const t=document.querySelector("#js-search-input"+this.instance.scope_sufix);e.onkeyup=()=>{t.value=e.value},e.onkeydown=()=>{t.value=e.value}})};_placeHolder=()=>{if(!this.placeholder)return"";document.querySelectorAll(this.search_scope_selector+" .js-poncho-map-search__input").forEach(e=>e.placeholder=this.placeholder.toString())};_renderSearch=e=>{var t=this.instance._filterData();this.instance.markersMap(t),this.instance.slider&&(this.instance._renderSlider(),this.instance._clickeableFeatures(),this.instance._clickeableMarkers(),this.instance._clickToggleSlider()),this.instance.hash&&this.instance._urlHash(),this.instance.resetView(),1==t.length?this.instance.gotoEntry(t[0].properties[this.instance.id]):""!=e.trim()&&(this.instance.removeHash(),setTimeout(this.instance.fitBounds,this.instance.anchor_delay)),this.instance._helpText(t),this.instance._resetSearch(),this.instance._clickToggleFilter(),this.instance._setFetureAttributes(),this.instance._accesibleMenu()};_addDataListOptions=()=>{if(!this.datalist)return null;document.querySelectorAll(this.search_scope_selector+" .js-porcho-map-search__list,"+` ${this.search_scope_selector} .js-poncho-map-search__list`).forEach(s=>{s.innerHTML="";var e=document.querySelector(this.search_scope_selector+" .js-poncho-map-search__input"),t="id-datalist"+this.scope_sufix;e.setAttribute("list",t),s.id=t,this.instance.filtered_entries.forEach(e=>{var t;e.properties[this.text]&&s.appendChild((e=e.properties[this.text],(t=document.createElement("option")).value=e,t))})})};_searchRegion=()=>{var e=document.querySelector(this.search_scope_selector);e.setAttribute("role","region"),e.setAttribute("aria-label","Buscador")};render=()=>{this._placeHolder(),this._triggerSearch(),this._addDataListOptions(),this.instance.filterChange(e=>{e.preventDefault(),this.instance._filteredData(),this._addDataListOptions()}),this._searchRegion(),this._keyup(),this.instance._accesibleMenu()}}class GapiSheetData{constructor(e){e=Object.assign({},{gapi_key:"AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",gapi_uri:"https://sheets.googleapis.com/v4/spreadsheets/"},e);this.gapi_key=e.gapi_key,this.gapi_uri=e.gapi_uri}url=(e,t,s)=>{return["https://sheets.googleapis.com/v4/spreadsheets/",t,"/values/",e,"?key=",void 0!==s?s:this.gapi_key,"&alt=json"].join("")};json_data=e=>{e=this.feed(e);return{feed:e,entries:this.entries(e),headers:this.headers(e)}};feed=(e,o=!0)=>{const i=e.values[0],n=/ |\/|_/gi;let l=[];return e.values.forEach((e,t)=>{if(0<t){var s,a={};for(s in i){var r=e.hasOwnProperty(s)?e[s].trim():"";o?a[""+i[s].toLowerCase().replace(n,"")]=r:a[""+i[s].replace(n,"")]=r}l.push(a)}}),l};gapi_feed_row=(e,t="-",s=!0)=>{const a=s?"filtro-":"";s=Object.entries(e);let r={};return s.map(e=>{return r[e[0].replace("gsx$","").replace(a,"").replace(/-/g,t)]=e[1].$t}),r};entries=e=>e.filter((e,t)=>0<t);headers=e=>e.find((e,t)=>0==t)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-poncho",
3
- "version": "2.0.295",
3
+ "version": "2.0.296",
4
4
  "description": "Base de html y css para la creación de sitios pertenecientes a la Administración Pública Nacional de la República Argentina.",
5
5
  "main": "index.js",
6
6
  "scripts": {