var/cache/dev_hbf2424ec14bff6839ae58d1d0c990333/twig/9f/9ffe60ddc8f8a9c91e22f7ff598175cb.php line 35

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use function Shopware\Core\Framework\Adapter\Twig\sw_get_attribute;
  4. use function Shopware\Core\Framework\Adapter\Twig\sw_escape_filter;
  5. use Twig\Error\LoaderError;
  6. use Twig\Error\RuntimeError;
  7. use Twig\Extension\SandboxExtension;
  8. use Twig\Markup;
  9. use Twig\Sandbox\SecurityError;
  10. use Twig\Sandbox\SecurityNotAllowedTagError;
  11. use Twig\Sandbox\SecurityNotAllowedFilterError;
  12. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  13. use Twig\Source;
  14. use Twig\Template;
  15. /* @WebProfiler/Profiler/base_js.html.twig */
  16. class __TwigTemplate_36a061c9402cc6c087f743ed3703b410 extends Template
  17. {
  18.     private $source;
  19.     private $macros = [];
  20.     public function __construct(Environment $env)
  21.     {
  22.         parent::__construct($env);
  23.         $this->source $this->getSourceContext();
  24.         $this->parent false;
  25.         $this->blocks = [
  26.         ];
  27.     }
  28.     protected function doDisplay(array $context, array $blocks = [])
  29.     {
  30.         $macros $this->macros;
  31.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  32.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""@WebProfiler/Profiler/base_js.html.twig"));
  33.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  34.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""@WebProfiler/Profiler/base_js.html.twig"));
  35.         // line 3
  36.         echo "<script";
  37.         if ((array_key_exists("csp_script_nonce"$context) && ($context["csp_script_nonce"] ?? null))) {
  38.             echo " nonce=\"";
  39.             echo sw_escape_filter($this->env, ($context["csp_script_nonce"] ?? null), "html"nulltrue);
  40.             echo "\"";
  41.         }
  42.         echo ">/*<![CDATA[*/
  43.     ";
  44.         // line 7
  45.         echo "
  46. if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
  47.     Sfjs = (function() {
  48.         \"use strict\";
  49.         if ('classList' in document.documentElement) {
  50.             var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
  51.             var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
  52.             var addClass = function(el, cssClass) { el.classList.add(cssClass); };
  53.             var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };
  54.         } else {
  55.             var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };
  56.             var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };
  57.             var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };
  58.             var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
  59.         }
  60.         var noop = function() {};
  61.         var profilerStorageKey = 'symfony/profiler/';
  62.         var addEventListener;
  63.         var el = document.createElement('div');
  64.         if (!('addEventListener' in el)) {
  65.             addEventListener = function (element, eventName, callback) {
  66.                 element.attachEvent('on' + eventName, callback);
  67.             };
  68.         } else {
  69.             addEventListener = function (element, eventName, callback) {
  70.                 element.addEventListener(eventName, callback, false);
  71.             };
  72.         }
  73.         if (navigator.clipboard) {
  74.             document.querySelectorAll('[data-clipboard-text]').forEach(function(element) {
  75.                 removeClass(element, 'hidden');
  76.                 element.addEventListener('click', function() {
  77.                     navigator.clipboard.writeText(element.getAttribute('data-clipboard-text'));
  78.                 })
  79.             });
  80.         }
  81.         var request = function(url, onSuccess, onError, payload, options, tries) {
  82.             var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
  83.             options = options || {};
  84.             options.retry = options.retry || false;
  85.             tries = tries || 1;
  86.             /* this delays for 125, 375, 625, 875, and 1000, ... */
  87.             var delay = tries < 5 ? (tries - 0.5) * 250 : 1000;
  88.             xhr.open(options.method || 'GET', url, true);
  89.             xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  90.             xhr.onreadystatechange = function(state) {
  91.                 if (4 !== xhr.readyState) {
  92.                     return null;
  93.                 }
  94.                 if (xhr.status == 404 && options.retry && !options.stop) {
  95.                     setTimeout(function() {
  96.                         if (options.stop) {
  97.                             return;
  98.                         }
  99.                         request(url, onSuccess, onError, payload, options, tries + 1);
  100.                     }, delay);
  101.                     return null;
  102.                 }
  103.                 if (200 === xhr.status) {
  104.                     (onSuccess || noop)(xhr);
  105.                 } else {
  106.                     (onError || noop)(xhr);
  107.                 }
  108.             };
  109.             if (options.onSend) {
  110.                 options.onSend(tries);
  111.             }
  112.             xhr.send(payload || '');
  113.         };
  114.         var getPreference = function(name) {
  115.             if (!window.localStorage) {
  116.                 return null;
  117.             }
  118.             return localStorage.getItem(profilerStorageKey + name);
  119.         };
  120.         var setPreference = function(name, value) {
  121.             if (!window.localStorage) {
  122.                 return null;
  123.             }
  124.             localStorage.setItem(profilerStorageKey + name, value);
  125.         };
  126.         var requestStack = [];
  127.         var extractHeaders = function(xhr, stackElement) {
  128.             /* Here we avoid to call xhr.getResponseHeader in order to */
  129.             /* prevent polluting the console with CORS security errors */
  130.             var allHeaders = xhr.getAllResponseHeaders();
  131.             var ret;
  132.             if (ret = allHeaders.match(/^x-debug-token:\\s+(.*)\$/im)) {
  133.                 stackElement.profile = ret[1];
  134.             }
  135.             if (ret = allHeaders.match(/^x-debug-token-link:\\s+(.*)\$/im)) {
  136.                 stackElement.profilerUrl = ret[1];
  137.             }
  138.             if (ret = allHeaders.match(/^Symfony-Debug-Toolbar-Replace:\\s+(.*)\$/im)) {
  139.                 stackElement.toolbarReplaceFinished = false;
  140.                 stackElement.toolbarReplace = '1' === ret[1];
  141.             }
  142.         };
  143.         var successStreak = 4;
  144.         var pendingRequests = 0;
  145.         var renderAjaxRequests = function() {
  146.             var requestCounter = document.querySelector('.sf-toolbar-ajax-request-counter');
  147.             if (!requestCounter) {
  148.                 return;
  149.             }
  150.             requestCounter.textContent = requestStack.length;
  151.             var infoSpan = document.querySelector(\".sf-toolbar-ajax-info\");
  152.             if (infoSpan) {
  153.                 infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length !== 1 ? 's' : '');
  154.             }
  155.             var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
  156.             if (requestStack.length) {
  157.                 ajaxToolbarPanel.style.display = 'block';
  158.             } else {
  159.                 ajaxToolbarPanel.style.display = 'none';
  160.             }
  161.             if (pendingRequests > 0) {
  162.                 addClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  163.             } else if (successStreak < 4) {
  164.                 addClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  165.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  166.             } else {
  167.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  168.                 removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  169.             }
  170.         };
  171.         var startAjaxRequest = function(index) {
  172.             var tbody = document.querySelector('.sf-toolbar-ajax-request-list');
  173.             if (!tbody) {
  174.                 return;
  175.             }
  176.             var nbOfAjaxRequest = tbody.rows.length;
  177.             if (nbOfAjaxRequest >= 100) {
  178.                 tbody.deleteRow(0);
  179.             }
  180.             var request = requestStack[index];
  181.             pendingRequests++;
  182.             var row = document.createElement('tr');
  183.             request.DOMNode = row;
  184.             var requestNumberCell = document.createElement('td');
  185.             requestNumberCell.textContent = index + 1;
  186.             row.appendChild(requestNumberCell);
  187.             var profilerCell = document.createElement('td');
  188.             profilerCell.textContent = 'n/a';
  189.             row.appendChild(profilerCell);
  190.             var methodCell = document.createElement('td');
  191.             methodCell.textContent = request.method;
  192.             row.appendChild(methodCell);
  193.             var typeCell = document.createElement('td');
  194.             typeCell.textContent = request.type;
  195.             row.appendChild(typeCell);
  196.             var statusCodeCell = document.createElement('td');
  197.             var statusCode = document.createElement('span');
  198.             statusCode.textContent = 'n/a';
  199.             statusCodeCell.appendChild(statusCode);
  200.             row.appendChild(statusCodeCell);
  201.             var pathCell = document.createElement('td');
  202.             pathCell.className = 'sf-ajax-request-url';
  203.             if ('GET' === request.method) {
  204.                 var pathLink = document.createElement('a');
  205.                 pathLink.setAttribute('href', request.url);
  206.                 pathLink.textContent = request.url;
  207.                 pathCell.appendChild(pathLink);
  208.             } else {
  209.                 pathCell.textContent = request.url;
  210.             }
  211.             pathCell.setAttribute('title', request.url);
  212.             row.appendChild(pathCell);
  213.             var durationCell = document.createElement('td');
  214.             durationCell.className = 'sf-ajax-request-duration';
  215.             durationCell.textContent = 'n/a';
  216.             row.appendChild(durationCell);
  217.             request.liveDurationHandle = setInterval(function() {
  218.                 durationCell.textContent = (new Date() - request.start) + ' ms';
  219.             }, 100);
  220.             row.className = 'sf-ajax-request sf-ajax-request-loading';
  221.             tbody.insertBefore(row, null);
  222.             var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  223.             toolbarInfo.scrollTop = toolbarInfo.scrollHeight;
  224.             renderAjaxRequests();
  225.         };
  226.         var finishAjaxRequest = function(index) {
  227.             var request = requestStack[index];
  228.             clearInterval(request.liveDurationHandle);
  229.             if (!request.DOMNode) {
  230.                 return;
  231.             }
  232.             if (request.toolbarReplace && !request.toolbarReplaceFinished && request.profile) {
  233.                 /* Flag as complete because finishAjaxRequest can be called multiple times. */
  234.                 request.toolbarReplaceFinished = true;
  235.                 /* Search up through the DOM to find the toolbar's container ID. */
  236.                 for (var elem = request.DOMNode; elem && elem !== document; elem = elem.parentNode) {
  237.                     if (elem.id.match(/^sfwdt/)) {
  238.                         Sfjs.loadToolbar(elem.id.replace(/^sfwdt/, ''), request.profile);
  239.                         break;
  240.                     }
  241.                 }
  242.             }
  243.             pendingRequests--;
  244.             var row = request.DOMNode;
  245.             /* Unpack the children from the row */
  246.             var profilerCell = row.children[1];
  247.             var methodCell = row.children[2];
  248.             var statusCodeCell = row.children[4];
  249.             var statusCodeElem = statusCodeCell.children[0];
  250.             var durationCell = row.children[6];
  251.             if (request.error) {
  252.                 row.className = 'sf-ajax-request sf-ajax-request-error';
  253.                 methodCell.className = 'sf-ajax-request-error';
  254.                 successStreak = 0;
  255.             } else {
  256.                 row.className = 'sf-ajax-request sf-ajax-request-ok';
  257.                 successStreak++;
  258.             }
  259.             if (request.statusCode) {
  260.                 if (request.statusCode < 300) {
  261.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status');
  262.                 } else if (request.statusCode < 400) {
  263.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
  264.                 } else {
  265.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  266.                 }
  267.                 statusCodeElem.textContent = request.statusCode;
  268.             } else {
  269.                 statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  270.             }
  271.             if (request.duration) {
  272.                 durationCell.textContent = request.duration + ' ms';
  273.             }
  274.             if (request.profilerUrl) {
  275.                 profilerCell.textContent = '';
  276.                 var profilerLink = document.createElement('a');
  277.                 profilerLink.setAttribute('href', request.profilerUrl);
  278.                 profilerLink.textContent = request.profile;
  279.                 profilerCell.appendChild(profilerLink);
  280.             }
  281.             renderAjaxRequests();
  282.         };
  283.         ";
  284.         // line 292
  285.         if (array_key_exists("excluded_ajax_paths"$context)) {
  286.             // line 293
  287.             echo "            if (window.fetch && window.fetch.polyfill === undefined) {
  288.                 var oldFetch = window.fetch;
  289.                 window.fetch = function () {
  290.                     var promise = oldFetch.apply(this, arguments);
  291.                     var url = arguments[0];
  292.                     var params = arguments[1];
  293.                     var paramType = Object.prototype.toString.call(arguments[0]);
  294.                     if (paramType === '[object Request]') {
  295.                         url = arguments[0].url;
  296.                         params = {
  297.                             method: arguments[0].method,
  298.                             credentials: arguments[0].credentials,
  299.                             headers: arguments[0].headers,
  300.                             mode: arguments[0].mode,
  301.                             redirect: arguments[0].redirect
  302.                         };
  303.                     } else {
  304.                         url = String(url);
  305.                     }
  306.                     if (!url.match(new RegExp(";
  307.             // line 312
  308.             echo $this->env->getFilter('json_encode')->getCallable()(($context["excluded_ajax_paths"] ?? null));
  309.             echo "))) {
  310.                         var method = 'GET';
  311.                         if (params && params.method !== undefined) {
  312.                             method = params.method;
  313.                         }
  314.                         var stackElement = {
  315.                             error: false,
  316.                             url: url,
  317.                             method: method,
  318.                             type: 'fetch',
  319.                             start: new Date()
  320.                         };
  321.                         var idx = requestStack.push(stackElement) - 1;
  322.                         promise.then(function (r) {
  323.                             stackElement.duration = new Date() - stackElement.start;
  324.                             stackElement.error = r.status < 200 || r.status >= 400;
  325.                             stackElement.statusCode = r.status;
  326.                             stackElement.profile = r.headers.get('x-debug-token');
  327.                             stackElement.profilerUrl = r.headers.get('x-debug-token-link');
  328.                             stackElement.toolbarReplaceFinished = false;
  329.                             stackElement.toolbarReplace = '1' === r.headers.get('Symfony-Debug-Toolbar-Replace');
  330.                             finishAjaxRequest(idx);
  331.                         }, function (e){
  332.                             stackElement.error = true;
  333.                             finishAjaxRequest(idx);
  334.                         });
  335.                         startAjaxRequest(idx);
  336.                     }
  337.                     return promise;
  338.                 };
  339.             }
  340.             if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) {
  341.                 var proxied = XMLHttpRequest.prototype.open;
  342.                 XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
  343.                     var self = this;
  344.                     /* prevent logging AJAX calls to static and inline files, like templates */
  345.                     var path = url;
  346.                     if (url.slice(0, 1) === '/') {
  347.                         if (0 === url.indexOf('";
  348.             // line 355
  349.             echo sw_escape_filter($this->envsw_escape_filter($this->envsw_get_attribute($this->env$this->source, ($context["request"] ?? null), "basePath", [], "any"falsefalsefalse355), "js"), "html"nulltrue);
  350.             echo "')) {
  351.                             path = url.slice(";
  352.             // line 356
  353.             echo sw_escape_filter($this->envtwig_length_filter($this->envsw_get_attribute($this->env$this->source, ($context["request"] ?? null), "basePath", [], "any"falsefalsefalse356)), "html"nulltrue);
  354.             echo ");
  355.                         }
  356.                     }
  357.                     else if (0 === url.indexOf('";
  358.             // line 359
  359.             echo sw_escape_filter($this->envsw_escape_filter($this->env, (sw_get_attribute($this->env$this->source, ($context["request"] ?? null), "schemeAndHttpHost", [], "any"falsefalsefalse359) . sw_get_attribute($this->env$this->source, ($context["request"] ?? null), "basePath", [], "any"falsefalsefalse359)), "js"), "html"nulltrue);
  360.             echo "')) {
  361.                         path = url.slice(";
  362.             // line 360
  363.             echo sw_escape_filter($this->envtwig_length_filter($this->env, (sw_get_attribute($this->env$this->source, ($context["request"] ?? null), "schemeAndHttpHost", [], "any"falsefalsefalse360) . sw_get_attribute($this->env$this->source, ($context["request"] ?? null), "basePath", [], "any"falsefalsefalse360))), "html"nulltrue);
  364.             echo ");
  365.                     }
  366.                     if (!path.match(new RegExp(";
  367.             // line 363
  368.             echo $this->env->getFilter('json_encode')->getCallable()(($context["excluded_ajax_paths"] ?? null));
  369.             echo "))) {
  370.                         var stackElement = {
  371.                             error: false,
  372.                             url: url,
  373.                             method: method,
  374.                             type: 'xhr',
  375.                             start: new Date()
  376.                         };
  377.                         var idx = requestStack.push(stackElement) - 1;
  378.                         this.addEventListener('readystatechange', function() {
  379.                             if (self.readyState == 4) {
  380.                                 stackElement.duration = new Date() - stackElement.start;
  381.                                 stackElement.error = self.status < 200 || self.status >= 400;
  382.                                 stackElement.statusCode = self.status;
  383.                                 extractHeaders(self, stackElement);
  384.                                 finishAjaxRequest(idx);
  385.                             }
  386.                         }, false);
  387.                         startAjaxRequest(idx);
  388.                     }
  389.                     proxied.apply(this, Array.prototype.slice.call(arguments));
  390.                 };
  391.             }
  392.         ";
  393.         }
  394.         // line 392
  395.         echo "
  396.         return {
  397.             hasClass: hasClass,
  398.             removeClass: removeClass,
  399.             addClass: addClass,
  400.             toggleClass: toggleClass,
  401.             getPreference: getPreference,
  402.             setPreference: setPreference,
  403.             addEventListener: addEventListener,
  404.             request: request,
  405.             renderAjaxRequests: renderAjaxRequests,
  406.             getSfwdt: function(token) {
  407.                 if (!this.sfwdt) {
  408.                     this.sfwdt = document.getElementById('sfwdt' + token);
  409.                 }
  410.                 return this.sfwdt;
  411.             },
  412.             load: function(selector, url, onSuccess, onError, options) {
  413.                 var el = document.getElementById(selector);
  414.                 if (el && el.getAttribute('data-sfurl') !== url) {
  415.                     request(
  416.                         url,
  417.                         function(xhr) {
  418.                             el.innerHTML = xhr.responseText;
  419.                             el.setAttribute('data-sfurl', url);
  420.                             removeClass(el, 'loading');
  421.                             var pending = pendingRequests;
  422.                             for (var i = 0; i < requestStack.length; i++) {
  423.                                 startAjaxRequest(i);
  424.                                 if (requestStack[i].duration) {
  425.                                     finishAjaxRequest(i);
  426.                                 }
  427.                             }
  428.                             /* Revert the pending state in case there was a start called without a finish above. */
  429.                             pendingRequests = pending;
  430.                             (onSuccess || noop)(xhr, el);
  431.                         },
  432.                         function(xhr) { (onError || noop)(xhr, el); },
  433.                         '',
  434.                         options
  435.                     );
  436.                 }
  437.                 return this;
  438.             },
  439.             showToolbar: function(token) {
  440.                 var sfwdt = this.getSfwdt(token);
  441.                 removeClass(sfwdt, 'sf-display-none');
  442.                 if (getPreference('toolbar/displayState') == 'none') {
  443.                     document.getElementById('sfToolbarMainContent-' + token).style.display = 'none';
  444.                     document.getElementById('sfToolbarClearer-' + token).style.display = 'none';
  445.                     document.getElementById('sfMiniToolbar-' + token).style.display = 'block';
  446.                 } else {
  447.                     document.getElementById('sfToolbarMainContent-' + token).style.display = 'block';
  448.                     document.getElementById('sfToolbarClearer-' + token).style.display = 'block';
  449.                     document.getElementById('sfMiniToolbar-' + token).style.display = 'none';
  450.                 }
  451.             },
  452.             hideToolbar: function(token) {
  453.                 var sfwdt = this.getSfwdt(token);
  454.                 addClass(sfwdt, 'sf-display-none');
  455.             },
  456.             initToolbar: function(token) {
  457.                 this.showToolbar(token);
  458.                 var hideButton = document.getElementById('sfToolbarHideButton-' + token);
  459.                 var hideButtonSvg = hideButton.querySelector('svg');
  460.                 hideButtonSvg.setAttribute('aria-hidden', 'true');
  461.                 hideButtonSvg.setAttribute('focusable', 'false');
  462.                 addEventListener(hideButton, 'click', function (event) {
  463.                     event.preventDefault();
  464.                     var p = this.parentNode;
  465.                     p.style.display = 'none';
  466.                     (p.previousElementSibling || p.previousSibling).style.display = 'none';
  467.                     document.getElementById('sfMiniToolbar-' + token).style.display = 'block';
  468.                     setPreference('toolbar/displayState', 'none');
  469.                 });
  470.                 var showButton = document.getElementById('sfToolbarMiniToggler-' + token);
  471.                 var showButtonSvg = showButton.querySelector('svg');
  472.                 showButtonSvg.setAttribute('aria-hidden', 'true');
  473.                 showButtonSvg.setAttribute('focusable', 'false');
  474.                 addEventListener(showButton, 'click', function (event) {
  475.                     event.preventDefault();
  476.                     var elem = this.parentNode;
  477.                     if (elem.style.display == 'none') {
  478.                         document.getElementById('sfToolbarMainContent-' + token).style.display = 'none';
  479.                         document.getElementById('sfToolbarClearer-' + token).style.display = 'none';
  480.                         elem.style.display = 'block';
  481.                     } else {
  482.                         document.getElementById('sfToolbarMainContent-' + token).style.display = 'block';
  483.                         document.getElementById('sfToolbarClearer-' + token).style.display = 'block';
  484.                         elem.style.display = 'none'
  485.                     }
  486.                     setPreference('toolbar/displayState', 'block');
  487.                 });
  488.             },
  489.             loadToolbar: function(token, newToken) {
  490.                 var that = this;
  491.                 var triesCounter = document.getElementById('sfLoadCounter-' + token);
  492.                 var options = {
  493.                     retry: true,
  494.                     onSend: function (count) {
  495.                         if (count === 3) {
  496.                             that.initToolbar(token);
  497.                         }
  498.                         if (triesCounter) {
  499.                             triesCounter.textContent = count;
  500.                         }
  501.                     },
  502.                 };
  503.                 var cancelButton = document.getElementById('sfLoadCancel-' + token);
  504.                 if (cancelButton) {
  505.                     addEventListener(cancelButton, 'click', function (event) {
  506.                         event.preventDefault();
  507.                         options.stop = true;
  508.                         that.hideToolbar(token);
  509.                     });
  510.                 }
  511.                 newToken = (newToken || token);
  512.                 this.load(
  513.                     'sfwdt' + token,
  514.                     '";
  515.         // line 540
  516.         echo sw_escape_filter($this->envsw_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("_wdt", ["token" => "xxxxxx"]), "js"), "html"nulltrue);
  517.         echo "'.replace(/xxxxxx/, newToken),
  518.                     function(xhr, el) {
  519.                         /* Do nothing in the edge case where the toolbar has already been replaced with a new one */
  520.                         if (!document.getElementById('sfToolbarMainContent-' + newToken)) {
  521.                             return;
  522.                         }
  523.                         /* Evaluate in global scope scripts embedded inside the toolbar */
  524.                         var i, scripts = [].slice.call(el.querySelectorAll('script'));
  525.                         for (i = 0; i < scripts.length; ++i) {
  526.                             eval.call({}, scripts[i].firstChild.nodeValue);
  527.                         }
  528.                         el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
  529.                         if (el.style.display == 'none') {
  530.                             return;
  531.                         }
  532.                         that.initToolbar(newToken);
  533.                         /* Handle toolbar-info position */
  534.                         var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
  535.                         for (i = 0; i < toolbarBlocks.length; ++i) {
  536.                             toolbarBlocks[i].onmouseover = function () {
  537.                                 var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
  538.                                 var pageWidth = document.body.clientWidth;
  539.                                 var elementWidth = toolbarInfo.offsetWidth;
  540.                                 var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
  541.                                 var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
  542.                                 /* Reset right and left value, useful on window resize */
  543.                                 toolbarInfo.style.right = '';
  544.                                 toolbarInfo.style.left = '';
  545.                                 if (elementWidth > pageWidth) {
  546.                                     toolbarInfo.style.left = 0;
  547.                                 }
  548.                                 else if (leftValue > 0 && rightValue > 0) {
  549.                                     toolbarInfo.style.right = (rightValue * -1) + 'px';
  550.                                 } else if (leftValue < 0) {
  551.                                     toolbarInfo.style.left = 0;
  552.                                 } else {
  553.                                     toolbarInfo.style.right = '0px';
  554.                                 }
  555.                             };
  556.                         }
  557.                         renderAjaxRequests();
  558.                         addEventListener(document.querySelector('.sf-toolbar-ajax-clear'), 'click', function() {
  559.                             requestStack = [];
  560.                             renderAjaxRequests();
  561.                             successStreak = 4;
  562.                             document.querySelector('.sf-toolbar-ajax-request-list').innerHTML = '';
  563.                         });
  564.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) {
  565.                             var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  566.                             elem.scrollTop = elem.scrollHeight;
  567.                         });
  568.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
  569.                             event.preventDefault();
  570.                             toggleClass(this.parentNode, 'hover');
  571.                         });
  572.                         var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
  573.                         if (null !== dumpInfo) {
  574.                             addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
  575.                                 dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
  576.                             });
  577.                             addEventListener(dumpInfo, 'mouseleave', function () {
  578.                                 dumpInfo.style.minHeight = '';
  579.                             });
  580.                         }
  581.                     },
  582.                     function(xhr) {
  583.                         if (xhr.status !== 0 && !options.stop) {
  584.                             var sfwdt = that.getSfwdt(token);
  585.                             sfwdt.innerHTML = '\\
  586.                                 <div class=\"sf-toolbarreset\">\\
  587.                                     <div class=\"sf-toolbar-icon\"><svg width=\"26\" height=\"28\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" x=\"0px\" y=\"0px\" viewBox=\"0 0 26 28\" enable-background=\"new 0 0 26 28\" xml:space=\"preserve\"><path fill=\"#FFFFFF\" d=\"M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z\"/></svg></div>\\
  588.                                     An error occurred while loading the web debug toolbar. <a href=\"";
  589.         // line 621
  590.         echo sw_escape_filter($this->envsw_escape_filter($this->env$this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("_profiler_home"), "js"), "html"nulltrue);
  591.         echo "' + newToken + '>Open the web profiler.</a>\\
  592.                                 </div>\\
  593.                             ';
  594.                             sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
  595.                         }
  596.                     },
  597.                     options
  598.                 );
  599.                 return this;
  600.             },
  601.             toggle: function(selector, elOn, elOff) {
  602.                 var tmp = elOn.style.display,
  603.                     el = document.getElementById(selector);
  604.                 elOn.style.display = elOff.style.display;
  605.                 elOff.style.display = tmp;
  606.                 if (el) {
  607.                     el.style.display = 'none' === tmp ? 'none' : 'block';
  608.                 }
  609.                 return this;
  610.             },
  611.             createTabs: function() {
  612.                 var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
  613.                 /* create the tab navigation for each group of tabs */
  614.                 for (var i = 0; i < tabGroups.length; i++) {
  615.                     var tabs = tabGroups[i].querySelectorAll(':scope > .tab');
  616.                     var tabNavigation = document.createElement('ul');
  617.                     tabNavigation.className = 'tab-navigation';
  618.                     var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
  619.                     for (var j = 0; j < tabs.length; j++) {
  620.                         var tabId = 'tab-' + i + '-' + j;
  621.                         var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
  622.                         var tabNavigationItem = document.createElement('li');
  623.                         tabNavigationItem.setAttribute('data-tab-id', tabId);
  624.                         if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
  625.                         if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
  626.                         tabNavigationItem.innerHTML = tabTitle;
  627.                         tabNavigation.appendChild(tabNavigationItem);
  628.                         var tabContent = tabs[j].querySelector('.tab-content');
  629.                         tabContent.parentElement.setAttribute('id', tabId);
  630.                     }
  631.                     tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
  632.                     addClass(document.querySelector('[data-tab-id=\"' + selectedTabId + '\"]'), 'active');
  633.                 }
  634.                 /* display the active tab and add the 'click' event listeners */
  635.                 for (i = 0; i < tabGroups.length; i++) {
  636.                     tabNavigation = tabGroups[i].querySelectorAll(':scope > .tab-navigation li');
  637.                     for (j = 0; j < tabNavigation.length; j++) {
  638.                         tabId = tabNavigation[j].getAttribute('data-tab-id');
  639.                         document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';
  640.                         if (hasClass(tabNavigation[j], 'active')) {
  641.                             document.getElementById(tabId).className = 'block';
  642.                         } else {
  643.                             document.getElementById(tabId).className = 'hidden';
  644.                         }
  645.                         tabNavigation[j].addEventListener('click', function(e) {
  646.                             var activeTab = e.target || e.srcElement;
  647.                             /* needed because when the tab contains HTML contents, user can click */
  648.                             /* on any of those elements instead of their parent '<li>' element */
  649.                             while (activeTab.tagName.toLowerCase() !== 'li') {
  650.                                 activeTab = activeTab.parentNode;
  651.                             }
  652.                             /* get the full list of tabs through the parent of the active tab element */
  653.                             var tabNavigation = activeTab.parentNode.children;
  654.                             for (var k = 0; k < tabNavigation.length; k++) {
  655.                                 var tabId = tabNavigation[k].getAttribute('data-tab-id');
  656.                                 document.getElementById(tabId).className = 'hidden';
  657.                                 removeClass(tabNavigation[k], 'active');
  658.                             }
  659.                             addClass(activeTab, 'active');
  660.                             var activeTabId = activeTab.getAttribute('data-tab-id');
  661.                             document.getElementById(activeTabId).className = 'block';
  662.                         });
  663.                     }
  664.                     tabGroups[i].setAttribute('data-processed', 'true');
  665.                 }
  666.             },
  667.             createToggles: function() {
  668.                 var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])');
  669.                 for (var i = 0; i < toggles.length; i++) {
  670.                     var elementSelector = toggles[i].getAttribute('data-toggle-selector');
  671.                     var element = document.querySelector(elementSelector);
  672.                     addClass(element, 'sf-toggle-content');
  673.                     if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {
  674.                         addClass(toggles[i], 'sf-toggle-on');
  675.                         addClass(element, 'sf-toggle-visible');
  676.                     } else {
  677.                         addClass(toggles[i], 'sf-toggle-off');
  678.                         addClass(element, 'sf-toggle-hidden');
  679.                     }
  680.                     addEventListener(toggles[i], 'click', function(e) {
  681.                         e.preventDefault();
  682.                         if ('' !== window.getSelection().toString()) {
  683.                             /* Don't do anything on text selection */
  684.                             return;
  685.                         }
  686.                         var toggle = e.target || e.srcElement;
  687.                         /* needed because when the toggle contains HTML contents, user can click */
  688.                         /* on any of those elements instead of their parent '.sf-toggle' element */
  689.                         while (!hasClass(toggle, 'sf-toggle')) {
  690.                             toggle = toggle.parentNode;
  691.                         }
  692.                         var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));
  693.                         toggleClass(toggle, 'sf-toggle-on');
  694.                         toggleClass(toggle, 'sf-toggle-off');
  695.                         toggleClass(element, 'sf-toggle-hidden');
  696.                         toggleClass(element, 'sf-toggle-visible');
  697.                         /* the toggle doesn't change its contents when clicking on it */
  698.                         if (!toggle.hasAttribute('data-toggle-alt-content')) {
  699.                             return;
  700.                         }
  701.                         if (!toggle.hasAttribute('data-toggle-original-content')) {
  702.                             toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);
  703.                         }
  704.                         var currentContent = toggle.innerHTML;
  705.                         var originalContent = toggle.getAttribute('data-toggle-original-content');
  706.                         var altContent = toggle.getAttribute('data-toggle-alt-content');
  707.                         toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
  708.                     });
  709.                     /* Prevents from disallowing clicks on links inside toggles */
  710.                     var toggleLinks = toggles[i].querySelectorAll('a');
  711.                     for (var j = 0; j < toggleLinks.length; j++) {
  712.                         addEventListener(toggleLinks[j], 'click', function(e) {
  713.                             e.stopPropagation();
  714.                         });
  715.                     }
  716.                     /* Prevents from disallowing clicks on \"copy to clipboard\" elements inside toggles */
  717.                     var copyToClipboardElements = toggles[i].querySelectorAll('span[data-clipboard-text]');
  718.                     for (var k = 0; k < copyToClipboardElements.length; k++) {
  719.                         addEventListener(copyToClipboardElements[k], 'click', function(e) {
  720.                             e.stopPropagation();
  721.                         });
  722.                     }
  723.                     toggles[i].setAttribute('data-processed', 'true');
  724.                 }
  725.             },
  726.             initializeLogsTable: function() {
  727.                 Sfjs.updateLogsTable();
  728.                 document.querySelectorAll('.log-filter input').forEach((input) => {
  729.                     input.addEventListener('change', () => { Sfjs.updateLogsTable(); });
  730.                 });
  731.                 document.querySelectorAll('.filter-select-all-or-none button').forEach((link) => {
  732.                     link.addEventListener('click', () => {
  733.                         const selectAll = link.classList.contains('select-all');
  734.                         link.closest('.log-filter-content').querySelectorAll('input').forEach((input) => {
  735.                             input.checked = selectAll;
  736.                         });
  737.                         Sfjs.updateLogsTable();
  738.                     });
  739.                 });
  740.                 document.body.addEventListener('click', (event) => {
  741.                     document.querySelectorAll('details.log-filter').forEach((filterElement) => {
  742.                         if (!filterElement.contains(event.target) && filterElement.open) {
  743.                             filterElement.open = false;
  744.                         }
  745.                     });
  746.                 });
  747.             },
  748.             updateLogsTable: function() {
  749.                 const selectedType = document.querySelector('#log-filter-type input:checked').value;
  750.                 const priorities = document.querySelectorAll('#log-filter-priority input');
  751.                 const allPriorities = Array.from(priorities).map((input) => input.value);
  752.                 const selectedPriorities = Array.from(priorities).filter((input) => input.checked).map((input) => input.value);
  753.                 const channels = document.querySelectorAll('#log-filter-channel input');
  754.                 const selectedChannels = Array.from(channels).filter((input) => input.checked).map((input) => input.value);
  755.                 const logs = document.querySelector('table.logs');
  756.                 if (null === logs) {
  757.                     return;
  758.                 }
  759.                 /* hide rows that don't match the current filters */
  760.                 let numVisibleRows = 0;
  761.                 logs.querySelectorAll('tbody tr').forEach((row) => {
  762.                     if ('all' !== selectedType && selectedType !== row.getAttribute('data-type')) {
  763.                         row.style.display = 'none';
  764.                         return;
  765.                     }
  766.                     const priority = row.getAttribute('data-priority');
  767.                     if (false === selectedPriorities.includes(priority) && true === allPriorities.includes(priority)) {
  768.                         row.style.display = 'none';
  769.                         return;
  770.                     }
  771.                     if ('' !== row.getAttribute('data-channel') && false === selectedChannels.includes(row.getAttribute('data-channel'))) {
  772.                         row.style.display = 'none';
  773.                         return;
  774.                     }
  775.                     row.style.display = 'table-row';
  776.                     numVisibleRows++;
  777.                 });
  778.                 document.querySelector('table.logs').style.display = 0 === numVisibleRows ? 'none' : 'table';
  779.                 document.querySelector('.no-logs-message').style.display = 0 === numVisibleRows ? 'block' : 'none';
  780.                 /* update the selected totals of all filters */
  781.                 document.querySelector('#log-filter-priority .filter-active-num').innerText = (priorities.length === selectedPriorities.length) ? 'All' : selectedPriorities.length;
  782.                 document.querySelector('#log-filter-channel .filter-active-num').innerText = (channels.length === selectedChannels.length) ? 'All' : selectedChannels.length;
  783.                 /* update the currently selected \"log type\" tab */
  784.                 document.querySelectorAll('#log-filter-type li').forEach((tab) => tab.classList.remove('active'));
  785.                 document.querySelector(`#log-filter-type input[value=\"\${selectedType}\"]`).parentElement.classList.add('active');
  786.             },
  787.         };
  788.     })();
  789.     Sfjs.addEventListener(document, 'DOMContentLoaded', function() {
  790.         Sfjs.createTabs();
  791.         Sfjs.createToggles();
  792.     });
  793. }
  794. /*]]>*/</script>
  795. ";
  796.         
  797.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  798.         
  799.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  800.     }
  801.     public function getTemplateName()
  802.     {
  803.         return "@WebProfiler/Profiler/base_js.html.twig";
  804.     }
  805.     public function isTraitable()
  806.     {
  807.         return false;
  808.     }
  809.     public function getDebugInfo()
  810.     {
  811.         return array (  694 => 621,  610 => 540,  460 => 392,  428 => 363,  422 => 360,  418 => 359,  412 => 356,  408 => 355,  362 => 312,  341 => 293,  339 => 292,  52 => 7,  43 => 3,);
  812.     }
  813.     public function getSourceContext()
  814.     {
  815.         return new Source("{# This file is partially duplicated in src/Symfony/Component/ErrorHandler/Resources/assets/js/exception.js.
  816.    If you make any change in this file, verify the same change is needed in the other file. #}
  817. <script{% if csp_script_nonce is defined and csp_script_nonce %} nonce=\"{{ csp_script_nonce }}\"{% endif %}>/*<![CDATA[*/
  818.     {# Caution: the contents of this file are processed by Twig before loading
  819.                 them as JavaScript source code. Always use '/*' comments instead
  820.                 of '//' comments to avoid impossible-to-debug side-effects #}
  821. if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
  822.     Sfjs = (function() {
  823.         \"use strict\";
  824.         if ('classList' in document.documentElement) {
  825.             var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
  826.             var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
  827.             var addClass = function(el, cssClass) { el.classList.add(cssClass); };
  828.             var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };
  829.         } else {
  830.             var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };
  831.             var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };
  832.             var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };
  833.             var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
  834.         }
  835.         var noop = function() {};
  836.         var profilerStorageKey = 'symfony/profiler/';
  837.         var addEventListener;
  838.         var el = document.createElement('div');
  839.         if (!('addEventListener' in el)) {
  840.             addEventListener = function (element, eventName, callback) {
  841.                 element.attachEvent('on' + eventName, callback);
  842.             };
  843.         } else {
  844.             addEventListener = function (element, eventName, callback) {
  845.                 element.addEventListener(eventName, callback, false);
  846.             };
  847.         }
  848.         if (navigator.clipboard) {
  849.             document.querySelectorAll('[data-clipboard-text]').forEach(function(element) {
  850.                 removeClass(element, 'hidden');
  851.                 element.addEventListener('click', function() {
  852.                     navigator.clipboard.writeText(element.getAttribute('data-clipboard-text'));
  853.                 })
  854.             });
  855.         }
  856.         var request = function(url, onSuccess, onError, payload, options, tries) {
  857.             var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
  858.             options = options || {};
  859.             options.retry = options.retry || false;
  860.             tries = tries || 1;
  861.             /* this delays for 125, 375, 625, 875, and 1000, ... */
  862.             var delay = tries < 5 ? (tries - 0.5) * 250 : 1000;
  863.             xhr.open(options.method || 'GET', url, true);
  864.             xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  865.             xhr.onreadystatechange = function(state) {
  866.                 if (4 !== xhr.readyState) {
  867.                     return null;
  868.                 }
  869.                 if (xhr.status == 404 && options.retry && !options.stop) {
  870.                     setTimeout(function() {
  871.                         if (options.stop) {
  872.                             return;
  873.                         }
  874.                         request(url, onSuccess, onError, payload, options, tries + 1);
  875.                     }, delay);
  876.                     return null;
  877.                 }
  878.                 if (200 === xhr.status) {
  879.                     (onSuccess || noop)(xhr);
  880.                 } else {
  881.                     (onError || noop)(xhr);
  882.                 }
  883.             };
  884.             if (options.onSend) {
  885.                 options.onSend(tries);
  886.             }
  887.             xhr.send(payload || '');
  888.         };
  889.         var getPreference = function(name) {
  890.             if (!window.localStorage) {
  891.                 return null;
  892.             }
  893.             return localStorage.getItem(profilerStorageKey + name);
  894.         };
  895.         var setPreference = function(name, value) {
  896.             if (!window.localStorage) {
  897.                 return null;
  898.             }
  899.             localStorage.setItem(profilerStorageKey + name, value);
  900.         };
  901.         var requestStack = [];
  902.         var extractHeaders = function(xhr, stackElement) {
  903.             /* Here we avoid to call xhr.getResponseHeader in order to */
  904.             /* prevent polluting the console with CORS security errors */
  905.             var allHeaders = xhr.getAllResponseHeaders();
  906.             var ret;
  907.             if (ret = allHeaders.match(/^x-debug-token:\\s+(.*)\$/im)) {
  908.                 stackElement.profile = ret[1];
  909.             }
  910.             if (ret = allHeaders.match(/^x-debug-token-link:\\s+(.*)\$/im)) {
  911.                 stackElement.profilerUrl = ret[1];
  912.             }
  913.             if (ret = allHeaders.match(/^Symfony-Debug-Toolbar-Replace:\\s+(.*)\$/im)) {
  914.                 stackElement.toolbarReplaceFinished = false;
  915.                 stackElement.toolbarReplace = '1' === ret[1];
  916.             }
  917.         };
  918.         var successStreak = 4;
  919.         var pendingRequests = 0;
  920.         var renderAjaxRequests = function() {
  921.             var requestCounter = document.querySelector('.sf-toolbar-ajax-request-counter');
  922.             if (!requestCounter) {
  923.                 return;
  924.             }
  925.             requestCounter.textContent = requestStack.length;
  926.             var infoSpan = document.querySelector(\".sf-toolbar-ajax-info\");
  927.             if (infoSpan) {
  928.                 infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length !== 1 ? 's' : '');
  929.             }
  930.             var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
  931.             if (requestStack.length) {
  932.                 ajaxToolbarPanel.style.display = 'block';
  933.             } else {
  934.                 ajaxToolbarPanel.style.display = 'none';
  935.             }
  936.             if (pendingRequests > 0) {
  937.                 addClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  938.             } else if (successStreak < 4) {
  939.                 addClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  940.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  941.             } else {
  942.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  943.                 removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  944.             }
  945.         };
  946.         var startAjaxRequest = function(index) {
  947.             var tbody = document.querySelector('.sf-toolbar-ajax-request-list');
  948.             if (!tbody) {
  949.                 return;
  950.             }
  951.             var nbOfAjaxRequest = tbody.rows.length;
  952.             if (nbOfAjaxRequest >= 100) {
  953.                 tbody.deleteRow(0);
  954.             }
  955.             var request = requestStack[index];
  956.             pendingRequests++;
  957.             var row = document.createElement('tr');
  958.             request.DOMNode = row;
  959.             var requestNumberCell = document.createElement('td');
  960.             requestNumberCell.textContent = index + 1;
  961.             row.appendChild(requestNumberCell);
  962.             var profilerCell = document.createElement('td');
  963.             profilerCell.textContent = 'n/a';
  964.             row.appendChild(profilerCell);
  965.             var methodCell = document.createElement('td');
  966.             methodCell.textContent = request.method;
  967.             row.appendChild(methodCell);
  968.             var typeCell = document.createElement('td');
  969.             typeCell.textContent = request.type;
  970.             row.appendChild(typeCell);
  971.             var statusCodeCell = document.createElement('td');
  972.             var statusCode = document.createElement('span');
  973.             statusCode.textContent = 'n/a';
  974.             statusCodeCell.appendChild(statusCode);
  975.             row.appendChild(statusCodeCell);
  976.             var pathCell = document.createElement('td');
  977.             pathCell.className = 'sf-ajax-request-url';
  978.             if ('GET' === request.method) {
  979.                 var pathLink = document.createElement('a');
  980.                 pathLink.setAttribute('href', request.url);
  981.                 pathLink.textContent = request.url;
  982.                 pathCell.appendChild(pathLink);
  983.             } else {
  984.                 pathCell.textContent = request.url;
  985.             }
  986.             pathCell.setAttribute('title', request.url);
  987.             row.appendChild(pathCell);
  988.             var durationCell = document.createElement('td');
  989.             durationCell.className = 'sf-ajax-request-duration';
  990.             durationCell.textContent = 'n/a';
  991.             row.appendChild(durationCell);
  992.             request.liveDurationHandle = setInterval(function() {
  993.                 durationCell.textContent = (new Date() - request.start) + ' ms';
  994.             }, 100);
  995.             row.className = 'sf-ajax-request sf-ajax-request-loading';
  996.             tbody.insertBefore(row, null);
  997.             var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  998.             toolbarInfo.scrollTop = toolbarInfo.scrollHeight;
  999.             renderAjaxRequests();
  1000.         };
  1001.         var finishAjaxRequest = function(index) {
  1002.             var request = requestStack[index];
  1003.             clearInterval(request.liveDurationHandle);
  1004.             if (!request.DOMNode) {
  1005.                 return;
  1006.             }
  1007.             if (request.toolbarReplace && !request.toolbarReplaceFinished && request.profile) {
  1008.                 /* Flag as complete because finishAjaxRequest can be called multiple times. */
  1009.                 request.toolbarReplaceFinished = true;
  1010.                 /* Search up through the DOM to find the toolbar's container ID. */
  1011.                 for (var elem = request.DOMNode; elem && elem !== document; elem = elem.parentNode) {
  1012.                     if (elem.id.match(/^sfwdt/)) {
  1013.                         Sfjs.loadToolbar(elem.id.replace(/^sfwdt/, ''), request.profile);
  1014.                         break;
  1015.                     }
  1016.                 }
  1017.             }
  1018.             pendingRequests--;
  1019.             var row = request.DOMNode;
  1020.             /* Unpack the children from the row */
  1021.             var profilerCell = row.children[1];
  1022.             var methodCell = row.children[2];
  1023.             var statusCodeCell = row.children[4];
  1024.             var statusCodeElem = statusCodeCell.children[0];
  1025.             var durationCell = row.children[6];
  1026.             if (request.error) {
  1027.                 row.className = 'sf-ajax-request sf-ajax-request-error';
  1028.                 methodCell.className = 'sf-ajax-request-error';
  1029.                 successStreak = 0;
  1030.             } else {
  1031.                 row.className = 'sf-ajax-request sf-ajax-request-ok';
  1032.                 successStreak++;
  1033.             }
  1034.             if (request.statusCode) {
  1035.                 if (request.statusCode < 300) {
  1036.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status');
  1037.                 } else if (request.statusCode < 400) {
  1038.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
  1039.                 } else {
  1040.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  1041.                 }
  1042.                 statusCodeElem.textContent = request.statusCode;
  1043.             } else {
  1044.                 statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  1045.             }
  1046.             if (request.duration) {
  1047.                 durationCell.textContent = request.duration + ' ms';
  1048.             }
  1049.             if (request.profilerUrl) {
  1050.                 profilerCell.textContent = '';
  1051.                 var profilerLink = document.createElement('a');
  1052.                 profilerLink.setAttribute('href', request.profilerUrl);
  1053.                 profilerLink.textContent = request.profile;
  1054.                 profilerCell.appendChild(profilerLink);
  1055.             }
  1056.             renderAjaxRequests();
  1057.         };
  1058.         {% if excluded_ajax_paths is defined %}
  1059.             if (window.fetch && window.fetch.polyfill === undefined) {
  1060.                 var oldFetch = window.fetch;
  1061.                 window.fetch = function () {
  1062.                     var promise = oldFetch.apply(this, arguments);
  1063.                     var url = arguments[0];
  1064.                     var params = arguments[1];
  1065.                     var paramType = Object.prototype.toString.call(arguments[0]);
  1066.                     if (paramType === '[object Request]') {
  1067.                         url = arguments[0].url;
  1068.                         params = {
  1069.                             method: arguments[0].method,
  1070.                             credentials: arguments[0].credentials,
  1071.                             headers: arguments[0].headers,
  1072.                             mode: arguments[0].mode,
  1073.                             redirect: arguments[0].redirect
  1074.                         };
  1075.                     } else {
  1076.                         url = String(url);
  1077.                     }
  1078.                     if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
  1079.                         var method = 'GET';
  1080.                         if (params && params.method !== undefined) {
  1081.                             method = params.method;
  1082.                         }
  1083.                         var stackElement = {
  1084.                             error: false,
  1085.                             url: url,
  1086.                             method: method,
  1087.                             type: 'fetch',
  1088.                             start: new Date()
  1089.                         };
  1090.                         var idx = requestStack.push(stackElement) - 1;
  1091.                         promise.then(function (r) {
  1092.                             stackElement.duration = new Date() - stackElement.start;
  1093.                             stackElement.error = r.status < 200 || r.status >= 400;
  1094.                             stackElement.statusCode = r.status;
  1095.                             stackElement.profile = r.headers.get('x-debug-token');
  1096.                             stackElement.profilerUrl = r.headers.get('x-debug-token-link');
  1097.                             stackElement.toolbarReplaceFinished = false;
  1098.                             stackElement.toolbarReplace = '1' === r.headers.get('Symfony-Debug-Toolbar-Replace');
  1099.                             finishAjaxRequest(idx);
  1100.                         }, function (e){
  1101.                             stackElement.error = true;
  1102.                             finishAjaxRequest(idx);
  1103.                         });
  1104.                         startAjaxRequest(idx);
  1105.                     }
  1106.                     return promise;
  1107.                 };
  1108.             }
  1109.             if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) {
  1110.                 var proxied = XMLHttpRequest.prototype.open;
  1111.                 XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
  1112.                     var self = this;
  1113.                     /* prevent logging AJAX calls to static and inline files, like templates */
  1114.                     var path = url;
  1115.                     if (url.slice(0, 1) === '/') {
  1116.                         if (0 === url.indexOf('{{ request.basePath|e('js') }}')) {
  1117.                             path = url.slice({{ request.basePath|length }});
  1118.                         }
  1119.                     }
  1120.                     else if (0 === url.indexOf('{{ (request.schemeAndHttpHost ~ request.basePath)|e('js') }}')) {
  1121.                         path = url.slice({{ (request.schemeAndHttpHost ~ request.basePath)|length }});
  1122.                     }
  1123.                     if (!path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
  1124.                         var stackElement = {
  1125.                             error: false,
  1126.                             url: url,
  1127.                             method: method,
  1128.                             type: 'xhr',
  1129.                             start: new Date()
  1130.                         };
  1131.                         var idx = requestStack.push(stackElement) - 1;
  1132.                         this.addEventListener('readystatechange', function() {
  1133.                             if (self.readyState == 4) {
  1134.                                 stackElement.duration = new Date() - stackElement.start;
  1135.                                 stackElement.error = self.status < 200 || self.status >= 400;
  1136.                                 stackElement.statusCode = self.status;
  1137.                                 extractHeaders(self, stackElement);
  1138.                                 finishAjaxRequest(idx);
  1139.                             }
  1140.                         }, false);
  1141.                         startAjaxRequest(idx);
  1142.                     }
  1143.                     proxied.apply(this, Array.prototype.slice.call(arguments));
  1144.                 };
  1145.             }
  1146.         {% endif %}
  1147.         return {
  1148.             hasClass: hasClass,
  1149.             removeClass: removeClass,
  1150.             addClass: addClass,
  1151.             toggleClass: toggleClass,
  1152.             getPreference: getPreference,
  1153.             setPreference: setPreference,
  1154.             addEventListener: addEventListener,
  1155.             request: request,
  1156.             renderAjaxRequests: renderAjaxRequests,
  1157.             getSfwdt: function(token) {
  1158.                 if (!this.sfwdt) {
  1159.                     this.sfwdt = document.getElementById('sfwdt' + token);
  1160.                 }
  1161.                 return this.sfwdt;
  1162.             },
  1163.             load: function(selector, url, onSuccess, onError, options) {
  1164.                 var el = document.getElementById(selector);
  1165.                 if (el && el.getAttribute('data-sfurl') !== url) {
  1166.                     request(
  1167.                         url,
  1168.                         function(xhr) {
  1169.                             el.innerHTML = xhr.responseText;
  1170.                             el.setAttribute('data-sfurl', url);
  1171.                             removeClass(el, 'loading');
  1172.                             var pending = pendingRequests;
  1173.                             for (var i = 0; i < requestStack.length; i++) {
  1174.                                 startAjaxRequest(i);
  1175.                                 if (requestStack[i].duration) {
  1176.                                     finishAjaxRequest(i);
  1177.                                 }
  1178.                             }
  1179.                             /* Revert the pending state in case there was a start called without a finish above. */
  1180.                             pendingRequests = pending;
  1181.                             (onSuccess || noop)(xhr, el);
  1182.                         },
  1183.                         function(xhr) { (onError || noop)(xhr, el); },
  1184.                         '',
  1185.                         options
  1186.                     );
  1187.                 }
  1188.                 return this;
  1189.             },
  1190.             showToolbar: function(token) {
  1191.                 var sfwdt = this.getSfwdt(token);
  1192.                 removeClass(sfwdt, 'sf-display-none');
  1193.                 if (getPreference('toolbar/displayState') == 'none') {
  1194.                     document.getElementById('sfToolbarMainContent-' + token).style.display = 'none';
  1195.                     document.getElementById('sfToolbarClearer-' + token).style.display = 'none';
  1196.                     document.getElementById('sfMiniToolbar-' + token).style.display = 'block';
  1197.                 } else {
  1198.                     document.getElementById('sfToolbarMainContent-' + token).style.display = 'block';
  1199.                     document.getElementById('sfToolbarClearer-' + token).style.display = 'block';
  1200.                     document.getElementById('sfMiniToolbar-' + token).style.display = 'none';
  1201.                 }
  1202.             },
  1203.             hideToolbar: function(token) {
  1204.                 var sfwdt = this.getSfwdt(token);
  1205.                 addClass(sfwdt, 'sf-display-none');
  1206.             },
  1207.             initToolbar: function(token) {
  1208.                 this.showToolbar(token);
  1209.                 var hideButton = document.getElementById('sfToolbarHideButton-' + token);
  1210.                 var hideButtonSvg = hideButton.querySelector('svg');
  1211.                 hideButtonSvg.setAttribute('aria-hidden', 'true');
  1212.                 hideButtonSvg.setAttribute('focusable', 'false');
  1213.                 addEventListener(hideButton, 'click', function (event) {
  1214.                     event.preventDefault();
  1215.                     var p = this.parentNode;
  1216.                     p.style.display = 'none';
  1217.                     (p.previousElementSibling || p.previousSibling).style.display = 'none';
  1218.                     document.getElementById('sfMiniToolbar-' + token).style.display = 'block';
  1219.                     setPreference('toolbar/displayState', 'none');
  1220.                 });
  1221.                 var showButton = document.getElementById('sfToolbarMiniToggler-' + token);
  1222.                 var showButtonSvg = showButton.querySelector('svg');
  1223.                 showButtonSvg.setAttribute('aria-hidden', 'true');
  1224.                 showButtonSvg.setAttribute('focusable', 'false');
  1225.                 addEventListener(showButton, 'click', function (event) {
  1226.                     event.preventDefault();
  1227.                     var elem = this.parentNode;
  1228.                     if (elem.style.display == 'none') {
  1229.                         document.getElementById('sfToolbarMainContent-' + token).style.display = 'none';
  1230.                         document.getElementById('sfToolbarClearer-' + token).style.display = 'none';
  1231.                         elem.style.display = 'block';
  1232.                     } else {
  1233.                         document.getElementById('sfToolbarMainContent-' + token).style.display = 'block';
  1234.                         document.getElementById('sfToolbarClearer-' + token).style.display = 'block';
  1235.                         elem.style.display = 'none'
  1236.                     }
  1237.                     setPreference('toolbar/displayState', 'block');
  1238.                 });
  1239.             },
  1240.             loadToolbar: function(token, newToken) {
  1241.                 var that = this;
  1242.                 var triesCounter = document.getElementById('sfLoadCounter-' + token);
  1243.                 var options = {
  1244.                     retry: true,
  1245.                     onSend: function (count) {
  1246.                         if (count === 3) {
  1247.                             that.initToolbar(token);
  1248.                         }
  1249.                         if (triesCounter) {
  1250.                             triesCounter.textContent = count;
  1251.                         }
  1252.                     },
  1253.                 };
  1254.                 var cancelButton = document.getElementById('sfLoadCancel-' + token);
  1255.                 if (cancelButton) {
  1256.                     addEventListener(cancelButton, 'click', function (event) {
  1257.                         event.preventDefault();
  1258.                         options.stop = true;
  1259.                         that.hideToolbar(token);
  1260.                     });
  1261.                 }
  1262.                 newToken = (newToken || token);
  1263.                 this.load(
  1264.                     'sfwdt' + token,
  1265.                     '{{ url(\"_wdt\", { \"token\": \"xxxxxx\" })|escape('js') }}'.replace(/xxxxxx/, newToken),
  1266.                     function(xhr, el) {
  1267.                         /* Do nothing in the edge case where the toolbar has already been replaced with a new one */
  1268.                         if (!document.getElementById('sfToolbarMainContent-' + newToken)) {
  1269.                             return;
  1270.                         }
  1271.                         /* Evaluate in global scope scripts embedded inside the toolbar */
  1272.                         var i, scripts = [].slice.call(el.querySelectorAll('script'));
  1273.                         for (i = 0; i < scripts.length; ++i) {
  1274.                             eval.call({}, scripts[i].firstChild.nodeValue);
  1275.                         }
  1276.                         el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
  1277.                         if (el.style.display == 'none') {
  1278.                             return;
  1279.                         }
  1280.                         that.initToolbar(newToken);
  1281.                         /* Handle toolbar-info position */
  1282.                         var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
  1283.                         for (i = 0; i < toolbarBlocks.length; ++i) {
  1284.                             toolbarBlocks[i].onmouseover = function () {
  1285.                                 var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
  1286.                                 var pageWidth = document.body.clientWidth;
  1287.                                 var elementWidth = toolbarInfo.offsetWidth;
  1288.                                 var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
  1289.                                 var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
  1290.                                 /* Reset right and left value, useful on window resize */
  1291.                                 toolbarInfo.style.right = '';
  1292.                                 toolbarInfo.style.left = '';
  1293.                                 if (elementWidth > pageWidth) {
  1294.                                     toolbarInfo.style.left = 0;
  1295.                                 }
  1296.                                 else if (leftValue > 0 && rightValue > 0) {
  1297.                                     toolbarInfo.style.right = (rightValue * -1) + 'px';
  1298.                                 } else if (leftValue < 0) {
  1299.                                     toolbarInfo.style.left = 0;
  1300.                                 } else {
  1301.                                     toolbarInfo.style.right = '0px';
  1302.                                 }
  1303.                             };
  1304.                         }
  1305.                         renderAjaxRequests();
  1306.                         addEventListener(document.querySelector('.sf-toolbar-ajax-clear'), 'click', function() {
  1307.                             requestStack = [];
  1308.                             renderAjaxRequests();
  1309.                             successStreak = 4;
  1310.                             document.querySelector('.sf-toolbar-ajax-request-list').innerHTML = '';
  1311.                         });
  1312.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) {
  1313.                             var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  1314.                             elem.scrollTop = elem.scrollHeight;
  1315.                         });
  1316.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
  1317.                             event.preventDefault();
  1318.                             toggleClass(this.parentNode, 'hover');
  1319.                         });
  1320.                         var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
  1321.                         if (null !== dumpInfo) {
  1322.                             addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
  1323.                                 dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
  1324.                             });
  1325.                             addEventListener(dumpInfo, 'mouseleave', function () {
  1326.                                 dumpInfo.style.minHeight = '';
  1327.                             });
  1328.                         }
  1329.                     },
  1330.                     function(xhr) {
  1331.                         if (xhr.status !== 0 && !options.stop) {
  1332.                             var sfwdt = that.getSfwdt(token);
  1333.                             sfwdt.innerHTML = '\\
  1334.                                 <div class=\"sf-toolbarreset\">\\
  1335.                                     <div class=\"sf-toolbar-icon\"><svg width=\"26\" height=\"28\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" x=\"0px\" y=\"0px\" viewBox=\"0 0 26 28\" enable-background=\"new 0 0 26 28\" xml:space=\"preserve\"><path fill=\"#FFFFFF\" d=\"M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z\"/></svg></div>\\
  1336.                                     An error occurred while loading the web debug toolbar. <a href=\"{{ url(\"_profiler_home\")|escape('js') }}' + newToken + '>Open the web profiler.</a>\\
  1337.                                 </div>\\
  1338.                             ';
  1339.                             sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
  1340.                         }
  1341.                     },
  1342.                     options
  1343.                 );
  1344.                 return this;
  1345.             },
  1346.             toggle: function(selector, elOn, elOff) {
  1347.                 var tmp = elOn.style.display,
  1348.                     el = document.getElementById(selector);
  1349.                 elOn.style.display = elOff.style.display;
  1350.                 elOff.style.display = tmp;
  1351.                 if (el) {
  1352.                     el.style.display = 'none' === tmp ? 'none' : 'block';
  1353.                 }
  1354.                 return this;
  1355.             },
  1356.             createTabs: function() {
  1357.                 var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
  1358.                 /* create the tab navigation for each group of tabs */
  1359.                 for (var i = 0; i < tabGroups.length; i++) {
  1360.                     var tabs = tabGroups[i].querySelectorAll(':scope > .tab');
  1361.                     var tabNavigation = document.createElement('ul');
  1362.                     tabNavigation.className = 'tab-navigation';
  1363.                     var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
  1364.                     for (var j = 0; j < tabs.length; j++) {
  1365.                         var tabId = 'tab-' + i + '-' + j;
  1366.                         var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
  1367.                         var tabNavigationItem = document.createElement('li');
  1368.                         tabNavigationItem.setAttribute('data-tab-id', tabId);
  1369.                         if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
  1370.                         if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
  1371.                         tabNavigationItem.innerHTML = tabTitle;
  1372.                         tabNavigation.appendChild(tabNavigationItem);
  1373.                         var tabContent = tabs[j].querySelector('.tab-content');
  1374.                         tabContent.parentElement.setAttribute('id', tabId);
  1375.                     }
  1376.                     tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
  1377.                     addClass(document.querySelector('[data-tab-id=\"' + selectedTabId + '\"]'), 'active');
  1378.                 }
  1379.                 /* display the active tab and add the 'click' event listeners */
  1380.                 for (i = 0; i < tabGroups.length; i++) {
  1381.                     tabNavigation = tabGroups[i].querySelectorAll(':scope > .tab-navigation li');
  1382.                     for (j = 0; j < tabNavigation.length; j++) {
  1383.                         tabId = tabNavigation[j].getAttribute('data-tab-id');
  1384.                         document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';
  1385.                         if (hasClass(tabNavigation[j], 'active')) {
  1386.                             document.getElementById(tabId).className = 'block';
  1387.                         } else {
  1388.                             document.getElementById(tabId).className = 'hidden';
  1389.                         }
  1390.                         tabNavigation[j].addEventListener('click', function(e) {
  1391.                             var activeTab = e.target || e.srcElement;
  1392.                             /* needed because when the tab contains HTML contents, user can click */
  1393.                             /* on any of those elements instead of their parent '<li>' element */
  1394.                             while (activeTab.tagName.toLowerCase() !== 'li') {
  1395.                                 activeTab = activeTab.parentNode;
  1396.                             }
  1397.                             /* get the full list of tabs through the parent of the active tab element */
  1398.                             var tabNavigation = activeTab.parentNode.children;
  1399.                             for (var k = 0; k < tabNavigation.length; k++) {
  1400.                                 var tabId = tabNavigation[k].getAttribute('data-tab-id');
  1401.                                 document.getElementById(tabId).className = 'hidden';
  1402.                                 removeClass(tabNavigation[k], 'active');
  1403.                             }
  1404.                             addClass(activeTab, 'active');
  1405.                             var activeTabId = activeTab.getAttribute('data-tab-id');
  1406.                             document.getElementById(activeTabId).className = 'block';
  1407.                         });
  1408.                     }
  1409.                     tabGroups[i].setAttribute('data-processed', 'true');
  1410.                 }
  1411.             },
  1412.             createToggles: function() {
  1413.                 var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])');
  1414.                 for (var i = 0; i < toggles.length; i++) {
  1415.                     var elementSelector = toggles[i].getAttribute('data-toggle-selector');
  1416.                     var element = document.querySelector(elementSelector);
  1417.                     addClass(element, 'sf-toggle-content');
  1418.                     if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {
  1419.                         addClass(toggles[i], 'sf-toggle-on');
  1420.                         addClass(element, 'sf-toggle-visible');
  1421.                     } else {
  1422.                         addClass(toggles[i], 'sf-toggle-off');
  1423.                         addClass(element, 'sf-toggle-hidden');
  1424.                     }
  1425.                     addEventListener(toggles[i], 'click', function(e) {
  1426.                         e.preventDefault();
  1427.                         if ('' !== window.getSelection().toString()) {
  1428.                             /* Don't do anything on text selection */
  1429.                             return;
  1430.                         }
  1431.                         var toggle = e.target || e.srcElement;
  1432.                         /* needed because when the toggle contains HTML contents, user can click */
  1433.                         /* on any of those elements instead of their parent '.sf-toggle' element */
  1434.                         while (!hasClass(toggle, 'sf-toggle')) {
  1435.                             toggle = toggle.parentNode;
  1436.                         }
  1437.                         var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));
  1438.                         toggleClass(toggle, 'sf-toggle-on');
  1439.                         toggleClass(toggle, 'sf-toggle-off');
  1440.                         toggleClass(element, 'sf-toggle-hidden');
  1441.                         toggleClass(element, 'sf-toggle-visible');
  1442.                         /* the toggle doesn't change its contents when clicking on it */
  1443.                         if (!toggle.hasAttribute('data-toggle-alt-content')) {
  1444.                             return;
  1445.                         }
  1446.                         if (!toggle.hasAttribute('data-toggle-original-content')) {
  1447.                             toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);
  1448.                         }
  1449.                         var currentContent = toggle.innerHTML;
  1450.                         var originalContent = toggle.getAttribute('data-toggle-original-content');
  1451.                         var altContent = toggle.getAttribute('data-toggle-alt-content');
  1452.                         toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
  1453.                     });
  1454.                     /* Prevents from disallowing clicks on links inside toggles */
  1455.                     var toggleLinks = toggles[i].querySelectorAll('a');
  1456.                     for (var j = 0; j < toggleLinks.length; j++) {
  1457.                         addEventListener(toggleLinks[j], 'click', function(e) {
  1458.                             e.stopPropagation();
  1459.                         });
  1460.                     }
  1461.                     /* Prevents from disallowing clicks on \"copy to clipboard\" elements inside toggles */
  1462.                     var copyToClipboardElements = toggles[i].querySelectorAll('span[data-clipboard-text]');
  1463.                     for (var k = 0; k < copyToClipboardElements.length; k++) {
  1464.                         addEventListener(copyToClipboardElements[k], 'click', function(e) {
  1465.                             e.stopPropagation();
  1466.                         });
  1467.                     }
  1468.                     toggles[i].setAttribute('data-processed', 'true');
  1469.                 }
  1470.             },
  1471.             initializeLogsTable: function() {
  1472.                 Sfjs.updateLogsTable();
  1473.                 document.querySelectorAll('.log-filter input').forEach((input) => {
  1474.                     input.addEventListener('change', () => { Sfjs.updateLogsTable(); });
  1475.                 });
  1476.                 document.querySelectorAll('.filter-select-all-or-none button').forEach((link) => {
  1477.                     link.addEventListener('click', () => {
  1478.                         const selectAll = link.classList.contains('select-all');
  1479.                         link.closest('.log-filter-content').querySelectorAll('input').forEach((input) => {
  1480.                             input.checked = selectAll;
  1481.                         });
  1482.                         Sfjs.updateLogsTable();
  1483.                     });
  1484.                 });
  1485.                 document.body.addEventListener('click', (event) => {
  1486.                     document.querySelectorAll('details.log-filter').forEach((filterElement) => {
  1487.                         if (!filterElement.contains(event.target) && filterElement.open) {
  1488.                             filterElement.open = false;
  1489.                         }
  1490.                     });
  1491.                 });
  1492.             },
  1493.             updateLogsTable: function() {
  1494.                 const selectedType = document.querySelector('#log-filter-type input:checked').value;
  1495.                 const priorities = document.querySelectorAll('#log-filter-priority input');
  1496.                 const allPriorities = Array.from(priorities).map((input) => input.value);
  1497.                 const selectedPriorities = Array.from(priorities).filter((input) => input.checked).map((input) => input.value);
  1498.                 const channels = document.querySelectorAll('#log-filter-channel input');
  1499.                 const selectedChannels = Array.from(channels).filter((input) => input.checked).map((input) => input.value);
  1500.                 const logs = document.querySelector('table.logs');
  1501.                 if (null === logs) {
  1502.                     return;
  1503.                 }
  1504.                 /* hide rows that don't match the current filters */
  1505.                 let numVisibleRows = 0;
  1506.                 logs.querySelectorAll('tbody tr').forEach((row) => {
  1507.                     if ('all' !== selectedType && selectedType !== row.getAttribute('data-type')) {
  1508.                         row.style.display = 'none';
  1509.                         return;
  1510.                     }
  1511.                     const priority = row.getAttribute('data-priority');
  1512.                     if (false === selectedPriorities.includes(priority) && true === allPriorities.includes(priority)) {
  1513.                         row.style.display = 'none';
  1514.                         return;
  1515.                     }
  1516.                     if ('' !== row.getAttribute('data-channel') && false === selectedChannels.includes(row.getAttribute('data-channel'))) {
  1517.                         row.style.display = 'none';
  1518.                         return;
  1519.                     }
  1520.                     row.style.display = 'table-row';
  1521.                     numVisibleRows++;
  1522.                 });
  1523.                 document.querySelector('table.logs').style.display = 0 === numVisibleRows ? 'none' : 'table';
  1524.                 document.querySelector('.no-logs-message').style.display = 0 === numVisibleRows ? 'block' : 'none';
  1525.                 /* update the selected totals of all filters */
  1526.                 document.querySelector('#log-filter-priority .filter-active-num').innerText = (priorities.length === selectedPriorities.length) ? 'All' : selectedPriorities.length;
  1527.                 document.querySelector('#log-filter-channel .filter-active-num').innerText = (channels.length === selectedChannels.length) ? 'All' : selectedChannels.length;
  1528.                 /* update the currently selected \"log type\" tab */
  1529.                 document.querySelectorAll('#log-filter-type li').forEach((tab) => tab.classList.remove('active'));
  1530.                 document.querySelector(`#log-filter-type input[value=\"\${selectedType}\"]`).parentElement.classList.add('active');
  1531.             },
  1532.         };
  1533.     })();
  1534.     Sfjs.addEventListener(document, 'DOMContentLoaded', function() {
  1535.         Sfjs.createTabs();
  1536.         Sfjs.createToggles();
  1537.     });
  1538. }
  1539. /*]]>*/</script>
  1540. ""@WebProfiler/Profiler/base_js.html.twig""/home/bardahls/shopware/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base_js.html.twig");
  1541.     }
  1542. }