<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var $block \Magento\Theme\Block\Html\Notices
 * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
 */
?>
<?php if ($block->displayNoscriptNotice()): ?>
    <noscript>
        <div class="message global noscript">
            <div class="content">
                <p>
                    <strong><?= $block->escapeHtml(__('JavaScript seems to be disabled in your browser.')) ?></strong>
                    <span>
                        <?= $block->escapeHtml(
                            __('For the best experience on our site, be sure to turn on Javascript in your browser.')
                        ) ?>
                    </span>
                </p>
            </div>
        </div>
    </noscript>
<?php endif; ?>
<?php if ($block->displayNoLocalStorageNotice()): ?>
    <div class="notice global site local_storage">
        <div class="content">
            <p>
                <strong><?= $block->escapeHtml(__('Local Storage seems to be disabled in your browser.')) ?></strong>
                <br />
                <?= $block->escapeHtml(
                    __('For the best experience on our site, be sure to turn on Local Storage in your browser.')
                ) ?>
            </p>
        </div>
    </div>
    <?= /* @noEscape */ $secureRenderer->renderStyleAsTag('display: none;', 'div.notice.global.site.local_storage') ?>

    <?php $scriptString = <<<script

require(['jquery'], function(jQuery){

        // <![CDATA[
        (function($) {
            var test = 'test';
            try {
                localStorage.setItem(test, test);
                localStorage.removeItem(test);
            } catch(e) {
                $(".notice.global.site.local_storage").show();
            }
        })(jQuery);
        // ]]>

});

script;
    ?>
    <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
<?php endif; ?>
<?php if ($block->displayDemoNotice()): ?>
    <div class="message global demo">
        <div class="content">
            <p><?= $block->escapeHtml(__('This is a demo store. No orders will be fulfilled.')) ?></p>
        </div>
    </div>
<?php endif; ?>
