/*

    ████████████████████████████████████████
    ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
    ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
    ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
    ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
    ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
    ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
    ███▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
    ████▓▓▓▓▓▓▓▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
    ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
    █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
    █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
    █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
    ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
    ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
    █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
    █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
    ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
    ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
    ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
    ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
    █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
    ██████████▓▓▓█▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
    ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
    ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
    ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
    ████████████████████████████████████████
    ███████████ NFTheft was here ███████████
    ████████████████████████████████████████
    2b02E63c9C7ed9fDC5fdc73E02Df0F8ee7Cdd3C4
    ████████████████████████████████████████

    This is a public notice. The Royalty Registry is dangerous.
    It's a false flag operation orchestrated by Manifold.
    It gives all the power to Manifold to control your royalties.
    They can change the payout rate, censor you, take a cut, etc.

    We don't need your Royalty Registry.
    You are trying to centralize a decentralised concept.
    Each smart contract should have it's own royalty logic / control.

    https://twitter.com/NFTheft/status/1451915003922198529

    https://twitter.com/NFTheft/status/1451716332643291136

*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import 'NFTheft_does_not_approve_ERC1967Proxy.sol';

contract TransparentUpgradeableProxy is ERC1967Proxy {
	constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
		assert(_ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
		_changeAdmin(admin_);
	}

	modifier ifAdmin() {
		if (msg.sender == _getAdmin()) {
			_;
		} else {
			_fallback();
		}
	}

	function admin() external ifAdmin returns (address admin_) {
		admin_ = _getAdmin();
	}

	function implementation() external ifAdmin returns (address implementation_) {
		implementation_ = _implementation();
	}

	function changeAdmin(address newAdmin) external virtual ifAdmin {
		_changeAdmin(newAdmin);
	}

	function upgradeTo(address newImplementation) external ifAdmin {
		_upgradeToAndCall(newImplementation, bytes(''), false);
	}

	function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
		_upgradeToAndCall(newImplementation, data, true);
	}

	function _admin() internal view virtual returns (address) {
		return _getAdmin();
	}

	function _beforeFallback() internal virtual override {
		require(msg.sender != _getAdmin(), 'TransparentUpgradeableProxy: admin cannot fallback to proxy target');
		super._beforeFallback();
	}
}