<?php
namespace Claromentis\Core\Module;

$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"] ?: array()) + array("_b497ce6f2af1" . "0f67516aed0ec" . "f34d8cf" => base64_decode("ZGlzcGF0Y2hlcg=" . "="), "_627b3c3896a7de4bff6" . "6ce8c38862087" => base64_decode("Y29yZS5iYX" . "NlX3BhdGg="), "_677bc33cfc057a689acf59" . "6b15f0ae8f" => base64_decode("Y29yZS5pbnR" . "yYW5ldF9wYX" . "Ro"), "_3ff276eba0f87c788f2f78fc9" . "00fe84d" => base64_decode("UGx1Z2luIGNs" . "YXNzICc="), "_fc9d7314a" . "9d9958d8fa" . "0a403ba8ff" . "197" => base64_decode("Z2V0X2" . "NsYXNz"), "_9c5ee1b2c77" . "f9815910fd2b" . "542a61a4a" => base64_decode("JyBpcyByZWdpc3RlcmVkLCBidXQgZG9lc24ndCBleGlzdA=" . "="), "_45a157a6" . "23e313165" . "93605eeb7" . "fa37ec" => base64_decode("YXBwbG" . "ljYXRp" . "b25z"), "_f10e5df" . "cd675369" . "f9b7a7e5" . "111a1743" . "1" => base64_decode("L2NvbmZpZ" . "w=="), "_fa447d7fa2948f150ff80176241af90" . "d" => base64_decode("cGx1Z2lucy5" . "yZXBvc2l0b3" . "J5"), "_aa0553266235d1e7c43a" . "6e8869464820" => base64_decode("REF" . "UQV" . "9ES" . "VI="), "_6596b8f6a4969f9a3f6a1b22b90e933" . "1" => base64_decode("c3ByaW5" . "0Zg=="), "_6c8e717df3fc2e5caa79afd002f" . "d2272" => base64_decode("dmVyc2lvb" . "nM="), "_a99e51514fd0f" . "cca58579cb5552" . "a6035" => base64_decode("cGx1" . "Z2lu" . "cw=="), "_a668ea431a2f50e2802d" . "c226025d4d96" => base64_decode("U2tpcHBlZCByZWdpc3RlcmluZyBhcHBsaWNhdGlvbiAnJXMnOyBpdCBkb2VzIG5vdCBpbXBsZW1l" . "bnQgJyVzJw=="), "_2b9b83b16cb8aa329cf0691ef433f3" . "72" => base64_decode("c3lzdGV" . "t"), "_c51bc96058fbdbf4c2e" . "f19b306d1a124" => base64_decode("Y2xhc3NfZXhpc" . "3Rz"), "_3646e924" . "512f86521" . "d3853d8a0" . "d5ef20" => base64_decode("Y29yZS5jdXN0b2" . "1fcGF0aA=="), "_8b0e61a144" . "a6a2c611168" . "b0c4e628b0f" => base64_decode("RXJyb3IgcmVnaXN0ZXJ" . "pbmcgYXBwbGljYXRpb2" . "4gcGx1Z2luICclcyc="));
use Claromentis\Console\Util\ApplicationRegistry;
use Claromentis\Console\Util\Locator;
use Claromentis\Core\Application;
use Claromentis\Core\Event\EventSubscriberInterface;
use Claromentis\Core\Log\LoggerFactory;
use Claromentis\Core\Plugin\PluginsRepository;
use Silex\Api\BootableProviderInterface;
use Claromentis\Core\Event\LazyResolver;
use Claromentis\Core\Module;
use Claromentis\Core\Plugin;
use Claromentis\Core\Plugin\AuditSubscriber;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Psr\Log\LoggerInterface;
use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Throwable;




class ModuleServiceProvider implements ServiceProviderInterface, BootableProviderInterface, EventListenerProviderInterface
{
    public function register(Container $app)
    {
        
        
        $app[PluginsRepository::class] = function ($app) {
            return new PluginsRepository($app->config[$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_aa0553266235d1e7" . "c43a6e8869464820"]] . $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_f10e5dfcd67" . "5369f9b7a7e5" . "111a17431"]);
        };
        $app[AuditSubscriber::class] = function (Application $app) {
            return $app->create(AuditSubscriber::class);
        };
        $app[Module\Api::class] = function (Application $app) {
            $api = new Module\Api($app[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_627b3c3896a7de4bff6" . "6ce8c38862087"]], $app[$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_677bc33cfc057a689acf596b1" . "5f0ae8f"]], $app[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_3646e92" . "4512f865" . "21d3853d" . "8a0d5ef2" . "0"]]);
            if (isset($app->db)) {
                $api->setDatabase($app->db);
            }
            $api->setLogger($app->GetLogger($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_2b9b83b16cb8a" . "a329cf0691ef43" . "3f372"]));
            return $api;
        };
        $app[Plugin\Api::class] = function (Application $app) {
            
            
            $api = $app->create(Plugin\Api::class);
            $api->setLogger($app->GetLogger($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_2b9b83b16cb8aa329cf069" . "1ef433f372"]));
            return $api;
        };
        $app[Locator::class] = function (Application $app) {
            return new Locator($app[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_627b3c38" . "96a7de4bf" . "f66ce8c38" . "862087"]]);
        };
        $app[ApplicationRegistry::class] = function (Application $app) {
            
            
            $registry = $app->create(ApplicationRegistry::class);
            if (isset($app->db)) {
                $registry->setDatabase($app->db);
            }
            return $registry;
        };
        
        
        $app[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_fa447d7fa2948f" . "150ff80176241af" . "90d"]] = PluginsRepository::class;
        $app[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_a99e51514fd0fcca58579" . "cb5552a6035"]] = Plugin\Api::class;
        $app[$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_6c8e717df3fc2e5caa79a" . "fd002fd2272"]] = Module\Api::class;
        
        
        $this->registerModules($app);
    }
    
    
    
    
    
    
    protected function registerModules(Container $app)
    {
        
        
        $_45a157a623e31316593605eeb7fa37ec = [
            
            
            new \Claromentis\Core\Audit\AuditApplication(),
            new \Claromentis\Core\Ai\AiServiceProvider(),
            new \Claromentis\WhatsNew\WhatsNewApplication(),
            
            
            new \Claromentis\Admin\Sysadmin\SysadminApplication(),
            new \Claromentis\Menu\MenuApplication(),
            new \Claromentis\Blog\BlogApplication(),
            new \Claromentis\Calendar\CalendarApplication(),
            new \Claromentis\Comments\CommentsServiceProvider(),
            new \Claromentis\Communication\CommunicationApplication(),
            new \Claromentis\Core\DataTable\Application(),
            new \Claromentis\Core\Like\LikesApplication(),
            new \Claromentis\Design\DesignApplication(),
            new \Claromentis\Documents\DocumentsApplication(),
            new \Claromentis\Forum\ForumApplication(),
            new \Claromentis\Help\HelpApplication(),
            new \Claromentis\Holidays\HolidaysApplication(),
            new \Claromentis\Login\LoginApplication(),
            new \Claromentis\Infocapture\InfocaptureApplication(),
            new \Claromentis\Main\HomePageApplication(),
            new \Claromentis\Mailgun\MailgunApplication(),
            new \Claromentis\News\NewsApplication(),
            new \Claromentis\OAuth2\OAuth2ServiceProvider(),
            new \Claromentis\Orgchart\OrgchartApplication(),
            new \Claromentis\People\PeopleApplication(),
            new \Claromentis\Rooms\RoomsApplication(),
            new \Claromentis\Gallery\GalleryApplication(),
            new \Claromentis\Search\SearchApplication(),
            new \Claromentis\Share\ShareApplication(),
            new \Claromentis\Onesignal\OnesignalApplication(),
            new \Claromentis\Admin\Sysadmin\IntegrationApplication(),
            new \Claromentis\Core\HealthCheck\HealthCheckApplication(),
            new \Claromentis\Core\Assets\AssetsApplication(),
            new \Claromentis\Admin\AdminPanelApplication(),
            new \Claromentis\Stat\StatApplication(),
        ];
        
        
        $_989ee88ce4d16454378692b7146e1d1c = $app[PluginsRepository::class];
        
        
        $_83e732e1e637ca0485df84759c2d3a20 = $_989ee88ce4d16454378692b7146e1d1c->GetClasses();
        foreach ($_83e732e1e637ca0485df84759c2d3a20 as $_66e1c6037dddc000087424629179d919) {
            if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_c51bc96058fbdbf4c2ef" . "19b306d1a124"]($_66e1c6037dddc000087424629179d919)) {
                $_38198dbb7190fed0f875632ecef1ac6f = new $_66e1c6037dddc000087424629179d919();
                $_45a157a623e31316593605eeb7fa37ec[] = $_38198dbb7190fed0f875632ecef1ac6f;
            } else {
                $logger = $this->getLogger($app);
                $logger->alert($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_3ff276e" . "ba0f87c7" . "88f2f78f" . "c900fe84" . "d"] . $_66e1c6037dddc000087424629179d919 . $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_9c5ee1b2c77f98" . "15910fd2b542a61" . "a4a"]);
            }
        }
        
        
        $app[$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_45a157a62" . "3e31316593" . "605eeb7fa3" . "7ec"]] = $_45a157a623e31316593605eeb7fa37ec;
        foreach ($_45a157a623e31316593605eeb7fa37ec as $_f44467aacb8a4520c7382769d24aa422) {
            if ($_f44467aacb8a4520c7382769d24aa422 instanceof ServiceProviderInterface) {
                try {
                    $app->register($_f44467aacb8a4520c7382769d24aa422);
                } catch (Throwable $throwable) {
                    $logger = $this->getLogger($app);
                    $logger->critical($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_6596b8f6" . "a4969f9a3" . "f6a1b22b9" . "0e9331"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_8b0e61a144a6a2c611168b0c4e628b0" . "f"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_fc9d7314a9d9958d8" . "fa0a403ba8ff197"]($_f44467aacb8a4520c7382769d24aa422)));
                    $logger->critical($throwable);
                }
            } else {
                $logger = $this->getLogger($app);
                $logger->debug($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_6596b8f6a4969f9a3f6a1" . "b22b90e9331"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_a668ea431a" . "2f50e2802dc" . "226025d4d96"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_fc9d7314a9d9958d8fa0a403ba8f" . "f197"]($_f44467aacb8a4520c7382769d24aa422), ServiceProviderInterface::class));
            }
        }
    }
    public function boot(\Silex\Application $app)
    {
        foreach ($app[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_45a157a" . "623e3131" . "6593605e" . "eb7fa37e" . "c"]] as $_f44467aacb8a4520c7382769d24aa422) {
            if ($_f44467aacb8a4520c7382769d24aa422 instanceof EventSubscriberInterface) {
                $app[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_b497ce6" . "f2af10f6" . "7516aed0" . "ecf34d8c" . "f"]]->addSubscriber($_f44467aacb8a4520c7382769d24aa422);
            }
        }
    }
    public function subscribe(Container $app, EventDispatcherInterface $_b497ce6f2af10f67516aed0ecf34d8cf)
    {
        
        
        (new LazyResolver($app, Plugin\AuditSubscriber::class, Plugin\AuditSubscriber::getSubscribedEvents()))->subscribe($_b497ce6f2af10f67516aed0ecf34d8cf);
    }
    
    
    
    
    
    
    
    protected function getLogger(Container $app) : LoggerInterface
    {
        
        
        $_7e1adb3b5de3c83f8c0c9b057bd5e6de = $app[LoggerFactory::class];
        return $_7e1adb3b5de3c83f8c0c9b057bd5e6de->GetLogger($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_2b9b83b16c" . "b8aa329cf06" . "91ef433f372"]);
    }
}