<?php
namespace Claromentis\Core\Assets\Storage;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] ?: array()) + array("_d199ac578887bdf15173b6037268e" . "b97" => base64_decode("Q291bGQgbm90IGdldCBsb2NhbCBjb3B5IG9mI" . "HRoZSBjYWNoZSBmaWxl"), "_c91b0ff19f81a8873a459" . "3a23719472c" => base64_decode("cnRyaW0" . "="), "_8a36a84baeffc" . "0085672f9bf9c0" . "64f67" => base64_decode("ZmlsZV9wdXRfY29" . "udGVudHM="), "_e9eade4f1a21911df60eb47" . "ea85ca607" => base64_decode("Y2RuX2Fzc2" . "V0X2NhY2hl"), "_fb2afe3" . "aa58eabd" . "86bcae0f" . "70e5ec64" . "4" => base64_decode("dGVtc" . "G5hbQ" . "=="), "_b2ed704ac3f86a8160456dd1" . "4c443280" => base64_decode("c3lzX2dldF90ZW1wX2Rpcg=" . "="), "_87daa84e346f6420a" . "3f3426e05d16a7b" => base64_decode("L" . "w" . "=" . "="), "_18c93a32ba5faf9509389a94787e" . "6798" => base64_decode("bW9kaWZpZ" . "WQ="));
use Claromentis\Core\CDN\CDNInterface;
use Claromentis\Core\CDN\FilesystemCDN;
use Claromentis\Core\CDN\Mirror;
use Exception;






class CdnStorage implements StorageInterface
{
    
    
    
    
    
    
    protected $cdn;
    
    
    
    
    
    
    protected $cache_path;
    
    
    
    
    
    
    
    public function __construct(CDNInterface $_fee64623e267830531765c6712d0f041, string $_97dcb980872ef5ddd551c02d81b4e8ae = '/assets_cache')
    {
        $this->cdn = $_fee64623e267830531765c6712d0f041;
        $this->cache_path = $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_c91b0ff19f8" . "1a8873a4593a" . "23719472c"]($_97dcb980872ef5ddd551c02d81b4e8ae, $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_87daa84e346f6420a3f3426e05d1" . "6a7b"]);
    }
    
    
    
    
    
    
    
    
    
    public function GetCacheFileLocalPath(string $_93469c9375390f862eebb779f8b740e4) : string
    {
        if ($this->cdn instanceof Mirror || $this->cdn instanceof FilesystemCDN) {
            $_c52bbd17a1963ef1954f5ada98102e06 = $this->cdn->GetLocalPath($_93469c9375390f862eebb779f8b740e4);
        } else {
            throw new Exception($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_d199ac57888" . "7bdf15173b60" . "37268eb97"]);
        }
        return $_c52bbd17a1963ef1954f5ada98102e06;
    }
    
    
    
    
    
    public function GetCacheFileUrl(string $_93469c9375390f862eebb779f8b740e4) : string
    {
        return $this->cdn->GetUrl($this->GetCacheFilePath($_93469c9375390f862eebb779f8b740e4));
    }
    
    
    
    
    
    public function CacheFileExists(string $_93469c9375390f862eebb779f8b740e4) : bool
    {
        return $this->cdn->Exists($this->GetCacheFilePath($_93469c9375390f862eebb779f8b740e4));
    }
    public function CreateCacheDirectory()
    {
        if (!$this->cdn->IsDir($this->cache_path)) {
            $this->cdn->CreateDir($this->cache_path);
        }
    }
    
    
    
    
    
    
    
    public function StoreCacheFile(string $_93469c9375390f862eebb779f8b740e4, string $_d34599daeb8cca374d3adb38b245839c)
    {
        
        
        $_194c06424f041cfe440a86e5729ccedc = $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_fb2afe3aa58eabd86bcae0f" . "70e5ec644"]($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_b2ed704ac3f86a8160456dd14c4" . "43280"](), $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_e9eade4f1a21911d" . "f60eb47ea85ca607"]);
        $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_8a36a84baeffc0085672f9bf9c064f6" . "7"]($_194c06424f041cfe440a86e5729ccedc, $_d34599daeb8cca374d3adb38b245839c);
        $this->cdn->Add($_194c06424f041cfe440a86e5729ccedc, $this->GetCacheFilePath($_93469c9375390f862eebb779f8b740e4));
    }
    
    
    
    
    
    
    public function GetCacheFileModifiedTime(string $_93469c9375390f862eebb779f8b740e4)
    {
        $_6aead4bff5639b251aebcf8a630e43a7 = $this->cdn->GetFileInfo($this->GetCacheFilePath($_93469c9375390f862eebb779f8b740e4));
        return $_6aead4bff5639b251aebcf8a630e43a7[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_18c93a32ba5faf950938" . "9a94787e6798"]] ?? false;
    }
    public function TouchCacheFile(string $_93469c9375390f862eebb779f8b740e4)
    {
        
        
    }
    
    
    
    
    
    
    
    protected function GetCacheFilePath($_93469c9375390f862eebb779f8b740e4)
    {
        return $this->cache_path . $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_87daa84e346f6420a3f3426e05d16a7" . "b"] . $_93469c9375390f862eebb779f8b740e4;
    }
}