UNPKG

carbon-components

Version:

Carbon Components is a component library for IBM Cloud

2 lines • 144 kB
var CarbonComponents=function(e){"use strict";function t(e){return e.reduce(function(e,n){return Array.isArray(n)?e.push.apply(e,x(t(n))):e.push(n),e},[])}function n(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];return t(n).reduce(function(e,t){return t(e)},function(){function e(){y(this,e)}return e}())}function o(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return e.addEventListener.apply(e,n),{release:function(){return e.removeEventListener.apply(e,n),null}}}function i(e,t){var n=e.target,o=e.currentTarget;if("function"==typeof n.matches){if(n.matches(t))return n;if(n.matches(t+" *")){var i=n.closest(t);if((o.nodeType===Node.DOCUMENT_NODE?o.documentElement:o).contains(i))return i}}}function a(e){if(!e||"function"==typeof e)return{launchingElement:null,launchingEvent:null};var t=e.delegateTarget||e.currentTarget||e,n=e.currentTarget&&e;if(t&&!t.nodeType)throw new TypeError("DOM Node should be given for launching element.");if(n&&!n.type)throw new TypeError("DOM event should be given for launching event.");return{launchingElement:t,launchingEvent:n}}function r(e){return function(e){function t(){return y(this,t),C(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return S(t,e),b(t,[{key:"show",value:function(e,t){e&&"function"!=typeof e||(t=e),this.changeState("shown",a(e),t)}},{key:"hide",value:function(e,t){e&&"function"!=typeof e||(t=e),this.changeState("hidden",a(e),t)}}]),t}(e)}function s(e){return function(e){function t(e,n){y(this,t);var i=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a="onfocusin"in window,r=a?"focusin":"focus";return i.manage(o(i.element.ownerDocument,r,function(e){i.element.contains(e.target)||i.handleBlur(e)},!a)),i}return S(t,e),b(t,[{key:"handleBlur",value:function(){throw new Error("Components inheriting TrackBlur mix-in must implement handleBlur() method.")}}]),t}(e)}function l(e,t,n){n?e.setAttribute(t,""):e.removeAttribute(t)}function c(e){var t={};for(var n in e)t[n]=e[n];return t}function u(e){var t=e._;return t&&(t.changeEvent&&(t._changeEvent=t.changeEvent),Object.defineProperty(t,"changeEvent",{get:function(){return this._changeEvent},set:function(e){e.detail=Object.assign(e.detail||{},{fromFlatpickr:!0}),this._changeEvent=e}})),e}function d(e,t,n){var o=e.getAttribute("class").trim().split(/\s+/),i=Object.keys(o.reduce(function(e,t){return Object.assign(e,w({},t,1))},{})),a=i.indexOf(t),r=a>=0,s=void 0===n?!r:n;r===!s&&(s?i.push(t):i.splice(a,1),e.setAttribute("class",i.join(" ")))}function h(e,t,n){function o(t){var n=h,o=f;return h=f=void 0,w=t,v=e.apply(o,n)}function i(e){return w=e,y=setTimeout(s,t),_?o(e):v}function a(e){var n=e-b,o=e-w,i=t-n;return k?Te(i,m-o):i}function r(e){var n=e-b,o=e-w;return void 0===b||n>=t||n<0||k&&o>=m}function s(){var e=Ae();if(r(e))return l(e);y=setTimeout(s,a(e))}function l(e){return y=void 0,S&&h?o(e):(h=f=void 0,v)}function c(){void 0!==y&&clearTimeout(y),w=0,h=b=f=y=void 0}function u(){return void 0===y?v:l(Ae())}function d(){var e=Ae(),n=r(e);if(h=arguments,f=this,b=e,n){if(void 0===y)return i(b);if(k)return y=setTimeout(s,t),o(b)}return void 0===y&&(y=setTimeout(s,t)),v}var h,f,m,v,y,b,w=0,_=!1,k=!1,S=!0;if("function"!=typeof e)throw new TypeError(ge);return t=g(t)||0,p(n)&&(_=!!n.leading,k="maxWait"in n,m=k?Me(g(n.maxWait)||0,t):m,S="trailing"in n?!!n.trailing:S),d.cancel=c,d.flush=u,d}function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(e){return!!e&&"object"==typeof e}function m(e){return"symbol"==typeof e||f(e)&&Ee.call(e)==ye}function g(e){if("number"==typeof e)return e;if(m(e))return ve;if(p(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=p(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(be,"");var n=_e.test(e);return n||ke.test(e)?Se(e.slice(2),n?2:8):we.test(e)?ve:+e}var v={prefix:"bx"},y=(function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,i){var s={key:e,arg:t,resolve:n,reject:i,next:null};r?r=r.next=s:(a=r=s,o(e,t))})}function o(n,a){try{var r=t[n](a),s=r.value;s instanceof e?Promise.resolve(s.value).then(function(e){o("next",e)},function(e){o("throw",e)}):i(r.done?"return":"normal",r.value)}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":a.resolve({value:t,done:!0});break;case"throw":a.reject(t);break;default:a.resolve({value:t,done:!1})}a=a.next,a?o(a.key,a.arg):r=null}var a,r;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}),b=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),w=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},k=function e(t,n,o){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,o)}if("value"in i)return i.value;var r=i.get;if(void 0!==r)return r.call(o)},S=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},C=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},x=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},D=function(e){return function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,t);var o=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(o.children=[],!e||e.nodeType!==Node.ELEMENT_NODE)throw new TypeError("DOM element should be given to initialize this widget.");return o.element=e,o.options=Object.assign(Object.create(o.constructor.options),n),o.constructor.components.set(o.element,o),o}return S(t,e),b(t,[{key:"release",value:function(){for(var e=this.children.pop();e;e=this.children.pop())e.release();return this.constructor.components.delete(this.element),null}}],[{key:"create",value:function(e,t){return this.components.get(e)||new this(e,t)}}]),t}(e)},L=function(e){return function(e){function t(){return y(this,t),C(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return S(t,e),b(t,null,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=Object.assign(Object.create(this.options),n);if(!t||t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.");t.nodeType===Node.ELEMENT_NODE&&t.matches(o.selectorInit)?this.create(t,n):[].concat(x(t.querySelectorAll(o.selectorInit))).forEach(function(t){return e.create(t,n)})}}]),t}(e)},E=function(e){return function(e){function t(){var e,n,o,i;y(this,t);for(var a=arguments.length,r=Array(a),s=0;s<a;s++)r[s]=arguments[s];return n=o=C(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r))),o.handles=new Set,i=n,C(o,i)}return S(t,e),b(t,[{key:"manage",value:function(e){return this.handles.add(e),e}},{key:"unmanage",value:function(e){return this.handles.delete(e),e}},{key:"release",value:function(){var e=this;return this.handles.forEach(function(t){t.release(),e.handles.delete(t)}),k(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"release",this).call(this)}}]),t}(e)},M={true:"true",false:"false",mixed:"mixed"},T=function(e){function t(e,n){y(this,t);var i=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.manage(o(i.element,"click",function(e){i._handleClick(e)})),i.manage(o(i.element,"focus",function(e){i._handleFocus(e)})),i.manage(o(i.element,"blur",function(e){i._handleBlur(e)})),i._indeterminateCheckbox(),i._initCheckbox(),i}return S(t,e),b(t,[{key:"_handleClick",value:function(){!0===this.element.checked?(this.element.setAttribute("checked",""),this.element.setAttribute("aria-checked","true"),this.element.checked=!0,this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.parentElement.setAttribute("data-contained-checkbox-state","true")):!1===this.element.checked&&(this.element.removeAttribute("checked"),this.element.setAttribute("aria-checked","false"),this.element.checked=!1,this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.parentElement.setAttribute("data-contained-checkbox-state","false"))}},{key:"_handleFocus",value:function(){this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.parentElement.classList.add("bx--checkbox-label__focus")}},{key:"_handleBlur",value:function(){this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.parentElement.classList.remove("bx--checkbox-label__focus")}},{key:"setState",value:function(e){if(void 0===e||void 0===M[e])throw new TypeError("setState expects a value of true, false or mixed.");this.element.setAttribute("aria-checked",e),this.element.indeterminate=e===M.mixed,this.element.checked=e===M.true;var t=this.element.closest("[data-contained-checkbox-state]");t&&t.setAttribute("data-contained-checkbox-state",e)}},{key:"setDisabled",value:function(e){if(void 0===e)throw new TypeError("setDisabled expects a boolean value of true or false");!0===e?this.element.setAttribute("disabled",!0):!1===e&&this.element.removeAttribute("disabled");var t=this.element.closest("[data-contained-checkbox-disabled]");t&&t.setAttribute("data-contained-checkbox-disabled",e)}},{key:"_indeterminateCheckbox",value:function(){"mixed"===this.element.getAttribute("aria-checked")&&(this.element.indeterminate=!0),!0===this.element.indeterminate&&this.element.setAttribute("aria-checked","mixed"),this.element.parentElement.classList.contains("bx--checkbox-label")&&!0===this.element.indeterminate&&this.element.parentElement.setAttribute("data-contained-checkbox-state","mixed")}},{key:"_initCheckbox",value:function(){!0===this.element.checked&&this.element.setAttribute("aria-checked","true"),this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.checked&&this.element.parentElement.setAttribute("data-contained-checkbox-state","true"),this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.parentElement.setAttribute("data-contained-checkbox-disabled","false"),this.element.parentElement.classList.contains("bx--checkbox-label")&&this.element.disabled&&this.element.parentElement.setAttribute("data-contained-checkbox-disabled","true")}}]),t}(n(D,L,E));T.components=new WeakMap,T.options={selectorInit:".bx--checkbox"},T.stateChangeTypes=M;var A=function(e){return function(e){function t(){return y(this,t),C(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return S(t,e),b(t,[{key:"_changeState",value:function(){throw new Error("_changeState() should be overriden to perform actual change in state.")}},{key:"changeState",value:function(){for(var e=this,t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var i="string"==typeof n[0]?n.shift():void 0,a=Object(n[0])===n[0]&&"function"!=typeof n[0]?n.shift():void 0,r="function"==typeof n[0]?n.shift():void 0;if("function"==typeof this.shouldStateBeChanged&&!this.shouldStateBeChanged(i,a))return void(r&&r(null,!0));var s={group:a&&a.group,state:i},l=[s.group,i].filter(Boolean).join("-").split("-").map(function(e){return e[0].toUpperCase()+e.substr(1)}).join(""),c=new CustomEvent(this.options["eventBefore"+l],{bubbles:!0,cancelable:!0,detail:a}),u=a&&a.delegatorNode||this.element;if(u.dispatchEvent(c)){var d=[i,a].filter(Boolean);this._changeState.apply(this,x(d).concat([function(){u.dispatchEvent(new CustomEvent(e.options["eventAfter"+l],{bubbles:!0,cancelable:!0,detail:a})),r&&r()}]))}else if(r){var h=new Error("Changing state ("+JSON.stringify(s)+") has been canceled.");h.canceled=!0,r(h)}}}]),t}(e)},N=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,t);var a=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(a._changeState=function(e,t,n){"delete-filename-fileuploader"===e&&a.container.removeChild(t.filenameElement),"function"==typeof n&&n()},a._handleDeleteButton=function(e){var t=i(e,"[data-for="+a.inputId+"]");t&&a._changeState("delete-filename-fileuploader",{initialEvt:e,filenameElement:t.parentNode})},a.input=a.element.querySelector(a.options.selectorInput),a.container=a.element.querySelector(a.options.selectorContainer),!a.input)throw new TypeError("Cannot find the file input box.");if(!a.container)throw new TypeError("Cannot find the file names container.");return a.inputId=a.input.getAttribute("id"),a.manage(o(a.input,"change",function(){return a._displayFilenames()})),a.manage(o(a.container,"click",a._handleDeleteButton)),a}return S(t,e),b(t,[{key:"_filenamesHTML",value:function(e,t){return'<span class="'+this.options.classSelectedFile+'">\n <p class="'+this.options.classFileName+'">'+e+'</p>\n <span data-for="'+t+'" class="'+this.options.classStateContainer+'"></span>\n </span>'}},{key:"_uploadHTML",value:function(){return'\n <div data-loading class="'+this.options.classLoading+'">\n <svg class="'+this.options.classLoadingSvg+'" viewBox="-42 -42 84 84">\n <circle cx="0" cy="0" r="37.5" />\n </svg>\n </div>'}},{key:"_closeButtonHTML",value:function(){return'\n <svg class="'+this.options.classFileClose+'" tabindex="0" viewBox="0 0 16 16" fill-rule="evenodd" width="16" height="16">\n <path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm3.5 10.1l-1.4 1.4L8\n 9.4l-2.1 2.1-1.4-1.4L6.6 8 4.5 5.9l1.4-1.4L8 6.6l2.1-2.1 1.4 1.4L9.4 8l2.1 2.1z" />\n </svg>'}},{key:"_checkmarkHTML",value:function(){return'\n <svg class="'+this.options.classFileComplete+'" viewBox="0 0 16 16" fill-rule="evenodd" width="16" height="16">\n <path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zM6.7 11.5L3.4 8.1l1.4-1.4 1.9 1.9 4.1-4.1 1.4 1.4-5.5 5.6z"/>\n </svg>'}},{key:"_getStateContainers",value:function(){var e=[].concat(x(this.element.querySelectorAll("[data-for="+this.inputId+"]")));if(0===e.length)throw new TypeError("State container elements not found; invoke _displayFilenames() first");if(e[0].dataset.for!==this.inputId)throw new TypeError("File input id must equal [data-for] attribute");return e}},{key:"_displayFilenames",value:function(){var e=this,t=this.element.querySelector(this.options.selectorContainer),n=[].concat(x(this.input.files)).map(function(t){return e._filenamesHTML(t.name,e.inputId)}).join("");t.insertAdjacentHTML("afterbegin",n)}},{key:"_removeState",value:function(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new TypeError("DOM element should be given to initialize this widget.");for(;e.firstChild;)e.removeChild(e.firstChild)}},{key:"_handleStateChange",value:function(e,t,n){var o=this;void 0===t?e.forEach(function(e){o._removeState(e),e.insertAdjacentHTML("beforeend",n)}):e.forEach(function(e,i){i===t&&(o._removeState(e),e.insertAdjacentHTML("beforeend",n))})}},{key:"setState",value:function(e,t){var n=this._getStateContainers();"edit"===e&&this._handleStateChange(n,t,this._closeButtonHTML()),"upload"===e&&this._handleStateChange(n,t,this._uploadHTML()),"complete"===e&&this._handleStateChange(n,t,this._checkmarkHTML())}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-file]",selectorInput:'input[type="file"].'+e+"--file-input",selectorContainer:"[data-file-container]",selectorCloseButton:"."+e+"--file-close",classLoading:e+"--loading",classLoadingSvg:e+"--loading__svg",classFileName:e+"--file-filename",classFileClose:e+"--file-close",classFileComplete:e+"--file-complete",classSelectedFile:e+"--file__selected-file",classStateContainer:e+"--file__state-container",eventBeforeDeleteFilenameFileuploader:"fileuploader-before-delete-filename",eventAfterDeleteFilenameFileuploader:"fileuploader-after-delete-filename"}}}]),t}(n(D,L,A,E));N.components=new WeakMap;var I=function(e){var t=function(e){function t(){return y(this,t),C(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return S(t,e),b(t,null,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=Object.assign(Object.create(this.options),n);if(!t||t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.");if(t.nodeType!==Node.ELEMENT_NODE||!t.matches(a.selectorInit)){var r="onfocusin"in(t.nodeType===Node.ELEMENT_NODE?t.ownerDocument:t).defaultView,s=a.initEventNames.map(function(s){return o(t,"focus"===s&&r?"focusin":s,function(t){var o=i(t,a.selectorInit);if(o&&!e.components.has(o)){var r=e.create(o,n);"function"==typeof r.createdByEvent&&r.createdByEvent(t)}},"focus"===s&&!r)});return{release:function(){for(var e=s.pop();e;e=s.pop())e.release()}}}return this.create(t,n),""}}]),t}(e);return t.forLazyInit=!0,t},O=function(e){function t(e){y(this,t);var n=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.manage(o(e,"click",function(e){n.toggle(e)})),n}return S(t,e),b(t,[{key:"createdByEvent",value:function(e){this.toggle(e)}},{key:"toggle",value:function(e){"A"===this.element.tagName&&e.preventDefault(),"closed"===this.element.dataset.state?this.element.dataset.state="open":this.element.dataset.state="closed"}}],[{key:"create",value:function(e){return this.components.get(e)||new this(e)}}]),t}(n(D,I,E));O.components=new WeakMap,O.options={selectorInit:"[data-fab]",initEventNames:["click"]};var F=function(e){function t(e,n){y(this,t);var i=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.manage(o(i.element,"click",function(e){i._handleClick(e)})),i}return S(t,e),b(t,[{key:"_handleClick",value:function(e){var t=i(e,this.options.selectorButton);t&&this.changeState({group:"selected",item:t,launchingEvent:e})}},{key:"_changeState",value:function(e,t){var n=this,o=e.item,i=o.querySelector(this.options.selectorLink);i&&([].concat(x(this.element.querySelectorAll(this.options.selectorLink))).forEach(function(e){e!==i&&e.setAttribute("aria-selected","false")}),i.setAttribute("aria-selected","true")),[].concat(x(this.element.querySelectorAll(this.options.selectorButton))).forEach(function(e){e!==o&&(e.setAttribute("aria-selected",!1),e.classList.toggle(n.options.classActive,!1),[].concat(x(e.ownerDocument.querySelectorAll(e.dataset.target))).forEach(function(e){e.setAttribute("hidden",""),e.setAttribute("aria-hidden","true")}))}),o.classList.toggle(this.options.classActive,!0),o.setAttribute("aria-selected",!0),[].concat(x(o.ownerDocument.querySelectorAll(o.dataset.target))).forEach(function(e){e.removeAttribute("hidden"),e.setAttribute("aria-hidden","false")}),t&&t()}},{key:"setActive",value:function(e,t){this.changeState({group:"selected",item:e},function(n){n?t&&t(Object.assign(n,{item:e})):t&&t(null,e)})}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-content-switcher]",selectorButton:'input[type="radio"], .'+e+"--content-switcher-btn",classActive:e+"--content-switcher--selected",eventBeforeSelected:"content-switcher-beingselected",eventAfterSelected:"content-switcher-selected"}}}]),t}(n(D,L,A,E));F.components=new WeakMap;var P=function(e){function t(e,n){y(this,t);var i=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.manage(o(i.element,"keydown",function(e){i._handleKeyDown(e)}));var a=i.element.querySelector(i.options.selectorButtonSelected);return a&&i._updateTriggerText(a),i}return S(t,e),b(t,[{key:"_changeState",value:function(e,n){var o=this;k(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_changeState",this).call(this,e,function(t){for(var i=arguments.length,a=Array(i>1?i-1:0),r=1;r<i;r++)a[r-1]=arguments[r];t||o._updateTriggerText(e.item),n.apply(void 0,[t].concat(a))})}},{key:"_handleClick",value:function(e){var n=i(e,this.options.selectorButton),o=i(e,this.options.selectorTrigger);n&&(k(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_handleClick",this).call(this,e),this._updateMenuState(!1)),o&&this._updateMenuState()}},{key:"_handleKeyDown",value:function(e){var t=this;if(i(e,this.options.selectorTrigger))return void(13===e.which&&this._updateMenuState());var n={37:this.constructor.NAVIGATE.BACKWARD,39:this.constructor.NAVIGATE.FORWARD}[e.which];if(n){var o=[].concat(x(this.element.querySelectorAll(this.options.selectorButton))),a=this.element.querySelector(this.options.selectorButtonSelected),r=Math.max(o.indexOf(a)+n,-1),s=r>=0&&r<o.length?r:r-Math.sign(r)*o.length;this.setActive(o[s],function(e,n){if(n){var o=n.querySelector(t.options.selectorLink);o&&o.focus()}}),e.preventDefault()}}},{key:"_updateMenuState",value:function(e){var t=this.element.querySelector(this.options.selectorMenu);t&&t.classList.toggle(this.options.classHidden,void 0===e?e:!e)}},{key:"_updateTriggerText",value:function(e){var t=this.element.querySelector(this.options.selectorTriggerText);t&&(t.textContent=e.textContent)}}],[{key:"options",get:function(){var e=v.prefix;return Object.assign(Object.create(F.options),{selectorInit:"[data-tabs]",selectorMenu:"."+e+"--tabs__nav",selectorTrigger:"."+e+"--tabs-trigger",selectorTriggerText:"."+e+"--tabs-trigger-text",selectorButton:"."+e+"--tabs__nav-item",selectorButtonSelected:"."+e+"--tabs__nav-item--selected",selectorLink:"."+e+"--tabs__nav-link",classActive:e+"--tabs__nav-item--selected",classHidden:e+"--tabs__nav--hidden",eventBeforeSelected:"tab-beingselected",eventAfterSelected:"tab-selected"})}}]),t}(F);P.components=new WeakMap,P.NAVIGATE={BACKWARD:-1,FORWARD:1};var q=[A,r],R=[E,s],j=function(){function e(){o.forEach(function(e){e()}),i=!1}function t(){i||(i=!0,window.requestAnimationFrame(e))}function n(e){if(e){o.indexOf(e)<0&&o.push(e)}}var o=[],i=!1;return{add:function(e){return o.length||window.addEventListener("resize",t),n(e),{release:function(){var t=o.indexOf(e);t>=0&&o.splice(t,1)}}}}}(),H=function(e){var t,n=e.menuSize,o=e.refPosition,i=e.offset,a=void 0===i?{}:i,r=e.direction,s=void 0===r?"bottom":r,l=e.scrollX,c=void 0===l?0:l,u=e.scrollY,d=void 0===u?0:u,h=o.left,p=void 0===h?0:h,f=o.top,m=void 0===f?0:f,g=o.right,v=void 0===g?0:g,y=o.bottom,b=void 0===y?0:y,_=n.width,k=n.height,S=a.top,C=void 0===S?0:S,x=a.left,D=void 0===x?0:x,L=(p+v)/2,E=(m+b)/2;return(t={},w(t,"left",{left:p-_+c-D,top:E-k/2+d+C}),w(t,"top",{left:L-_/2+c+D,top:m-k+d-C}),w(t,"right",{left:v+c+D,top:E-k/2+d+C}),w(t,"bottom",{left:L-_/2+c+D,top:b+d+C}),t)[s]},B=function(e){function t(e,n){y(this,t);var o=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o.element.getAttribute(o.options.attribDirection);return o.options.direction||(o.options.direction=i||"bottom"),i||o.element.setAttribute(o.options.attribDirection,o.options.direction),o}return S(t,e),b(t,[{key:"handleBlur",value:function(e){if(this.element.classList.contains(this.options.classShown)){this.changeState("hidden",a(e));var t=this.options.refNode;this.element.contains(e.relatedTarget)&&t&&e.target!==t&&HTMLElement.prototype.focus.call(t)}}},{key:"_getContainer",value:function(){return this.element.closest(this.options.selectorContainer)||this.element.ownerDocument.body}},{key:"_getPos",value:function(){var e=this.element,t=this.options,n=t.refNode,o=t.offset,i=t.direction;if(!n)throw new Error("Cannot find the refernce node for positioning floating menu.");return H({menuSize:e.getBoundingClientRect(),refPosition:n.getBoundingClientRect(),offset:"function"!=typeof o?o:o(e,i),direction:i,scrollX:n.ownerDocument.defaultView.pageXOffset,scrollY:n.ownerDocument.defaultView.pageYOffset})}},{key:"_testStyles",value:function(){if(this.options.debugStyle){var e=this.element,t=e.ownerDocument.defaultView.getComputedStyle(e),n={position:"absolute",right:"auto",margin:0};Object.keys(n).forEach(function(e){("number"==typeof n[e]?parseFloat(n[e]):n[e])!==t.getPropertyValue(e)&&console.warn("Floating menu component expects "+e+": "+n[e]+" style.")})}}},{key:"_place",value:function(){var e=this.element,t=this._getPos(),n=t.left,o=t.top;e.style.left=n+"px",e.style.top=o+"px",this._testStyles()}},{key:"shouldStateBeChanged",value:function(e){return("shown"===e||"hidden"===e)&&e!==(this.element.classList.contains(this.options.classShown)?"shown":"hidden")}},{key:"_changeState",value:function(e,t,n){var o=this,i="shown"===e,a=this.options,r=a.refNode,s=a.classShown,l=a.classRefShown;if(!r)throw new TypeError("Cannot find the refernce node for changing the style.");this.element.classList.toggle(s,i),l&&r.classList.toggle(l,i),"shown"===e&&(this.hResize||(this.hResize=j.add(function(){o._place()})),this._getContainer().appendChild(this.element),this._place(),this.element.hasAttribute(this.options.attribAvoidFocusOnOpen)||(this.element.querySelector(this.options.selectorPrimaryFocus)||this.element).focus()),"hidden"===e&&this.hResize&&(this.hResize.release(),this.hResize=null),n()}},{key:"release",value:function(){this.hResize&&(this.hResize.release(),this.hResize=null),k(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"release",this).call(this)}}]),t}(n(D,q,R));B.options={selectorContainer:"[data-floating-menu-container]",selectorPrimaryFocus:"[data-floating-menu-primary-focus]",attribDirection:"data-floating-menu-direction",attribAvoidFocusOnOpen:"data-avoid-focus-on-open",classShown:"",classRefShown:"",eventBeforeShown:"floating-menu-beingshown",eventAfterShown:"floating-menu-shown",eventBeforeHidden:"floating-menu-beinghidden",eventAfterHidden:"floating-menu-hidden",refNode:null,offset:{left:0,top:0}},B.components=new WeakMap;var Y,V,W=(Y={},w(Y,"top","bottom"),w(Y,"bottom","top"),Y),z=(V={},w(V,"top",-2),w(V,"bottom",-1),V),U=function(e,t){var n=W[t],o=z[t];n&&o||console.warn("Wrong floating menu direction:",t);var i=e.offsetWidth,a=e.ownerDocument.defaultView.getComputedStyle(e,":before"),r=[n,"left","width","height","border-top-width"].reduce(function(e,t){return _({},e,w({},t,Number((/^([\d-.]+)px$/.exec(a.getPropertyValue(t))||[])[1])))},{});if(Object.keys(r).every(function(e){return!isNaN(r[e])})){var s=r.left,l=r.width,c=r.height,u=r["border-top-width"];return{left:i/2-(s+Math.sqrt(Math.pow(l,2)+Math.pow(c,2))/2),top:Math.sqrt(2*Math.pow(u,2))+o*r[n]}}},K=function(e){function t(e,n){y(this,t);var i=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.manage(o(i.element.ownerDocument,"click",function(e){i._handleDocumentClick(e),i.wasOpenBeforeClick=void 0})),i.manage(o(i.element.ownerDocument,"keypress",function(e){i._handleKeyPress(e)})),i.manage(o(i.element,"mousedown",function(){i.wasOpenBeforeClick=e.classList.contains(i.options.classShown)})),i}return S(t,e),b(t,[{key:"changeState",value:function(e,t,n){if(!this.optionMenu){var o=this.element.querySelector(this.options.selectorOptionMenu);if(!o)throw new Error("Cannot find the target menu.");this.optionMenu=B.create(o,{refNode:this.element,classShown:this.options.classMenuShown,classRefShown:this.options.classShown,offset:this.options.objMenuOffset}),this.children.push(this.optionMenu)}this.optionMenu.element.classList.contains(this.options.classMenuFlip)&&(this.optionMenu.options.offset=this.options.objMenuOffsetFlip),this.optionMenu.changeState(e,Object.assign(t,{delegatorNode:this.element}),n)}},{key:"_handleDocumentClick",value:function(e){var t=this.element,n=this.optionMenu,o=this.wasOpenBeforeClick,i=t.contains(e.target),r=n&&n.element.contains(e.target),s=i&&!o,l=s?"shown":"hidden";i&&("A"===t.tagName&&e.preventDefault(),e.delegateTarget=t),this.changeState(l,a(e),function(){"hidden"===l&&r&&t.focus()})}},{key:"_handleKeyPress",value:function(e){if(13===e.which){var t=this.element,n=this.optionMenu,o=this.options,i=t.contains(e.target),r=n&&n.element.contains(e.target),s=i&&!t.classList.contains(o.classShown),l=s?"shown":"hidden";i&&("A"===t.tagName&&e.preventDefault(),e.delegateTarget=t),this.changeState(l,a(e),function(){"hidden"===l&&r&&t.focus()})}}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-overflow-menu]",selectorOptionMenu:"."+e+"--overflow-menu-options",classShown:e+"--overflow-menu--open",classMenuShown:e+"--overflow-menu-options--open",classMenuFlip:e+"--overflow-menu--flip",objMenuOffset:U,objMenuOffsetFlip:U}}}]),t}(n(D,L,q,E));K.components=new WeakMap;var G=function(e){var t=function(e){function t(){return y(this,t),C(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return S(t,e),b(t,null,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=Object.assign(Object.create(this.options),n);if(!t||t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.");if(t.nodeType!==Node.ELEMENT_NODE||!t.matches(a.selectorInit)){var r=a.initEventNames.map(function(r){return o(t,r,function(t){var o=i(t,"["+a.attribInitTarget+"]");if(o){t.delegateTarget=o;var r=[].concat(x(o.ownerDocument.querySelectorAll(o.getAttribute(a.attribInitTarget))));if(r.length>1)throw new Error("Target widget must be unique.");if(1===r.length){"A"===o.tagName&&t.preventDefault();var s=e.create(r[0],n);"function"==typeof s.createdByLauncher&&s.createdByLauncher(t)}}})});return{release:function(){for(var e=r.pop();e;e=r.pop())e.release()}}}return this.create(t,n),""}}]),t}(e);return t.forLazyInit=!0,t},$=function(e){function t(e,n){y(this,t);var o=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o._handleFocusin=function(e){o.element.classList.contains(o.options.classVisible)&&!o.element.contains(e.target)&&o.options.selectorsFloatingMenus.every(function(t){return!i(e,t)})&&o.element.focus()},o._hookCloseActions(),o}return S(t,e),b(t,[{key:"createdByLauncher",value:function(e){this.show(e)}},{key:"shouldStateBeChanged",value:function(e){return"shown"===e?!this.element.classList.contains(this.options.classVisible):this.element.classList.contains(this.options.classVisible)}},{key:"_changeState",value:function(e,t,n){var i=this,a=void 0,r=function(){a&&(a=i.unmanage(a).release()),"shown"===e&&i.element.offsetWidth>0&&i.element.offsetHeight>0&&(i.element.querySelector(i.options.selectorPrimaryFocus)||i.element).focus(),n()};if(this._handleFocusinListener&&(this._handleFocusinListener=this.unmanage(this._handleFocusinListener).release()),"shown"===e){var s="onfocusin"in this.element.ownerDocument.defaultView,l=s?"focusin":"focus";this._handleFocusinListener=this.manage(o(this.element.ownerDocument,l,this._handleFocusin,!s))}"hidden"===e?this.element.classList.toggle(this.options.classVisible,!1):"shown"===e&&this.element.classList.toggle(this.options.classVisible,!0),a=this.manage(o(this.element,"transitionend",r))}},{key:"_hookCloseActions",value:function(){var e=this ;this.manage(o(this.element,"click",function(t){var n=i(t,e.options.selectorModalClose);n&&(t.delegateTarget=n),(n||t.target===e.element)&&e.hide(t)})),this._handleKeydownListener&&(this._handleKeydownListener=this.unmanage(this._handleKeydownListener).release()),this._handleKeydownListener=this.manage(o(this.element.ownerDocument.body,"keydown",function(t){27===t.which&&e.hide(t)}))}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-modal]",selectorModalClose:"[data-modal-close]",selectorPrimaryFocus:"[data-modal-primary-focus]",selectorsFloatingMenus:["."+e+"--overflow-menu-options","."+e+"--tooltip",".flatpickr-calendar"],classVisible:"is-visible",attribInitTarget:"data-modal-target",initEventNames:["click"],eventBeforeShown:"modal-beingshown",eventAfterShown:"modal-shown",eventBeforeHidden:"modal-beinghidden",eventAfterHidden:"modal-hidden"}}}]),t}(n(D,G,q,E));$.components=new WeakMap;var J=function(e){function t(e,n){y(this,t);var o=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.active=o.options.active,o.set(o.active),o}return S(t,e),b(t,[{key:"set",value:function(e){if("boolean"!=typeof e)throw new TypeError("set expects a boolean.");this.active=e,this.element.classList.toggle(this.options.classLoadingStop,!this.active);var t=this.element.parentNode;return t&&t.classList.contains(this.options.classLoadingOverlay)&&t.classList.toggle(this.options.classLoadingOverlayStop,!this.active),this}},{key:"toggle",value:function(){return this.set(!this.active)}},{key:"isActive",value:function(){return this.active}},{key:"end",value:function(){var e=this;this.set(!1);var t=this.manage(o(this.element,"animationend",function(n){t&&(t=e.unmanage(t).release()),"rotate-end-p2"===n.animationName&&e._deleteElement()}))}},{key:"_deleteElement",value:function(){var e=this.element.parentNode;e.removeChild(this.element),e.classList.contains(this.options.selectorLoadingOverlay)&&e.remove()}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-loading]",selectorLoadingOverlay:"."+e+"--loading-overlay",classLoadingOverlay:e+"--loading-overlay",classLoadingStop:e+"--loading--stop",classLoadingOverlayStop:e+"--loading-overlay--stop",active:!0}}}]),t}(n(D,L,E));J.components=new WeakMap;var X=function(e){function t(e,n){y(this,t);var o=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o.options.initialState;return i&&o.setState(i),o}return S(t,e),b(t,[{key:"setState",value:function(e){var t=this.constructor.states,n=Object.keys(t).map(function(e){return t[e]});if(n.indexOf(e)<0)throw new Error("One of the following value should be given as the state: "+n.join(", "));var o=this.element,i=this.options,a=i.selectorSpinner,r=i.selectorFinished,s=i.selectorTextActive,c=i.selectorTextFinished,u=o.querySelector(a),d=o.querySelector(r),h=o.querySelector(s),p=o.querySelector(c);return u&&(u.classList.toggle(this.options.classLoadingStop,e!==t.ACTIVE),l(u,"hidden",e===t.FINISHED)),d&&l(d,"hidden",e!==t.FINISHED),h&&l(h,"hidden",e!==t.ACTIVE),p&&l(p,"hidden",e!==t.FINISHED),this}}],[{key:"options",get:function(){return{selectorInit:"[data-inline-loading]",selectorSpinner:"[data-inline-loading-spinner]",selectorFinished:"[data-inline-loading-finished]",selectorTextActive:"[data-inline-loading-text-active]",selectorTextFinished:"[data-inline-loading-text-finished]",classLoadingStop:v.prefix+"--loading--stop"}}}]),t}(n(D,L,E));X.states={INACTIVE:"inactive",ACTIVE:"active",FINISHED:"finished"},X.components=new WeakMap;var Z=function(e){function t(e,n){y(this,t);var a=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return a.manage(o(a.element.ownerDocument,"click",function(e){a._toggle(e)})),a.manage(o(a.element,"keydown",function(e){a._handleKeyDown(e)})),a.manage(o(a.element,"click",function(e){var t=i(e,a.options.selectorItem);t&&a.select(t)})),a}return S(t,e),b(t,[{key:"_handleKeyDown",value:function(e){var t=this.element.classList.contains(this.options.classOpen),n={38:this.constructor.NAVIGATE.BACKWARD,40:this.constructor.NAVIGATE.FORWARD}[e.which];t&&void 0!==n?(this.navigate(n),e.preventDefault()):this._toggle(e)}},{key:"_toggle",value:function(e){var t=this;if(!this.element.classList.contains(this.options.classDisabled)&&([13,32,40].indexOf(e.which)>=0&&!e.target.matches(this.options.selectorItem)||27===e.which||"click"===e.type)){var n=this.element.classList.contains(this.options.classOpen),o=this.element.contains(e.target),i={add:o&&40===e.which&&!n,remove:(!o||27===e.which)&&n,toggle:o&&27!==e.which&&40!==e.which};Object.keys(i).forEach(function(e){i[e]&&(t.element.classList[e](t.options.classOpen),t.element.focus())}),[].concat(x(this.element.querySelectorAll(this.options.selectorItem))).forEach(function(e){t.element.classList.contains(t.options.classOpen)?e.tabIndex=0:e.tabIndex=-1})}}},{key:"getCurrentNavigation",value:function(){var e=this.element.ownerDocument.activeElement;return e.nodeType===Node.ELEMENT_NODE&&e.matches(this.options.selectorItem)?e:null}},{key:"navigate",value:function(e){for(var t=[].concat(x(this.element.querySelectorAll(this.options.selectorItem))),n=this.getCurrentNavigation()||this.element.querySelector(this.options.selectorItemSelected),o=function(n){var o=Math.max(t.indexOf(n)+e,-1);return t[function(e,t){return e+(e>=0?0:t)}(function(e,t){return e-(e<t?0:t)}(o,t.length),t.length)]},i=o(n);i&&i!==n;i=o(i))if(!i.matches(this.options.selectorItemSelected)){i.focus();break}}},{key:"select",value:function(e){var t=this,n=new CustomEvent(this.options.eventBeforeSelected,{bubbles:!0,cancelable:!0,detail:{item:e}});if(this.element.dispatchEvent(n)){if("navigation"!==this.element.dataset.dropdownType){var o="inline"!==this.element.dataset.dropdownType?this.options.selectorText:this.options.selectorTextInner,i=this.element.querySelector(o);i&&(i.innerHTML=e.innerHTML),e.classList.add(this.options.classSelected)}this.element.dataset.value=e.parentElement.dataset.value,[].concat(x(this.element.querySelectorAll(this.options.selectorItemSelected))).forEach(function(n){e!==n&&n.classList.remove(t.options.classSelected)}),this.element.dispatchEvent(new CustomEvent(this.options.eventAfterSelected,{bubbles:!0,cancelable:!0,detail:{item:e}}))}}},{key:"handleBlur",value:function(){this.element.classList.remove(this.options.classOpen)}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-dropdown]",selectorText:"."+e+"--dropdown-text",selectorTextInner:"."+e+"--dropdown-text__inner",selectorItem:"."+e+"--dropdown-link",selectorItemSelected:"."+e+"--dropdown--selected",classSelected:e+"--dropdown--selected",classOpen:e+"--dropdown--open",classDisabled:e+"--dropdown--disabled",eventBeforeSelected:"dropdown-beingselected",eventAfterSelected:"dropdown-selected"}}}]),t}(n(D,L,R));Z.components=new WeakMap,Z.NAVIGATE={BACKWARD:-1,FORWARD:1};var Q=function(e){function t(e,n){y(this,t);var i=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.manage(o(i.element.querySelector(".up-icon"),"click",function(e){i._handleClick(e)})),i.manage(o(i.element.querySelector(".down-icon"),"click",function(e){i._handleClick(e)})),i}return S(t,e),b(t,[{key:"_handleClick",value:function(e){var t=this.element.querySelector(this.options.selectorInput),n=e.currentTarget.getAttribute("class").split(" ");n.indexOf("up-icon")>=0?++t.value:n.indexOf("down-icon")>=0&&--t.value,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1}))}}],[{key:"options",get:function(){return{selectorInit:"[data-numberinput]",selectorInput:"."+v.prefix+"--number input"}}}]),t}(n(D,L,E));Q.components=new WeakMap;var ee=function(e){function t(e,n){y(this,t);var a=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return te.call(a),a.container=e.parentNode,a.tableBody=a.element.querySelector(a.options.selectorTableBody),a.expandCells=[],a.expandableRows=[],a.parentRows=[],a.overflowInitialized=!1,a.refreshRows(),a.manage(o(a.element,"click",function(e){var t=i(e,a.options.eventTrigger);t&&a._toggleState(t,e)})),a.manage(o(a.element,"keydown",function(e){if(13===e.which){var t=i(e,a.options.eventTrigger);t&&a._toggleState(t,e)}})),a}return S(t,e),b(t,[{key:"_changeState",value:function(e,t){this[this.constructor.eventHandlers[e.group]](e),t()}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-responsive-table]",selectorExpandCells:"."+e+"--table-expand",selectorExpandableRows:"."+e+"--expandable-row",selectorParentRows:"."+e+"--parent-row",selectorTableBody:"."+e+"--table-body",selectorCheckbox:"."+e+"--checkbox",classParentRowEven:e+"--parent-row--even",classExpandableRow:e+"--expandable-row",classExpandableRowEven:e+"--expandable-row--even",classExpandableRowHidden:e+"--expandable-row--hidden",classTableSortAscending:e+"--table-sort--ascending",eventBeforeExpand:"responsive-table-beforetoggleexpand",eventAfterExpand:"responsive-table-aftertoggleexpand",eventBeforeSort:"responsive-table-beforetogglesort",eventAfterSort:"responsive-table-aftertogglesort",eventBeforeSelectAll:"responsive-table-beforetoggleselectall",eventAfterSelectAll:"responsive-table-aftertoggleselectall",eventTrigger:"[data-event]",eventParentContainer:"[data-parent-row]"}}}]),t}(n(D,L,A,E));ee.components=new WeakMap,ee.eventHandlers={expand:"_toggleRowExpand",sort:"_toggleSort","select-all":"_toggleSelectAll"};var te=function(){var e=this;this._toggleState=function(t,n){var o=t.dataset,i=o.label?o.label:"",a=o.previousValue?o.previousValue:"",r=n;e.changeState({group:o.event,element:t,label:i,previousValue:a,initialEvt:r})},this._zebraStripe=function(t){t.forEach(function(t,n){n%2==0?(t.classList.add(e.options.classParentRowEven),t.nextElementSibling&&t.nextElementSibling.classList.contains(e.options.classExpandableRow)&&t.nextElementSibling.classList.add(e.options.classExpandableRowEven)):t.classList.remove(e.options.classParentRowEven)})},this._initExpandableRows=function(t){t.forEach(function(t){t.classList.remove(e.options.classExpandableRowHidden),e.tableBody.removeChild(t)})},this._toggleRowExpand=function(t){var n=t.element,o=i(t.initialEvt,e.options.eventParentContainer),a=e.expandCells.indexOf(n);void 0===n.dataset.previousValue||"expanded"===n.dataset.previousValue?(n.dataset.previousValue="collapsed",e.tableBody.insertBefore(e.expandableRows[a],e.parentRows[a+1])):(e.tableBody.removeChild(o.nextElementSibling),n.dataset.previousValue="expanded")},this._toggleSort=function(t){var n=t.element,o=t.previousValue;o&&"descending"!==o?(n.dataset.previousValue="descending",n.classList.remove(e.options.classTableSortAscending)):(n.dataset.previousValue="ascending",n.classList.add(e.options.classTableSortAscending))},this._toggleSelectAll=function(t){var n=t.element,o=t.previousValue,i=[].concat(x(e.element.querySelectorAll(e.options.selectorCheckbox)));o&&"toggled"!==o?(i.forEach(function(e){e.checked=!1}),n.dataset.previousValue="toggled"):(i.forEach(function(e){e.checked=!0}),n.dataset.previousValue="off")},this.refreshRows=function(){var t=[].concat(x(e.element.querySelectorAll(e.options.selectorExpandCells))),n=[].concat(x(e.element.querySelectorAll(e.options.selectorExpandableRows))),o=[].concat(x(e.element.querySelectorAll(e.options.selectorParentRows)));if(e.parentRows.length>0){var i=o.filter(function(t){return!e.parentRows.some(function(e){return e===t})});if(n.length>0){var a=i.map(function(e){return e.nextElementSibling}),r=[].concat(x(e.expandableRows),x(a));e._initExpandableRows(a),e.expandableRows=r}e._zebraStripe(o)}else e._zebraStripe(o),n.length>0&&(e._initExpandableRows(n),e.expandableRows=n);e.expandCells=t,e.parentRows=o}},ne=function(e){function t(e,n){y(this,t);var o=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return oe.call(o),o.container=e.parentNode,o.toolbarEl=o.element.querySelector(o.options.selectorToolbar),o.batchActionEl=o.element.querySelector(o.options.selectorActions),o.countEl=o.element.querySelector(o.options.selectorCount),o.cancelEl=o.element.querySelector(o.options.selectorActionCancel),o.tableHeaders=o.element.querySelectorAll("th"),o.tableBody=o.element.querySelector(o.options.selectorTableBody),o.expandCells=[],o.expandableRows=[],o.parentRows=[],o.refreshRows(),o.element.addEventListener("mouseover",function(e){var t=i(e,o.options.selectorChildRow);t&&o._expandableHoverToggle(t,!0)}),o.element.addEventListener("click",function(e){var t=i(e,o.options.eventTrigger);t&&o._toggleState(t,e)}),o.element.addEventListener("keydown",o._keydownHandler),o.state={checkboxCount:0},o}return S(t,e),b(t,[{key:"_changeState",value:function(e,t){this[this.constructor.eventHandlers[e.group]](e),t()}}],[{key:"options",get:function(){var e=v.prefix;return{selectorInit:"[data-table-v2]",selectorToolbar:"."+e+"--table--toolbar",selectorActions:"."+e+"--batch-actions",selectorCount:"[data-items-selected]",selectorActionCancel:"."+e+"--batch-summary__cancel",selectorCheckbox:"."+e+"--checkbox",selectorExpandCells:"."+e+"--table-expand-v2",selectorExpandableRows:"."+e+"--expandable-row-v2",selectorParentRows:"."+e+"--parent-row-v2",selectorChildRow:"[data-child-row]",selectorTableBody:"tbody",selectorTableSort:"."+e+"--table-sort-v2",selectorTableSelected:"."+e+"--data-table-v2--selected",classExpandableRow:e+"--expandable-row-v2",classExpandableRowHidden:e+"--expandable-row--hidden-v2",classExpandableRowHover:e+"--expandable-row--hover-v2",classTableSortAscending:e+"--table-sort-v2--ascending",classTableSortActive:e+"--table-sort-v2--active",classActionBarActive:e+"--batch-actions--active",classTableSelected:e+"--data-table-v2--selected",eventBeforeExpand:"data-table-v2-beforetoggleexpand",eventAfterExpand:"data-table-v2-aftertoggleexpand",eventBeforeSort:"data-table-v2-beforetogglesort",eventAfterSort:"data-table-v2-aftertogglesort",eventTrigger:"[data-event]",eventParentContainer:"[data-parent-row]"}}}]),t}(n(D,L,A));ne.components=new WeakMap,ne.eventHandlers={expand:"_rowExpandToggle",sort:"_sortToggle",select:"_selectToggle","select-all":"_selectAllToggle","action-bar-cancel":"_actionBarCancel"};var oe=function(){var e=this;this._sortToggle=function(t){var n=t.element,o=t.previousValue;[].concat(x(e.tableHeaders)).forEach(function(t){var o=t.querySelector(e.options.selectorTableSort);null!==o&&o!==n&&(o.classList.remove(e.options.classTableSortActive),o.classList.remove(e.options.classTableSortAscending))}),o&&"descending"!==o?(n.dataset.previousValue="descending",n.classList.add(e.options.classTableSortActive),n.classList.remove(e.options.classTableSortAscending)):(n.dataset.previousValue="ascending",n.classList.add(e.options.classTableSortActive),n.classList.add(e.options.classTableSortAscending))},this._selectToggle=function(t){var n=t.element,o=n.checked;e.state.checkboxCount+=o?1:-1,e.countEl.textContent=e.state.checkboxCount,n.parentNode.parentNode.classList.toggle(e.options.classTableSelected),e._actionBarToggle(e.state.checkboxCount>0)},this._selectAllToggle=function(t){var n=t.element.checked,o=[].concat(x(e.element.querySelectorAll(e.options.selectorCheckbox)));e.state.checkboxCount=n?o.length-1:0,o.forEach(function(t){t.checked=n;var o=t.parentNode.parentNode;n&&o?o.classList.add(e.options.classTableSelected):o.classList.remove(e.options.classTableSelected)}),e._actionBarToggle(e.state.checkboxCount>0),e.batchActionEl&&(e.countEl.textContent=e.state.checkboxCount)},this._actionBarCancel=function(){var t=[].concat(x(e.element.querySelectorAll(e.options.selectorCheckbox)));[].concat(x(e.element.querySelectorAll(e.options.selectorTableSelected))).forEach(function(t){t.classList.remove(e.options.classTableSelected)}),t.forEach(function(e){e.checked=!1}),e.state.checkboxCount=0,e._actionBarToggle(!1),e.batchActionEl&&(e.countEl.textContent=e.state.checkboxCount)},this._actionBarToggle=function(t){var n=function t(n){e.batchActionEl.removeEventListener("transitionend",t),n.target.matches(e.options.selectorActions)&&("false"===e.batchActionEl.dataset.active?e.batchActionEl.setAttribute("tabIndex",-1):e.batchActionEl.setAttribute("tabIndex",0))};t?(e.batchActionEl.dataset.active=!0,e.batchActionEl.classList.add(e.options.classActionBarActive)):e.batchActionEl&&(e.batchActionEl.dataset.active=!1,e.batchActionEl.classList.remove(e.options.classActionBarActive)),e.batchActionEl&&e.batchActionEl.addEventListener("transitionend",n)},this._expandableRowsInit=function(t){t.forEach(function(t){t.classList.remove(e.options.classExpandableRowHidden),e.tableBody.removeChild(t)})},this._rowExpandToggle=function(t){var n=t.element,o=i(t.initialEvt,e.options.eventParentContainer),a=e.expandCells.indexOf(n);void 0===n.dataset.previousValue||"expanded"===n.dataset.previousValue?(n.dataset.previousValue="collapsed",o.classList.add(e.options.classExpandableRow),e.tableBody.insertBefore(e.expandableRows[a],e.parentRows[a+1])):(o.classList.remove(e.options.classExpandableRow),e.tableBody.removeChild(o.nextElementSibling),n.dataset.previousValue="expanded")},this._expandableHoverToggle=function(t){t.previousElementSibling.classList.add(e.options.classExpandableRowHover);var n=function n(){t.previousElementSibling.classList.remove(e.options.classExpandableRowHover),t.removeEventListener("mouseout",n)};t.addEventListener("mouseout",n)},this._toggleState=function(t,n){var o=t.dataset,i=o.label?o.label:"",a=o.previousValue?o.previousValue:"",r=n;e.changeState({group:o.event,element:t,label:i,previousValue:a,initialEvt:r})},this._keydownHandler=function(t){27===t.which&&e._actionBarCancel()},this.refreshRows=function(){var t=[].concat(x(e.element.querySelectorAll(e.options.selectorExpandCells))),n=[].concat(x(e.element.querySelectorAll(e.options.selectorExpandableRows))),o=[].concat(x(e.element.querySelectorAll(e.options.selectorParentRows)));if(e.parentRows.length>0){var i=o.filter(function(t){return!e.parentRows.some(function(e){return e===t})});if(n.length>0){var a=i.map(function(e){return e.nextElementSibling}),r=[].concat(x(e.expandableRows),x(a))