/home/preegmxb/byeaglytics-co.com/media/system/js/fields/joomla-field-subform-es5.min.js
!function(){"use strict";function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function a(t,e,o){return(a=n()?Reflect.construct:function(t,e,n){var a=[null];a.push.apply(a,e);var o=new(Function.bind.apply(t,a));return n&&r(o,n.prototype),o}).apply(null,arguments)}function o(t){var n="function"==typeof Map?new Map:void 0;return(o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,i)}function i(){return a(t,arguments,e(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,t)})(t)}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}!function(e){var n=32,a=27,u=13;var s=function(e){var o,s;function l(){var t,r=i(t=e.call(this)||this);if(t.containerWithRows=i(t),t.rowsContainer){var a=t.querySelectorAll(t.rowsContainer);Array.from(a).forEach((function(e){e.closest("joomla-field-subform")===i(t)&&(t.containerWithRows=e)}))}return t.lastRowIndex=t.getRows().length-1,t.template="",t.prepareTemplate(),(t.buttonAdd||t.buttonRemove)&&(t.addEventListener("click",(function(t){var e=null,n=null;if(r.buttonAdd&&(e=t.target.matches(r.buttonAdd)?t.target:t.target.closest(r.buttonAdd)),r.buttonRemove&&(n=t.target.matches(r.buttonRemove)?t.target:t.target.closest(r.buttonRemove)),e&&e.closest("joomla-field-subform")===r){var a=e.closest(r.repeatableElement);a=a&&a.closest("joomla-field-subform")===r?a:null,r.addRow(a),t.preventDefault()}else if(n&&n.closest("joomla-field-subform")===r){var o=n.closest(r.repeatableElement);r.removeRow(o),t.preventDefault()}})),t.addEventListener("keydown",(function(t){if(t.keyCode===n){var e=r.buttonAdd&&t.target.matches(r.buttonAdd),a=r.buttonRemove&&t.target.matches(r.buttonRemove);if((e||a)&&t.target.closest("joomla-field-subform")===r){var o=t.target.closest(r.repeatableElement);o=o&&o.closest("joomla-field-subform")===r?o:null,a&&o?r.removeRow(o):e&&r.addRow(o),t.preventDefault()}}}))),t.buttonMove&&t.setUpDragSort(),t}s=e,(o=l).prototype=Object.create(s.prototype),o.prototype.constructor=o,r(o,s);var b,c,f,d=l.prototype;return d.getRows=function(){var t=this,e=Array.from(this.containerWithRows.children),r=[];return e.forEach((function(e){e.matches(t.repeatableElement)&&r.push(e)})),r},d.prepareTemplate=function(){var t=[].slice.call(this.children).filter((function(t){return t.classList.contains("subform-repeatable-template-section")}));if(t[0]&&(this.template=t[0].innerHTML),!this.template)throw new Error("The row template is required for the subform element to work")},d.addRow=function(t){var e,r=this.getRows().length;if(r>=this.maximum)return null;(e="TBODY"===this.containerWithRows.nodeName||"TABLE"===this.containerWithRows.nodeName?document.createElement("tbody"):document.createElement("div")).innerHTML=this.template;var n=e.children[0];return t?t.parentNode.insertBefore(n,t.nextSibling):this.containerWithRows.append(n),this.buttonMove&&(n.setAttribute("draggable","false"),n.setAttribute("aria-grabbed","false"),n.setAttribute("tabindex","0")),n.setAttribute("data-new","1"),this.fixUniqueAttributes(n,r),this.dispatchEvent(new CustomEvent("subform-row-add",{detail:{row:n},bubbles:!0})),n.dispatchEvent(new CustomEvent("joomla:updated",{bubbles:!0,cancelable:!0})),n},d.removeRow=function(t){this.getRows().length<=this.minimum||(this.dispatchEvent(new CustomEvent("subform-row-remove",{detail:{row:t},bubbles:!0})),t.dispatchEvent(new CustomEvent("joomla:removed",{bubbles:!0,cancelable:!0})),t.parentNode.removeChild(t))},d.fixUniqueAttributes=function(t,e){var r=this,n=e||0,a=t.getAttribute("data-group"),o=t.getAttribute("data-base-name"),i=Math.max(this.lastRowIndex,n),u=o+i;this.lastRowIndex=i+1,t.setAttribute("data-group",u);var s=t.querySelectorAll("[name]"),l={};(s=[].slice.call(s).filter((function(t){return t.closest("joomla-field-subform")===r}))).forEach((function(e){var r=e,n=r.getAttribute("name"),o=r.getAttribute("aria-describedby"),i=n.replace(/(\[\]$)/g,"").replace(/(\]\[)/g,"__").replace(/\[/g,"_").replace(/\]/g,""),s=n.replace("["+a+"][","["+u+"]["),b=i.replace(a,u).replace(/\W/g,"_"),c=0,f=i;if("checkbox"===r.type&&n.match(/\[\]$/)){if(!(c=l[i]?l[i].length:0)){var d=r.closest("fieldset.checkboxes"),m=t.querySelector('label[for="'+i+'"]');d&&d.setAttribute("id",b),m&&(m.setAttribute("for",b),m.setAttribute("id",b+"-lbl"))}f+=c,b+=c}else if("radio"===r.type){if(!(c=l[i]?l[i].length:0)){var g=r.closest("fieldset.radio"),p=t.querySelector('label[for="'+i+'"]');g&&g.setAttribute("id",b),p&&(p.setAttribute("for",b),p.setAttribute("id",b+"-lbl"))}f+=c,b+=c}l[i]?l[i].push(!0):l[i]=[!0],r.name=s,r.id&&(r.id=b),o&&r.setAttribute("aria-describedby",s+"-desc");var h=t.querySelector('label[for="'+f+'"]');h&&(h.setAttribute("for",b),h.setAttribute("id",b+"-lbl"))}))},d.setUpDragSort=function(){var t=this,e=null,r=!1;function o(e){return!e.form&&e.matches(t.buttonMove)?e:e.closest(t.buttonMove)}function i(t,e){var r=!1;if(t.parentNode===e.parentNode)for(var n=t;n;n=n.previousSibling)if(n===e){r=!0;break}r?e.parentNode.insertBefore(t,e):e.parentNode.insertBefore(t,e.nextSibling)}Array.from(this.getRows()).forEach((function(t){t.setAttribute("draggable","false"),t.setAttribute("aria-grabbed","false"),t.setAttribute("tabindex","0")})),this.addEventListener("touchstart",(function(n){r=!0;var a=o(n.target),u=a?a.closest(t.repeatableElement):null;u&&u.closest("joomla-field-subform")===t&&(e?(u!==e&&i(e,u),e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null):(u.setAttribute("draggable","true"),u.setAttribute("aria-grabbed","true"),e=u),n.preventDefault())})),this.addEventListener("mousedown",(function(n){var a=n.target;if(!r){var i=o(a),u=i?i.closest(t.repeatableElement):null;u&&u.closest("joomla-field-subform")===t&&(u.setAttribute("draggable","true"),u.setAttribute("aria-grabbed","true"),e=u)}})),this.addEventListener("mouseup",(function(){e&&!r&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null)})),this.addEventListener("keydown",(function(r){if(!(r.keyCode!==a&&r.keyCode!==n&&r.keyCode!==u||r.target.form)&&r.target.matches(t.repeatableElement)){var o=r.target;if(o&&o.closest("joomla-field-subform")===t&&(r.keyCode===n&&function(t){return t.ctrlKey||t.metaKey||t.shiftKey}(r)&&("true"===o.getAttribute("aria-grabbed")?(o.setAttribute("draggable","false"),o.setAttribute("aria-grabbed","false"),e=null):(e&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null),o.setAttribute("draggable","true"),o.setAttribute("aria-grabbed","true"),e=o),r.preventDefault()),r.keyCode===a&&e&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null),r.keyCode===u&&e)){if(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),o===e)return void(e=null);i(e,o),r.preventDefault(),e=null}}})),this.addEventListener("dragstart",(function(t){var r=t.dataTransfer;e&&(r.effectAllowed="move",r.setData("text",""))})),this.addEventListener("dragover",(function(t){e&&t.preventDefault()})),this.addEventListener("dragenter",(function(r){var n=r.target;if(e&&(!t.rowsContainer||n.closest(t.rowsContainer)===t.containerWithRows)){var a=n.matches(t.repeatableElement)?n:n.closest(t.repeatableElement);a&&i(e,a)}})),this.addEventListener("dragend",(function(){e&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null)}))},b=l,(c=[{key:"buttonAdd",get:function(){return this.getAttribute("button-add")}},{key:"buttonRemove",get:function(){return this.getAttribute("button-remove")}},{key:"buttonMove",get:function(){return this.getAttribute("button-move")}},{key:"rowsContainer",get:function(){return this.getAttribute("rows-container")}},{key:"repeatableElement",get:function(){return this.getAttribute("repeatable-element")}},{key:"minimum",get:function(){return this.getAttribute("minimum")}},{key:"maximum",get:function(){return this.getAttribute("maximum")}},{key:"name",get:function(){return this.getAttribute("name")},set:function(t){return this.template=this.template.replace(new RegExp(' name="'+this.name.replace(/[[\]]/g,"\\$&"),"g"),' name="'+t),this.setAttribute("name",t)}}])&&t(b.prototype,c),f&&t(b,f),l}(o(HTMLElement));e.define("joomla-field-subform",s)}(customElements)}();