<?php
namespace Claromentis\Core\Admin;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] ?: array()) + array("_a553d306e3" . "b2f1320f801" . "e43d53186dd" => base64_decode("dWFzb3" . "J0"), "_04bc1c31a0" . "bd067c23d30" . "b26b83b665f" => base64_decode("JyBub3QgZm91bm" . "Q="), "_db6f0ba" . "0791e9a6" . "35407659" . "a9fe04e4" . "0" => base64_decode("aXNfb2JqZW" . "N0"), "_2b9b83b1" . "6cb8aa329" . "cf0691ef4" . "33f372" => base64_decode("c3lzdG" . "Vt"), "_fb98d288" . "1656b8ebf" . "08ab79b95" . "eb29c4" => base64_decode("QWRtaW" . "4gcGFu" . "ZWwgJw" . "=="), "_a5cd1a7a8e722dddd" . "521c97f97e29e80" => base64_decode("QWRta" . "W4gcG" . "FuZWw" . "g"), "_b4e5e7d3839ef7887d0849571df" . "f86a9" => base64_decode("c3Ry" . "Y2Fz" . "ZWNt" . "cA=="), "_5324a8c3e903d" . "135ac4d178f5db" . "1192b" => base64_decode("IGlzIGFuIG9iamVjdCwgYn" . "V0IGRvZXNuJ3QgaW1wbGVt" . "ZW50IEFkbWluUGFuZWwgaW" . "50ZXJmYWNl"));
use Claromentis\Core\Acl\Simple\SimpleAclRepository;
use Claromentis\Core\Icon\IconInterface;
use RuntimeException;










class PanelsList
{
    
    
    
    
    
    
    protected array $adminPanelDefinitions;
    
    
    
    
    
    
    
    
    
    
    
    protected ?array $adminPanels;
    
    
    
    
    protected SimpleAclRepository $aclRepository;
    
    
    
    
    protected IconInterface $defaultIcon;
    
    
    
    
    
    
    
    
    public function __construct(array $_8f7ea0f47c3a8592a9066e402bdf6b88, SimpleAclRepository $_b364df2407d90ec8bc1ca90b11fe628b, IconInterface $_95ea4563ee8473be4737762eecad1daf)
    {
        $this->adminPanelDefinitions = $_8f7ea0f47c3a8592a9066e402bdf6b88;
        $this->adminPanels = null;
        $this->aclRepository = $_b364df2407d90ec8bc1ca90b11fe628b;
        $this->setDefaultIcon($_95ea4563ee8473be4737762eecad1daf);
    }
    
    
    
    
    
    
    
    
    public function GetAll() : array
    {
        if ($this->adminPanels === null) {
            $this->adminPanels = $this->prepareAdminPanels($this->adminPanelDefinitions);
        }
        return $this->adminPanels;
    }
    
    
    
    
    
    
    
    
    public function GetOne(string $_3ed8177c8a0de82816ebbc0c43e5038d) : AdminPanel
    {
        if (!isset($this->adminPanelDefinitions[$_3ed8177c8a0de82816ebbc0c43e5038d])) {
            throw new RuntimeException($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_fb98d2881656b8ebf08ab79b95" . "eb29c4"] . $_3ed8177c8a0de82816ebbc0c43e5038d . $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_04bc1c31a" . "0bd067c23d" . "30b26b83b6" . "65f"]);
        }
        if (isset($this->adminPanels[$_3ed8177c8a0de82816ebbc0c43e5038d])) {
            return $this->adminPanels[$_3ed8177c8a0de82816ebbc0c43e5038d];
        }
        return $this->createAdminPanel($_3ed8177c8a0de82816ebbc0c43e5038d, $this->adminPanelDefinitions[$_3ed8177c8a0de82816ebbc0c43e5038d]);
    }
    
    
    
    
    
    
    
    public function has(string $_3ed8177c8a0de82816ebbc0c43e5038d) : bool
    {
        return isset($this->adminPanelDefinitions[$_3ed8177c8a0de82816ebbc0c43e5038d]);
    }
    
    
    
    
    
    
    
    protected function prepareAdminPanels(array $_cb2682f723ef25f3d0e8a8dcee6d2296) : array
    {
        $_1f335c62fbed8a6b314f9ecb4b3b3977 = [];
        foreach ($_cb2682f723ef25f3d0e8a8dcee6d2296 as $_3ed8177c8a0de82816ebbc0c43e5038d => $_1deb9e67a41a4a1ccc70e7e59d238e8f) {
            $_1f335c62fbed8a6b314f9ecb4b3b3977[$_3ed8177c8a0de82816ebbc0c43e5038d] = $this->createAdminPanel($_3ed8177c8a0de82816ebbc0c43e5038d, $_1deb9e67a41a4a1ccc70e7e59d238e8f);
        }
        return $this->sortAdminPanels($_1f335c62fbed8a6b314f9ecb4b3b3977);
    }
    
    
    
    
    
    
    
    
    protected function createAdminPanel(string $_3ed8177c8a0de82816ebbc0c43e5038d, $_1deb9e67a41a4a1ccc70e7e59d238e8f) : AdminPanel
    {
        if ($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_db6f0ba0791e9a635407" . "659a9fe04e40"]($_1deb9e67a41a4a1ccc70e7e59d238e8f)) {
            if (!$_1deb9e67a41a4a1ccc70e7e59d238e8f instanceof AdminPanel) {
                throw new \LogicException($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_a5cd1a7a8e722dddd521c97" . "f97e29e80"] . $_3ed8177c8a0de82816ebbc0c43e5038d . $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_5324a8c3e90" . "3d135ac4d178" . "f5db1192b"]);
            }
            $_3dfaa2b9f156ba68eecd8e8f3be689a9 = $_1deb9e67a41a4a1ccc70e7e59d238e8f;
        } else {
            $_3dfaa2b9f156ba68eecd8e8f3be689a9 = new AdminPanelStandard($_3ed8177c8a0de82816ebbc0c43e5038d, $_1deb9e67a41a4a1ccc70e7e59d238e8f);
        }
        if ($_3dfaa2b9f156ba68eecd8e8f3be689a9 instanceof AdminPanelSimpleAcl) {
            $_3dfaa2b9f156ba68eecd8e8f3be689a9->SetAclRepository($this->aclRepository);
        }
        if ($_3dfaa2b9f156ba68eecd8e8f3be689a9->getIcon() === null) {
            $_3dfaa2b9f156ba68eecd8e8f3be689a9->setIcon($this->defaultIcon);
        }
        return $_3dfaa2b9f156ba68eecd8e8f3be689a9;
    }
    
    
    
    
    
    
    
    
    public function getDefaultIcon() : IconInterface
    {
        return $this->defaultIcon;
    }
    
    
    
    
    
    
    
    
    public function setDefaultIcon(IconInterface $_aad576a27d4270db0bcce79b5b765b54) : void
    {
        $this->defaultIcon = $_aad576a27d4270db0bcce79b5b765b54;
        
        
        
        $this->adminPanels = null;
    }
    
    
    
    
    
    
    
    protected function sortAdminPanels(array $_1f335c62fbed8a6b314f9ecb4b3b3977) : array
    {
        $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_a553d306e3b2f1320f801e43d531" . "86dd"]($_1f335c62fbed8a6b314f9ecb4b3b3977, function ($_5feede65e7cfe8f0b3d9854c0363d548, $_74e6c647b312810242fc360c4ae14d72) {
            
            
            
            
            
            
            
            if ($_5feede65e7cfe8f0b3d9854c0363d548->GetCode() == $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_2b9b83b16cb8aa329cf0691ef433f37" . "2"]) {
                return -1;
            }
            if ($_74e6c647b312810242fc360c4ae14d72->GetCode() == $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_2b9b83b16c" . "b8aa329cf06" . "91ef433f372"]) {
                return 1;
            }
            
            
            return $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_b4e5e7d3839ef7887d08" . "49571dff86a9"]($_5feede65e7cfe8f0b3d9854c0363d548->GetName(), $_74e6c647b312810242fc360c4ae14d72->GetName());
        });
        return $_1f335c62fbed8a6b314f9ecb4b3b3977;
    }
}