{"version":3,"sources":["scripts/browser-update.js"],"sourcesContent":["//browser-update.org notification script, <browser-update.org>\n//Copyright (c) 2007-2009, MIT Style License <browser-update.org/LICENSE.txt>\n\n/* eslint-disable no-var */\n\n(function () {\n  var $buo = function () {\n    // Sometimes we have to resort to parsing the user agent string. :(\n    if (navigator && navigator.userAgent) {\n      var ua = navigator.userAgent;\n\n      // we don't ask Googlebot to update their browser\n      if (\n        ua.indexOf(\"Googlebot\") >= 0 ||\n        ua.indexOf(\"Mediapartners\") >= 0 ||\n        ua.indexOf(\"AdsBot\") >= 0\n      ) {\n        return;\n      }\n    }\n\n    if (!window.unsupportedBrowser) {\n      return;\n    }\n\n    document.getElementsByTagName(\"body\")[0].className += \" crawler\";\n    var noscriptElements = document.getElementsByTagName(\"noscript\");\n    // find the element with the \"data-path\" attribute set\n    for (var i = noscriptElements.length - 1; i >= 0; i--) {\n      var element = noscriptElements[i];\n\n      // noscriptElements[i].innerHTML contains encoded HTML, so we need to access\n      // the childNodes instead. Browsers seem to split very long content into multiple\n      // text childNodes.\n      var result = \"\";\n      for (var j = 0; j < element.childNodes.length; j++) {\n        result += element.childNodes[j].nodeValue;\n      }\n\n      if (element.getAttribute(\"data-path\")) {\n        document.getElementById(\"main\").outerHTML = result;\n      } else {\n        element.outerHTML = result;\n      }\n    }\n\n    // retrieve localized browser upgrade text\n    var t = I18n.t(\"browser_update\"); // eslint-disable-line no-undef\n    if (t.indexOf(\".browser_update]\") !== -1) {\n      // very old browsers might fail to load even translations\n      t =\n        'Unfortunately, <a href=\"https://www.discourse.org/faq/#browser\">your browser is unsupported</a>. Please <a href=\"https://browsehappy.com\">switch to a supported browser</a> to view rich content, log in and reply.';\n    }\n\n    // create the notification div HTML\n    var div = document.createElement(\"div\");\n    div.className = \"buorg\";\n    div.innerHTML = \"<div>\" + t + \"</div>\";\n\n    // create the notification div stylesheet\n    var sheet = document.createElement(\"style\");\n    var style =\n      \".buorg {position:absolute; z-index:111111; width:100%; top:0px; left:0px; background:#FDF2AB; text-align:left; font-family: sans-serif; color:#000; font-size: 14px;} .buorg div {padding: 8px;} .buorg a, .buorg a:visited {color:#E25600; text-decoration: underline;} @media print { .buorg { display: none !important; } }\";\n\n    // insert the div and stylesheet into the DOM\n    document.body.appendChild(div); // put it last in the DOM so Googlebot doesn't include it in search excerpts\n    document.getElementsByTagName(\"head\")[0].appendChild(sheet);\n    try {\n      sheet.innerText = style;\n      sheet.innerHTML = style;\n    } catch (e) {\n      try {\n        sheet.styleSheet.cssText = style;\n      } catch (ex) {\n        return;\n      }\n    }\n\n    // shift the body down to make room for our notification div\n    document.body.style.marginTop = div.clientHeight + \"px\";\n  };\n\n  $bu = $buo(); // eslint-disable-line no-undef\n})(this);\n"],"names":["$buo","navigator","userAgent","ua","indexOf","window","unsupportedBrowser","document","getElementsByTagName","className","noscriptElements","i","length","element","result","j","childNodes","nodeValue","getAttribute","getElementById","outerHTML","t","I18n","div","createElement","innerHTML","sheet","style","body","appendChild","innerText","e","styleSheet","cssText","ex","marginTop","clientHeight","$bu"],"mappings":"AAAA;AACA;;AAEA;AAEA,CAAC,YAAY;EACX,IAAIA,IAAI,GAAG,YAAY;IACrB;IACA,IAAIC,SAAS,IAAIA,SAAS,CAACC,SAA3B,EAAsC;MACpC,IAAIC,EAAE,GAAGF,SAAS,CAACC,SAAnB,CADoC,CAGpC;;MACA,IACEC,EAAE,CAACC,OAAH,CAAW,WAAX,KAA2B,CAA3B,IACAD,EAAE,CAACC,OAAH,CAAW,eAAX,KAA+B,CAD/B,IAEAD,EAAE,CAACC,OAAH,CAAW,QAAX,KAAwB,CAH1B,EAIE;QACA;MACD;IACF;;IAED,IAAI,CAACC,MAAM,CAACC,kBAAZ,EAAgC;MAC9B;IACD;;IAEDC,QAAQ,CAACC,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,EAAyCC,SAAzC,IAAsD,UAAtD;IACA,IAAIC,gBAAgB,GAAGH,QAAQ,CAACC,oBAAT,CAA8B,UAA9B,CAAvB,CApBqB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