/**
 * @copyright  (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */((n,r)=>{if(!n)throw new Error("core.js was not properly initialised");n.finderIndexer=()=>{const a="index.php?option=com_finder&task=indexer.debug&tmpl=component&format=json",i=`&${r.getElementById("finder-indexer-token").getAttribute("name")}=1`;n.debugIndexing=()=>{const c=new URLSearchParams(Array.from(new FormData(r.getElementById("debug-form")))).toString(),o=e=>{try{return JSON.parse(e).message||e}catch{return e}};n.request({url:`${a}${i}&${c}`,method:"GET",data:"",perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess:e=>{const t=r.getElementById("indexer-output"),s={fieldset:[],legend:[],dl:["class"],dt:["class"],dd:["class"]};try{const d=JSON.parse(e);if(d.error){t.textContent=o(e);return}t.innerHTML=n.sanitizeHtml(d.rendered,s)}catch{t.innerHTML=n.sanitizeHtml(e,s)}},onError:e=>{const t=r.getElementById("indexer-output");t.textContent=o(e.response)}})}}})(Joomla,document),document.addEventListener("DOMContentLoaded",()=>{window.Indexer=Joomla.finderIndexer()});
