<?php
namespace Claromentis\Orgchart\Subscriber;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] ?: array()) + array("_cc365128de5c940bf3" . "5fd2b5bd71bf31" => base64_decode("b25Qcm9" . "maWxlRm" . "llbGRVc" . "GRhdGU="), "_cccbf72fd" . "d00aeb3489" . "588124d713" . "7c3" => base64_decode("W" . "2" . "1" . "d"), "_f0abbaae" . "eb4901fe8" . "b478a2f30" . "2e0607" => base64_decode("b25Qcm9maWxl" . "RmllbGREZWxl" . "dGU="), "_58ca0626" . "eba249b8a" . "74733ff5c" . "cf3280" => base64_decode("cHJvZmlsZV" . "9maWVsZHM="));
use Claromentis\Core\Event\EventSubscriberInterface;
use Claromentis\Core\Metadata\Events\MetaDataEventType;
use Claromentis\Core\Metadata\Events\MetadataFieldDeletedEvent;
use Claromentis\Core\Metadata\Events\MetadataFieldUpdatedEvent;
use Claromentis\Orgchart\OrgchartApplication;
class UserFieldsSubscriber implements EventSubscriberInterface
{
    
    
    
    
    public static function getSubscribedEvents() : array
    {
        return array(MetaDataEventType::FIELD_UPDATED => $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_cc365128de5c" . "940bf35fd2b5b" . "d71bf31"], MetaDataEventType::FIELD_DELETED => $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_f0abbaaeeb" . "4901fe8b478" . "a2f302e0607"]);
    }
    public function onProfileFieldUpdate(MetadataFieldUpdatedEvent $event)
    {
        if ($event->GetMetadataSetType() != METADATA_SET_USER) {
            return;
        }
        $_d8f5eba4e43c8ff065b8dd64d682ad6c = $event->GetOldField();
        $_2fe7618e12aca07791d27b07f63963c8 = $event->GetNewField();
        $config = OrgchartApplication::getConfig();
        $_efaf49c1c48cffb67e16163f24ece765 = $config->get($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_58ca0626eba249b8a7473" . "3ff5ccf3280"]) ?: [];
        foreach ($_efaf49c1c48cffb67e16163f24ece765 as $key => $_35ab4546eb09c38fc76fa5f9276eb2ad) {
            if ($_35ab4546eb09c38fc76fa5f9276eb2ad === $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_cccbf72fdd00aeb348" . "9588124d7137c3"] . $_d8f5eba4e43c8ff065b8dd64d682ad6c->GetName()) {
                $_efaf49c1c48cffb67e16163f24ece765[$key] = $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_cccbf72fdd00aeb3" . "489588124d7137c3"] . $_2fe7618e12aca07791d27b07f63963c8->GetName();
                break;
            }
        }
        $config->set($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_58ca0626eba249b8a7473" . "3ff5ccf3280"], $_efaf49c1c48cffb67e16163f24ece765);
        $config->save();
    }
    public function onProfileFieldDelete(MetadataFieldDeletedEvent $event)
    {
        if ($event->GetMetadataSetType() != METADATA_SET_USER) {
            return;
        }
        $_525740ec58795ae0359e93ffc33e30d2 = $event->GetDeletedField();
        $config = OrgchartApplication::getConfig();
        $_efaf49c1c48cffb67e16163f24ece765 = $config->get($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_58ca0626eba249b8a" . "74733ff5ccf3280"]);
        foreach ($_efaf49c1c48cffb67e16163f24ece765 as $key => $_35ab4546eb09c38fc76fa5f9276eb2ad) {
            if ($_35ab4546eb09c38fc76fa5f9276eb2ad === $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_cccbf72fdd00aeb3489588124d" . "7137c3"] . $_525740ec58795ae0359e93ffc33e30d2->GetName()) {
                unset($_efaf49c1c48cffb67e16163f24ece765[$key]);
                break;
            }
        }
        $config->set($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_58ca0626eba249b8a74733" . "ff5ccf3280"], $_efaf49c1c48cffb67e16163f24ece765);
        $config->save();
    }
}