- md5
- d54bc96a895417f2f1f4da1a7712ca8e
- sha1
- 31dda21df35c2eb1f34fd70a6424c794047cb25d
- sha256
- 73bc8ca1a8954e727e32cc8e0212af6ad006e4df880fabb7b30ee8df637e5b0b
!function t(e,i,r){function n(s,o){if(!i[s]){if(!e[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=i[s]={exports:{}};e[s][0].call(h.exports,function(t){var i=e[s][1][t];return n(i||t)},h,h.exports,t,e,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(t,e,i){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}();var a=function(t){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var t=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":r(e))&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.hasActive=!1,t.currentActive="",t.hasNested=!1,t.isNested=!1,t.tabs=[],t.tabsLinks=[],t.panels=[],t.tabLinkHash=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":r(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,HTMLElement),n(e,[{key:"recall",get:function(){return this.getAttribute("recall")},set:function(t){return this.setAttribute("recall",t)}},{key:"view",get:function(){return this.getAttribute("view")},set:function(t){this.setAttribute("view",t)}},{key:"orientation",get:function(){return this.getAttribute("orientation")||"horizontal"},set:function(t){this.setAttribute("orientation",t)}},{key:"responsive",get:function(){return this.getAttribute("responsive")},set:function(t){this.setAttribute("responsive",t)}},{key:"collapseWidth",get:function(){return this.getAttribute("collapse-width")},set:function(t){this.setAttribute("collapse-width",t)}}],[{key:"observedAttributes",get:function(){return["recall","orientation","view","responsive","collapse-width"]}}]),n(e,[{key:"connectedCallback",value:function(){var t=this;if((!this.orientation||this.orientation&&-1===["horizontal","vertical"].indexOf(this.orientation))&&this.setAttribute("orientation","horizontal"),this.view=this.getAttribute("view")||"tabs",this.recall=this.recall||"false",this.responsive=this.getAttribute("responsive")||"false",this.collapseWidth=this.getAttribute("collapseWidth")||0,this.panels=[].slice.call(this.querySelectorAll("section")),!this.panels.length)throw new Error("`Joomla-panels` require one ore more panels!");if(this.findAncestorByTagNme(this,"joomla-tab")&&(this.isNested=!0),this.querySelector("joomla-tab")&&(this.hasNested=!0),this.recall){var e=sessionStorage.getItem(this.getStorageKey());e&&!/@\[/.test(e)&&this.tabLinkHash.push(e),this.setTabState()}"ul"!==this.firstElementChild.tagName&&this.createNavigation(),this.panels.forEach(function(e){e.setAttribute("role","tabpanel"),t.tabs.push("#tab-"+e.id),e.hasAttribute("active")&&(t.hasActive=!0,t.currentActive=e.id,t.querySelector("#tab-"+e.id).setAttribute("aria-selected","true"),t.querySelector("#tab-"+e.id).setAttribute("active",""),t.querySelector("#tab-"+e.id).setAttribute("tabindex","0"))}),this.hasActive||(this.tabsLinks[0].setAttribute("active",""),this.hasActive=!0,this.currentActive=this.panels[0].id,this.tabsLinks[0].setAttribute("aria-selected","true"),this.tabsLinks[0].setAttribute("tabindex","0"),this.tabsLinks[0].setAttribute("active",""),this.panels[0].setAttribute("active","")),window.location.href.match(/#tab-/),"accordion"===this.view&&this.toAccordion.bind(this)(),"true"===this.responsive&&(this.changeView.bind(this),window.addEventListener("resize",this.changeView.bind(this)))}},{key:"disconnectedCallback",value:function(){var t=this,e=this.querySelector("ul");[].slice.call(e.querySelectorAll("a")).forEach(function(e){e.removeEventListener("click",t.activateTabFromLink,!0)}),e.removeEventListener("keydown",t.keyBehaviour,!0)}},{key:"createNavigation",value:function(){var t=this,e=this,i="";"ul"!==this.firstElementChild.tagName.toLowerCase()&&(i=document.createElement("ul")),i.setAttribute("role","tablist"),this.panels.forEach(function(r){if(!r.id)throw new Error("`joomla-panels` All panels require an ID");if(r.parentNode===t){var n=r.getAttribute("active")||!1,a=document.createElement("li"),s=document.createElement("a");a.setAttribute("role","presentation"),s.setAttribute("role","tab"),s.setAttribute("aria-controls",r.id),s.setAttribute("aria-selected",n?"true":"false"),s.setAttribute("tabindex",n?"0":"-1"),s.setAttribute("href","#"+r.id),s.setAttribute("id","tab-"+r.id),s.innerHTML=r.getAttribute("name"),n&&s.setAttribute("active",""),s.addEventListener("click",e.activateTabFromLink.bind(e)),t.tabsLinks.push(s),a.append(s),i.append(a),r.setAttribute("aria-labelledby","tab-"+r.id),n||r.setAttribute("aria-hidden","true")}}),this.insertAdjacentElement("afterbegin",i),this.querySelector("ul").addEventListener("keydown",this.keyBehaviour.bind(this))}},{key:"hideCurrent",value:function(){if(this.currentActive){var t=this.querySelector('a[aria-controls="'+this.currentActive+'"]');this.dispatchCustomEvent("joomla.tab.hide",t,this.querySelector("#tab-"+this.currentActive)),t.removeAttribute("active"),t.setAttribute("tabindex","-1"),this.querySelector("#"+this.currentActive).removeAttribute("active"),this.querySelector("#"+this.currentActive).setAttribute("aria-hidden","true"),t.removeAttribute("aria-selected"),this.dispatchCustomEvent("joomla.tab.hidden",t,this.querySelector("#tab-"+this.currentActive))}}},{key:"activateTabFromLink",value:function(t){t.preventDefault();var e=this.currentActive;this.hasActive&&this.hideCurrent(),this.dispatchCustomEvent("joomla.tab.show",t.target,this.querySelector("#tab-"+e)),t.target.setAttribute("active",""),t.target.setAttribute("aria-selected","true"),t.target.setAttribute("tabindex","0"),this.querySelector(t.target.hash).setAttribute("active",""),this.querySelector(t.target.hash).removeAttribute("aria-hidden"),this.currentActive=t.target.hash.substring(1),this.dispatchCustomEvent("joomla.tab.shown",t.target,this.querySelector("#tab-"+e)),this.saveState("#tab-"+t.target.hash.substring(1))}},{key:"showTab",value:function(t){document.querySelector("#tab-"+t.id).click()}},{key:"show",value:function(t){t.click()}},{key:"keyBehaviour",value:function(t){var e=this.querySelector("#tab-"+this.currentActive),i=e.parentNode.previousElementSibling||e.parentNode.parentNode.lastElementChild,r=e.parentNode.nextElementSibling||e.parentNode.parentNode.firstElementChild;if(!t.metaKey&&!t.altKey&&-1!==this.tabs.indexOf("#"+document.activeElement.id))switch(t.keyCode){case 37:case 38:t.preventDefault(),t.stopPropagation(),i.querySelector("a").click(),i.querySelector("a").focus();break;case 39:case 40:t.preventDefault(),t.stopPropagation(),r.querySelector("a").click(),r.querySelector("a").focus()}}},{key:"getStorageKey",value:function(){return window.location.href.toString().split(window.location.host)[1].replace(/&return=[a-zA-Z0-9%]+/,"").split("#")[0]}},{key:"saveState",value:function(t){var e=this.getStorageKey();sessionStorage.setItem(e,t)}},{key:"setTabState",value:function(){var t=this,e=this,i=this.tabsLinks;if(this.hasNested){if(this.tabLinkHash.length&&""!==this.tabLinkHash[0]){var r=this.tabLinkHash[0].substring(5),n=this.querySelector(""+r);if(n){var a=this.findAncestorByTagNme(n,"joomla-tab");if(this.findAncestorByTagNme(a,"joomla-tab")){var s=this.findAncestorByTagNme(a,"section");s&&this.tabLinkHash.push("#tab-"+s.id)}}}i.forEach(function(i){if(t.tabLinkHash.length){var r="#tab-"+i.id;-1===t.tabLinkHash.indexOf(r)?i.removeAttribute("active"):i.setAttribute("active","")}i.parentNode===e&&t.tabsLinks.push(i)})}else i.forEach(function(e){if(t.tabLinkHash.length){var i="#tab-"+e.hash;t.tabLinkHash.indexOf(i)>-1?e.removeAttribute("active"):e.setAttribute("active","")}}),this.tabsLinks=i}},{key:"toTabs",value:function(){for(var t=this,e=0,i=this.panels.length;e<i;++e)this.panels[e].parentNode.parentNode.parentNode===this&&this.tabsLinks.push(this.panels[e]);this.tabsLinks.length&&this.tabsLinks.forEach(function(e){t.appendChild(e)})}},{key:"toAccordion",value:function(){var t=this;this.panels.length&&this.panels.forEach(function(e){t.querySelector('a[aria-controls="'+e.id+'"]').parentNode.appendChild(e)})}},{key:"changeView",value:function(){if(window.outerWidth>920){if("tabs"===this.view)return;this.toTabs.bind(this),this.view="tabs"}else{if("accordion"===this.view)return;this.toAccordion.bind(this),this.view="accordion"}}},{key:"activateUriHash",value:function(){var t=window.location.href.match(/#\S[^&]*/),e=this.querySelector(t[0]);if(e){var i=this.findAncestorByTagNme(e,"joomla-tab"),r=this.findAncestorByTagNme(i,"joomla-tab");if(r){var n=this.findAncestorByTagNme(i,"section");r.showTab(n),this.show(e)}else this.showTab(e)}}},{key:"findAncestorByTagNme",value:function(t,e){for(;(t=t.parentElement)&&t.nodeName.toLowerCase()!==e;);return t}},{key:"dispatchCustomEvent",value:function(t,e,i){var r=new CustomEvent(t,{bubbles:!0,cancelable:!0});i&&(r.relatedTarget=i),e.dispatchEvent(r),e.removeEventListener(t,e)}}]),e}();customElements.define("joomla-panels",a)},{}]},{},[1]);
No other release has this exact content. See every version of this file.