<?php 

if (!function_exists('check_if_page_exists')) {
	function check_if_page_exists($url) {
		// Extract path from full URL (e.g., from https://example.com/my-page/ -> my-page)
		$path = parse_url($url, PHP_URL_PATH);
		$path = trim($path, '/'); // Remove leading/trailing slashes
		$page = get_page_by_path($path); // For standard pages
		// For custom post types, add post_type: get_page_by_path($path, OBJECT, 'custom_post_type');

		if ($page) {
			return true; // Exists as a page
		}
		return false; // Does not exist
	}
}
 
class APK_Extractor_Settings {
	
	public function __construct() {
		add_action( 'load-post.php', array( $this, 'post_metabox_setup' ) );
		add_action( 'load-post-new.php', array( $this, 'post_metabox_setup' ) );
	}

	public function post_metabox_setup() {
		add_action( 'add_meta_boxes', array( $this, 'apkextractor_ap_metabox' ) );
		add_action( 'add_meta_boxes', array( $this, 'add_updates_metaboxes1' ) );
		add_action( 'add_meta_boxes', array( $this, 'add_updates_metaboxes2' ) );
		add_action( 'save_post', array( $this, 'save_updates_post1' ) ); 
		add_action( 'save_post', array( $this, 'save_updates_post2' ) ); 
		add_action( 'save_post', array( $this, 'save_extra' ) );  
		add_action( 'admin_footer', array( $this, 'add_new_apkextractor_js' ) );   
		add_action( 'admin_notices', array( $this, 'my_post_type_notification' ) );   
		add_shortcode( 'new_versi', array( $this, 'check_new_versi' ) );   
		//add_shortcode('new_versi', 'check_new_versi');
	}
	 
	public function apkextractor_ap_metabox( $post_type ) {
		$post_types = array( 'post' );
		if ( in_array( $post_type, $post_types, true ) ) {
		add_meta_box( 'apkextractor_ap_metabox', __( 'Get Apk Data Info', TEXT_DOMAIN ), array( $this, 'apkextractor_metabox_callback' ), $post_type, 'normal', 'high' );
		}
	}

	public function apkextractor_metabox_callback() {
		global $post, $wpdb, $opt_themes;
		$homebase 		= (empty($_SERVER['HTTPS']) ? 'http' : 'https').'://'.$_SERVER['HTTP_HOST']; 
		$link_to_check 	= $homebase.'/gps/'; 
	?>
 

	<p class='howto'>
		Just insert <strong style="color: #2271b1;">Link Playstore</strong> or <strong style="color: #2271b1;">Package Name ID</strong> from Google Play Store Apps. 
		<br>
		For example this link <strong style="color: #2271b1;">https://play.google.com/store/apps/details?id=com.roblox.client</strong> or just insert <strong style="color:crimson;">com.roblox.client</strong>
		<br>
		Go To Google Play Store <a href="https://play.google.com/store/games" target="_blank">New Games</a> or <a href="https://play.google.com/store/apps" target="_blank">New Apps </a>
	</p>


	<form id="apkextractor" method="post" action=""> 
		<table cellspacing='0' style="margin-top:1rem;">
		<tr>
			<td>
			<input type="text" id="pkgid" style='width:100%' placeholder="<?php _e( 'Example: https://play.google.com/store/apps/details?id=com.roblox.client or com.roblox.client', TEXT_DOMAIN ); ?>" /> 
			</td>
			<td width='7%'>
			<button id='grab_button' type="submit" class="btn btn-default button-primary"><?php _e( 'Grab Now', TEXT_DOMAIN ); ?></button>
			</td>
		</tr>
		</table>
		<input type="hidden" id="post_id" value="<?php echo $post->ID; ?>" />  
	</form>

	<div class="message_box"></div>
 
	<?php } 
		
	public function add_updates_metaboxes1() {
		global $post, $opt_themes, $pagenow;
		if($opt_themes['check_updates_versi_post']){
			if ( $pagenow === 'post.php' && isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) { 
				add_meta_box('app_to_updates',  __( 'Apps to update', THEMES_NAMES ),  array( $this, 'apk_updates_info1' ),  $post_type, 'normal', 'low' ); 
			}
		} 
	}
	
	
	public function apk_updates_info1() { 
	global $post, $wpdb;

	$update_available				= get_post_meta( $post->ID, 'update_available', true );
	$available_version				= get_post_meta( $post->ID, 'available_version', true );

	?>

	<div class="admin-inside-box clearfix">
		<div class="aps-wrap">
		
		<div class="aps-tabs-container">
		<div class="aps-group-inputs">
		<ul class="aps-features">
		
		<li>
		<div class="aps-col-3" style="text-transform:uppercase">
		<label for="update_available">update available</label>
		<input type="text" id="update_available" class=" aps-text-input" name="update_available" value="<?= $update_available ?>" placeholder="example : yes" />
		</div>

		<div class="aps-col-3" style="text-transform:uppercase">
		<label for="available_version">available version</label>
		<input type="text" id="available_version" class=" aps-text-input" name="available_version" value="<?= $available_version ?>" placeholder="example : 123" />
		</div>
		</li>
		
		</ul>
		</div>
		</div>
	 
		</div>       
	</div>       
	<?php 
	}

	public function save_updates_post1( $post_id ) { 
		if ( 'page' == @$_REQUEST['post_type'] ) {
			if ( ! current_user_can( 'edit_page', $post_id ) )
				return;
		} else {
			if ( ! current_user_can( 'edit_post', $post_id ) )
				return;
		}
		$wpapk_meta = array(  
			'update_available',
			'available_version',
		);
		 
		$post_ID = @$_POST['post_ID'];
		foreach ($wpapk_meta as $meta_key) {
			if(isset($_POST[$meta_key])) update_post_meta($post_ID, $meta_key, $_POST[$meta_key]);
		}
		
		if( isset( $_POST[ 'wp_version_GP' ] ) ) {
			delete_post_meta( $post_id, 'update_available' );
			delete_post_meta( $post_id, 'available_version' );
		}
		
		 
	}
	
	public function add_updates_metaboxes2() {
		global $post, $opt_themes, $pagenow;  
			add_meta_box('apk_info2',  __( 'More Core', THEMES_NAMES ),  array( $this, 'apk_info2' ),  $post_type, 'normal', 'low' ); 
	}


	public function apk_info2() { 
	global $post, $wpdb;

    $category			= wp_strip_all_tags(get_post_meta( $post->ID, 'wp_category', true ));	
    $poster				= get_post_meta( $post->ID, 'poster', true );
    $background			= get_post_meta( $post->ID, 'background', true );
	?>
	
	<div class="admin-inside-box clearfix">
	<div class="aps-wrap">
	
	<div class="aps-tabs-container">
	
	<div id="aps-tb-generalz" class="aps-tab-content active"> 
	<div class="aps-group-inputs">
	
	<ul class="aps-features">
	
	
	<li>  
	<div class="aps-col-2" style="text-transform:uppercase">
	<label for="wp_category">category</label>
	<input readonly type="text" id="wp_category" class=" aps-text-input" name="wp_category" value="<?php echo $category; ?>"  />  
	</div> 
	
	<div class="aps-col-2" style="text-transform:uppercase">
	<label for="poster">poster</label>
	<input readonly type="text" id="poster" class=" aps-text-input" name="poster" value="<?php echo $poster; ?>" />  
	</div>  
	
	<div class="aps-col-2" style="text-transform:uppercase">
	<label for="background">background</label>
	<input readonly type="text" id="background" class=" aps-text-input"  name="background" value="<?php echo $background; ?>"  />
	</div>
	 
	</li> 	
	 
	</ul>
	</div>
	</div>
	
	</div>
	
	</div>
	</div>
	<?php 
	}

	public function save_updates_post2( $post_id ) { 
		if ( 'page' == @$_REQUEST['post_type'] ) {
			if ( ! current_user_can( 'edit_page', $post_id ) )
				return;
		} else {
			if ( ! current_user_can( 'edit_post', $post_id ) )
				return;
		}
		$wpapk_meta = array(  
			'wp_category',
			'poster',
			'background',
		);
		 
		$post_ID = @$_POST['post_ID'];
		foreach ($wpapk_meta as $meta_key) {
			if(isset($_POST[$meta_key])) update_post_meta($post_ID, $meta_key, $_POST[$meta_key]);
		}
		 
	}
	
	public function save_extra( $post_id ) { 
			global $opt_themes;
			
			if ( 'page' == @$_REQUEST['post_type'] ) {
				if ( ! current_user_can( 'edit_page', $post_id ) )
					return;
			} else {
				if ( ! current_user_can( 'edit_post', $post_id ) )
					return;
			}
		
			/* All good, its safe for us to save the data now. */
			
			$GP_ID			= get_post_meta( get_the_ID(), 'wp_GP_ID', true ); 
			 
			//$get_infos		= @get_linkz1($gp);  
			//$g_data			= @file_get_contents($url2);
			
			if (!function_exists('file_get_html')) {
				require_once get_template_directory().'/libs/addons/inc/dom.php';
			}
			
			$context = stream_context_create([
				'ssl' => [
					'verify_peer' => false,
					'verify_peer_name' => false,
				]
			]); 
	 
			$appid			= get_post_meta( $post_id, 'wp_GP_ID', true );
			$gp				= "https://play.google.com/store/apps/details?id=".$appid."&hl=en-US"; 
			$url 			= (empty($_SERVER['HTTPS']) ? 'http' : 'https').'://'.$_SERVER['HTTP_HOST'].'/gps/?pkgid='.$appid;
			$url2 			= 'https://apks.exthem.es/gps/?pkgid='.$appid; 
			$url3 			= 'https://apks.exthem.es/?pkgid='.$appid; 
			$url4 			= 'https://exthem.es/gps.php?pkgid='.$appid; 
			
			/* 
			$g_data			= @file_get_contents($url3); 
			 
			$n_version		= matchx('/<div class="version">(.*?)<\/div>/ms', $g_data, 1);  
			$poster			= matchx('/<div class="poster">(.*?)<\/div>/ms', $g_data, 1);  
			$background		= matchx('/<div class="background">(.*?)<\/div>/ms', $g_data, 1);  
			*/
			
			$html			= file_get_html($url3, false, $context); // Load the HTML from a URL wirhout ssl verfied
			$get_infos		= get_linkz($gp); 
			if (!empty($html)) {
			$g_data 		= $html->outertext;
			$pkg			= $this->match('/<div class="pkgids">(.*?)<\/div>/ms', $g_data, 1);  
			$url_ps			= $this->match('/<div class="url_ps">(.*?)<\/div>/ms', $g_data, 1);  
			$n_version		= $this->match('/<div class="version">(.*?)<\/div>/ms', $g_data, 1);  
			$app_names2		= $this->match('/<div class="appname">(.*?)<\/div>/ms', $g_data, 1);  
			$poster			= $this->match('/<div class="poster">(.*?)<\/div>/ms', $g_data, 1);  
			$background		= $this->match('/<div class="background">(.*?)<\/div>/ms', $g_data, 1);  
			$linkps			= $this->match('/<div class="linkdownload">(.*?)<\/div>/ms', $g_data, 1);  
			$app_names		= $this->match('/<h1><span.*?itemprop="name">(.*?)<\/span><\/h1>/', $get_infos, 1);
			$images_GP		= $this->match_all('/<img.*?src="(.*?)".*?>/ms', $this->match('/<div id="gallery">(.*?)<\/div>/ms', $g_data, 1), 1); 

			$tags			= $this->match_all('/<div.*?data-idom-class="Rj2Mlf OLiIxf PDpWxe P62QJc LQeN7 LMoCf">.*?<a.*?aria-label="(.*?)".*?><\/a>/ms', $this->match('/<div class="Uc6QCc">(.*?)<\/section>/ms', $get_infos, 1), 1);
	 
			/* featured image */
			if (!empty($poster)){
			$image_url		= $poster;
			$image			= $image_url;
			$title_image	= sanitize_title($app_names);
			$title_image2	= sanitize_title_with_dashes($app_names); 
			$title			= $post_id.'-'.$title_image;
			$uploaddir		= wp_upload_dir();
			$filename		= "{$title}.png"; 
			$uploadfile		= $uploaddir['path'].'/'.$filename;
			$contents		= get_linkz($image);
			$savefile		= fopen($uploadfile, 'w');
			fwrite($savefile, $contents);
			fclose($savefile);
			$wp_filetype	= wp_check_filetype(basename($filename), null );
			$attachment		= array(
				'post_mime_type'	=> $wp_filetype['type'],
				'post_title'		=> $filename,
				'post_content'		=> '',
				'post_status'		=> 'inherit'
			);
			$attach_id		= wp_insert_attachment( $attachment, $uploadfile );
			require_once(ABSPATH . 'wp-admin/includes/image.php');
			$attach_data	= wp_generate_attachment_metadata( $attach_id, $uploadfile );
			wp_update_attachment_metadata( $attach_id, $attach_data );
			set_post_thumbnail( get_the_ID(), $attach_id );
			}
			 
			/* background image */		 
			if (!empty($background)){
			$image_bg_url	= $background;
			$image_bg		= $image_bg_url;
			$title_bg		= sanitize_title($app_names); 
			$title_bg		= $post_id.'-'.$title_bg;
			$uploaddir_bg	= wp_upload_dir();
			$filename_bg	= "{$title_bg}-bg.png";
			$uploadfile_bg	= $uploaddir_bg['path'].'/'.$filename_bg;
			$contents_bg	= get_linkz($image_bg);
			$savefile_bg	= fopen($uploadfile_bg, 'w');
			fwrite($savefile_bg, $contents_bg);
			fclose($savefile_bg);
			$wp_filetype_bg	= wp_check_filetype(basename($filename_bg), null );
			$attachment_bg	= array(
				'post_mime_type'	=> $wp_filetype_bg['type'],
				'post_title'		=> $filename_bg,
				'post_content'		=> '',
				'post_status'		=> 'inherit'
			);
			$attach_id_bg	= wp_insert_attachment( $attachment_bg, $uploadfile_bg );
			require_once(ABSPATH . 'wp-admin/includes/image.php');
			$attach_data_bg	= wp_generate_attachment_metadata( $attach_id_bg, $uploadfile_bg );
			wp_update_attachment_metadata( $attach_id_bg, $attach_data_bg ); 
			add_post_meta( $post_id, '_background_image_id', $attach_id_bg );
			add_post_meta( $post_id, 'background_images', $attach_id_bg ); 
			//update_post_meta( get_the_ID(), '_background_image_id', $attach_id_bg);
			//update_post_meta( get_the_ID(), 'background_images', $attach_id_bg);
			}
				 
			if ( !empty($images_GP) ) { 
				$gallery_image	= array(); 
				for ($i = 0; $i < count( $images_GP ); $i++ ) {
					if ( '' != $images_GP[$i] ) {
						$gallery_image['image_url'][] = $images_GP[$i];
					}
				}
				add_post_meta( $post_id, 'gallery_data', $gallery_image ); 
			}
			
		 
			/* download link */
			$download_info_linkQ = array();
			
			$get = $_GET['pkgid'];
			 
			if (!empty($pkg)){
			$title_dwz	= get_post_meta( get_the_ID(), 'wp_title_GP', true );
			$title_dwz1	= 'Download Apk';
			$size_dwz	= get_post_meta( get_the_ID(), 'wp_sizes', true );
			$linkapkz1	= ouo_io_exhemes('https://exthem.es/apk.php?pkg='.$appid);
			$linkapkz	= ouo_io_exhemes($url_ps); 

			$linkapkz2	= 'https://play.google.com/store/apps/details?id='.$pkg; 
			$linkapks	= ouo_io_exhemes($linkapkz2); 
				 
			$download_info_link_data_gpsQ = [
				'name'		=> $app_names,
				'title' 	=> $app_names,
				'url'		=> $linkapks,
				'links' 	=> $linkapks,
				'sizes1' 	=> $size_dwz,
				'sizes' 	=> $size_dwz,
				'size' 		=> $size_dwz,
				'tipes' 	=> '',
				'notes' 	=> '',
			]; 
				 
			array_push($download_info_linkQ, $download_info_link_data_gpsQ);
			add_post_meta( $post_id, "repeatable_fields", $download_info_linkQ);
			add_post_meta( $post_id, "group_downloads_links", $download_info_linkQ);			
			}
				
			$categorys	= get_post_meta( get_the_ID(), 'wp_category', true );
			$developers	= get_post_meta( get_the_ID(), 'wp_developers_GP', true );
			
			
			//if ( !empty($categorys) ) { 
			//wp_set_object_terms( $post_id, $categorys, 'category', false );
			//}
			//$screen = get_current_screen();				 
			// tambahkan 'add' untuk tampil pada new post
			// hilangkan 'add' untuk tampil pada edit post		
			//if ( $screen->post_type === 'post' && $screen->action === 'add' ) {
			//wp_set_object_terms( $post_id, get_post_meta( $post_id, 'wp_category', true ), 'category', true );
			//}
			
			//if( isset( $_GET['pkgid'] ) ) {
			//wp_set_object_terms( $post_id, get_post_meta( $post_id, 'wp_category', true ), 'category', false );
			//update_post_meta( $post_id, 'category', $categorys);	
			//}		
			
			//wp_set_object_terms( $post_id, get_post_meta( $post_id, 'wp_developers_GP', true ), 'developer', true ); 
			wp_set_object_terms( $post_id, $app_names, 'post_tag', true );
			wp_set_object_terms( $post_id, $tags, 'post_tag', true );
			
			 
			
			
			$html->clear();
			unset($html);		
			
			}

	}

	public function add_new_apkextractor_js() {
	?>

	<script src="#https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

	<?php 
	$current_link 		= (empty($_SERVER['HTTPS']) ? 'http' : 'https')."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 
	$link_to_checked 	= (empty($_SERVER['HTTPS']) ? 'http' : 'https').'://'.$_SERVER['HTTP_HOST'].'/gps/'; 
	if (check_if_page_exists($link_to_checked)) {
	//$ajaxurl = get_template_directory_uri().'/libs/addons/inc/gps2.php';
	$ajaxurl = get_template_directory_uri().'/libs/addons/inc/gps.php';
	} else {
	$ajaxurl = get_template_directory_uri().'/libs/addons/inc/gps.php';
	} 

	?>

	<script> 
	document.querySelector('input#pkgid').addEventListener('input', function(e) {
		let value = e.target.value;
		if ( value.includes('?id=') ) {
			e.target.value = value.split('?id=')[1] || ''; 
		} else if (value.includes('?pkgid=')) {
			e.target.value = value.split('?pkgid=')[1] || ''; 
		} 
	});
	</script>

	<script>  
	$(document).ready(function() {
		var delay = 2000;
		$('.btn-default').click(function(e){
		e.preventDefault();
		var pkgid = $('#pkgid').val();
		var forms = $('#apkextractor').serialize();
		var url_position = $( "#pkgid" ).offset().top - 100;
		var metabox_info = $( "#wp_apk_details" ).offset().top - 10;
		
		if(pkgid == ''){
		$('.message_box').html(	'<span style="color:red;">Enter Package ID!</span>' );
		$('#pkgid').focus();
			return false;
		} 

		$( "html, body" ).animate( { scrollTop: url_position }, "slow" );
		$( "#grab_button" ).text( "Please Wait.." ).prop( "disabled",true );
		$( "#pkgid" ).prop( "disabled",true );
		
		$.ajax ({
		type: "GET",// "POST" or "GET"		
		url: "<?php echo $ajaxurl; ?>", 
		data: "pkgid="+pkgid, 	 
		//data: forms,
		dataType: "json",
		
		//statusCode: {
		//	200: function() {
		//		console.log('Request successful (Status 200).');
		//	},
		//	404: function() {
		//		alert('Resource not found (Status 404).');
		//	},
		//	500: function() {
		//		alert('Server error (Status 500).');
		//	}
		//},
		
		beforeSend: function() {
			//$('.message_box').html(	'<div class="loading-popup"><div class="dot-overtaking"></div><b>Please wait</b></div>' );
		},
		
		success: function(data) {
				
			$( "#grab_button" ).text( "Grab Now" ).prop( "disabled", false );
			$( "#pkgid" ).prop( "disabled", false );
			//return false;
			
			$('.message_box').html(data);
			 
			document.querySelector('input#pkgid').value = '';		
			//document.querySelector('input[name="newtag[post_tag]"]').value = data.name;
			document.querySelector('input[name="newtag[post_tag]"]').value = data.tag;
			document.querySelector('input[name="newtag[developer]"]').value = data.developer;
			document.querySelector('a#category-add-toggle').click();
			document.querySelector('input[name=newcategory]').value = data.category; 
			 
			var background = data.background;
			var poster = data.poster;
			
			//$('#background_images_meta_box .inside div#background_image_preview').before('<div class="image-preview" id="background_image_preview"><img src="' + background + '"></div></div>');
			$('#postimagediv .inside .hide-if-no-js').before('<img src="' + poster + '" >');
			
			document.querySelector('input[name="post_title"]').value = data.name; 	
			document.querySelector('textarea[name="content"]').value = data.content; 
			document.querySelector('textarea[name="wp_playstore_link"]').value = data.linkgps; 
			document.querySelector('input[name="wp_GP_ID"]').value = data.pkgid;
			document.querySelector('input[name="wp_title_GP"]').value = data.name;
			document.querySelector('input[name="wp_version_GP"]').value = data.versi;
			document.querySelector('input[name="wp_sizes"]').value = data.size;	
			document.querySelector('textarea[name="wp_desck_GP"]').value = data.description; 
			document.querySelector('textarea[name="wp_whatnews_GP"]').value = data.whatsnew; 
			document.querySelector('input[name="wp_requires_GP"]').value = data.os;
			document.querySelector('input[name="wp_updates_GP"]').value = data.update;
			document.querySelector('input[name="wp_youtube_GP"]').value = data.youtube;
			document.querySelector('input[name="wp_rated_GP"]').value = data.rate;
			document.querySelector('input[name="wp_ratings_GP"]').value = data.vote;
			document.querySelector('textarea[name="wp_poster_GP"]').value = data.poster+"=s90-rw"; 
			document.querySelector('input[name="poster"]').value = data.poster;
			document.querySelector('textarea[name="wp_backgrounds_GP"]').value = data.background;
			document.querySelector('input[name="background"]').value = data.background;
			document.querySelector('input[name="wp_developers_GP"]').value = data.developer;
			document.querySelector('input[name="wp_category"]').value = data.category;
			//document.querySelector('input#appdev').value = data.developer;
			//document.querySelector('input#appcategory').value = data.category;
			//document.querySelector('input[name="remote_background"]').value = data.background;
			//document.querySelector('input[name="fifu_input_url"]').value = data.poster;
				
			setTimeout(function() {
				//alert(data);
				//console.log(data);
				//log(data);
				
				//$( "html, body" ).animate( { scrollTop: 0 }, "slow" );
				$( "html, body" ).animate( { scrollTop: metabox_info }, "slow" );
				//document.querySelector( "html, body" ).animate( { scrollTop: 0 }, "slow" ); 
			}, 600);
			
		} 
		//,
		//error: function(xhr, resp, text) {
			//console.log(xhr, resp, text);
		//	alert(xhr, resp, text);
		//}
					
		//error: function(data) { 
		//	alert( "Ops sorry : " + data.status + " ");
		//}
		 
		 
		});
		
		});
				
	});
	 
	</script>

	<style>
	/* Container for the popup overlay */
	.loading-popup {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: rgba(0, 0, 0, 0.6);display: flex;justify-content: center;align-items: center;z-index: 10000;backdrop-filter: saturate(180%) blur(1px);}.loader {border: 8px solid #f3f3f3;border-top: 8px solid #3498db;border-radius: 50%;width: 60px;height: 60px;animation: spin 1s linear infinite;}@keyframes spin {0% {transform: rotate(0deg);}100% {transform: rotate(360deg);}}

	.loading-popup div b, .loading-popup b {font-weight:900;color:gold;}
	.loading-popup b {display:none}
	#app_to_updates, #apk_info2 {display: none;}
	/**   
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: saturate(180%) blur(10px);
	 * ==============================================
	 * Dot Elastic
	 * https://codepen.io/nzbin/pen/GGrXbp
	 * ==============================================
	 */
	 
	.dot-elastic {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-elastic 1s infinite linear;}.dot-elastic::before, .dot-elastic::after {content: "";display: inline-block;position: absolute;top: 0;}.dot-elastic::before {left: -15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-elastic-before 1s infinite linear;}.dot-elastic::after {left: 15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-elastic-after 1s infinite linear;}@keyframes dot-elastic-before {0% {transform: scale(1, 1);}25% {transform: scale(1, 1.5);}50% {transform: scale(1, 0.67);}75% {transform: scale(1, 1);}100% {transform: scale(1, 1);}}@keyframes dot-elastic {0% {transform: scale(1, 1);}25% {transform: scale(1, 1);}50% {transform: scale(1, 1.5);}75% {transform: scale(1, 1);}100% {transform: scale(1, 1);}}@keyframes dot-elastic-after {0% {transform: scale(1, 1);}25% {transform: scale(1, 1);}50% {transform: scale(1, 0.67);}75% {transform: scale(1, 1.5);}100% {transform: scale(1, 1);}}.dot-pulse {position: relative;left: -9999px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;box-shadow: 9999px 0 0 -5px;animation: dot-pulse 1.5s infinite linear;animation-delay: 0.25s;}.dot-pulse::before, .dot-pulse::after {content: "";display: inline-block;position: absolute;top: 0;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;}.dot-pulse::before {box-shadow: 9984px 0 0 -5px;animation: dot-pulse-before 1.5s infinite linear;animation-delay: 0s;}.dot-pulse::after {box-shadow: 10014px 0 0 -5px;animation: dot-pulse-after 1.5s infinite linear;animation-delay: 0.5s;}@keyframes dot-pulse-before {0% {box-shadow: 9984px 0 0 -5px;}30% {box-shadow: 9984px 0 0 2px;}60%, 100% {box-shadow: 9984px 0 0 -5px;}}@keyframes dot-pulse {0% {box-shadow: 9999px 0 0 -5px;}30% {box-shadow: 9999px 0 0 2px;}60%, 100% {box-shadow: 9999px 0 0 -5px;}}@keyframes dot-pulse-after {0% {box-shadow: 10014px 0 0 -5px;}30% {box-shadow: 10014px 0 0 2px;}60%, 100% {box-shadow: 10014px 0 0 -5px;}}.dot-flashing {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-flashing 1s infinite linear alternate;animation-delay: 0.5s;}.dot-flashing::before, .dot-flashing::after {content: "";display: inline-block;position: absolute;top: 0;}.dot-flashing::before {left: -15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-flashing 1s infinite alternate;animation-delay: 0s;}.dot-flashing::after {left: 15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-flashing 1s infinite alternate;animation-delay: 1s;}@keyframes dot-flashing {0% {background-color: #9880ff;}50%, 100% {background-color: rgba(152, 128, 255, 0.2);}}.dot-collision {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;}.dot-collision::before, .dot-collision::after {content: "";display: inline-block;position: absolute;top: 0;}.dot-collision::before {left: -10px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-collision-before 2s infinite ease-in;}.dot-collision::after {left: 10px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-collision-after 2s infinite ease-in;animation-delay: 1s;}@keyframes dot-collision-before {0%, 50%, 75%, 100% {transform: translateX(0);}25% {transform: translateX(-15px);}}@keyframes dot-collision-after {0%, 50%, 75%, 100% {transform: translateX(0);}25% {transform: translateX(15px);}}.dot-revolution {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;}.dot-revolution::before, .dot-revolution::after {content: "";display: inline-block;position: absolute;}.dot-revolution::before {left: 0;top: -15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;transform-origin: 5px 20px;animation: dot-revolution 1.4s linear infinite;}.dot-revolution::after {left: 0;top: -30px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;transform-origin: 5px 35px;animation: dot-revolution 1s linear infinite;}@keyframes dot-revolution {0% {transform: rotateZ(0deg) translate3d(0, 0, 0);}100% {transform: rotateZ(360deg) translate3d(0, 0, 0);}}.dot-carousel {position: relative;left: -9999px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;animation: dot-carousel 1.5s infinite linear;}@keyframes dot-carousel {0% {box-shadow: 9984px 0 0 -1px #9880ff, 9999px 0 0 1px #9880ff, 10014px 0 0 -1px #9880ff;}50% {box-shadow: 10014px 0 0 -1px #9880ff, 9984px 0 0 -1px #9880ff, 9999px 0 0 1px #9880ff;}100% {box-shadow: 9999px 0 0 1px #9880ff, 10014px 0 0 -1px #9880ff, 9984px 0 0 -1px #9880ff;}}.dot-typing {position: relative;left: -9999px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;animation: dot-typing 1.5s infinite linear;}@keyframes dot-typing {0% {box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;}16.667% {box-shadow: 9984px -10px 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;}33.333% {box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;}50% {box-shadow: 9984px 0 0 0 #9880ff, 9999px -10px 0 0 #9880ff, 10014px 0 0 0 #9880ff;}66.667% {box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;}83.333% {box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px -10px 0 0 #9880ff;}100% {box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;}}.dot-windmill {position: relative;top: -10px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;transform-origin: 5px 15px;animation: dot-windmill 2s infinite linear;}.dot-windmill::before, .dot-windmill::after {content: "";display: inline-block;position: absolute;}.dot-windmill::before {left: -8.66254px;top: 15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;}.dot-windmill::after {left: 8.66254px;top: 15px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;}@keyframes dot-windmill {0% {transform: rotateZ(0deg) translate3d(0, 0, 0);}100% {transform: rotateZ(720deg) translate3d(0, 0, 0);}}.dot-bricks {position: relative;top: 8px;left: -9999px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;box-shadow: 9991px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff, 10007px 0 0 0 #9880ff;animation: dot-bricks 2s infinite ease;}@keyframes dot-bricks {0% {box-shadow: 9991px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff, 10007px 0 0 0 #9880ff;}8.333% {box-shadow: 10007px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff, 10007px 0 0 0 #9880ff;}16.667% {box-shadow: 10007px -16px 0 0 #9880ff, 9991px -16px 0 0 #9880ff, 10007px 0 0 0 #9880ff;}25% {box-shadow: 10007px -16px 0 0 #9880ff, 9991px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff;}33.333% {box-shadow: 10007px 0 0 0 #9880ff, 9991px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff;}41.667% {box-shadow: 10007px 0 0 0 #9880ff, 10007px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff;}50% {box-shadow: 10007px 0 0 0 #9880ff, 10007px -16px 0 0 #9880ff, 9991px -16px 0 0 #9880ff;}58.333% {box-shadow: 9991px 0 0 0 #9880ff, 10007px -16px 0 0 #9880ff, 9991px -16px 0 0 #9880ff;}66.666% {box-shadow: 9991px 0 0 0 #9880ff, 10007px 0 0 0 #9880ff, 9991px -16px 0 0 #9880ff;}75% {box-shadow: 9991px 0 0 0 #9880ff, 10007px 0 0 0 #9880ff, 10007px -16px 0 0 #9880ff;}83.333% {box-shadow: 9991px -16px 0 0 #9880ff, 10007px 0 0 0 #9880ff, 10007px -16px 0 0 #9880ff;}91.667% {box-shadow: 9991px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff, 10007px -16px 0 0 #9880ff;}100% {box-shadow: 9991px -16px 0 0 #9880ff, 9991px 0 0 0 #9880ff, 10007px 0 0 0 #9880ff;}}.dot-floating {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-floating 3s infinite cubic-bezier(0.15, 0.6, 0.9, 0.1);}.dot-floating::before, .dot-floating::after {content: "";display: inline-block;position: absolute;top: 0;}.dot-floating::before {left: -12px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-floating-before 3s infinite ease-in-out;}.dot-floating::after {left: -24px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-floating-after 3s infinite cubic-bezier(0.4, 0, 1, 1);}@keyframes dot-floating {0% {left: calc(-50% - 5px);}75% {left: calc(50% + 105px);}100% {left: calc(50% + 105px);}}@keyframes dot-floating-before {0% {left: -50px;}50% {left: -12px;}75% {left: -50px;}100% {left: -50px;}}@keyframes dot-floating-after {0% {left: -100px;}50% {left: -24px;}75% {left: -100px;}100% {left: -100px;}}.dot-fire {position: relative;left: -9999px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;box-shadow: 9999px 22.5px 0 -5px #9880ff;animation: dot-fire 1.5s infinite linear;animation-delay: -0.85s;}.dot-fire::before, .dot-fire::after {content: "";display: inline-block;position: absolute;top: 0;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;}.dot-fire::before {box-shadow: 9999px 22.5px 0 -5px #9880ff;animation: dot-fire 1.5s infinite linear;animation-delay: -1.85s;}.dot-fire::after {box-shadow: 9999px 22.5px 0 -5px #9880ff;animation: dot-fire 1.5s infinite linear;animation-delay: -2.85s;}@keyframes dot-fire {1% {box-shadow: 9999px 22.5px 0 -5px #9880ff;}50% {box-shadow: 9999px -5.625px 0 2px #9880ff;}100% {box-shadow: 9999px -22.5px 0 -5px #9880ff;}}.dot-spin {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: transparent;color: transparent;box-shadow: 0 -18px 0 0 #9880ff, 12.727926px -12.727926px 0 0 #9880ff, 18px 0 0 0 #9880ff, 12.727926px 12.727926px 0 0 rgba(152, 128, 255, 0), 0 18px 0 0 rgba(152, 128, 255, 0), -12.727926px 12.727926px 0 0 rgba(152, 128, 255, 0), -18px 0 0 0 rgba(152, 128, 255, 0), -12.727926px -12.727926px 0 0 rgba(152, 128, 255, 0);animation: dot-spin 1.5s infinite linear;}@keyframes dot-spin {0%, 100% {box-shadow: 0 -18px 0 0 #9880ff, 12.727926px -12.727926px 0 0 #9880ff, 18px 0 0 0 #9880ff, 12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), 0 18px 0 -5px rgba(152, 128, 255, 0), -12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), -18px 0 0 -5px rgba(152, 128, 255, 0), -12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0);}12.5% {box-shadow: 0 -18px 0 -5px rgba(152, 128, 255, 0), 12.727926px -12.727926px 0 0 #9880ff, 18px 0 0 0 #9880ff, 12.727926px 12.727926px 0 0 #9880ff, 0 18px 0 -5px rgba(152, 128, 255, 0), -12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), -18px 0 0 -5px rgba(152, 128, 255, 0), -12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0);}25% {box-shadow: 0 -18px 0 -5px rgba(152, 128, 255, 0), 12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0), 18px 0 0 0 #9880ff, 12.727926px 12.727926px 0 0 #9880ff, 0 18px 0 0 #9880ff, -12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), -18px 0 0 -5px rgba(152, 128, 255, 0), -12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0);}37.5% {box-shadow: 0 -18px 0 -5px rgba(152, 128, 255, 0), 12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0), 18px 0 0 -5px rgba(152, 128, 255, 0), 12.727926px 12.727926px 0 0 #9880ff, 0 18px 0 0 #9880ff, -12.727926px 12.727926px 0 0 #9880ff, -18px 0 0 -5px rgba(152, 128, 255, 0), -12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0);}50% {box-shadow: 0 -18px 0 -5px rgba(152, 128, 255, 0), 12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0), 18px 0 0 -5px rgba(152, 128, 255, 0), 12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), 0 18px 0 0 #9880ff, -12.727926px 12.727926px 0 0 #9880ff, -18px 0 0 0 #9880ff, -12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0);}62.5% {box-shadow: 0 -18px 0 -5px rgba(152, 128, 255, 0), 12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0), 18px 0 0 -5px rgba(152, 128, 255, 0), 12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), 0 18px 0 -5px rgba(152, 128, 255, 0), -12.727926px 12.727926px 0 0 #9880ff, -18px 0 0 0 #9880ff, -12.727926px -12.727926px 0 0 #9880ff;}75% {box-shadow: 0 -18px 0 0 #9880ff, 12.727926px -12.727926px 0 -5px rgba(152, 128, 255, 0), 18px 0 0 -5px rgba(152, 128, 255, 0), 12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), 0 18px 0 -5px rgba(152, 128, 255, 0), -12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), -18px 0 0 0 #9880ff, -12.727926px -12.727926px 0 0 #9880ff;}87.5% {box-shadow: 0 -18px 0 0 #9880ff, 12.727926px -12.727926px 0 0 #9880ff, 18px 0 0 -5px rgba(152, 128, 255, 0), 12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), 0 18px 0 -5px rgba(152, 128, 255, 0), -12.727926px 12.727926px 0 -5px rgba(152, 128, 255, 0), -18px 0 0 -5px rgba(152, 128, 255, 0), -12.727926px -12.727926px 0 0 #9880ff;}}.dot-falling {position: relative;left: -9999px;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;box-shadow: 9999px 0 0 0 #9880ff;animation: dot-falling 1s infinite linear;animation-delay: 0.1s;}.dot-falling::before, .dot-falling::after {content: "";display: inline-block;position: absolute;top: 0;}.dot-falling::before {width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-falling-before 1s infinite linear;animation-delay: 0s;}.dot-falling::after {width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-falling-after 1s infinite linear;animation-delay: 0.2s;}@keyframes dot-falling {0% {box-shadow: 9999px -15px 0 0 rgba(152, 128, 255, 0);}25%, 50%, 75% {box-shadow: 9999px 0 0 0 #9880ff;}100% {box-shadow: 9999px 15px 0 0 rgba(152, 128, 255, 0);}}@keyframes dot-falling-before {0% {box-shadow: 9984px -15px 0 0 rgba(152, 128, 255, 0);}25%, 50%, 75% {box-shadow: 9984px 0 0 0 #9880ff;}100% {box-shadow: 9984px 15px 0 0 rgba(152, 128, 255, 0);}}@keyframes dot-falling-after {0% {box-shadow: 10014px -15px 0 0 rgba(152, 128, 255, 0);}25%, 50%, 75% {box-shadow: 10014px 0 0 0 #9880ff;}100% {box-shadow: 10014px 15px 0 0 rgba(152, 128, 255, 0);}}.dot-stretching {position: relative;width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;transform: scale(1.25, 1.25);animation: dot-stretching 2s infinite ease-in;}.dot-stretching::before, .dot-stretching::after {content: "";display: inline-block;position: absolute;top: 0;}.dot-stretching::before {width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-stretching-before 2s infinite ease-in;}.dot-stretching::after {width: 10px;height: 10px;border-radius: 5px;background-color: #9880ff;color: #9880ff;animation: dot-stretching-after 2s infinite ease-in;}@keyframes dot-stretching {0% {transform: scale(1.25, 1.25);}50%, 60% {transform: scale(0.8, 0.8);}100% {transform: scale(1.25, 1.25);}}@keyframes dot-stretching-before {0% {transform: translate(0) scale(0.7, 0.7);}50%, 60% {transform: translate(-20px) scale(1, 1);}100% {transform: translate(0) scale(0.7, 0.7);}}@keyframes dot-stretching-after {0% {transform: translate(0) scale(0.7, 0.7);}50%, 60% {transform: translate(20px) scale(1, 1);}100% {transform: translate(0) scale(0.7, 0.7);}}.dot-gathering {position: relative;width: 12px;height: 12px;border-radius: 6px;background-color: hsl(0deg, 100%, 0%);color: transparent;margin: -1px 0;filter: blur(2px);}.dot-gathering::before, .dot-gathering::after {content: "";display: inline-block;position: absolute;top: 0;left: -50px;width: 12px;height: 12px;border-radius: 6px;background-color: hsl(0deg, 100%, 0%);color: transparent;opacity: 0;filter: blur(2px);animation: dot-gathering 2s infinite ease-in;}.dot-gathering::after {animation-delay: 0.5s;}@keyframes dot-gathering {0% {opacity: 0;transform: translateX(0);}35%, 60% {opacity: 1;transform: translateX(50px);}100% {opacity: 0;transform: translateX(100px);}}.dot-hourglass {position: relative;top: -15px;width: 12px;height: 12px;border-radius: 6px;background-color: hsl(0deg, 100%, 0%);color: transparent;margin: -1px 0;filter: blur(2px);transform-origin: 5px 20px;animation: dot-hourglass 2.4s infinite ease-in-out;animation-delay: 0.6s;}.dot-hourglass::before, .dot-hourglass::after {content: "";display: inline-block;position: absolute;top: 0;left: 0;width: 12px;height: 12px;border-radius: 6px;background-color: hsl(0deg, 100%, 0%);color: transparent;filter: blur(2px);}.dot-hourglass::before {top: 30px;}.dot-hourglass::after {animation: dot-hourglass-after 2.4s infinite cubic-bezier(0.65, 0.05, 0.36, 1);}@keyframes dot-hourglass {0% {transform: rotateZ(0deg);}25% {transform: rotateZ(180deg);}50% {transform: rotateZ(180deg);}75% {transform: rotateZ(360deg);}100% {transform: rotateZ(360deg);}}@keyframes dot-hourglass-after {0% {transform: translateY(0);}25% {transform: translateY(30px);}50% {transform: translateY(30px);}75% {transform: translateY(0);}100% {transform: translateY(0);}}.dot-overtaking {position: relative;width: 12px;height: 12px;border-radius: 6px;background-color: transparent;color: hsl(0deg, 100%, 0%);margin: -1px 0;box-shadow: 0 -20px 0 0;filter: blur(2px);animation: dot-overtaking 2s infinite cubic-bezier(0.2, 0.6, 0.8, 0.2);}.dot-overtaking::before, .dot-overtaking::after {content: "";display: inline-block;position: absolute;top: 0;left: 0;width: 12px;height: 12px;border-radius: 6px;background-color: transparent;color: hsl(0deg, 100%, 0%);box-shadow: 0 -20px 0 0;filter: blur(2px);}.dot-overtaking::before {animation: dot-overtaking 2s infinite cubic-bezier(0.2, 0.6, 0.8, 0.2);animation-delay: 0.3s;}.dot-overtaking::after {animation: dot-overtaking 1.5s infinite cubic-bezier(0.2, 0.6, 0.8, 0.2);animation-delay: 0.6s;}@keyframes dot-overtaking {0% {transform: rotateZ(0deg);}100% {transform: rotateZ(360deg);}}.dot-shuttle {position: relative;left: -15px;width: 12px;height: 12px;border-radius: 6px;background-color: hsl(0deg, 100%, 0%);color: transparent;margin: -1px 0;filter: blur(2px);}.dot-shuttle::before, .dot-shuttle::after {content: "";display: inline-block;position: absolute;top: 0;width: 12px;height: 12px;border-radius: 6px;background-color: hsl(0deg, 100%, 0%);color: transparent;filter: blur(2px);}.dot-shuttle::before {left: 15px;animation: dot-shuttle 2s infinite ease-out;}.dot-shuttle::after {left: 30px;}@keyframes dot-shuttle {0%, 50%, 100% {transform: translateX(0);}25% {transform: translateX(-45px);}75% {transform: translateX(45px);}}.dot-bouncing {position: relative;height: 13px;font-size: 13px;}.dot-bouncing::before {content: "🏐🏀🏐";display: inline-block;position: relative;animation: dot-bouncing 1s infinite;}@keyframes dot-bouncing {0% {top: -20px;animation-timing-function: ease-in;}34% {transform: scale(1, 1);}35% {top: 20px;animation-timing-function: ease-out;transform: scale(1.5, 0.5);}45% {transform: scale(1, 1);}90% {top: -20px;}100% {top: -20px;}}.dot-rolling {position: relative;height: 10px;font-size: 10px;}.dot-rolling::before {content: "🏐";display: inline-block;position: relative;transform: translateX(-25px);animation: dot-rolling 3s infinite;}@keyframes dot-rolling {0% {content: "🏐";transform: translateX(-25px) rotateZ(0deg);}16.667% {content: "🏐";transform: translateX(25px) rotateZ(720deg);}33.333% {content: "🏐";transform: translateX(-25px) rotateZ(0deg);}34.333% {content: "🏀";transform: translateX(-25px) rotateZ(0deg);}50% {content: "🏀";transform: translateX(25px) rotateZ(720deg);}66.667% {content: "🏀";transform: translateX(-25px) rotateZ(0deg);}67.667% {content: "🏐";transform: translateX(-25px) rotateZ(0deg);}83.333% {content: "🏐";transform: translateX(25px) rotateZ(720deg);}100% {content: "🏐";transform: translateX(-25px) rotateZ(0deg);}}
	#featured_image_and_background_remote {display:none;}
	</style>

	<?php  
	}
	
	
	public function check_new_versi() {
		global $post, $wpdb, $opt_themes, $pagenow;
		
		//if ( $pagenow === 'post.php' && isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) { 
		
		$screen = get_current_screen();

		// Check if the current screen is the 'post' post type's edit or new post screen
		if ( $screen->post_type === 'post' && ( $screen->id === 'post' || $screen->id === 'edit-post' ) ) {
		
			if($opt_themes['check_updates_versi_post']){		 
				
			//if (!function_exists('file_get_html')) {
			//	require_once get_template_directory().'/libs/addons/inc/dom.php';
			//}
			//require get_template_directory().'/libs/addons/inc/curl.php';
			
			@ini_set('user_agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');   
			@ini_set('user_agent', 'My-Application/2.5'); 
			 
			$appid			= get_post_meta( get_the_ID(), 'wp_GP_ID', true );
			$gp				= "https://play.google.com/store/apps/details?id=".$appid."&hl=en-US"; 
			$url 			= (empty($_SERVER['HTTPS']) ? 'http' : 'https').'://'.$_SERVER['HTTP_HOST'].'/gps/?pkgid='.$appid;
			$url2 			= 'https://apks.exthem.es/gps/?pkgid='.$appid; 
			$url3 			= 'https://apks.exthem.es/?pkgid='.$appid; 
			$url4 			= 'https://exthem.es/gps.php?pkgid='.$appid; 
			 
			//$g_data			= @file_get_contents($url3); 
			$g_data			= $this->geturl($url3); 
			 
			$n_version		= $this->match('/<div class="version">(.*?)<\/div>/ms', $g_data, 1);  		
			$a_version		= get_post_meta( get_the_ID(), 'available_version', true );
			$c_version		= get_post_meta( get_the_ID(), 'wp_version_GP', true ); 
			
				if (version_compare($n_version, $c_version ) > 0 ) {
					update_post_meta( get_the_ID(), 'update_available', 'yes' );
					update_post_meta( get_the_ID(), 'available_version', $n_version );
					//update_post_meta( $post_id, 'wp_sizes', $new_size );
					//update_post_meta( $post_id, 'wp_whatnews_GP', $new_whats_news );
					return true;
				}	 

			}
		} 
	} 
		
	public function my_post_type_notification() {
		global $post, $opt_themes, $pagenow;	 
		if ($opt_themes['check_updates_versi_post']){	
		if ( $pagenow === 'post.php' && isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) { 
		//array( $this, 'check_new_versi' );
		echo do_shortcode( '[new_versi]' );
		@ini_set('user_agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');   
		@ini_set('user_agent', 'My-Application/2.5'); 
			 
		$n_version	 	= get_post_meta( get_the_ID(), 'available_version', true );
		$c_version 		= get_post_meta( get_the_ID(), 'wp_version_GP', true );
		$appname	 	= get_post_meta( get_the_ID(), 'wp_title_GP', true );
		$users 			= get_users( array( 'role__in' => array( 'administrator', 'editor' ) ) ); 
		
			if ( version_compare($n_version, $c_version) > 0 ) { 
			?>

			<div class="notice notice-info is-dismissible marquee" style="background-color: cornsilk; ">
				<p class="marquee-content">📢 Hello <?php echo $users[0]->data->user_nicename; ?>... <b style="color: blue;" class="up-down-shake"><?php echo $appname; ?></b> 
				<?php if($c_version){?><b style="color: red;font-weight: 700;">v<?php echo $c_version; ?></b> <i>Available updates</i> to <?php } ?> <b style="color: green;font-weight: 700;">v<?php echo $n_version; ?></b> </p>
			</div>
				 
			<style>
			.blink {animation: blink 1s step-end infinite;}@keyframes blink {0% {opacity: 1;}50% {opacity: 0;}100% {opacity: 1;}}.marquee {width: auto;overflow: hidden;white-space: nowrap;box-sizing: border-box;}.marquee-content {display: inline-block;animation: marquee 30s linear infinite;}@keyframes marquee {0% {transform: translateX(100%);}100% {transform: translateX(-100%);}}.marquee:hover .marquee-content,.marquee marquee--fit-content:hover .marquee-content {animation-play-state: paused;}
			</style>

		
	<?php
			}
		}

		}
	}

	private function geturl($url){
		
		$btext    = wp_rand( 0, 100000 );
		$mozillav = wp_rand( 2, 9 );
		$wow      = wp_rand( 20, 80 );
		$browser  = 'Mozilla/$mozillav.0 (Windows NT $mozillav.2; WOW$wow) AppleWebKit/$btext (KHTML, like Gecko) Chrome/$btext Safari/$btext';
		
		$ch 	= curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
		curl_setopt($ch, CURLOPT_HEADER, false); 
		$ip		= wp_rand(0,255).'.'.wp_rand(0,255).'.'.wp_rand(0,255).'.'.wp_rand(0,255);
		//$ip=172.69.70.6;
		curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"));
		//curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/".rand(3,5).".".rand(0,3)." (Windows NT ".rand(3,5).".".rand(0,2)."; rv:2.0.1) Gecko/20100101 Firefox/".rand(3,5).".0.1");
		curl_setopt($ch, CURLOPT_USERAGENT, $browser);
		curl_setopt($ch, CURLOPT_REFERER, 'https://google.com');
		curl_setopt($ch, CURLOPT_AUTOREFERER, true);
		$html = curl_exec($ch);
		curl_close($ch);
		return $html;
	}
	
	private function match_all_key_value($regex, $str, $keyIndex = 1, $valueIndex = 2){
		$arr = array();
		preg_match_all($regex, $str, $matches, PREG_SET_ORDER);
		foreach($matches as $m){
			$arr[$m[$keyIndex]] = $m[$valueIndex];
		}
		return $arr;
	}
	
	private function match_all($regex, $str, $i = 0){
		if(preg_match_all($regex, $str, $matches) === false)
			return false;
		else
			return $matches[$i];
	}
	
	private function match($regex, $str, $i = 0){
		if(preg_match($regex, $str, $match) == 1)
			return $match[$i];
		else
			return false;
	}
	
}


// Load only if dashboard.
if ( is_admin() ) {
	new APK_Extractor_Settings();
} 
