{"version":3,"file":"index-DA3OpK7r.js","sources":["../../src/scripts/helpers/index.ts"],"sourcesContent":["import modules from '../modules';\nimport { breakpoints } from './variables';\n\nconst debounce = (callback: (args: unknown) => void, wait: number) => {\n let timerId: ReturnType;\n return (...args: [unknown]) => {\n clearTimeout(timerId);\n timerId = setTimeout(() => {\n callback(...args);\n }, wait);\n };\n};\n\nconst throttle = (callback: (args: unknown) => void, wait: number) => {\n let inThrottle: boolean;\n return (...args: [unknown]) => {\n if (!inThrottle) {\n callback(...args);\n inThrottle = true;\n setTimeout(() => {\n inThrottle = false;\n }, wait);\n }\n };\n};\n// Map number x from range [a, b] to [c, d]\nconst map = (x: number, a: number, b: number, c: number, d: number) =>\n ((x - a) * (d - c)) / (b - a) + c;\n// Linear interpolation\nconst lerp = (a: number, b: number, n: number) => (1 - n) * a + n * b;\nconst calcWinsize = () => {\n return { width: window.innerWidth, height: window.innerHeight };\n};\n\n// Gets the mouse position\nconst getMousePos = (e: { clientX: number; clientY: number }) => {\n return {\n x: e.clientX,\n y: e.clientY\n };\n};\n\nconst distance = (x1: number, y1: number, x2: number, y2: number) => {\n const a = x1 - x2;\n const b = y1 - y2;\n return Math.hypot(a, b);\n};\n\nconst isDesktop = () => {\n return window.matchMedia(`(min-width: ${breakpoints.desktop}px)`).matches;\n};\n\nconst isSmallDesktop = () => {\n return window.matchMedia(`(min-width: ${breakpoints.smallDesktop}px)`).matches;\n};\n\nconst isTabletLandscape = () => {\n return window.matchMedia(`(min-width: ${breakpoints.tabletLandscape}px)`).matches;\n};\n\nconst isTablet = () => {\n return window.matchMedia(\n `(min-width: ${breakpoints.tablet}px) and (max-width: ${breakpoints.desktop - 1}px)`\n ).matches;\n};\n\nconst isMobile = () => {\n return window.matchMedia(`(max-width: ${breakpoints.desktop - 1}px)`).matches;\n};\n\nconst prefersReducedMotion = () => {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n};\n\nconst getBrowserName = () => {\n const userAgent = navigator.userAgent;\n let browserName;\n if (userAgent.match(/chrome|chromium|crios/i)) {\n browserName = 'chrome';\n } else if (userAgent.match(/firefox|fxios/i)) {\n browserName = 'firefox';\n } else if (userAgent.match(/safari/i)) {\n browserName = 'safari';\n } else if (userAgent.match(/opr\\//i)) {\n browserName = 'opera';\n } else if (userAgent.match(/edg/i)) {\n browserName = 'edge';\n } else {\n browserName = 'No browser detection';\n }\n return browserName;\n};\n\nconst iOS = () => {\n return (\n ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(\n navigator.platform\n ) ||\n // iPad on iOS 13 detection\n (navigator.userAgent.includes('Mac') && 'ontouchend' in document)\n );\n};\nexport {\n iOS,\n debounce,\n throttle,\n map,\n lerp,\n calcWinsize,\n getMousePos,\n distance,\n isDesktop,\n isSmallDesktop,\n isTablet,\n isMobile,\n isTabletLandscape,\n prefersReducedMotion,\n getBrowserName\n};\n\nexport const loadDeferredModules = async (el: Element) => {\n const deferredModules = el.querySelectorAll(\n '[data-module]:not([data-loaded=\"true\"])'\n );\n deferredModules.forEach(node => {\n const mappedModule = modules.find(m => m.name === node.dataset.module);\n if (mappedModule) {\n mappedModule\n .loader?.()\n .then(module => {\n mappedModule.render?.(module.default, [node] as unknown as NodeListOf);\n node.dataset.loaded = 'true';\n })\n .catch(err => {\n console.log(`There was an error loading your module's javascript file - ${err}`);\n });\n }\n });\n};\n\nexport const getEnvGQLUrl = () => {\n const baseUrl = import.meta.env.VITE_OPTIGRAPHQL_BASE_URL as string;\n\n if (document.querySelector('body')?.getAttribute('graph-env') === 'prd') {\n return `${baseUrl}${import.meta.env.VITE_OPTIGRAPHQL_PROD_KEY}`;\n } else if (document.querySelector('body')?.getAttribute('graph-env') === 'stg') {\n return `${baseUrl}${import.meta.env.VITE_OPTIGRAPHQL_STG_KEY}`;\n } else {\n return `${baseUrl}${import.meta.env.VITE_OPTIGRAPHQL_INTE_KEY}`;\n }\n};\n"],"names":["debounce","callback","wait","timerId","args","isDesktop","breakpoints","isSmallDesktop","isTabletLandscape","isTablet","isMobile","prefersReducedMotion","iOS","getEnvGQLUrl","baseUrl","_a","_b"],"mappings":"qCAGM,MAAAA,EAAW,CAACC,EAAmCC,IAAiB,CAChE,IAAAC,EACJ,MAAO,IAAIC,IAAoB,CAC7B,aAAaD,CAAO,EACpBA,EAAU,WAAW,IAAM,CACzBF,EAAS,GAAGG,CAAI,GACfF,CAAI,CACT,CACF,EAqCMG,EAAY,IACT,OAAO,WAAW,eAAeC,EAAY,OAAO,KAAK,EAAE,QAG9DC,EAAiB,IACd,OAAO,WAAW,eAAeD,EAAY,YAAY,KAAK,EAAE,QAGnEE,EAAoB,IACjB,OAAO,WAAW,eAAeF,EAAY,eAAe,KAAK,EAAE,QAGtEG,EAAW,IACR,OAAO,WACZ,eAAeH,EAAY,MAAM,uBAAuBA,EAAY,QAAU,CAAC,KAAA,EAC/E,QAGEI,EAAW,IACR,OAAO,WAAW,eAAeJ,EAAY,QAAU,CAAC,KAAK,EAAE,QAGlEK,EAAuB,IACpB,OAAO,WAAW,kCAAkC,EAAE,QAsBzDC,EAAM,IAER,CAAC,iBAAkB,mBAAoB,iBAAkB,OAAQ,SAAU,MAAM,EAAE,SACjF,UAAU,QACZ,GAEC,UAAU,UAAU,SAAS,KAAK,GAAK,eAAgB,SAyC/CC,EAAe,IAAM,SAC1B,MAAAC,EAAU,6CAEhB,QAAIC,EAAA,SAAS,cAAc,MAAM,IAA7B,YAAAA,EAAgC,aAAa,gBAAiB,MACzD,GAAGD,CAAO,qDACRE,EAAA,SAAS,cAAc,MAAM,IAA7B,YAAAA,EAAgC,aAAa,gBAAiB,MAChE,GAAGF,CAAO,mDAEV,GAAGA,CAAO,kDAErB"}
巴士三国杀
New-Portuguese-gambling-customerservice@airllevant.com
皇冠体育网址
英国AA网中国官网
太阳城
峆一药业
半米孕期专家
买球平台
穿针引线
太阳城娱乐
金羊娱乐
思念食品
新葡京
博彩app
青年工社
赌博平台
安然纳米实业有限公司
博彩平台
猪八戒
金沙娱乐城
陇南公众信息网
打牌吧
天风证券
天创环境
千叶珠宝官方网站
哈尔滨电气集团佳木斯电机股份有限公司
搜钱网
江阴农商银行
《完美世界经典版》官方论坛
3533手机游戏
客所思
微量网
lee官网
126家具人才网
软媒魔方官网