Files
partsERP/static/dist/js/main.bundle.js

2 lines
120 KiB
JavaScript

/*! For license information please see main.bundle.js.LICENSE.txt */
(()=>{"use strict";(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(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,r(o.key),o)}}function r(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}var n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r=e,n=[{key:"isEmpty",value:function(e){var t=!0;if(null!==e&&"null"!==e&&void 0!==e&&"undefined"!==e)if(null==e.length)t=!1;else if("function"==typeof e)t=!1;else{var r="string"==typeof e;if(r&&(e=e.trim()),e.length>0)if(r)t=!1;else if("string"!=typeof e[0])t=!1;else for(var n=0;n<e.length;n++)if(""!=e[n]){t=!1;break}}return t}},{key:"isValidNumber",value:function(t,r){return!e.isEmpty(t)&&!isNaN(t)&&(!r||parseFloat(t)>0)}},{key:"getDataContentType",value:function(t){var r=null,n="";return e.isEmpty(t)||("string"==typeof t?(r=t,n="application/x-www-form-urlencoded; charset=UTF-8"):(r=JSON.stringify(t),n="application/json; charset=UTF-8")),{Data:r,ContentType:n}}},{key:"arrayContainsItem",value:function(t,r){var n=!1;if(!e.isEmpty(t)&&!e.isEmpty(r))if(t[0]instanceof jQuery){for(var o=0;o<t.length;o++)if(document.querySelectorAll(t[o]).is(r)){n=!0;break}}else if(t[0]instanceof Date){for(var i=0;i<t.length;i++)if(t[i].getTime()===r.getTime()){n=!0;break}}else for(var a=0;a<t.length;a++)if(t[a]==r){n=!0;break}return n}},{key:"dictHasKey",value:function(e,t){return t in e}},{key:"areEqualDicts",value:function(e,t){var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var o=0,i=r;o<i.length;o++){var a=i[o];if(e[a]!==t[a])return!1}return!0}},{key:"imageExists",value:function(e,t){var r=new Image;r.onload=function(){t(!0)},r.onerror=function(){t(!1)},r.src=e}},{key:"validateImageUrl",value:function(t,r){e.imageExists(r,(function(e){e&&document.querySelectorAll("#"+t).css({"background-image":"url("+url+")","background-size":"35px 35px"})}))}}],null&&t(r.prototype,null),n&&t(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}();function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,o=[{key:"setElementValueCurrent",value:function(e,t){e.setAttribute(attrValueCurrent,t),"checkbox"===e.type?e.checked=t:"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName?e.value=t:e.textContent=t}},{key:"setElementValuePrevious",value:function(e,t){e.setAttribute(attrValuePrevious,t)}},{key:"getCellFromElement",value:function(e){return e.closest("td")}},{key:"getRowFromElement",value:function(e){return e.closest("tr")}},{key:"convertForm2JSON",value:function(t){var r={};if(n.isEmpty(t))return console.log("empty form element"),r;var o,i,a,l=t.querySelectorAll("."+flagContainerInput+"."+flagFilter);console.log("containersFilter: "+l);for(var u=0;u<l.length;u++)i=(o=l[u]).querySelector("label").getAttribute("for"),a=o.querySelector("#".concat(i)),r[i]=e.getElementValueCurrent(a);return r}},{key:"loadPageBody",value:function(e){document.querySelector(idPageBody).innerHTML=e}},{key:"getHashPageCurrent",value:function(){var e=document.body.dataset.page;return console.log("hashPageCurrent: "+e),e}},{key:"isElementDirty",value:function(t){t.setAttribute(attrValueCurrent,e.getElementValueCurrent(t));var r=t.getAttribute(attrValuePrevious)!=t.getAttribute(attrValueCurrent);return e.handleDirtyElement(t,r),r}},{key:"handleDirtyElement",value:function(e,t){t?e.classList.add(flagDirty):e.classList.remove(flagDirty)}},{key:"getElementValueCurrent",value:function(e){var t="";return n.isEmpty(e)||(t="checkbox"===e.type?e.checked:"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName?e.value:e.textContent),n.isEmpty(t)&&(t=""),t}},{key:"isTableElementDirty",value:function(t){var r=e.isElementDirty(t),n=e.getCellFromElement(t);r?n.classList.add(flagDirty):n.classList.remove(flagDirty)}}],(r=[{key:"scrollToElement",value:function(e,t){e.scrollTop(e.scrollTop()+(t.offset().top-e.offset().top))}},{key:"isElementInContainer",value:function(e,t){"function"==typeof jQuery&&(e instanceof jQuery&&(e=e[0]),t instanceof jQuery&&(t=t[0]));var r=e.getBoundingClientRect(),n=t.getBoundingClientRect();return r.top<=n.top&&r.left<=n.left&&n.top+n.height<=r.top+r.height&&n.left+n.width<=r.left+r.width}},{key:"alertError",value:function(e,t){alert(e+"\n"+t)}}])&&i(t.prototype,r),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,o}();function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}var f=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"initialiseEventHandler",value:function(e,t,r){document.querySelectorAll(e).forEach((function(e){e.classList.contains(t)||(e.classList.add(t),r(e))}))}}],null&&c(e.prototype,null),t&&c(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}var v=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"getLocalStorage",value:function(e){return JSON.parse(localStorage.getItem(e))}},{key:"setLocalStorage",value:function(e,t){localStorage.setItem(e,JSON.stringify(t))}}],null&&d(e.prototype,null),t&&d(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function g(){g=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),l=new q(n||[]);return o(a,"_invoke",{value:j(e,r,l)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var y="suspendedStart",d="suspendedYield",p="executing",v="completed",m={};function b(){}function S(){}function P(){}var k={};c(k,a,(function(){return this}));var w=Object.getPrototypeOf,E=w&&w(w(D([])));E&&E!==r&&n.call(E,a)&&(k=E);var O=P.prototype=b.prototype=Object.create(k);function C(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function L(e,t){function r(o,i,a,l){var u=f(e[o],e,i);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==h(s)&&n.call(s,"__await")?t.resolve(s.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(s).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,l)}))}l(u.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,r,n){var o=y;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var l=n.delegate;if(l){var u=T(l,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=f(t,r,n);if("normal"===c.type){if(o=n.done?v:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=v,n.method="throw",n.arg=c.arg)}}}function T(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,T(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function q(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function D(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(h(t)+" is not iterable")}return S.prototype=P,o(O,"constructor",{value:P,configurable:!0}),o(P,"constructor",{value:S,configurable:!0}),S.displayName=c(P,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c(e,u,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},C(L.prototype),c(L.prototype,l,(function(){return this})),t.AsyncIterator=L,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new L(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},C(O),c(O,u,"Generator"),c(O,a,(function(){return this})),c(O,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=D,q.prototype={constructor:q,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:D(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function m(e,t,r,n,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void r(e)}l.done?t(u):Promise.resolve(u).then(n,o)}function b(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){m(i,n,o,a,l,"next",e)}function l(e){m(i,n,o,a,l,"throw",e)}a(void 0)}))}}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,P(n.key),n)}}function P(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}var k=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,r=[{key:"getCsrfToken",value:function(){return document.querySelector(idCSRFToken).getAttribute("content")}},{key:"request",value:(u=b(g().mark((function t(r){var n,o,i,a,l,u,c=arguments;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:"GET",o=c.length>2&&void 0!==c[2]?c[2]:null,i=c.length>3&&void 0!==c[3]?c[3]:null,a=e.getUrlFromHash(r,i),l={method:n,headers:{"Content-Type":"application/json","X-CSRFToken":e.getCsrfToken()}},!o||"POST"!==n&&"PUT"!==n&&"PATCH"!==n||(l.body=JSON.stringify(o)),console.log("API request:",n,a,o),t.prev=7,t.next=10,fetch(a,l);case 10:if((u=t.sent).ok){t.next=13;break}throw new Error("HTTP error! status: ".concat(u.status));case 13:return t.next=15,u.json();case 15:return t.abrupt("return",t.sent);case 18:throw t.prev=18,t.t0=t.catch(7),console.error("API request failed:",t.t0),t.t0;case 22:case"end":return t.stop()}}),t,null,[[7,18]])}))),function(e){return u.apply(this,arguments)})},{key:"getUrlFromHash",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;null==e&&(e=hashPageHome),console.log("getUrlFromHash:"),console.log("base url: "+_pathHost+"\nhash: "+e+"\nparams: "+t);var r=_pathHost+e;return t&&(r+="?"+new URLSearchParams(t).toString()),console.log("url: "+r),r}},{key:"goToUrl",value:function(e){window.location.href=e}},{key:"goToHash",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.getUrlFromHash(t,r);e.goToUrl(n)}},{key:"loginUser",value:(a=b(g().mark((function t(){var r;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(r={})[keyCallback]=l.getHashPageCurrent(),t.next=4,e.request(hashPageUserLogin,"POST",r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)}))),function(){return a.apply(this,arguments)})},{key:"getCategories",value:(i=b(g().mark((function t(){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.request(hashGetStoreProductCategory);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),function(){return i.apply(this,arguments)})},{key:"getCategoriesByFilters",value:(o=b(g().mark((function t(r){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.goToHash(hashPageStoreProductCategories,r);case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)})},{key:"saveCategories",value:(n=b(g().mark((function t(r,n,o){var i;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(i={})[flagFormFilters]=l.convertForm2JSON(n),i[flagCategory]=r,i[flagComment]=o,t.next=6,e.request(hashSaveStoreProductCategory,"POST",i);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)})}],r&&S(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n,o,i,a,u}();function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,O(n.key),n)}}function O(e){var t=function(e){if("object"!=w(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==w(t)?t:t+""}var C=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new Error("Router is required");if(console.log("initialising with router: ",t),this.router=t,this.title=titlePageCurrent,this.constructor===e)throw new Error("Cannot instantiate abstract class");if(!this.constructor.hash)throw new Error("Class ".concat(this.constructor.name," must have a static hash attribute."))}return t=e,r=[{key:"initialize",value:function(){throw new Error("Method 'initialize()' must be implemented.")}},{key:"sharedInitialize",value:function(){this.logInitialisation(),this.hookupCommonElements()}},{key:"logInitialisation",value:function(){console.log("Initializing "+this.title+" page")}},{key:"hookupCommonElements",value:function(){this.hookupNavigation(),this.hookupImagesLogo()}},{key:"hookupNavigation",value:function(){console.log("hooking up navigation");var e=document.querySelector(idOverlayHamburger).querySelectorAll("div."+flagRow).length;console.log("count nav options: ",e),f.initialiseEventHandler(idButtonHamburger,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation();var t=document.querySelector(idOverlayHamburger);t.classList.contains(flagCollapsed)?(t.classList.remove(flagCollapsed),t.classList.add(flagExpanded)):(t.classList.remove(flagExpanded),t.classList.add(flagCollapsed))}))})),this.hookupButtonNavHome(),this.hookupButtonNavServices(),this.hookupButtonNavContact(),this.hookupButtonNavUserAccount(),this.hookupButtonNavUserLogout(),this.hookupButtonNavUserLogin(),this.hookupButtonNavStoreHome(),this.hookupButtonNavStoreProductPermutations(),this.hookupButtonNavStoreStockItems(),this.hookupButtonNavAdminHome()}},{key:"hookupButtonNavHome",value:function(){var e=this;f.initialiseEventHandler("."+flagNavHome,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageHome)}))}))}},{key:"hookupButtonNavServices",value:function(){var e=this;f.initialiseEventHandler("."+flagNavServices,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),console.log("going to services page"),e.router.navigateToHash(hashPageServices)}))}))}},{key:"hookupButtonNavContact",value:function(){var e=this;f.initialiseEventHandler("."+flagNavContact,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageContact)}))}))}},{key:"hookupButtonNavUserAccount",value:function(){var e=this;f.initialiseEventHandler("."+flagNavUserAccount,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageUserAccount)}))}))}},{key:"hookupButtonNavUserLogout",value:function(){var e=this;f.initialiseEventHandler("."+flagNavUserLogout,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageUserLogout)}))}))}},{key:"hookupButtonNavUserLogin",value:function(){f.initialiseEventHandler("."+flagNavUserLogin,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation(),k.loginUser().then((function(e){e.Success?this.router.navigateToUrl(e[keyCallback],null,!1):l.alertError("Error",e.Message)}))}))}))}},{key:"hookupButtonNavStoreHome",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreHome,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreHome)}))}))}},{key:"hookupButtonNavStoreProductCategories",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreProductCategories,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreProductCategories)}))}))}},{key:"hookupButtonNavStoreProducts",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreProducts,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreProducts)}))}))}},{key:"hookupButtonNavStoreProductPermutations",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreProductPermutations,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreProductPermutations)}))}))}},{key:"hookupButtonNavStoreProductPrices",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreProductPrices,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreProductPrices)}))}))}},{key:"hookupButtonNavStoreProductVariations",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreProductVariations,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreProductVariations)}))}))}},{key:"hookupButtonNavStoreStockItems",value:function(){var e=this;f.initialiseEventHandler("."+flagNavStoreStockItems,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageStoreStockItems)}))}))}},{key:"hookupButtonNavAdminHome",value:function(){var e=this;f.initialiseEventHandler("."+flagNavAdminHome,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageAdminHome)}))}))}},{key:"hookupImagesLogo",value:function(){var e=this,t="img."+flagImageLogo;f.initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.router.navigateToHash(hashPageHome)}))}))}},{key:"hookupOverlayFromId",value:function(e){f.initialiseEventHandler(e,flagInitialised,(function(e){e.querySelector("button."+flagClose).addEventListener("click",(function(t){t.stopPropagation(),e.css("display","none")}))}))}},{key:"hookupButtonSave",value:function(){f.initialiseEventHandler("form."+flagFilter+" button."+flagSave,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation(),showOverlayConfirm()})),e.classList.add(flagCollapsed)}))}},{key:"hookupVideos",value:function(){f.initialiseEventHandler("video",flagInitialised,(function(e){e.addEventListener("mouseover",videoPlay(e)),e.addEventListener("mouseout",videoPause(e))}))}},{key:"leave",value:function(){if(console.log("Leaving "+this.title+" page"),this.constructor===e)throw new Error("Must implement leave() method.")}},{key:"setLocalStoragePage",value:function(e){v.setLocalStorage(this.constructor.hash,e)}},{key:"getLocalStoragePage",value:function(){return v.getLocalStorage(this.constructor.hash)}},{key:"toggleShowButtonsSaveCancel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null==t&&(t=document.querySelector("form."+flagFilter+" button."+flagSave)),null==r&&(r=document.querySelector("form."+flagFilter+" button."+flagCancel)),e?(r.classList.remove(flagCollapsed),t.classList.remove(flagCollapsed)):(r.classList.add(flagCollapsed),t.classList.add(flagCollapsed))}}],n=[{key:"isDirtyFilter",value:function(e){var t=l.isElementDirty(e);return t&&document.querySelectorAll(idTableMain+" tbody tr").remove(),t}}],r&&E(t.prototype,r),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}();function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,x(n.key),n)}}function T(e,t,r){return t=q(t),function(e,t){if(t&&("object"==L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,I()?Reflect.construct(t,r||[],q(e).constructor):t.apply(e,r))}function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(I=function(){return!!e})()}function A(){return A="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=q(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},A.apply(null,arguments)}function q(e){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},q(e)}function D(e,t){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},D(e,t)}function x(e){var t=function(e){if("object"!=L(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=L(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==L(t)?t:t+""}var R,_,F,N=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),T(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}(t,e),r=t,n=[{key:"initialize",value:function(){this.sharedInitialize(),this.hookupAdminStore()}},{key:"hookupAdminStore",value:function(){this.hookupButtonNavStoreProductCategories(),this.hookupButtonNavStoreProducts(),this.hookupButtonNavStoreProductPermutations(),this.hookupButtonNavStoreProductPrices(),this.hookupButtonNavStoreStockItems(),this.hookupButtonNavStoreProductVariations(),this.hookupButtonNavAdminStoreStripeProducts(),this.hookupButtonNavAdminStoreStripePrices()}},{key:"hookupButtonNavAdminStoreStripeProducts",value:function(){f.initialiseEventHandler("."+flagNavAdminStoreStripeProducts,flagInitialised,(function(e){e.addEventListener("click",(function(e){this.router.navigateToHash(hashPageAdminStoreStripeProducts)}))}))}},{key:"hookupButtonNavAdminStoreStripePrices",value:function(){f.initialiseEventHandler("."+flagNavAdminStoreStripePrices,flagInitialised,(function(e){e.addEventListener("click",(function(e){this.router.navigateToHash(hashPageAdminStoreStripePrices)}))}))}},{key:"leave",value:function(){var e,r,n;(e=t,r=this,"function"==typeof(n=A(q(1&3?e.prototype:e),"leave",r))?function(e){return n.apply(r,e)}:n)([])}}],n&&j(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(C);function B(e){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(e)}function V(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,U(n.key),n)}}function H(e,t,r){return t=z(t),function(e,t){if(t&&("object"==B(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,M()?Reflect.construct(t,r||[],z(e).constructor):t.apply(e,r))}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(M=function(){return!!e})()}function Q(){return Q="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=z(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Q.apply(null,arguments)}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},z(e)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}function U(e){var t=function(e){if("object"!=B(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==B(t)?t:t+""}R=N,_="hash",F=hashPageAdminHome,(_=x(_))in R?Object.defineProperty(R,_,{value:F,enumerable:!0,configurable:!0,writable:!0}):R[_]=F;var G=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),H(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}(t,e),function(e,t){return t&&V(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize(),this.hookupButtonNavContact()}},{key:"leave",value:function(){!function(e,t,r){var n=Q(z(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function K(e){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},K(e)}function X(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,te(n.key),n)}}function Y(e,t,r){return t=Z(t),function(e,t){if(t&&("object"==K(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,W()?Reflect.construct(t,r||[],Z(e).constructor):t.apply(e,r))}function W(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(W=function(){return!!e})()}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Z(e)}function ee(e,t){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ee(e,t)}function te(e){var t=function(e){if("object"!=K(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=K(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==K(t)?t:t+""}!function(e,t,r){(t=U(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(G,"hash",hashPageHome);var re=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Y(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ee(e,t)}(t,e),function(e,t){return t&&X(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}}])}(C);function ne(e){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ne(e)}function oe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,se(n.key),n)}}function ie(e,t,r){return t=ue(t),function(e,t){if(t&&("object"==ne(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ae()?Reflect.construct(t,r||[],ue(e).constructor):t.apply(e,r))}function ae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ae=function(){return!!e})()}function le(){return le="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ue(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},le.apply(null,arguments)}function ue(e){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ue(e)}function ce(e,t){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ce(e,t)}function se(e){var t=function(e){if("object"!=ne(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=ne(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ne(t)?t:t+""}!function(e,t,r){(t=te(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(re,"hash",hashPageContact);var fe=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ie(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ce(e,t)}(t,e),function(e,t){return t&&oe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}},{key:"leave",value:function(){!function(e,t,r){var n=le(ue(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function ye(e){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(e)}function de(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,be(n.key),n)}}function pe(e,t,r){return t=ge(t),function(e,t){if(t&&("object"==ye(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ve()?Reflect.construct(t,r||[],ge(e).constructor):t.apply(e,r))}function ve(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ve=function(){return!!e})()}function he(){return he="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ge(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},he.apply(null,arguments)}function ge(e){return ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ge(e)}function me(e,t){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},me(e,t)}function be(e){var t=function(e){if("object"!=ye(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=ye(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ye(t)?t:t+""}!function(e,t,r){(t=se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(fe,"hash",hashPageServices);var Se=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),pe(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&me(e,t)}(t,e),function(e,t){return t&&de(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}},{key:"leave",value:function(){!function(e,t,r){var n=he(ge(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function Pe(e){return Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pe(e)}function ke(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,je(n.key),n)}}function we(e,t,r){return t=Ce(t),function(e,t){if(t&&("object"==Pe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ee()?Reflect.construct(t,r||[],Ce(e).constructor):t.apply(e,r))}function Ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ee=function(){return!!e})()}function Oe(){return Oe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ce(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Oe.apply(null,arguments)}function Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ce(e)}function Le(e,t){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Le(e,t)}function je(e){var t=function(e){if("object"!=Pe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Pe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pe(t)?t:t+""}!function(e,t,r){(t=be(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Se,"hash",hashPageAccessibilityReport);var Te=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),we(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Le(e,t)}(t,e),function(e,t){return t&&ke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}},{key:"leave",value:function(){!function(e,t,r){var n=Oe(Ce(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function Ie(e){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ie(e)}function Ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Fe(n.key),n)}}function qe(e,t,r){return t=Re(t),function(e,t){if(t&&("object"==Ie(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,De()?Reflect.construct(t,r||[],Re(e).constructor):t.apply(e,r))}function De(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(De=function(){return!!e})()}function xe(){return xe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Re(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},xe.apply(null,arguments)}function Re(e){return Re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Re(e)}function _e(e,t){return _e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_e(e,t)}function Fe(e){var t=function(e){if("object"!=Ie(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Ie(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ie(t)?t:t+""}!function(e,t,r){(t=je(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Te,"hash",hashPageAccessibilityStatement);var Ne=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),qe(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_e(e,t)}(t,e),function(e,t){return t&&Ae(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}},{key:"leave",value:function(){!function(e,t,r){var n=xe(Re(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function Ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ue(n.key),n)}}function He(e,t,r){return t=ze(t),function(e,t){if(t&&("object"==Be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Me()?Reflect.construct(t,r||[],ze(e).constructor):t.apply(e,r))}function Me(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Me=function(){return!!e})()}function Qe(){return Qe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ze(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Qe.apply(null,arguments)}function ze(e){return ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ze(e)}function Je(e,t){return Je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Je(e,t)}function Ue(e){var t=function(e){if("object"!=Be(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Be(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Be(t)?t:t+""}!function(e,t,r){(t=Fe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ne,"hash",hashPageLicense);var Ge=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),He(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Je(e,t)}(t,e),function(e,t){return t&&Ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize(),this.hookupStoreCardsInfo(),this.hookupOverlaysStoreBasketInfo(),this.hookupButtonCheckoutSession()}},{key:"hookupStoreCardsInfo",value:function(){document.querySelectorAll(idContainerInfoDelivery).addEventListener("click",(function(e){console.log("delivery modal display method"),document.querySelectorAll(idOverlayInfoDelivery).css("display","block")})),document.querySelectorAll(idContainerInfoBilling).addEventListener("click",(function(e){console.log("billing modal display method"),document.querySelectorAll(idOverlayInfoBilling).css("display","block")}))}},{key:"hookupOverlaysStoreBasketInfo",value:function(){var e,t;e=document.querySelectorAll(idOverlayInfoDelivery),t=e.querySelector("form"),hookupOverlay(e),f.initialiseEventHandler(t,flagInitialised,(function(){t.submit((function(e){t=document.querySelectorAll(t),e.preventDefault(),console.log("delivery submit method"),ajaxData={},ajaxData[keyInfoType]=keyInfoDelivery,ajaxData=convertFormBilling2JSON(ajaxData,idOverlayInfoDelivery),ajaxJSONData("info delivery",mapHashToController(hashStoreBasketInfo),ajaxData,loadInfoAddress,!1)}))})),e=document.querySelectorAll(idOverlayInfoBilling),t=e.querySelector("form"),hookupOverlay(e),f.initialiseEventHandler(t,flagInitialised,(function(){t.submit((function(e){e.preventDefault(),console.log("billing submit method"),ajaxData={},ajaxData[keyInfoType]=keyInfoBilling,ajaxData=convertFormBilling2JSON(ajaxData,idOverlayInfoBilling),ajaxJSONData("info billing",mapHashToController(hashStoreBasketInfo),ajaxData,loadInfoAddress,!1)}))}));var r=[keyNameFull,keyPhoneNumber,keyPostcode,keyAddress1,keyCity,keyCounty];for(var n in r)t.querySelector("#"+r[n]).removeAttr("required")}},{key:"loadInfoAddress",value:function(e){console.log("ajax:"),console.log(e.data);var t=e.data[keyInfoType],r=e.data[t];if(v.setLocalStorage(t,r),t==keyInfoBilling){var n=document.querySelectorAll(idContainerInfoBilling);r[keyInfoIdentical]?n.querySelector("div").innerHTML="Same as delivery address":n.querySelector("div").innerHTML="<strong>"+r[keyNameFull]+"</strong> at <strong>"+r[keyPostcode]+"</strong>",document.querySelectorAll(idOverlayInfoBilling).css("display","none"),document.querySelectorAll(idOverlayInfoBilling).querySelector("form").classList.add(flagSubmitted)}else document.querySelectorAll(idContainerInfoDelivery).querySelector("div").innerHTML="<strong>"+r[keyNameFull]+"</strong> at <strong>"+r[keyPostcode]+"</strong>",document.querySelectorAll(idOverlayInfoDelivery).css("display","none"),document.querySelectorAll(idOverlayInfoDelivery).querySelector("form").classList.add(flagSubmitted)}},{key:"convertFormBilling2JSON",value:function(e,t){var r;r=document.querySelectorAll(t).querySelector("form"),r=document.querySelectorAll(idOverlayInfoDelivery).querySelector("form"),console.log("converting billing form to json\nform ID: "+r.id),e[keyForm]=convertForm2JSON(r);var n=[keyNameFull,keyPhoneNumber,keyPostcode,keyAddress1,keyAddress2,keyCity,keyCounty];for(var o in console.log("ajaxData:"),console.log(e),e[keyForm][keyInfoIdentical]=getElementCurrentValue(r.querySelector("#"+keyInfoIdentical)),n)t==idOverlayInfoBilling&&e[keyForm][keyInfoIdentical]?e[keyForm][n[o]]=getElementCurrentValue((void 0).querySelector("#"+n[o])):e[keyForm][n[o]]=getElementCurrentValue(r.querySelector("#"+n[o]));return console.log("ajaxData:"),console.log(e),e}},{key:"hookupButtonCheckoutSession",value:function(){var e=document.querySelectorAll(idButtonCheckout);e.classList.remove(flagInitialised),f.initialiseEventHandler(idButtonCheckout,flagInitialised,(function(){e.removeEventListener("click"),e.addEventListener("click",(function(e){var t=v.getLocalStorage(keyBasket),r={};r[keyBasket]=t,r=convertFormBilling2JSON(r,idOverlayInfoDelivery),(r=convertFormBilling2JSON(r,idOverlayInfoBilling))[key_code_currency]=getCurrencySelected(),ajaxJSONData("checkout session",mapHashToController(hashPageStoreCheckout),r,handleResponseCheckout,!1)}))}))}},{key:"handleResponseCheckout",value:function(e){window.location.href=e.data[keyUrlCheckout]}},{key:"hookupButtonFormBillingCopy",value:function(){f.initialiseEventHandler(idButtonFormBillingCopy,flagInitialised,(function(){document.querySelectorAll(idButtonFormBillingCopy).addEventListener("click",(function(e){var t=[keyNameFull,keyPhoneNumber,keyPostcode,keyAddress1,keyAddress2,keyCity,keyCounty],r=document.querySelectorAll(idOverlayInfoBilling).querySelector("form"),n=document.querySelectorAll(idOverlayInfoDelivery).querySelector("form");for(var o in t)r.querySelector("#"+t[o]).value=getElementCurrentValue(n.querySelector("#"+t[o]))}))}))}},{key:"leave",value:function(){!function(e,t,r){var n=Qe(ze(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function Ke(e){return Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(e)}function Xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tt(n.key),n)}}function Ye(e,t,r){return t=Ze(t),function(e,t){if(t&&("object"==Ke(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,$e()?Reflect.construct(t,r||[],Ze(e).constructor):t.apply(e,r))}function $e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return($e=function(){return!!e})()}function We(){return We="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ze(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},We.apply(null,arguments)}function Ze(e){return Ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ze(e)}function et(e,t){return et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},et(e,t)}function tt(e){var t=function(e){if("object"!=Ke(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Ke(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ke(t)?t:t+""}!function(e,t,r){(t=Ue(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ge,"hash",hashPageStoreBasket);var rt=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Ye(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&et(e,t)}(t,e),function(e,t){return t&&Xe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize(),this.hookupFiltersStore(),this.hookupStoreHome()}},{key:"leave",value:function(){!function(e,t,r){var n=We(Ze(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function nt(e){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nt(e)}function ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,it(n.key),n)}}function it(e){var t=function(e){if("object"!=nt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nt(t)?t:t+""}function at(e,t,r){return t=ct(t),function(e,t){if(t&&("object"==nt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,lt()?Reflect.construct(t,r||[],ct(e).constructor):t.apply(e,r))}function lt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(lt=function(){return!!e})()}function ut(){return ut="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ct(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},ut.apply(null,arguments)}function ct(e){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ct(e)}function st(e,t){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},st(e,t)}!function(e,t,r){(t=tt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(rt,"hash",hashPageStoreHome);var ft=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=at(this,t,[e])).cursorYInitial=null,r.rowInitial=null,r.placeholder=null,r.dragSrcEl=null,r.dragSrcRow=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&st(e,t)}(t,e),function(e,t,r){return t&&ot(e.prototype,t),r&&ot(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.constructor===t)throw new Error("Must implement initialize() method.");if(r){var o=this.getLocalStoragePage()[flagFormFilters],i=this.getFormFilters(),a=l.convertForm2JSON(i);n.areEqualDicts(o,a)}else this.sharedInitialize(),this.hookupFilters(),this.hookupButtonsAddSaveCancel(),this.hookupTableMain(),hookupOverlayConfirm((function(){e.leave(),e.saveRecordsTableDirty()}))}},{key:"hookupFilters",value:function(){if(this.constructor===t)throw new Error("Subclass of TableBasePage must implement method hookupFilters().");this.hookupButtonApplyFilters()}},{key:"hookupFilterActive",value:function(){f.initialiseEventHandler(idFormFilters+"."+flagActive,flagInitialised,(function(e){e.addEventListener("change",(function(r){t.isDirtyFilter(e)}))}))}},{key:"hookupButtonApplyFilters",value:function(){var e=this;f.initialiseEventHandler(idButtonApplyFilters,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.getAndLoadFilteredTableContent()}))}))}},{key:"getAndLoadFilteredTableContent",value:function(){var e=this.getFormFilters(),t=l.convertForm2JSON(e);this.callFilterTableContent(t).catch((function(e){return console.error("Error:",e)}))}},{key:"getFormFilters",value:function(){return document.querySelector(idFormFilters)}},{key:"callbackLoadTableContent",value:function(e){this.getTableMain().querySelector("tbody").querySelectorAll("tr").forEach((function(e){e.remove()}));var t=e.data[flagRows];!n.isEmpty(t)&&t.every((function(e){return e.hasOwnProperty("display_order")}))&&(t=t.sort((function(e,t){return e.display_order-t.display_order}))),t.forEach(this.loadRowTable.bind(this)),this.hookupTableMain()}},{key:"getTableMain",value:function(){return document.querySelector(idTableMain)}},{key:"loadRowTable",value:function(e){throw new Error("Subclass of TableBasePage must implement method loadRowTable().")}},{key:"hookupButtonsAddSaveCancel",value:function(){this.hookupButtonSave(),this.hookupButtonCancel(),this.hookupButtonAddRowTable()}},{key:"saveRecordsTableDirty",value:function(){var e=this,t=this.getTableRecords(!0);if(0!=t.length){var r=this.getFormFilters(),n=l.getElementValueCurrent(document.querySelector(idTextareaConfirm));this.callSaveTableContent(t,r,n).then((function(t){t[flagStatus]==flagSuccess?(console.log("Data received:",t),e.callbackLoadTableContent(t),console.log("Records saved!")):showOverlayError(t[flagMessage])})).catch((function(e){return console.error("Error:",e)}))}else showOverlayError("No records to save")}},{key:"getTableRecords",value:function(){var e,t=this,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.getTableMain(),o=[];return n.querySelectorAll("tbody tr").forEach((function(n){r&&!n.classList.contains(flagDirty)||(e=t.getJsonRow(n),o.push(e))})),o}},{key:"getJsonRow",value:function(e){throw new Error("Subclass of TableBasePage must implement method getJsonRow().")}},{key:"hookupButtonCancel",value:function(){f.initialiseEventHandler(idFormFilters+" button."+flagCancel,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation(),getAndLoadFilteredTableContent()})),e.classList.add(flagCollapsed)}))}},{key:"hookupButtonAddRowTable",value:function(){var e=this;f.initialiseEventHandler(idFormFilters+" button."+flagAdd,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation();var r=document.querySelector(idTableMain+" tbody"),n=_rowBlank.cloneNode(!0);n.classList.remove(flagInitialised),n.querySelectorAll("."+flagInitialised).forEach((function(e){e.classList.remove(flagInitialised)}));var o=parseInt(r.querySelector("tr:last-child").querySelector("td."+flagDisplayOrder+" ."+flagSlider).getAttribute(attrValueCurrent))+1;r.appendChild(n);var i=r.querySelector("tr:last-child").querySelector("td."+flagDisplayOrder+" ."+flagSlider);i&&(i.setAttribute(attrValueCurrent,o),i.setAttribute(attrValuePrevious,o)),e.hookupTableMain()}))}))}},{key:"hookupTableMain",value:function(){if(this.constructor===t)throw new Error("Must implement hookupTableMain() method.");null==_rowBlank&&this.cacheRowBlank()}},{key:"cacheRowBlank",value:function(){var e=idTableMain+" tbody tr."+flagRowNew,t=document.querySelector(e);console.log("row blank temp: ",t),_rowBlank=t.cloneNode(!0),document.querySelectorAll(e).forEach((function(e){e.remove()}))}},{key:"hookupSlidersDisplayOrderTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagDisplayOrder+" input."+flagSlider+"."+flagDisplayOrder;f.initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(r){console.log("slider change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupTextareasCodeTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagCode+" textarea";f.initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(r){console.log("textarea change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"handleChangeElementCellTable",value:function(e){var t=l.getRowFromElement(e),r=l.getCellFromElement(e);console.log("td: ",r);var n=this.isDirtyRow(t),o=e.classList.contains(flagDirty),i=l.isElementDirty(e);if(console.log("isDirtyElement: ",i),console.log("wasDirtyElement: ",o),i!=o){l.handleDirtyElement(r,i);var a=this.isDirtyRow(t);if(console.log("isNowDirtyRow: ",a),console.log("wasDirtyRow: ",n),a!=n){l.handleDirtyElement(t,a);var u=this.getTableRecords(!0),c=u.length>0;console.log("dirty records:",u),console.log("existsDirtyRecord:",c),this.toggleShowButtonsSaveCancel(c)}}}},{key:"isDirtyRow",value:function(e){throw new Error("Subclass of TableBasePage must implement method isDirtyRow().")}},{key:"toggleShowButtonsSaveCancel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null==t&&(t=document.querySelector(idFormFilters+" button."+flagSave)),null==r&&(r=document.querySelector(idFormFilters+" button."+flagCancel)),e?(r.classList.remove(flagCollapsed),t.classList.remove(flagCollapsed)):(r.classList.add(flagCollapsed),t.classList.add(flagCollapsed))}},{key:"handleChangeSelectCellTable",value:function(e){var t=l.getRowFromElement(e),r=l.getCellFromElement(e);console.log("td: ",r);var n=this.isDirtyRow(t),o=e.classList.contains(flagDirty),i=l.isElementDirty(e);if(console.log("isDirtyElement: ",i),console.log("wasDirtyElement: ",o),i!=o){l.handleDirtyElement(r,i);var a=e.options[e.selectedIndex];r.setAttribute(attrIdAccessLevel,a.value),r.setAttribute(flagAccessLevelRequired,a.textcontent);var u=this.isDirtyRow(t);if(console.log("isNowDirtyRow: ",u),console.log("wasDirtyRow: ",n),u!=n){l.handleDirtyElement(t,u);var c=this.getTableRecords(!0),s=c.length>0;console.log("dirty records:",c),console.log("existsDirtyRecord:",s),this.toggleShowButtonsSaveCancel(s)}}}},{key:"hookupTextareasNameTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagName+" textarea";f.initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(r){console.log("textarea change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupTextareasDescriptionTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagDescription+" textarea";f.initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(r){console.log("textarea change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupInputsActiveTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagActive+' input[type="checkbox"]';f.initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(r){console.log("input change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupTdsAccessLevel",value:function(){var e=this;f.initialiseEventHandler(idTableMain+" tbody td."+flagAccessLevel,flagInitialised,(function(t){t.addEventListener("click",(function(t){e.handleClickTdAccessLevel(t)}))}))}},{key:"handleClickTdAccessLevel",value:function(e){console.log("tdAccessLevel clicked"),e.stopPropagation();var t=l.getCellFromElement(e.target);console.log("tdAccessLevel: ",t);var r=l.getRowFromElement(t),n=t.querySelector("div."+flagAccessLevel).getAttribute(attrIdAccessLevel),o=document.createElement("select");o.classList.add(flagAccessLevel),o.setAttribute(attrValueCurrent,n),o.setAttribute(attrValuePrevious,n),optionsAccessLevel.forEach((function(e){var t=document.createElement("option");t.value=e.value,t.textContent=e.text,e.value==n&&(t.selected=!0),o.appendChild(t)}));var i=t.cloneNode(!0);i.innerHTML="",i.appendChild(o),r.replaceChild(i,t),this.hookupDdlsAccessLevelTable()}},{key:"hookupDdlsAccessLevelTable",value:function(){var e=this;f.initialiseEventHandler(idTableMain+" tbody select."+flagAccessLevel,flagInitialised,(function(t){t.addEventListener("change",(function(r){r.stopPropagation(),e.handleChangeDdlAccessLevelTable(t)}))}))}},{key:"handleChangeDdlAccessLevelTable",value:function(e){var t=l.getRowFromElement(e),r=l.getCellFromElement(e);console.log("td: ",r);var n=this.isDirtyRow(t),o=e.classList.contains(flagDirty),i=l.isElementDirty(e);if(console.log("isDirtyElement: ",i),console.log("wasDirtyElement: ",o),i!=o){l.handleDirtyElement(r,i);var a=e.options[e.selectedIndex];r.setAttribute(attrIdAccessLevel,a.value),r.setAttribute(flagAccessLevelRequired,a.textcontent);var u=this.isDirtyRow(t);if(console.log("isNowDirtyRow: ",u),console.log("wasDirtyRow: ",n),u!=n){l.handleDirtyElement(t,u);var c=this.getTableRecords(!0),s=c.length>0;console.log("dirty records:",c),console.log("existsDirtyRecord:",s),this.toggleShowButtonsSaveCancel(s)}}}},{key:"leave",value:function(){if(this.constructor===t)throw new Error("Must implement leave() method.");!function(e,t,r){var n=ut(ct(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([]);var e=this.getFormFilters(),r={};r[flagFormFilters]=l.convertForm2JSON(e),this.setLocalStoragePage(r),_rowBlank=null}}],[{key:"isDirtyFilter",value:function(e){var t=l.isElementDirty(e);if(t){var r=document.querySelector(idTableMain+" tbody");r.querySelectorAll("tr").remove(),r.appendChild(document.createElement('<div>Press "Apply Filters" to refresh the table.</div>'))}return t}}])}(C);function yt(e){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yt(e)}function dt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Pt(n.key),n)}}function pt(e,t,r){return t=mt(t),function(e,t){if(t&&("object"==yt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,vt()?Reflect.construct(t,r||[],mt(e).constructor):t.apply(e,r))}function vt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(vt=function(){return!!e})()}function ht(e,t,r,n){var o=gt(mt(1&n?e.prototype:e),t,r);return 2&n&&"function"==typeof o?function(e){return o.apply(r,e)}:o}function gt(){return gt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=mt(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},gt.apply(null,arguments)}function mt(e){return mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mt(e)}function bt(e,t){return bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},bt(e,t)}function St(e,t,r){return(t=Pt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pt(e){var t=function(e){if("object"!=yt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=yt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yt(t)?t:t+""}var kt=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),St(r=pt(this,t,[e]),"callFilterTableContent",k.getCategoriesByFilters),St(r,"callSaveTableContent",k.saveCategories),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bt(e,t)}(t,e),function(e,t){return t&&dt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){ht(t,"initialize",this,3)([])}},{key:"hookupFilters",value:function(){ht(t,"hookupFilters",this,3)([]),this.hookupFilterIsNotEmpty(),this.hookupFilterActive()}},{key:"hookupFilterIsNotEmpty",value:function(){f.initialiseEventHandler("."+flagIsNotEmpty,flagInitialised,(function(e){e.addEventListener("change",(function(r){t.isDirtyFilter(e)}))}))}},{key:"loadRowTable",value:function(e){if(null!=e){var t=_rowBlank.cloneNode(!0);t.classList.remove(flagRowNew),t.classList.remove(flagInitialised),t.querySelectorAll("."+flagInitialised).forEach((function(e){e.classList.remove(flagInitialised)})),console.log("applying data row: ",e);var r=t.querySelector("td."+flagDisplayOrder+" ."+flagSlider),n=t.querySelector("td."+flagCode+" textarea"),o=t.querySelector("td."+flagName+" textarea"),i=t.querySelector("td."+flagDescription+" textarea"),a=t.querySelector("td."+flagAccessLevel),u=a.querySelector("div."+flagAccessLevel),c=t.querySelector("td."+flagActive+' input[type="checkbox"]');r.setAttribute(attrValueCurrent,e[flagDisplayOrder]),l.setElementValuePrevious(r,e[flagDisplayOrder]),l.setElementValueCurrent(n,e[flagCode]),l.setElementValuePrevious(n,e[flagCode]),l.setElementValueCurrent(o,e[flagName]),l.setElementValuePrevious(o,e[flagName]),l.setElementValueCurrent(i,e[flagDescription]),l.setElementValuePrevious(i,e[flagDescription]),a.setAttribute(attrIdAccessLevel,e[attrIdAccessLevel]),a.setAttribute(flagAccessLevelRequired,e[flagAccessLevelRequired]),u.setAttribute(attrIdAccessLevel,e[attrIdAccessLevel]),l.setElementValueCurrent(u,e[attrIdAccessLevel]),l.setElementValuePrevious(u,e[attrIdAccessLevel]),u.textContent=e[flagAccessLevelRequired],l.setElementValueCurrent(c,e[flagActive]),l.setElementValuePrevious(c,e[flagActive]),t.setAttribute(e[flagKeyPrimary],e[e[flagKeyPrimary]]),this.getTableMain().querySelector("tbody").appendChild(t)}}},{key:"getJsonRow",value:function(e){if(null!=e){var t=e.querySelector("td."+flagDisplayOrder+" ."+flagSlider),r=e.querySelector("td."+flagCode+" textarea"),n=e.querySelector("td."+flagName+" textarea"),o=e.querySelector("td."+flagDescription+" textarea"),i=e.querySelector("td."+flagAccessLevel),a=e.querySelector("td."+flagActive+' input[type="checkbox"]'),u={};return u[attrIdCategory]=e.getAttribute(attrIdCategory),u[flagCode]=l.getElementValueCurrent(r),u[flagName]=l.getElementValueCurrent(n),u[flagDescription]=l.getElementValueCurrent(o),u[flagAccessLevelRequired]=i.getAttribute(flagAccessLevelRequired),u[attrIdAccessLevel]=i.getAttribute(attrIdAccessLevel),u[flagActive]=l.getElementValueCurrent(a),u[flagDisplayOrder]=t.getAttribute(attrValueCurrent),u}}},{key:"hookupTableMain",value:function(){ht(t,"hookupTableMain",this,3)([]),this.hookupSlidersDisplayOrderTable(),this.hookupTextareasCodeTable(),this.hookupTextareasNameTable(),this.hookupTextareasDescriptionTable(),this.hookupTdsAccessLevel(),this.hookupInputsActiveTable()}},{key:"isDirtyRow",value:function(e){if(null==e)return!1;console.log("Product Category isDirtyRow"),console.log("row: ",e);var t=e.querySelector("td."+flagDisplayOrder),r=e.querySelector("td."+flagCode+" textarea"),n=e.querySelector("td."+flagName+" textarea"),o=e.querySelector("td."+flagDescription+" textarea"),i=e.querySelector("td."+flagAccessLevel),a=e.querySelector("td."+flagActive+' input[type="checkbox"]'),u=t.classList.contains(flagDirty)||r.classList.contains(flagDirty)||n.classList.contains(flagDirty)||o.classList.contains(flagDirty)||i.classList.contains(flagDirty)||a.classList.contains(flagDirty);return l.handleDirtyElement(e,u),u}},{key:"leave",value:function(){ht(t,"leave",this,3)([])}},{key:"getFiltersDefaults",value:function(){return filters={},filters.flagIsNotEmpty=!0,filters.flagActive=!0,filters}}])}(ft);function wt(e){return wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(e)}function Et(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,At(n.key),n)}}function Ot(e,t,r){return t=jt(t),function(e,t){if(t&&("object"==wt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ct()?Reflect.construct(t,r||[],jt(e).constructor):t.apply(e,r))}function Ct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ct=function(){return!!e})()}function Lt(){return Lt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=jt(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Lt.apply(null,arguments)}function jt(e){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jt(e)}function Tt(e,t){return Tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tt(e,t)}function It(e,t,r){return(t=At(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function At(e){var t=function(e){if("object"!=wt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wt(t)?t:t+""}St(kt,"hash",hashPageStoreProductCategories);var qt=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Ot(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tt(e,t)}(t,e),function(e,t){return t&&Et(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize(),hookupFilters(),hookupButtonsSaveCancel(),hookupTableMain(),hookupOverlayConfirm(savePermutations)}},{key:"hookupFilters",value:function(){f.initialiseEventHandler(idFilterCategory,flagInitialised,(function(e){console.log("hooking up filter category"),e.addEventListener("change",(function(e){loadPermutations()})),console.log("hooked up filter category")})),f.initialiseEventHandler(idFilterProduct,flagInitialised,(function(e){listProducts.forEach((function(t){t[attrIdCategory]==getElementCurrentValue(document.querySelectorAll(idFilterCategory))&&e.appendChild(document.createElement("<option>",t))})),e.addEventListener("change",(function(e){loadPermutations()}))})),f.initialiseEventHandler(idFilterIsOutOfStock,flagInitialised,(function(e){e.addEventListener("change",(function(e){loadPermutations()}))})),f.initialiseEventHandler(idFilterQuantityMin,flagInitialised,(function(e){e.addEventListener("change",(function(e){loadPermutations()}))})),f.initialiseEventHandler(idFilterQuantityMax,flagInitialised,(function(e){e.addEventListener("change",(function(e){loadPermutations()}))}))}},{key:"loadPermutations",value:function(){var e=document.querySelectorAll(idFormFiltersPermutations),t={};t[keyForm]=convertForm2JSON(e),t.csrf_token=t[keyForm].csrf_token,console.log("ajaxData:"),console.log(t),ajaxJSONData("permutations",mapHashToController(hashPageStorePermutationsPost),t,callbackLoadPermutations,!1,{"X-CSRFToken":t.csrf_token})}},{key:"callbackLoadPermutations",value:function(e){console.log("ajax:"),console.log(e.data);var t,r,n,o=document.querySelectorAll(idTableMain);(t=o.querySelector("tbody")).querySelector("tr").remove(),e.data.forEach((function(e){r=_rowBlank.cloneNode(!0),(r=document.querySelectorAll(r)).classList.remove(flagRowNew),console.log("applying data row: ",e),r.querySelector("td."+flagCategory+" select").value=e[attrIdCategory],n=r.querySelector("td."+flagProduct+" select"),listProducts.forEach((function(t){t[attrIdCategory]==e[attrIdCategory]&&n.appendChild(document.createElement("<option>",t))})),n.value=e[attrIdProduct],r.querySelector("td."+flagVariations+" textarea").value=e[flagVariations],r.querySelector("td."+flagQuantityStock+" input").value=e[flagQuantityStock],r.querySelector("td."+flagQuantityMin+" input").value=e[flagQuantityMin],r.querySelector("td."+flagQuantityMax+" input").value=e[flagQuantityMax],r.querySelector("td."+flagCostLocalVATIncl).innerHTML=e[flagCostLocalVATIncl],r.attr(attrIdCategory,e[flagCategory]),r.attr(attrIdProduct,e[flagProduct]),r.attr(attrIdPermutation,e[attrIdPermutation]),t.appendChild(r)}))}},{key:"hookupButtonsSaveCancel",value:function(){f.initialiseEventHandler(idButtonSave,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation(),showOverlayConfirm()}))})),f.initialiseEventHandler(idButtonCancel,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation(),loadPermutations()}))})),f.initialiseEventHandler(idButtonCancel,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation();var t=document.querySelectorAll(idTableMain),r=_rowBlank.cloneNode(!0);(r=document.querySelectorAll(r)).classList.remove(flagRowNew),r.querySelector("td."+flagCategory+" select");var n=getElementCurrentValue(document.querySelectorAll(idFilterCategory));n=0==n?idCategoryDefault:n;var o=r.querySelector("td."+flagProduct+" select");productsByCategory[n].forEach((function(e){o.appendChild(document.createElement("<option>",e))})),t.querySelector("tbody").appendChild(r)}))}))}},{key:"savePermutations",value:function(){var e=getPermutations(!0);if(0!=e.length){var t={};t[keyPermutations]=e,t[keyForm]=convertForm2JSON(elForm),t.csrf_token=t[keyForm].csrf_token,t.comment=document.querySelectorAll(idTextareaConfirm).value,console.log("ajaxData:"),console.log(t),ajaxJSONData("permutations",mapHashToController(hashPageStorePermutationsPost),t,callbackLoadPermutations,!1,{})}else showOverlayError("No permutations to save")}},{key:"getPermutations",value:function(e){var t,r,n,o,i,a,l,u=document.querySelectorAll(idTableMain),c=[];return u.querySelector("tbody tr").each((function(u,s){s=document.querySelectorAll(s),e&&!s.classList.contains(flagDirty)||(r=s.querySelector("td."+flagCategory+" select"),n=s.querySelector("td."+flagProduct+" select"),o=s.querySelector("td."+flagVariations+" textarea"),i=s.querySelector("td."+flagQuantityStock+" input"),a=s.querySelector("td."+flagQuantityMin+" input"),l=s.querySelector("td."+flagQuantityMax+" input"),(t={})[attrIdCategory]=r.attr(attrValueCurrent),t[attrIdProduct]=n.attr(attrValueCurrent),t[attrIdPermutation]=s.attr(attrIdPermutation),t[flagVariations]=o.attr(attrValueCurrent),t[flagQuantityStock]=i.attr(attrValueCurrent),t[flagQuantityMin]=a.attr(attrValueCurrent),t[flagQuantityMax]=l.attr(attrValueCurrent),c.push(t))})),c}},{key:"hookupTableMain",value:function(){f.initialiseEventHandler(idTableMain,flagInitialised,(function(e){e.querySelectorAll("td."+flagCategory+" select").addEventListener("change",(function(e){handleChangeInputPermutations(this),ddlCategory=this,row=getRowFromElement(ddlCategory),ddlProduct=row.querySelector("td."+flagProduct+" select"),ddlProduct.querySelector("option").remove(),ddlProduct.appendChild(document.createElement("<option>",{value:"",text:"Select Product"})),listProducts.forEach((function(e){e[attrIdCategory]==getElementCurrentValue(ddlCategory)&&ddlProduct.appendChild(document.createElement("<option>",e))})),handleChangeInputPermutations(ddlProduct)})),e.querySelectorAll("change","td."+flagProduct+" select,td."+flagQuantityStock+" input,td."+flagQuantityMin+" input,td."+flagQuantityMax+" input").addEventListener("change",(function(e){handleChangeInputPermutations(this)})),e.querySelectorAll("click","td."+flagVariations+" textarea").addEventListener("change",(function(e){e.stopPropagation(),handleClickPermutationsInputVariations(this)})),e.querySelectorAll("click","td."+flagDetail+" button").addEventListener("change",(function(e){e.stopPropagation(),console.log("not implemented error: detail clicked")})),e.querySelectorAll("click","td."+flagVariations+" button."+flagAdd).addEventListener("change",(function(e){e.stopPropagation(),handleClickPermutationsVariationsButtonAdd(this)}))}));var e=table.querySelector("tr."+flagRowNew);console.log("row blank temp: ",e),_rowBlank=e.cloneNode(!0),table.querySelectorAll("tr."+flagRowNew).forEach((function(e){e.remove()}))}},{key:"handleChangeInputPermutations",value:function(e){console.log("handleChangeInputPermutations"),console.log("element value:",e.value);var t=getRowFromElement(e),r=document.querySelector(idFormFiltersPermutations),o=r.querySelector(idButtonCancel),i=r.querySelector(idButtonSave),a=isElementDirty(e);if(objJQuery.classList.contains(flagVariations)?e.setAttribute(attrValueCurrent,getProductVariationsText(e)):e.setAttribute(attrValueCurrent,getElementCurrentValue(e)),a!=isElementDirty(e)){isRowDirty(t);var l=getPermutations(!0);n.isEmpty(l)?(o.classList.add(flagCollapsed),i.classList.add(flagCollapsed)):(o.classList.remove(flagCollapsed),i.classList.remove(flagCollapsed))}}},{key:"isElementDirty",value:function(e){var t=e.attr(attrValuePrevious)!=e.attr(attrValueCurrent),r=getCellFromElement(e);return t?(e.classList.add(flagDirty),r.classList.add(flagDirty)):(e.classList.remove(flagDirty),r.classList.remove(flagDirty)),t}},{key:"isRowDirty",value:function(e){var t=e.querySelector("td."+flagCategory+" select"),r=e.querySelector("td."+flagProduct+" select"),n=e.querySelector("td."+flagVariations+" textarea"),o=e.querySelector("td."+flagQuantityStock+" input"),i=e.querySelector("td."+flagQuantityMin+" input"),a=e.querySelector("td."+flagQuantityMax+" input"),l=t.classList.contains(flagDirty)||r.classList.contains(flagDirty)||n.classList.contains(flagDirty)||o.classList.contains(flagDirty)||i.classList.contains(flagDirty)||a.classList.contains(flagDirty);return l?e.classList.add(flagDirty):e.classList.remove(flagDirty),l}},{key:"getProductVariationsText",value:function(e){return e=document.querySelectorAll(e),dictVariations[e.attr(attrIdVariation)].map((function(e,t){return e[keyNameVariationType]+": "+e[keyNameVariation]})).join(",\n")}},{key:"getElementProductVariations",value:function(e){var t=(e=document.querySelectorAll(e)).attr(attrValueCurrent),r=[];return n.isEmpty(t)||(t=t.split(",")).forEach((function(e){var t=e.split(":");2==t.length&&r.push(It(It({},attrIdVariationType,t[0].trim()),attrIdVariation,t[1].trim()))})),r}},{key:"handleClickPermutationsInputVariations",value:function(e){var t,r,n,o,i,a,l,u,c,s,f,y;e=document.querySelectorAll(e);var d=getElementProductVariations(e),p=document.createElement("<table>"),v=document.createElement("<thead>");n=document.createElement("<tr>");var h=document.createElement("<th>",{text:"Type"}),g=document.createElement("<th>",{text:"Name"}),m=document.createElement("<button>",{class:flagAdd,text:"+"}),b=document.createElement("<th>");b.appendChild(m),n.appendChild(h),n.appendChild(g),n.appendChild(b),v.appendChild(n),p.appendChild(v);var S=document.createElement("<tbody>");console.log("variations:",d),d.forEach((function(e,d){r=dictVariations[e[attrIdVariationType]],t=dictVariations[e[attrIdVariation]],o=document.createElement("<td>",{class:attrIdVariationType}),(a={class:attrIdVariationType,value:e[attrIdVariationType]})[attrValueCurrent]=t[attrIdVariationType],a[attrValuePrevious]=t[attrIdVariationType],i=document.createElement("<select>",a),listVariationTypes.forEach((function(e){dictVariationTypes[e],i.appendChild(document.createElement("<option>",{value:r[attrIdVariationType],text:r[keyNameVariationType],selected:e==r[attrIdVariationType]}))})),l=document.createElement("<td>",{class:attrIdVariation}),(c={class:attrIdVariation,value:e[attrIdVariation]})[attrValueCurrent]=t[attrIdVariation],c[attrValuePrevious]=t[attrIdVariation],u=document.createElement("<select>",c),listVariations.forEach((function(e){y=dictVariations[e],console.log("id_variation: ",e),console.log("tmpJsonVariation: ",y),u.appendChild(document.createElement("<option>",{value:y[attrIdVariation],text:y[keyNameVariation],selected:e==t[attrIdVariation]}))})),s=document.createElement("<td>",{class:flagDelete}),f=document.createElement("<button>",{class:flagDelete,text:"x"}),n=document.createElement("<tr>"),o.appendChild(i),n.appendChild(o),l.appendChild(u),n.appendChild(l),s.appendChild(f),n.appendChild(s),S.appendChild(n)})),p.appendChild(S);var P=e.parentElement;P.innerHTML="",P.appendChild(p),console.log("tblVariations: ",p)}},{key:"handleClickPermutationsVariationsButtonAdd",value:function(e){e=document.querySelectorAll(e);var t=getRowFromElement(e).querySelector("td."+flagVariations+" textarea"),r=t.value;r=n.isEmpty(r)?"":r+"\n",r+="Type: Variation\n",t.value=r,handleChangeInputPermutations(t),console.log("error: not implemented")}},{key:"leave",value:function(){!function(e,t,r){var n=Lt(jt(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function Dt(e,t,r,n){var o=xt(Ht(1&n?e.prototype:e),t,r);return 2&n&&"function"==typeof o?function(e){return o.apply(r,e)}:o}function xt(){return xt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ht(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},xt.apply(null,arguments)}function Rt(e){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rt(e)}function _t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ft(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Jt(n.key),n)}}function Nt(e,t,r){return t&&Ft(e.prototype,t),r&&Ft(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bt(e,t,r){return t=Ht(t),function(e,t){if(t&&("object"==Rt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Vt()?Reflect.construct(t,r||[],Ht(e).constructor):t.apply(e,r))}function Vt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vt=function(){return!!e})()}function Ht(e){return Ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ht(e)}function Mt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qt(e,t)}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qt(e,t)}function zt(e,t,r){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jt(e){var t=function(e){if("object"!=Rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Rt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rt(t)?t:t+""}It(qt,"hash",hashPageStoreProductPermutations);var Ut=function(e){function t(e){return _t(this,t),Bt(this,t,[e])}return Mt(t,e),Nt(t,[{key:"initialize",value:function(){this.sharedInitialize(),this.hookupFilters(),this.hookupButtonsSaveCancel(),hookupTableMain(),hookupOverlayConfirm(savePermutations)}},{key:"hookupFilters",value:function(){var e=document.querySelectorAll(idFilterCategory);f.initialiseEventHandler(e,flagInitialised,(function(){console.log("hooking up filter category"),(e=document.querySelectorAll(e)).addEventListener("change",(function(e){loadPermutations()})),console.log("hooked up filter category")}));var t=document.querySelectorAll(idFilterProduct);f.initialiseEventHandler(t,flagInitialised,(function(){listProducts.forEach((function(e){e[attrIdCategory]==getElementCurrentValue(document.querySelectorAll(idFilterCategory))&&t.appendChild(document.createElement("<option>",e))})),t.addEventListener("change",(function(e){loadPermutations()}))}));var r=document.querySelectorAll(idFilterIsOutOfStock);f.initialiseEventHandler(r,flagInitialised,(function(){r.addEventListener("change",(function(e){loadPermutations()}))}));var n=document.querySelectorAll(idFilterQuantityMin);f.initialiseEventHandler(n,flagInitialised,(function(){n.addEventListener("change",(function(e){loadPermutations()}))}));var o=document.querySelectorAll(idFilterQuantityMax);f.initialiseEventHandler(o,flagInitialised,(function(){o.addEventListener("change",(function(e){loadPermutations()}))}))}},{key:"loadPermutations",value:function(){var e=document.querySelectorAll(idFormFiltersPermutations),t={};t[keyForm]=convertForm2JSON(e),t.csrf_token=t[keyForm].csrf_token,console.log("ajaxData:"),console.log(t),ajaxJSONData("permutations",mapHashToController(hashPageStorePermutationsPost),t,callbackLoadPermutations,!1,{"X-CSRFToken":t.csrf_token})}},{key:"callbackLoadPermutations",value:function(e){console.log("ajax:"),console.log(e.data);var t,r,n,o=document.querySelectorAll(idTableMain);(t=o.querySelector("tbody")).querySelector("tr").remove(),$.each(e.data,(function(e,o){r=_rowBlank.cloneNode(!0),(r=document.querySelectorAll(r)).classList.remove(flagRowNew),console.log("applying data row: ",o),r.querySelector("td."+flagCategory+" select").val(o[attrIdCategory]),n=r.querySelector("td."+flagProduct+" select"),listProducts.forEach((function(e){e[attrIdCategory]==o[attrIdCategory]&&n.appendChild(document.createElement("<option>",e))})),n.val(o[attrIdProduct]),r.querySelector("td."+flagVariations+" textarea").value=o[flagVariations],r.querySelector("td."+flagQuantityStock+" input").value=o[flagQuantityStock],r.querySelector("td."+flagQuantityMin+" input").value=o[flagQuantityMin],r.querySelector("td."+flagQuantityMax+" input").value=o[flagQuantityMax],r.querySelector("td."+flagCostLocal).innerHTML=o[flagCostLocal],r.attr(attrIdCategory,o[flagCategory]),r.attr(attrIdProduct,o[flagProduct]),r.attr(attrIdPermutation,o[attrIdPermutation]),t.appendChild(r)}))}},{key:"hookupButtonsSaveCancel",value:function(){var e=document.querySelectorAll(idButtonSave),t=document.querySelectorAll(idButtonCancel),r=document.querySelectorAll(idButtonAdd);e.addEventListener("click",(function(e){e.stopPropagation(),showOverlayConfirm()})),e.classList.add(flagCollapsed),t.addEventListener("click",(function(e){e.stopPropagation(),loadPermutations()})),t.classList.add(flagCollapsed),r.addEventListener("click",(function(e){e.stopPropagation();var t=document.querySelectorAll(idTableMain),r=_rowBlank.cloneNode(!0);(r=document.querySelectorAll(r)).classList.remove(flagRowNew),t.querySelector("tbody").appendChild(r)}))}},{key:"savePermutations",value:function(){var e=getPermutations(!0);if(0!=e.length){var t={};t[keyPermutations]=e,t[keyForm]=convertForm2JSON(elForm),t.csrf_token=t[keyForm].csrf_token,t.comment=document.querySelector(idTextareaConfirm).value,console.log("ajaxData:"),console.log(t),ajaxJSONData("permutations",mapHashToController(hashPageStorePermutationsPost),t,callbackLoadPermutations,!1,{})}else showOverlayError("No permutations to save")}},{key:"getPermutations",value:function(e){var t,r,n,o,i,a,l,u=document.querySelectorAll(idTableMain),c=[];return u.querySelector("tbody tr").each((function(u,s){s=document.querySelectorAll(s),e&&!s.classList.contains(flagDirty)||(r=s.querySelector("td."+flagCategory+" select"),n=s.querySelector("td."+flagProduct+" select"),o=s.querySelector("td."+flagVariations+" textarea"),i=s.querySelector("td."+flagQuantityStock+" input"),a=s.querySelector("td."+flagQuantityMin+" input"),l=s.querySelector("td."+flagQuantityMax+" input"),(t={})[attrIdCategory]=r.attr(attrValueCurrent),t[attrIdProduct]=n.attr(attrValueCurrent),t[attrIdPermutation]=s.attr(attrIdPermutation),t[flagVariations]=o.attr(attrValueCurrent),t[flagQuantityStock]=i.attr(attrValueCurrent),t[flagQuantityMin]=a.attr(attrValueCurrent),t[flagQuantityMax]=l.attr(attrValueCurrent),c.push(t))})),c}},{key:"hookupTableMain",value:function(){var e,t,r,n,o,i,a=document.querySelectorAll(idTableMain),l=a.querySelector("tr."+flagRowNew);console.log("row blank temp: ",l),_rowBlank=l.cloneNode(!0),a.querySelector("tr."+flagRowNew).remove(),a.querySelector("tbody tr").each((function(a,l){console.log("hooking up row ",a),l=document.querySelectorAll(l),e=l.querySelector("td."+flagCategory+" select"),t=l.querySelector("td."+flagProduct+" select"),r=l.querySelector("td."+flagVariations+" textarea"),n=l.querySelector("td."+flagQuantityStock+" input"),o=l.querySelector("td."+flagQuantityMin+" input"),i=l.querySelector("td."+flagQuantityMax+" input"),f.initialiseEventHandler(e,flagInitialised,(function(){e.addEventListener("change",(function(){handleChangeInputPermutations(this),e=this,l=getRowFromElement(e),(t=l.querySelector("td."+flagProduct+" select")).querySelector("option").remove(),t.appendChild(document.createElement("<option>",{value:"",text:"Select Product"})),listProducts.forEach((function(r){r[attrIdCategory]==getElementCurrentValue(e)&&t.appendChild(document.createElement("<option>",r))})),handleChangeInputPermutations(t)}))})),f.initialiseEventHandler(t,flagInitialised,(function(){t.addEventListener("change",(function(){handleChangeInputPermutations(this)}))})),f.initialiseEventHandler(r,flagInitialised,(function(){r.addEventListener("change",(function(){handleChangeInputPermutations(this)}))})),f.initialiseEventHandler(n,flagInitialised,(function(){n.addEventListener("change",(function(){handleChangeInputPermutations(this)}))})),f.initialiseEventHandler(o,flagInitialised,(function(){o.addEventListener("change",(function(){handleChangeInputPermutations(this)}))})),f.initialiseEventHandler(i,flagInitialised,(function(){i.addEventListener("change",(function(){handleChangeInputPermutations(this)}))}))}))}},{key:"handleChangeInputPermutations",value:function(e){console.log(e.value);var t=document.querySelectorAll(e);t.value=e.value;var r=getRowFromElement(t),o=document.querySelectorAll(idButtonCancel),i=document.querySelectorAll(idButtonSave),a=isElementDirty(t);if(t.classList.contains(flagVariations)?t.attr(attrValueCurrent,getVariationsCurrentValue(t)):t.attr(attrValueCurrent,getElementCurrentValue(t)),a!=isElementDirty(t)){isRowDirty(r);var l=getPermutations(!0);n.isEmpty(l)?(o.classList.add(flagCollapsed),i.classList.add(flagCollapsed)):(o.classList.remove(flagCollapsed),i.classList.remove(flagCollapsed))}}},{key:"isRowDirty",value:function(e){var t=e.querySelector("td."+flagCategory+" select"),r=e.querySelector("td."+flagProduct+" select"),n=e.querySelector("td."+flagVariations+" textarea"),o=e.querySelector("td."+flagQuantityStock+" input"),i=e.querySelector("td."+flagQuantityMin+" input"),a=e.querySelector("td."+flagQuantityMax+" input"),l=t.classList.contains(flagDirty)||r.classList.contains(flagDirty)||n.classList.contains(flagDirty)||o.classList.contains(flagDirty)||i.classList.contains(flagDirty)||a.classList.contains(flagDirty);return l?e.classList.add(flagDirty):e.classList.remove(flagDirty),l}},{key:"getVariationsCurrentValue",value:function(e){var t=(e.value||null).split("\n");return(t=(t=t.map((function(e){return e.trim()}))).filter((function(e){return e.length>0}))).join(",")}}])}(C);zt(Ut,"hash",hashPageStoreStockItems);var Gt=function(e){function t(){var e;return _t(this,t),zt(e=Bt(this,t),"callFilterTableContent",k.getCategoriesByFilters),e}return Mt(t,e),Nt(t,[{key:"initialize",value:function(){Dt(t,"initialize",this,3)([])}},{key:"hookupFilters",value:function(){Dt(t,"hookupFilters",this,3)([]),this.hookupFilterIsNotEmpty(),this.hookupFilterActive()}},{key:"hookupFilterIsNotEmpty",value:function(){f.initialiseEventHandler("."+flagIsNotEmpty,flagInitialised,(function(e){e.addEventListener("change",(function(r){t.isDirtyFilter(e)}))}))}},{key:"loadRowTable",value:function(e){if(null!=e){var t=_rowBlank.cloneNode(!0);t.classList.remove(flagRowNew),t.classList.remove(flagInitialised),t.querySelectorAll("."+flagInitialised).forEach((function(e){e.classList.remove(flagInitialised)})),console.log("applying data row: ",e);var r=t.querySelector("td."+flagDisplayOrder+" ."+flagSlider),n=t.querySelector("td."+flagCode+" textarea"),o=t.querySelector("td."+flagName+" textarea"),i=t.querySelector("td."+flagDescription+" textarea"),a=t.querySelector("td."+flagAccessLevel),u=a.querySelector("div."+flagAccessLevel),c=t.querySelector("td."+flagActive+' input[type="checkbox"]');r.setAttribute(attrValueCurrent,e[flagDisplayOrder]),l.setElementValuePrevious(r,e[flagDisplayOrder]),l.setElementValueCurrent(n,e[flagCode]),l.setElementValuePrevious(n,e[flagCode]),l.setElementValueCurrent(o,e[flagName]),l.setElementValuePrevious(o,e[flagName]),l.setElementValueCurrent(i,e[flagDescription]),l.setElementValuePrevious(i,e[flagDescription]),a.setAttribute(attrIdAccessLevel,e[attrIdAccessLevel]),a.setAttribute(flagAccessLevelRequired,e[flagAccessLevelRequired]),u.setAttribute(attrIdAccessLevel,e[attrIdAccessLevel]),l.setElementValueCurrent(u,e[attrIdAccessLevel]),l.setElementValuePrevious(u,e[attrIdAccessLevel]),u.textContent=e[flagAccessLevelRequired],l.setElementValueCurrent(c,e[flagActive]),l.setElementValuePrevious(c,e[flagActive]),t.setAttribute(e[flagKeyPrimary],e[e[flagKeyPrimary]]),this.getTableMain().querySelector("tbody").appendChild(t)}}},{key:"getJsonRow",value:function(e){if(null!=e){var t=e.querySelector("td."+flagDisplayOrder+" ."+flagSlider),r=e.querySelector("td."+flagCode+" textarea"),n=e.querySelector("td."+flagName+" textarea"),o=e.querySelector("td."+flagDescription+" textarea"),i=e.querySelector("td."+flagAccessLevel),a=e.querySelector("td."+flagActive+' input[type="checkbox"]'),u={};return u[attrIdCategory]=e.getAttribute(attrIdCategory),u[flagCode]=l.getElementValueCurrent(r),u[flagName]=l.getElementValueCurrent(n),u[flagDescription]=l.getElementValueCurrent(o),u[flagAccessLevelRequired]=i.getAttribute(flagAccessLevelRequired),u[attrIdAccessLevel]=i.getAttribute(attrIdAccessLevel),u[flagActive]=l.getElementValueCurrent(a),u[flagDisplayOrder]=t.getAttribute(attrValueCurrent),u}}},{key:"hookupTableMain",value:function(){Dt(t,"hookupTableMain",this,3)([]),this.hookupSlidersDisplayOrderTable(),this.hookupTextareasCodeTable(),this.hookupTextareasNameTable(),this.hookupTextareasDescriptionTable(),this.hookupTdsAccessLevel(),this.hookupInputsActiveTable()}},{key:"isRowDirty",value:function(e){if(null!=e){var t=e.querySelector("td."+flagCategory+" select"),r=e.querySelector("td."+flagProduct+" select"),n=e.querySelector("td."+flagVariations+" textarea"),o=e.querySelector("td."+flagQuantityStock+" input"),i=e.querySelector("td."+flagQuantityMin+" input"),a=e.querySelector("td."+flagQuantityMax+" input"),l=t.classList.contains(flagDirty)||r.classList.contains(flagDirty)||n.classList.contains(flagDirty)||o.classList.contains(flagDirty)||i.classList.contains(flagDirty)||a.classList.contains(flagDirty);return l?e.classList.add(flagDirty):e.classList.remove(flagDirty),l}}},{key:"leave",value:function(){Dt(t,"leave",this,3)([])}},{key:"getFiltersDefaults",value:function(){return filters={},filters.flagIsNotEmpty=!0,filters.flagActive=!0,filters}}])}(ft);function Kt(e){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kt(e)}function Xt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tr(n.key),n)}}function Yt(e,t,r){return t=Zt(t),function(e,t){if(t&&("object"==Kt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,$t()?Reflect.construct(t,r||[],Zt(e).constructor):t.apply(e,r))}function $t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return($t=function(){return!!e})()}function Wt(){return Wt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Zt(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Wt.apply(null,arguments)}function Zt(e){return Zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zt(e)}function er(e,t){return er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},er(e,t)}function tr(e){var t=function(e){if("object"!=Kt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Kt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Kt(t)?t:t+""}zt(Gt,"hash",hashPageStoreProductCategories);var rr=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Yt(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&er(e,t)}(t,e),function(e,t){return t&&Xt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}},{key:"leave",value:function(){!function(e,t,r){var n=Wt(Zt(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function nr(e){return nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nr(e)}function or(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sr(n.key),n)}}function ir(e,t,r){return t=ur(t),function(e,t){if(t&&("object"==nr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ar()?Reflect.construct(t,r||[],ur(e).constructor):t.apply(e,r))}function ar(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ar=function(){return!!e})()}function lr(){return lr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ur(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},lr.apply(null,arguments)}function ur(e){return ur=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ur(e)}function cr(e,t){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},cr(e,t)}function sr(e){var t=function(e){if("object"!=nr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=nr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nr(t)?t:t+""}!function(e,t,r){(t=tr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(rr,"hash",hashPagePrivacyPolicy);var fr=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ir(this,t,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cr(e,t)}(t,e),function(e,t){return t&&or(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"initialize",value:function(){this.sharedInitialize()}},{key:"leave",value:function(){!function(e,t,r){var n=lr(ur(e.prototype),"leave",r);return"function"==typeof n?function(e){return n.apply(r,e)}:n}(t,0,this)([])}}])}(C);function yr(e){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yr(e)}function dr(){dr=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new I(n||[]);return o(a,"_invoke",{value:C(e,r,l)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var y="suspendedStart",d="suspendedYield",p="executing",v="completed",h={};function g(){}function m(){}function b(){}var S={};c(S,a,(function(){return this}));var P=Object.getPrototypeOf,k=P&&P(P(A([])));k&&k!==r&&n.call(k,a)&&(S=k);var w=b.prototype=g.prototype=Object.create(S);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,i,a,l){var u=f(e[o],e,i);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==yr(s)&&n.call(s,"__await")?t.resolve(s.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(s).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,l)}))}l(u.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function C(t,r,n){var o=y;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var l=n.delegate;if(l){var u=L(l,n);if(u){if(u===h)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=f(t,r,n);if("normal"===c.type){if(o=n.done?v:d,c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=v,n.method="throw",n.arg=c.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var i=f(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,h;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,h):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function A(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(yr(t)+" is not iterable")}return m.prototype=b,o(w,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,u,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},E(O.prototype),c(O.prototype,l,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(w),c(w,u,"Generator"),c(w,a,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=A,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:A(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),h}},t}function pr(e,t,r,n,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void r(e)}l.done?t(u):Promise.resolve(u).then(n,o)}function vr(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){pr(i,n,o,a,l,"next",e)}function l(e){pr(i,n,o,a,l,"throw",e)}a(void 0)}))}}function hr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,gr(n.key),n)}}function gr(e){var t=function(e){if("object"!=yr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=yr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yr(t)?t:t+""}!function(e,t,r){(t=sr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(fr,"hash",hashPageDataRetentionSchedule);var mr=function(){return function(e,t,r){return t&&hr(e.prototype,t),r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pages={},this.pages[hashPageHome]={name:"PageHome",module:N},this.pages[hashPageContact]={name:"PageContact",module:re},this.pages[hashPageServices]={name:"PageServices",module:fe},this.pages[hashPageAdminHome]={name:"PageAdminHome",module:N},this.pages[hashPageAccessibilityStatement]={name:"PageAccessibilityStatement",module:Te},this.pages[hashPageDataRetentionSchedule]={name:"PageDataRetentionSchedule",module:fr},this.pages[hashPageLicense]={name:"PageLicense",module:Ne},this.pages[hashPagePrivacyPolicy]={name:"PagePrivacyPolicy",module:rr},this.pages[hashPageStoreProductCategories]={name:"PageStoreProductCategories",module:kt},this.pages[hashPageStoreProductPermutations]={name:"PageStoreProductPermutations",module:qt},this.pages[hashPageStoreStockItems]={name:"PageStoreStockItems",module:Ut},this.routes={},this.routes[hashPageHome]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageHome,e)},this.routes[hashPageContact]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageContact,e)},this.routes[hashPageServices]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageServices,e)},this.routes[hashPageAdminHome]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageAdminHome,e)},this.routes[hashPageAccessibilityStatement]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageAccessibilityStatement,e)},this.routes[hashPageDataRetentionSchedule]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageDataRetentionSchedule,e)},this.routes[hashPageLicense]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageLicense,e)},this.routes[hashPagePrivacyPolicy]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPagePrivacyPolicy,e)},this.routes[hashPageStoreProductCategories]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageStoreProductCategories,e)},this.routes[hashPageStoreProductPermutations]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageStoreProductPermutations,e)},this.routes[hashPageStoreProducts]=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.navigateToHash(hashPageStoreProducts,e)},this.initialize()}),[{key:"loadPage",value:(r=vr(dr().mark((function e(t){var r,n,o=arguments;return dr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]&&o[1],console.log("loadPage: "+t),e.next=4,this.getClassPageFromHash(t);case 4:n=e.sent,console.log("PageClass: ",n),this.currentPage=new n(this),console.log("this.currentPage: ",this.currentPage),this.currentPage.initialize(r);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"getClassPageFromHash",value:(t=vr(dr().mark((function e(t){var r,n;return dr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.pages[t],console.log("pageJson: ",r),e.prev=2,n=r.module,console.log("module: ",n),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(2),console.log("this.pages: ",this.pages),console.error("Page not found:",t),e.t0;case 13:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(e){return t.apply(this,arguments)})},{key:"initialize",value:function(){window.addEventListener("popstate",this.handlePopState.bind(this))}},{key:"handlePopState",value:function(e){this.loadPageCurrent()}},{key:"loadPageCurrent",value:function(){var e=l.getHashPageCurrent();this.loadPage(e)}},{key:"navigateToHash",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.beforeLeave();var n=k.getUrlFromHash(e,r);history.pushState({data:t,params:r},"",e),k.goToUrl(n,t)}},{key:"beforeLeave",value:(e=vr(dr().mark((function e(){return dr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getClassPageFromHash(l.getHashPageCurrent());case 2:new(0,e.sent)(this).leave();case 5:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}],[{key:"loadPageBodyFromResponse",value:function(e){console.log(e.data),l.loadPageBody(e.data)}}]);var e,t,r}();function br(e){return br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},br(e)}function Sr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Pr(n.key),n)}}function Pr(e){var t=function(e){if("object"!=br(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=br(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==br(t)?t:t+""}new mr;var kr,wr=function(){return function(e,t){return t&&Sr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.dom=new l,this.router=new mr}),[{key:"initialize",value:function(){console.log("Initializing application..."),this.setupEventListeners(),this.start()}},{key:"setupEventListeners",value:function(){}},{key:"handleGlobalClick",value:function(e){console.log("Global click:",e.target)}},{key:"start",value:function(){console.log("Starting application..."),this.initPageCurrent()}},{key:"initPageCurrent",value:function(){console.log("initPageCurrent"),this.router.loadPageCurrent()}}])}(),Er=new wr;kr=function(){Er.initialize()},"loading"!==document.readyState?kr():document.addEventListener("DOMContentLoaded",kr),window.app=Er})()})();