<commit_before><?php
/** @var \WebinoDraw\Debugger\DrawPanel $this */
/** @var \WebinoDraw\Service\DrawProfiler $profiler */
$profiler = $this->getProfiler();
?>
<style>
    .webino-draw-highlight {
        position: absolute;
        z-index: 9999;
        background: #159;
        opacity: .5;
    }

    .webino-draw-highlight-link strong:hover {
        text-decoration: underline !important;
    }
</style>
<h1><?= $this->escapeHtml($this->title) ?></h1>
<div class="tracy-inner tracy-inner-box" style="padding: 10px">
    <div class="tracy-inner-container">
        <p>Total time: <?= $this->escapeHtml(sprintf('%s ms', number_format($profiler->getTotalTime() * 1000, 1, '.', ' '))) ?></p>
        <br />
        <div>
            <?php foreach ($profiler->getData() as $key => $data): ?>
                <span class="webino-draw-highlight-link">
                    <?php
                    $locator = join('\', \'', empty($data['spec']['locator']) ? [] : (array) $data['spec']['locator']);
                    $locator = '[\'' . strtr($locator, [PHP_EOL => '', '"' => '\\\'']) . '\']';
                    ?>
                    <strong style="font-size: larger; cursor: pointer;"
                            onmouseover="webinoDrawHighlight(<?= $this->escapeHtml($locator) ?>)"
                            onmouseout="webinoDrawRemoveHighlight()">
                        <?= $this->escapeHtml($key) ?>
                    </strong>
                    <?= $this->escapeHtml($data['time'] ? sprintf(' / %s ms', number_format($data['time'] * 1000, 1, '.', ' ')) : '') ?>
                </span>
                <?= $this->dump($data['spec']) ?>
                <br />
            <?php endforeach; ?>
        </div>
    </div>
</div>
<script>
    function getElementsByXpath(path) {
        console.log(path);
        return document.evaluate(path, document, null, XPathResult.ANY_TYPE, null);
    }

    function webinoDrawHighlight(locator)
    {
        var l = locator.length;
        for (var i = 0; i < l; i++) {
            if ('xpath=' === locator[i].substring(0, 6)) {
                console.log(getElementsByXpath(locator[i].substring(6)));
                return;
            }

            var q = locator[i].split('[');
            if (q.length > 1) {
                // nth-child
                q[0]+= ':nth-child(' + parseInt(q[1]) + ')';
            }<commit_msg>Enhanced Debugger\draw.panel.phtml<commit_after><?php
/** @var \WebinoDraw\Debugger\DrawPanel $this */
/** @var \WebinoDraw\Service\DrawProfiler $profiler */
$profiler = $this->getProfiler();
?>
<style>
    .webino-draw-highlight {
        position: absolute;
        z-index: 9999;
        background: #159;
        opacity: .5;
    }

    .webino-draw-highlight-link strong:hover {
        text-decoration: underline !important;
    }

    .webino-draw-highlight-link .missing,
    .webino-draw-highlight-link .missing:hover {
        text-decoration: line-through !important;
        cursor: not-allowed !important;
    }
</style>
<h1><?= $this->escapeHtml($this->title) ?></h1>
<div class="tracy-inner tracy-inner-box" style="padding: 10px">
    <div class="tracy-inner-container">
        <p>Total time: <?= $this->escapeHtml(sprintf('%s ms', number_format($profiler->getTotalTime() * 1000, 1, '.', ' '))) ?></p>
        <br />
        <div>
            <?php
            $n = 0;
            foreach ($profiler->getData() as $key => $data):
                $n++;
                ?>
                <span class="webino-draw-highlight-link">
                    <?php
                    $locator = join('\', \'', empty($data['spec']['locator']) ? [] : (array) $data['spec']['locator']);
                    $locator = '[\'' . strtr($locator, [PHP_EOL => '', '"' => '\\\'']) . '\']';
                    ?>
                    <strong style="font-size: larger; cursor: pointer;" class="<?php if (empty($data['time'])) echo 'missing' ?>"
                            onmouseover="webinoDrawHighlight(<?= $this->escapeHtml($locator) ?>)"
                            onmouseout="webinoDrawRemoveHighlight()">
                        <?= $this->escapeHtml($n . '. ' . $key) ?>
                    </strong>
                    <?= $this->escapeHtml($data['time'] ? sprintf(' / %s ms', number_format($data['time'] * 1000, 1, '.', ' ')) : '') ?>
                </span>
                <?= $this->dump($data['spec']) ?>
                <br />
            <?php endforeach; ?>
        </div>
    </div>
</div>
<script>
    function getElementsByXpath(path) {
        console.log(path);
        return document.evaluate(path, document, null, XPathResult.ANY_TYPE, null);
    }

    function webinoDrawHighlight(locator)
    {
        var l = locator.length;
        for (var i = 0; i < l; i++) {
            if ('xpath=' === locator[i].substring(0, 6)) {
                console.log(getElementsByXpath(locator[i].substring(6)));
                return;
            }

            var q = locator[i].split('[');
            if (q.length > 1) {
                // nth-child
                q[0]+= ':nth-child(' + parseInt(q[1]) + ')';
            }
{'fraction_non_alphanumeric': 0.19547846423699083, 'fraction_numerical': 0.011498733190411226, 'mean_word_length': 1.8120547945205479, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 90, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6799090', 'n_tokens_mistral': 1641, 'n_tokens_neox': 1567, 'n_words': 270}