<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <link rel="modulepreload" href="remark.mjs" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>Comments</title>
    <base target="_blank" />
    <script>
      if (window.location.search === '?selfClose') {
        window.close();
      }
      (function () {
        function isCSSVariablesSupported() {
          if (typeof window === `undefined`) {
            return true;
          }

          return window.CSS && window.CSS.supports && window.CSS.supports('color', 'var(--fake-var)');
        }
        if (isCSSVariablesSupported()) {
          var name;
          try {
            name = JSON.parse(window.name);
            if (name.__colors__) {
              const colors = name.__colors__;
              for (var color in colors) {
                var root = document.documentElement;
                root.style.setProperty(color, colors[color]);
              }
            }
          } catch (e) {}
        }
      })();
    </script>
    <!-- TODO: we have to move styles in css file -->
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
      }

      body {
        padding: 6px;
      }

      @keyframes bouncing {
        0%,
        80%,
        100% {
          box-shadow: 0 10px 0 -10px;
        }

        40% {
          box-shadow: 0 10px 0 0;
        }
      }

      .preloader,
      .preloader::before,
      .preloader::after {
        border-radius: 50%;
        width: 10px;
        height: 10px;
        text-align: left;
        animation-name: bouncing;
        animation-timing-function: ease-in-out;
        animation-fill-mode: both;
        animation-duration: 1.8s;
        animation-iteration-count: infinite;
      }

      .preloader {
        /* stylelint-disable-next-line */
        color: #fff;
        color: var(--color6, #fff);
        position: relative;
        transform: translate3d(0, -10px, 0);
        animation-delay: -0.16s;
      }

      .preloader::before,
      .preloader::after {
        content: '';
        position: absolute;
        top: 0;
      }

      .preloader::before {
        transform: translate3d(-15px, 0, 0);
        animation-delay: -0.32s;
      }

      .preloader::after {
        transform: translate3d(15px, 0, 0);
      }

      .preloader_view_iframe {
        margin: 0 auto;
        /* stylelint-disable-next-line */
        color: #888;
        color: var(--color13, #888);
      }

      :focus:not(.focus-visible):not(.button) {
        outline: none;
      }
    </style>
    <% if (htmlWebpackPlugin.options.env === 'production') { %>
    <link rel="stylesheet" href="remark.css" />
    <% } %>
  </head>
  <body>
    <div id="remark42">
      <div class="preloader preloader_view_iframe"></div>
    </div>
    <% if (htmlWebpackPlugin.options.env === 'development') { %>
    <script>
      if (window.parent !== window) {
        try {
          window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
        } catch (e) {}
      }
    </script>
    <% } %>
    <script>
      // TODO: we must stop using `setInterval` for resize iframe
      // TODO: we must use more efficient way to change iframe height
      // TODO: we must open comments widget and user-info widget on different pages (now iframe.html opens both of widgets)
      var lastHeight = 0;
      setInterval(function () {
        if (document.body.offsetHeight !== lastHeight && document.body.offsetHeight > 22) {
          lastHeight = document.body.offsetHeight;
          window.parent.postMessage(JSON.stringify({ remarkIframeHeight: lastHeight }), '*');
        }
      }, 200);

      window.addEventListener('message', receiveMessages);

      function receiveMessages(event) {
        try {
          const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
          const isItHash = data.hash && data.hash.indexOf('#') === 0;

          if (isItHash) {
            location.replace(data.hash);
          }

          if (data.title) {
            document.title = data.title;
          }
        } catch (e) {}
      }

      var remark_config =
        window.location.search.length < 2
          ? {}
          : window.location.search
              .substr(1)
              .split('&')
              .reduce(function (c, x) {
                var splitted = x.split('=');
                if (!splitted[1]) {
                  splitted[1] = '';
                }
                c[splitted[0]] = decodeURIComponent(splitted[1]);
                return c;
              }, {});

      window.parent.postMessage(JSON.stringify({ inited: true }), '*');
    </script>
    <script>
      (function (d) {
        var r = d.head || d.body;
        var s = d.createElement('script');
        var m = 'noModule' in s;
        s.src = 'remark' + (m ? '.mjs' : '.js');
        m && (s.type = 'module');
        s.async = true;
        s.defer = true;
        r.appendChild(s);
      })(document);
    </script>
  </body>
</html>
