(()=>{"use strict";function e(e,t=!1){if(!e)return null;try{const o=localStorage.getItem(e);return null===o?null:t?JSON.parse(o):o}catch(e){return console.error("Error reading from localStorage:",e),null}}function t(e,t){if(e)try{const o=t instanceof Object?JSON.stringify(t):String(t);localStorage.setItem(e,o)}catch(e){console.error("Error writing to localStorage:",e)}}function o(e){if(e)try{localStorage.removeItem(e)}catch(e){console.error("Error removing from localStorage:",e)}}"undefined"!=typeof window&&(window.getStorage=e,window.setStorage=t,window.deleteStorage=o);var n=function(e,t,o,n){return new(o||(o=Promise))((function(s,l){function r(e){try{d(n.next(e))}catch(e){l(e)}}function i(e){try{d(n.throw(e))}catch(e){l(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,i)}d((n=n.apply(e,t||[])).next())}))};let s=0,l=0,r=0;function i(){const e=window.innerHeight,t=window.innerWidth;document.documentElement.style.setProperty("--viewport-height",`${e}px`),document.documentElement.style.setProperty("--viewport-width",`${t}px`),s=Math.floor(e/5),document.documentElement.style.setProperty("--line-width",`${s}px`),r=28,document.documentElement.style.setProperty("--line-count",`${r}`),l=Math.floor(4*s),document.documentElement.style.setProperty("--background-width",`${l}px`);const o=Math.floor(2*s);document.documentElement.style.setProperty("--background-height",`${o}px`)}i(),window.addEventListener("resize",i);let d,a=null;a="production",d="./assets/sounds/";let c={start:d+"start.mp3",coins:d+"coins.mp3",fire:d+"fire.mp3",step:d+"step.mp3",finish:d+"finish.wav",protectedSound:d+"protected.wav",damage:d+"damage.wav",doorStartBoofer:d+"door-start.wav",doorChainBoofer:d+"door-chain.wav"};const u=new window.AudioContext;function m(e,t=1){if(!e)return void console.error("Буфер не инициализирован");const o=u.createBufferSource();o.buffer=e;const n=u.createGain();n.gain.value=t,o.connect(n),n.connect(u.destination),o.start(0)}let y=null,v=null,p=null,f=null,h=null,g=null,L=null,S=null,w=null;function q(e){return n(this,void 0,void 0,(function*(){try{const t=yield fetch(e);if(!t.ok)throw new Error(`Ошибка загрузки файла: ${e}`);const o=yield t.arrayBuffer();return yield u.decodeAudioData(o)}catch(e){return e instanceof Error?console.error(`Ошибка при загрузке или декодировании аудио: ${e.message}`):console.error("Неизвестная ошибка:",e),null}}))}function b(e,t,o){const n=e.scrollLeft,s=t-n,l=performance.now();requestAnimationFrame((function t(r){const i=r-l,d=Math.min(i/o,1);var a;e.scrollLeft=n+s*((a=d)<.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2),d<1&&requestAnimationFrame(t)}))}!function(){n(this,void 0,void 0,(function*(){y=yield q(c.start),v=yield q(c.coins),p=yield q(c.fire),f=yield q(c.step),h=yield q(c.finish),g=yield q(c.protectedSound),L=yield q(c.damage),S=yield q(c.doorStartBoofer),w=yield q(c.doorChainBoofer)}))}();let E=0,k=1e3,x=!1,T=!1,A="idle";const C=window.location.hostname;document.addEventListener("DOMContentLoaded",(()=>{!function(){n(this,void 0,void 0,(function*(){var l,r,i,d,a;const c=document.querySelector(".player");if(!c)return void console.error("Player element not found!");const u=document.querySelector(".sceneScroll");function h(e,t,o){let n;if(c.style.transition=o?"all 0.6s ease-in-out":"none",n=t?0===e?0:s*e-s/2:0===e?0:s*e,c.style.transform=`translateX(${n}px)`,u){const e=n-u.clientWidth/2+s/2;b(u,e,k)}const l=document.querySelectorAll(".line");l.forEach((e=>{e.classList.remove("current")}));const r=l[e];E>=0&&r&&r.classList.add("current")}function q(e){const t=document.querySelectorAll(".decoration"),o=document.querySelectorAll(".decoration .decorationFrames"),n=document.querySelector(".background-container");t.forEach((t=>{e?(t.classList.add("gameplay-start"),n&&n.classList.add("gameplay-start")):(t.classList.remove("gameplay-start"),n&&n.classList.remove("gameplay-start"))})),o.forEach((e=>{const t=Array.from(e.querySelectorAll(".decorationFrame"));if(0===t.length)return;let o=0;t.forEach(((e,t)=>{e.style.display=0===t?"block":"none"})),setInterval((()=>{t[o].style.display="none",o=(o+1)%t.length,t[o].style.display="block"}),96)}))}let I={total:0,available:0};function D(e,t){const o=document.querySelector(".bar-protection"),n=null==o?void 0:o.querySelector(".value");if(!o||!n)return;let s=0;if(t)for(const e in t)"protected"===t[e].status&&s++;let l=e+s;if(n.innerHTML="",l>0){o.classList.remove("d-none");for(let e=0;e=l-s&&t.classList.add("used"),n.appendChild(t)}}else o.classList.add("d-none");I={total:l,available:e}}let F="0",P=0;const M=yield function(){return n(this,void 0,void 0,(function*(){try{const e=yield fetch("https://dungeon-knight.com/bet/config.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(!e.ok)throw new Error(`Ошибка: ${e.status}`);return yield e.json()}catch(e){console.error("Ошибка запроса:",e)}}))}();function N(e,t){return n(this,void 0,void 0,(function*(){const o=M.multipliers;console.log("values",o);const n=document.querySelector(".bar-coins");null==n||n.classList.remove("d-none");const s=null==n?void 0:n.querySelector(".symbol-coins"),l=null==n?void 0:n.querySelector(".value"),r=Number(P);if(console.log("bet",P),console.log("betNumber",r),!0===e||void 0===e){if(null===t)l&&(F=r.toFixed(2),l.textContent=r.toFixed(2));else if(null==t&&l){console.log("Мы тут!");let e=E-1;0==r?(F="0",l.textContent="0"):(F=(r*o[e]).toFixed(2),l.textContent=(r*o[e]).toFixed(2))}if(t&&l){const e=Object.keys(t).sort(((e,t)=>{const o=parseInt(e.replace(/[^\d]/g,""));return parseInt(t.replace(/[^\d]/g,""))-o}))[0],n=t[e],s=parseInt(e.replace(/[^\d]/g,""))-1;if((!0===n.status||"protected"===n.status)&&s>=0&&s{null==s||s.classList.remove("active")}),250)}else l&&(l.style.color="red",setTimeout((()=>{l.style.color="white"}),250),l.innerHTML="0");let i=document.querySelectorAll(".coin");i&&i.forEach(((e,t)=>{var n,s;const l=e.querySelector(".coin-container");l&&l.setAttribute("data-after",null!==(s=null===(n=o[t])||void 0===n?void 0:n.toFixed(2))&&void 0!==s?s:"")}))}))}function $(e,t,o){const n=document.querySelectorAll(".enemy");1==t?(n.forEach((e=>{e.style.transition="none"})),setTimeout((()=>{n.forEach((e=>{e.style.transition="all 1s ease-in-out"}))}),500)):n.forEach((e=>{e.style.transition="all 1s ease-in-out"})),o&&"object"==typeof o&&Object.entries(o).forEach((([e,t],o)=>{const n=document.querySelectorAll(".line-regular")[o],s=n.querySelector(".enemy");if(s)if(n&&t.status&&n.classList.add("coin-up"),n&&"protected"===t.status){s.classList.add("active","damage");const e=s.querySelector('.frames-container[data-frames-type="damage"]');e&&e.classList.remove("d-none")}else if(!1===t.status){s.classList.add("active");const e=s.querySelector('.frames-container[data-frames-type="idle"]');e&&e.classList.remove("d-none")}})),o&&"boolean"==typeof o&&(document.querySelectorAll(".enemy").forEach((e=>{e.classList.remove("active"),setTimeout((()=>{e.querySelectorAll(".frames-container").forEach((e=>{e.classList.add("d-none")}))}),k)})),document.querySelectorAll(".line-regular").forEach((e=>{e.classList.remove("coin-up")})))}function O(e,t){var o,n,s,l,r,i;e?(null===(s=document.querySelector(".take_money"))||void 0===s||s.removeAttribute("disabled"),null===(l=document.querySelector(".step"))||void 0===l||l.removeAttribute("disabled")):(null===(o=document.querySelector(".take_money"))||void 0===o||o.setAttribute("disabled","disabled"),null===(n=document.querySelector(".step"))||void 0===n||n.setAttribute("disabled","disabled")),t?null===(i=document.querySelector(".new_bet"))||void 0===i||i.removeAttribute("disabled"):null===(r=document.querySelector(".new_bet"))||void 0===r||r.setAttribute("disabled","disabled")}window.addEventListener("resize",(()=>{h(3+E,"damage"==A,!1),$(0,!0,void 0)}));let U=0,G=0,K=null;function B(e,t){A="idle",K&&clearTimeout(K);const o=null==c?void 0:c.querySelector('.frames[data-status="idle"]'),n=null==c?void 0:c.querySelector('.frames[data-status="run"]'),s=null==c?void 0:c.querySelector('.frames[data-status="walk"]'),l=null==c?void 0:c.querySelector('.frames[data-status="protected"]'),r=null==c?void 0:c.querySelector('.frames[data-status="damage"]');"finish"==e&&(o.classList.add("d-none"),n.classList.remove("d-none"),s.classList.add("d-none"),l.classList.add("d-none"),r.classList.add("d-none")),"walk"!=e&&"run"!=e||("walk"==e&&(o.classList.add("d-none"),n.classList.add("d-none"),s.classList.remove("d-none"),l.classList.add("d-none"),r.classList.add("d-none")),"run"==e&&(o.classList.add("d-none"),n.classList.remove("d-none"),s.classList.add("d-none"),l.classList.add("d-none"),r.classList.add("d-none")),K=setTimeout((()=>{o.classList.remove("d-none"),n.classList.add("d-none"),s.classList.add("d-none"),l.classList.add("d-none"),r.classList.add("d-none")}),600),h(t?2:3+E,!1,!0)),"protected"!=e&&"damage"!=e||(h(3+E,!0,!0),"protected"==e&&(x=!1,o.classList.add("d-none"),n.classList.add("d-none"),l.classList.add("d-none"),r.classList.add("d-none"),s.classList.remove("d-none"),setTimeout((()=>{s.classList.add("d-none"),l.classList.remove("d-none");const e=l.querySelector("svg");if(e&&e.parentNode){const t=e.cloneNode(!0);e.parentNode.replaceChild(t,e)}}),600),K=setTimeout((()=>{o.classList.add("d-none"),n.classList.add("d-none"),s.classList.remove("d-none"),l.classList.add("d-none"),r.classList.add("d-none"),h(3+E,!1,!0)}),1800),K=setTimeout((()=>{o.classList.remove("d-none"),n.classList.add("d-none"),s.classList.add("d-none"),l.classList.add("d-none"),r.classList.add("d-none"),x=!0}),2400)),"damage"===e&&(A="damage",x=!1,[o,n,l].forEach((e=>e.classList.add("d-none"))),s.classList.remove("d-none"),setTimeout((()=>{s.classList.add("d-none"),r.classList.remove("d-none");const e=r.querySelector("svg");if(e&&e.parentNode){const t=e.cloneNode(!0);e.parentNode.replaceChild(t,e)}q(!1)}),600))),"idle"==e&&(o.classList.remove("d-none"),n.classList.add("d-none"),s.classList.add("d-none"),l.classList.add("d-none"),r.classList.add("d-none"))}function j(e){setTimeout((()=>{m(v,.2)}),500);const t=document.querySelectorAll(".line")[e];0!=E&&t&&t.classList.add("current"),setTimeout((()=>{t.classList.add("coin-up"),N(!0,void 0)}),250)}function R(e,t){return n(this,void 0,void 0,(function*(){const o=document.querySelectorAll(".line-regular")[e-4+1];if(!o)return;const n=o.querySelector(".enemy");if(n){if(n.classList.remove("damage"),n.classList.add("active"),"damage"===t){const e=n.querySelector('[data-frames-type="attack"]'),t=n.querySelector('[data-frames-type="idle"]');if(!e||!t)return;t.classList.remove("d-none"),setTimeout((()=>{t.classList.add("d-none"),e.classList.remove("d-none")}),350),setTimeout((()=>{e.classList.add("d-none"),t.classList.remove("d-none")}),1350)}if("protected"===t){const e=n.querySelector('[data-frames-type="damage"]'),t=n.querySelector('[data-frames-type="idle"]');if(!e||!t)return;t.classList.remove("d-none"),setTimeout((()=>{t.classList.add("d-none"),e.classList.remove("d-none")}),1150),setTimeout((()=>{n.classList.add("damage")}),1350)}}}))}let X=!1;const _=e("LighterixGameDungeonKnightUser",!0);function J(){x&&(function(){n(this,void 0,void 0,(function*(){const t=e("LighterixGameDungeonKnightUser",!0);if(console.log("getCookie",C+"LighterixGameDungeonKnightUser"),(null==t?void 0:t.token)&&E<=20)try{const e=new URLSearchParams;e.append("token",t.token);const n=yield fetch("https://dungeon-knight.com/bet/take.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()}),s=yield n.json();(null==s?void 0:s.error)?console.error("Ошибка:",s.error.description||s.error):(J(),console.log("Деньги успешно забраны"),o("LighterixGameDungeonKnightUser"),console.log("deleteCookie",C+"LighterixGameDungeonKnightUser"))}catch(e){console.error("Ошибка запроса:",e)}else console.warn("Токен не найден или шаг превышает лимит")}))}(),x=!1,X=!0,P=0,N(void 0,void 0),D(0,void 0),O(x,X),$(0,!1,!0),h(0,!1,!1),q(!1))}console.log("getCookie",C+"LighterixGameDungeonKnightUser"),function(){n(this,void 0,void 0,(function*(){if(document.querySelectorAll('.decoration[data-decoration="lamp"]').forEach((e=>{e.classList.remove("d-none"),e.classList.add("lamp-swing");const t=(3*Math.random()).toFixed(2)+"s";e.style.animationDelay=t})),document.querySelectorAll(".coin-animation").forEach((e=>{e.style.setProperty("--random-delay",Math.random().toFixed(2))})),null==_?void 0:_.token)try{const e=new URLSearchParams;e.append("token",_.token);const t=yield fetch("https://dungeon-knight.com/bet/init.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()}),o=JSON.parse(yield t.text());o.error||!1===o.access?(console.log("IF"),1!=o.take&&1!=o.take&&(X=!0,E=o.step,B("damage",!1),h(3+E,!0,!1),N(void 0,void 0))):(console.log("ELSE"),P=o.bet,N(void 0,o.history),B("idle",!1),q(!0),o.step?(E=o.step,20==E?(X=!0,x=!1):(X=!1,x=!0)):(X=!1,x=!0),h(3+E,!1,!1)),o.history?$(0,!1,o.history):$(0,!1,void 0),D(o.protection,o.history)}catch(e){console.error("Ошибка запроса:",e)}else console.log("NEW GAME"),X=!0,h(0,!1,!1),B("idle",!1),N(void 0,void 0);O(x,X)}))}();const z=document.querySelector(".step");null==z||z.addEventListener("click",(function(){return n(this,void 0,void 0,(function*(){if(T)return;if(!x)return;m(f,.3);const t=e("LighterixGameDungeonKnightUser",!0);if(console.log("getCookie",C+"LighterixGameDungeonKnightUser"),(null==t?void 0:t.token)&&E<=20)try{const e=new URLSearchParams;e.append("token",t.token);const o=yield fetch("https://dungeon-knight.com/bet/step.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()});if(!o.ok)throw new Error(`Ошибка: ${o.status}`);const n=yield o.json(),l=Date.now();l-U<=500?G++:G=1,U=l,E=Math.min(E+1,20),!0===n||"protected"===n?(20==E&&(X=!0,T=!0,function(){const e=document.querySelector(".player"),t=document.getElementById("playerReceiverFinish"),o=document.querySelector(".platform-center .door-finish");setTimeout((()=>{setTimeout((()=>{e&&t&&(t.appendChild(e),e.style.transform="translateX(calc(-1 * ((var(--line-width) * 3) - (var(--line-width) / 1))))")}),0),setTimeout((()=>{let t;e.style.transition="all 3s ease-in-out",B("walk",!1),t=3*s+s/6,e.style.transform="translateX(calc(-1 * ((var(--line-width) * 2) - (var(--line-width) / 1))))",u&&b(u,22*s,k)}),500),setTimeout((()=>{o&&(o.classList.add("door-open"),m(w,.5))}),1e3),setTimeout((()=>{let t;e.style.transition="all 2s ease-in-out",B("finish",!1),t=3*s+s/6,e.style.transform=`translateX(${t}px)`,u&&b(u,23*s,k)}),3e3),setTimeout((()=>{o&&o.classList.remove("door-open")}),4e3),setTimeout((()=>{q(!1)}),5e3)}),500)}()),"protected"===n?(B("protected",!1),R(3+E-1,"protected"),setTimeout((()=>{m(g,.5)}),500),setTimeout((()=>{j(3+E)}),2e3),O(!1,!1),E<20?setTimeout((()=>{O(!0,!1)}),2e3):setTimeout((()=>{O(!1,!0)}),2e3),function(){var e,t;I.available--;const o=null===(e=document.querySelector(".status-panel"))||void 0===e?void 0:e.querySelector(".spinner-border"),n=null===(t=document.querySelector(".status-panel"))||void 0===t?void 0:t.querySelectorAll(".protection-line");if(n&&n.length>0){const e=Array.from(n).reverse().find((e=>!e.classList.contains("used")));e&&e.classList.add("used")}null==o||o.classList.remove("opacity-0"),setTimeout((()=>{null==o||o.classList.add("opacity-0")}),2e3)}()):(B(G>=2?"run":"walk",!1),j(3+E),O(20!=E&&x,X))):(B("damage",!1),R(3+E-1,"damage"),X=!0,setTimeout((()=>{m(L,.5),O(x,X),N(!1,void 0)}),500))}catch(e){console.error("Ошибка запроса:",e)}}))}));let H=!1;const W=document.querySelector("#warningReaded"),Q=document.querySelector("#takeMoney");null===(l=document.querySelector(".take_money"))||void 0===l||l.addEventListener("click",(()=>{var e,t,o,n,s;null===(e=document.querySelector(".window-take-money"))||void 0===e||e.classList.toggle("d-none");const l=document.querySelector("#valueCoins");l&&(l.value=F);const r=document.querySelector("#valueShield");r&&(r.value=I.available+"/"+I.total),I.available>0?(null===(t=document.querySelector(".message"))||void 0===t||t.classList.remove("d-none"),null===(o=document.querySelector(".valueShield"))||void 0===o||o.classList.remove("d-none"),H?null==Q||Q.removeAttribute("disabled"):null==Q||Q.setAttribute("disabled","true")):(null===(n=document.querySelector(".message"))||void 0===n||n.classList.add("d-none"),null===(s=document.querySelector(".valueShield"))||void 0===s||s.classList.add("d-none"),null==Q||Q.removeAttribute("disabled"))})),null==W||W.addEventListener("change",(()=>{W.checked?(H=!0,null==Q||Q.removeAttribute("disabled")):(H=!1,null==Q||Q.setAttribute("disabled","true"))})),null===(r=document.querySelector("#declineTakeMoney"))||void 0===r||r.addEventListener("click",(()=>{var e;null===(e=document.querySelector(".window-take-money"))||void 0===e||e.classList.toggle("d-none")})),null===(i=document.querySelector("#takeMoney"))||void 0===i||i.addEventListener("click",(()=>{var e,t,o,n,s,l;const r=document.querySelector("#valueCoins");r&&(r.value=F);const i=document.querySelector("#valueShield");i&&(i.value=I.available+"/"+I.total),I.available>0?(null===(e=document.querySelector(".message"))||void 0===e||e.classList.remove("d-none"),null===(t=document.querySelector(".valueShield"))||void 0===t||t.classList.remove("d-none"),H?(J(),null===(o=document.querySelector(".window-take-money"))||void 0===o||o.classList.toggle("d-none")):null==Q||Q.setAttribute("disabled","true")):(null===(n=document.querySelector(".message"))||void 0===n||n.classList.add("d-none"),null===(s=document.querySelector(".valueShield"))||void 0===s||s.classList.add("d-none"),J(),null===(l=document.querySelector(".window-take-money"))||void 0===l||l.classList.toggle("d-none"))})),null===(d=document.querySelector(".new_bet"))||void 0===d||d.addEventListener("click",(()=>{var e;null===(e=document.querySelector(".window-new-bet"))||void 0===e||e.classList.toggle("d-none")})),null===(a=document.querySelector("#approveNewBet"))||void 0===a||a.addEventListener("click",(function(){return n(this,void 0,void 0,(function*(){var e,o,n,s,l;if(X){const r=null===(o=null===(e=document.querySelector('.window-new-bet .item .title[data-title="coins"]'))||void 0===e?void 0:e.parentElement)||void 0===o?void 0:o.querySelector('input[type="number"]'),i=null===(s=null===(n=document.querySelector('.window-new-bet .item .title[data-title="protection"]'))||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.querySelector('input[type="number"]'),d=r&&parseInt(r.value)||0,a=i&&parseInt(i.value)||0;try{const e=yield fetch("https://dungeon-knight.com/bet/new.php",{method:"POST",body:new URLSearchParams({coins:d.toString(),shiel:a.toString()}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),o=JSON.parse(yield e.text());(null==o?void 0:o.token)&&(t("LighterixGameDungeonKnightUser",{token:o.token}),console.log("setCookie",C+"LighterixGameDungeonKnightUser"),X=!1,T=!1,E=0,x=!0,function(){O(!1,!1),m(y,.8),h(0,!1,!1),B("idle",!0);const e=document.querySelector(".player"),t=document.getElementById("playerReceiverStart"),o=document.getElementById("playerContainer");e.style.transition="none",e.style.display="none",e.style.transform="translateX(0)",setTimeout((()=>{q(!0),m(p,.5),setTimeout((()=>{e&&t&&t.appendChild(e)}),0);const n=document.querySelector(".door-start");setTimeout((()=>{n&&(n.classList.add("door-open"),m(S,.5),e.style.display="block")}),500),setTimeout((()=>{e.style.transition="all 1s ease-in-out",B("run",!0)}),1e3),setTimeout((()=>{n&&n.classList.remove("door-open")}),1500),setTimeout((()=>{e&&o&&o.appendChild(e),h(3+E,!1,!1),O(x,X)}),3e3)}),1e3)}(),$(0,!1,!0),D(a,void 0),P=d,N(void 0,null),null===(l=document.querySelector(".window-new-bet"))||void 0===l||l.classList.add("d-none"))}catch(e){console.error("Ошибка запроса:",e)}}}))})),document.querySelectorAll(".window-new-bet .item").forEach((e=>{const t=e.querySelector('input[type="number"]'),o=e.querySelector("button.plus"),n=e.querySelector("button.minus");if(!t||!o||!n)return;const s=""!==t.min?parseInt(t.min):-1/0,l=""!==t.max?parseInt(t.max):1/0,r=()=>{const e=parseInt(t.value)||0;n.disabled=e<=s,o.disabled=e>=l,(()=>{var e,t;const o=null===(t=null===(e=document.querySelector('.window-new-bet .item .title[data-title="coins"]'))||void 0===e?void 0:e.parentElement)||void 0===t?void 0:t.querySelector('input[type="number"]'),n=document.querySelector(".window-new-bet .window-footer button"),s=null==n?void 0:n.querySelector(".text-shadow"),l=null==n?void 0:n.querySelector(".gradient-text");o&&n&&s&&l&&((parseInt(o.value)||0)<1?(n.disabled=!0,s.textContent="min bet 1 coin(s)",l.textContent="min bet 1 coin(s)"):(n.disabled=!1,s.textContent="Approve",l.textContent="Approve"))})()};r(),o.addEventListener("click",(()=>{let e=parseInt(t.value)||0;e{let e=parseInt(t.value)||0;e>s&&(e--,t.value=e.toString(),r(),a())})),t.addEventListener("input",(()=>{let e=parseInt(t.value)||0;el&&(e=l),t.value=e.toString(),r(),a()}));const i=document.querySelector('.window-new-bet .item .symbol-coins ~ .price + .title + ul input[type="number"]'),d=document.querySelector(".window-new-bet .item .symbol-protection ~ .price span"),a=()=>{if(i&&d){const e=((parseFloat(i.value)||0)*M.protection.price).toFixed(2);d.textContent=`${e} $`}};i&&i.addEventListener("input",a),a()}))}))}()}));const I=document.querySelector(".sceneScroll"),D=document.querySelectorAll(".background"),F=[];D.forEach((e=>{e.querySelectorAll(".layer").forEach((e=>{const t=Number(e.dataset.layer)||0;F.push({element:e,depth:t})}))}));let P=!1;I.addEventListener("scroll",(()=>{P||(window.requestAnimationFrame((()=>{const e=I.scrollLeft;F.forEach((({element:t,depth:o})=>{const n=e*(.03*o);t.style.transform=`translateX(-${n}px)`})),P=!1})),P=!0)})),window.addEventListener("DOMContentLoaded",(()=>{let e=document.querySelector(".scene"),t=document.querySelector("#preloader");e&&(e.classList.remove("d-none"),setTimeout((()=>{t.style.opacity="0"}),3e3),setTimeout((()=>{t.style.zIndex="0"}),4e3))})),window.addEventListener("wheel",(function(e){e.ctrlKey&&e.preventDefault()}),{passive:!1}),window.addEventListener("gesturestart",(e=>e.preventDefault())),window.addEventListener("gesturechange",(e=>e.preventDefault())),window.addEventListener("gestureend",(e=>e.preventDefault()))})();