!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).MagicAnswers=e()}(this,function(){"use strict";var n={init:function(){const n=document.querySelectorAll(".magic-answers-wrap");n.forEach(function(n){e(n)})}};function e(n){const i=JSON.parse(decodeURIComponent(n.dataset.quotes));if(i){n.querySelector(".ma-response");const u=n.querySelector(".ma-flex");let t=c(i),r=null;function c(n){return function(n){const e=atob(n);var t=e.length;const a=new Uint8Array(t);for(let n=0;n<t;n++)a[n]=e.charCodeAt(n);const s=new TextDecoder;return s.decode(a)}(n[Math.floor(Math.random()*n.length)])}function s(n,e){return n=Math.ceil(n),e=Math.floor(e),Math.floor(Math.random()*(e-n+1)+n)}function o(n){const e=[u.innerHTML=".",". .",". . ."];let t=1,a=0;r=setInterval(function(){t<7?(u.innerHTML=e[a],t++,a++,a=2<a?0:a):(clearInterval(r),r=null,function(n){u.innerHTML='"';const e=n.split(" ");let t=0,a=e.length;r=setInterval(function(){t<a?(u.innerHTML+=e[t]+" ",t++):(u.innerHTML+='"',clearInterval(r),r=null)},100)}(n))},500)}function l(n){var a,e=u.innerHTML;n.classList.contains("ma-ball")?((a=n).classList.add("shake-hard","shake-constant"),setTimeout(function(){var n=s(-25,25),e=s(-22,22),t=s(-22,22);u.style.transform="rotate("+n+"deg) translateX("+e+"%) translateY("+t+"%)",a.classList.remove("shake-hard","shake-constant"),a.classList.add("show-answer")},2500)):(n.classList.contains("ma-mouth")&&o(e),n.classList.add("show-answer"))}!function(n){const s=n.querySelector(".magic-answers");if(!s.getAttribute("data-magic-answers")){s.classList.remove("ma-animate"),s.classList.add("magicanswer-hidden"),u.innerHTML=t,s.dataset.magicAnswers=!0;const e=s.querySelectorAll("img"),o=e.length;let a=0;e.forEach(function(n){var e,t=n.src;e=t,n=function(){a++,a==o&&setTimeout(()=>{s.classList.add("ma-animate"),s.classList.remove("magicanswer-hidden")},400)},(t=new Image).onload=n,t.src=e}),n.addEventListener("click",function(){var n;s.classList.contains("show-answer")?(n=s,clearInterval(r),n.classList.remove("show-answer"),t=c(i),u.innerHTML=t):l(s)})}}(n)}}return function(){return n.init()}}),MagicAnswers();