<!DOCTYPE html>
<html lang="en">
<head>
    <style type="text/css">
        svg.on {
            border: 4px solid #008CFF;
            animation: blink-animation 1s linear;
            -webkit-animation: blink-animation 1s linear;
        }

        .node.on g:first-of-type a:first-child path:first-child {
            stroke: #008CFF;
            stroke-width: 4;
            animation: blink-animation 1s linear;
            -webkit-animation: blink-animation 1s linear;
        }

        .node.on g:first-of-type a:first-child polygon:first-child {
            stroke: #008CFF;
            stroke-width: 4;
            animation: blink-animation 1s linear;
            -webkit-animation: blink-animation 1s linear;
        }

        @keyframes blink-animation {
            to {
                stroke-width: 0;
                border-width: 0;
            }
        }

        @-webkit-keyframes blink-animation {
            to {
                stroke-width: 0;
                border-width: 0;
            }
        }
    </style>
</head>
<body style="height: 100vh; width: 100vw" onload="_onload()">
{{ obj|safe }}
<script>
    function getURLParam(name) {
        var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
        if (results == null) {
            return null;
        } else {
            return decodeURI(results[1]) || 0;
        }
    }

    function _onload() {
        var el = document.getElementById(getURLParam("id") || 'graph0');
        if (el)
            if (el.getAttribute('class').indexOf('node') !== -1) {
                var bound = el.getBoundingClientRect();
                window.scrollTo((bound.left + bound.right) / 2 - document.body.offsetWidth / 2, (bound.top + bound.bottom) / 2 - document.body.offsetHeight / 2);
                el.setAttribute('class', el.getAttribute('class') + " on");
            } else if (el.getAttribute('class').indexOf('graph') !== -1) {
                el.parentNode.setAttribute('class', el.parentNode.getAttribute('class') + " on");
            }
    }

    function getParentOrigin() {
        try {
            return parent.window.origin || "null";
        } catch (exception) {
            return "null"
        }
    }

    function sendUrl() {
        if (parent_iframe_id !== null && window.location.href !== url) {
            url = window.location.href;
            parent.postMessage({
                id: parent_iframe_id,
                url: url,
                action: 'url'
            }, '*');
            clearInterval(refreshIntervalId);
        }
    }

    var parent_iframe_id = null, url = null,
        refreshIntervalId = setInterval(sendUrl, 100);
    window.addEventListener('message', function(event) {
        var origin = event.origin === 'file:' ? 'null' : (event.origin||'null');
        if (origin === getParentOrigin())
            if (parent_iframe_id === null && event.data.action === 'id') {
                parent_iframe_id = event.data.id
            }
    });
</script>
</body>
</html>