/**
 * @copyright  (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */((i,l)=>{window.jSelectMenuItem=(r,t,e,s,g,o)=>{console.warn("Method jSelectMenuItem() is deprecated. Use postMessage() instead.");let n="";if(!i.getOptions("xtd-menus"))return;const a=i.getOptions("xtd-menus").editor;o!==""&&(n="&lang=");const d=`<a href="${e+n+o}">${t}</a>`;window.parent.Joomla.editors.instances[a].getSelection()?window.parent.Joomla.editors.instances[a].replaceSelection(`<a href="${e+n+o}">${window.parent.Joomla.editors.instances[a].getSelection()}</a>`):window.parent.Joomla.editors.instances[a].replaceSelection(d),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()},l.querySelectorAll(".select-link").forEach(r=>{r.addEventListener("click",t=>{t.preventDefault();const e=t.target.getAttribute("data-function");e==="jSelectMenuItem"&&window[e]?window[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),t.target.getAttribute("data-uri"),null,null,t.target.getAttribute("data-language")):window.parent[e]&&window.parent[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),null,null,t.target.getAttribute("data-uri"),t.target.getAttribute("data-language"),null),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()})})})(Joomla,document);
