/*! For license information please see home.js.LICENSE.txt */ (()=>{"use strict";var t,e,r={510:(t,e,r)=>{r.d(e,{Hp:()=>n.H});var n=r(463);r(451)},463:(t,e,r)=>{r.d(e,{H:()=>o});var n=function(t){var e=t.carousel,r=t.isPositive;if(e)return function(t){var e=t.carousel,r=t.isPositive,n=e.clientWidth;e.scrollLeft=r?e.scrollLeft+n:e.scrollLeft-n,e.scrollLeft===e.scrollWidth-e.clientWidth&&r&&(e.scrollLeft=0),0!==e.scrollLeft||r||(e.scrollLeft=e.scrollWidth-e.clientWidth)}({carousel:e,isPositive:r});console.error("Carousel or slide is not found",{carousel:e})},o=function(){document.querySelectorAll("[aria-label='Slider']").forEach((function(t){var e=t.parentElement,r=e.querySelector("[aria-label='Next slide']"),o=e.querySelector("[aria-label='Previous slide']");r&&o&&(r.addEventListener("click",(function(){return n({carousel:t,isPositive:!0})})),o.addEventListener("click",(function(){return n({carousel:t,isPositive:!1})})))}))}},451:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return e};var t,e={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},l=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function d(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,a=Object.create(o.prototype),c=new M(n||[]);return i(a,"_invoke",{value:O(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=d;var p="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function w(){}function b(){}function L(){}var x={};f(x,l,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(N([])));S&&S!==r&&a.call(S,l)&&(x=S);var k=L.prototype=w.prototype=Object.create(x);function P(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,c,l){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==n(f)&&a.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,c,l)}),(function(t){r("throw",t,c,l)})):e.resolve(f).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,l)}))}l(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}})}function O(e,r,n){var o=p;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=q(c,n);if(l){if(l===g)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(e,r,n);if("normal"===u.type){if(o=n.done?m:v,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function q(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,q(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[l];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function a(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){a(i,n,o,c,l,"next",t)}function l(t){a(i,n,o,c,l,"throw",t)}c(void 0)}))}}var c,l,u={url:"",size:"md",hasContainer:!0,open:(l=i(o().mark((function t(e){var r,n,a,i,c,l,s,f;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.preventDefault(),r=e.target.closest("[data-modal]")){t.next=5;break}return console.error("Modal target is not found",{targetUrl:n}),t.abrupt("return");case 5:if(n=r.dataset.modal){t.next=9;break}return console.error("Modal target is not found",{event:e,targetUrl:n}),t.abrupt("return");case 9:return a=r.dataset.modalContainer,(i=r.dataset.modalSize)&&(u.size=i),"false"===a&&(u.hasContainer=!1),u.url=n,u.showLoading(),t.next=17,u.load();case 17:c=t.sent,l=c.title,s=c.content,f=c.error,u.set({title:l,content:s,error:f,name:u.url}),u.afterLoad(),document.querySelector(".modal-close").addEventListener("click",u.close),document.querySelector(".modal-overlay").addEventListener("click",u.close),document.addEventListener("keydown",u.onEscapeKeyDown);case 28:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)}),load:(c=i(o().mark((function t(){var e,r,n,a;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("/modal/".concat(u.url,"/"),{cache:"force-cache",headers:{"Content-Type":"application/json","X-Requested-With":"fetch"}});case 3:return e=t.sent,t.next=6,e.json();case 6:return r=t.sent,n=r.title,a=r.content,t.abrupt("return",{title:n,content:a,error:null});case 12:return t.prev=12,t.t0=t.catch(0),console.error("Error fetching modal content",{e:t.t0}),t.abrupt("return",{title:"",content:"",error:t.t0});case 16:case"end":return t.stop()}}),t,null,[[0,12]])}))),function(){return c.apply(this,arguments)}),close:function(){var t=document.querySelector("[aria-label='Modal']");t&&t.remove()},set:function(t){var e=t.title,r=t.content,n=t.error,o=t.name;if(!n){var a=document.querySelector("[aria-label='Modal']");if(a)return a.dataset.activeModal=o,void(a.querySelector(".modal-container").innerHTML=u.template({title:e,content:r}));var i=document.createElement("div");i.dataset.activeModal=o,i.classList.add("modal"),i.setAttribute("aria-label","Modal"),i.innerHTML=u.container(u.template({title:e,content:r})),document.body.appendChild(i)}},container:function(t){return'")},template:function(t){var e=t.title,r=t.content;return'\n \n \n ")},showLoading:function(){u.set({title:"Loading...",error:null,name:"loading",content:''})},showError:function(t){var e="An error occurred: ".concat(t.message);u.set({title:"Error",content:e,error:t,name:"error"})},focusFirstInput:function(){if(document.querySelector("[data-active-modal] form")){var t=document.querySelector("[data-active-modal] input");t&&t.focus()}},onEscapeKeyDown:function(t){"Escape"===t.key&&u.close()},afterLoad:function(){var t;u.focusFirstInput(),(t=document.querySelectorAll("[data-modal]"))&&t.forEach((function(t){t.addEventListener("click",u.open)}))}}}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var a=n[t]={exports:{}};return r[t](a,a.exports,o),a.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t=o(510),(e={init:function(){(0,t.Hp)({carousel:document.querySelector(".slider-container"),nextButton:document.querySelector("[aria-label='Next slide']"),prevButton:document.querySelector("[aria-label='Previous slide']")})}}).init(),window.mofycore.pages.Home=e})();