{"version":3,"sources":["settings.js","_html/common/body_tag_1.js","_html/common/body_tag_2.js"],"names":["window","require","registerSettings","enable_homepage","theme_uploads","adminPages","isAdminPage","console","log","forEach","page","location","pathname","indexOf","$","insertBefore","startsWith","loadList","addLoadListener","moduleName","push","addEventListener","filter","listItem","length","dispatchEvent","CustomEvent","css","document","comboBox","getElementsByClassName","event","querySelector","style","maxWidth","navigator","userAgent","match","setTimeout","injectScript","src","script","createElement","async","head","appendChild","inject","filename","includes","isJS","cssNode","setAttribute","injectStylesheet","injectGA4","currentContact","_infl","hub","features","siteSettings","Discourse","SiteSettings","tracking_id","influitive_hub_google_analytics_4_tracking_id","influitive_google_analytics_4_tracking_id","influitive_disable_user_tracking_cookies","scriptText","id","influitive_ga4_tracking_id","hub_ga_tracking_id","text","getElementsByTagName","firstChild","injectGA","hubId","influitive_hub_google_analytics_tracking_id","className","type","influitive_google_analytics_tracking_id","influitive_subdomain","assets","Object","keys","standaloneChallengeViewInstance","ChallengeModalViewSafeGuard","open","challenge","get","then","configResponse","config","tokenUrl","baseUrl","api","url","post","token","ajax","method","headers","X_JWT_TOKEN","X_ORG_ID","data","attr","obj","C2HomepageEnabled","discourseHomepage","_inflTheme","themeColorPrimary","inflComp","ChallengeModalView","pusherKey","Pusher","subscribe","bind","Event","currentUser","hasLoggedIntoMaven","deepLinkUrl","URL","decodeURI","influnetLink","replace","catch","err","response","other","status","getElementById","classList","add","default","app","analytics","logEvent","name","parameters","callback","undefined"],"mappings":"AACM,YAAaA,QACfC,QAAQ,sCAAsCC,iBAAiB,IAAK,CAACC,iBAAkB,EAAKC,cAAgB,CAAC,2BAA2B,oGAAoG,yBAAyB,oGAAoG,2BAA2B,oGAAoG,4BAA4B,oGAAoG,8BAA8B;ACDxoB,MAAMC,WAAa,CAAC,gBAAiB;AACrC,IAAIC,aAAc;AAClBC,QAAQC,IAAI,uDAEZH,WAAWI,SAAQC,IACbV,OAAOW,SAASC,SAASC,QAAQH,IAAS,IAC5CJ,aAAc,EA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OR,EAAIO,WACPE,UAAUT,EAAI/C,IAAIU,IAE/B+C,KAAK,wBAAwB,SAASZ,GAC5CrG,OAAOyB,cAAc,IAAIyF,MAAM,mCACjC,IA2DM1C,EAASxE,OAAOuD,MAAMD,eAAgBmB,GACtCpB,EAAUrD,OAAOuD,MAAMD,gBACnBnB,UAAUC,UAAUY,SAAS,YAC3Bb,UAAUC,UAAUY,SAAS,UAC9BhD,OAAOuD,MAAM4D,YAAYC,oBA1DpC,WACE,IAAIC,EAAczF,SAAS0F;AAC3BD,EAAcE,UAAUF;AACxB,MACMG,EAAeH,EAAYI,QADb,iBACkC;AACtDzH,OAAOW,SAAW6G,CACnB,CAND,GA8DW5F,SAASI,cAAc,wBAC1BhC,OAAOuD,MAAMwB,OAAO,WAAWtE,QAAQqC,GACvC9C,OAAOuD,MAAMwB,OAAuB,eAAEtE,QAAQqC,GAElD,GACF,IAAG4E,OAAM,SAASC,EAAKC,EAAUC,GAEZ,MAAfF,EAAIG,SACN9H,OAAOuD,MAAMwB,OAAO,WAAWtE,QAAQqC,GACvC0B,EAAS,KAAMC,GACfpB,EAAU,OAEZzB,SAASmG,eAAe,eAAeC,UAAUC,IAAI,kBACvD,GACF,GACF,MAEEnH,EAAEwE,IAAI,gDAAgDC,MAAK,SAASqC,GAClEA,EAASvB,KAAKtB,OAAOmD,QAAQzH,QAAQqC,EACvC;AAGF9C,OAAOmI,IAAM,CAAC,EACdnI,OAAOmI,IAAIC,UAAY,CACrBC,SAAW,SAASC,EAAMC,EAAYC,GACpCjI,QAAQC,IAAI,kDACOiI,IAAbD,GACFA,GAEN,EAEH,CAtND","sourceRoot":"theme-166/","sourcesContent":["(function() {\n  if ('require' in window) {\n    require(\"discourse/lib/theme-settings-store\").registerSettings(166, {\"enable_homepage\":true,\"theme_uploads\":{\"proximanova-regular-woff\":\"https://discourse-static.influitive.net/original/1X/554789866cc41b30c2d20c29157547f610d37e48.woff\",\"proximanova-light-woff\":\"https://discourse-static.influitive.net/original/1X/bb724e0609dd3bfbef5660cd1250ceb74def4f9e.woff\",\"proximanova-lightit-woff\":\"https://discourse-static.influitive.net/original/1X/5ef2fa0d95dd36ff21d233177ea8ebb14e507faf.woff\",\"proximanova-semibold-woff\":\"https://discourse-static.influitive.net/original/1X/d3d0db670554257454da02196a666d82f0fe3c78.woff\",\"proximanova-semiboldit-woff\":\"https://discourse-static.influitive.net/original/1X/39e07f77b7741e5c3a31bd123007f561204f57de.woff\"}});\n  }\n})();\n","\n  const adminPages = ['/forum/review', '/forum/admin'];\n  let isAdminPage = false;\n  console.log('--- Influitive Discourse Theme (Check for Widgets?)');\n\n  adminPages.forEach(page => {\n    if (window.location.pathname.indexOf(page) > -1) {\n      isAdminPage = true;\n      return;\n    }\n  });\n\n  if (isAdminPage) {\n    $(\"<header id='infl-fe-admin-nav'></header>\").insertBefore(\"#main\");\n  } else {\n    $(\"<header id='infl-fe-advocate-nav'></header>\").insertBefore(\"#main\");\n  }\n\n  if (!window.location.pathname.startsWith('/forum/admin')) {\n    $('<style>#main, #custom-footer { visibility: hidden; }</style>').insertBefore(\"#main\");\n  }\n\n  let loadList = [];\n  \n  document.addEventListener(\"DOMContentLoaded\", function() {\n    const comboBox = document.getElementsByClassName('category-drop')[0];\n    if (comboBox) {\n      comboBox.addEventListener('change', function(event) {\n        if (document.querySelector('.nav-item_my_votes')) {\n            document.querySelector('.select-kit.combo-box.category-drop .badge-wrapper .badge-category').style.maxWidth = '105px';\n        } else {\n          document.querySelector('.select-kit.combo-box.category-drop .badge-wrapper .badge-category').style.maxWidth = '260px';\n        }\n      });\n    }\n  });\n\n  function addLoadListener(moduleName) {\n    loadList.push(moduleName);\n\n    window.addEventListener(`${moduleName}::LOADED`, () => {\n      loadList = loadList.filter(listItem => listItem === moduleName);\n      if (loadList.length === 0) {\n        window.dispatchEvent(new CustomEvent('scroll'));\n        $('#main').css('visibility', 'visible');\n        $('#custom-footer').css('visibility', 'visible');\n      }\n    });\n  }\n\n  if (navigator.userAgent.match(/Android|iPhone/i)) {\n    $('#main').css('visibility', 'visible');\n    $('#custom-footer').css('visibility', 'visible');\n  } else {\n    addLoadListener('ADVOCATE_NAV');\n    addLoadListener('CHALLENGES_CAROUSEL');\n  }\n\n\n  setTimeout(() => {\n    $('#main').css('visibility', 'visible');\n    $('#custom-footer').css('visibility', 'visible');\n  }, 5000);\n\n","\n(function(){\n// GENERAL HELPER FUNCTIONS\nfunction getUrlParameter(name) {\n    const reg = new RegExp(`[?&]${name}=([^&#]*)`);\n    const string = reg.exec(window.location.href);\n    return string ? string[1] : null;\n  }\n  function unnest(response) { return response['data'] || {}; }\n  function isJS(filename) { return filename.includes('.js') }\n  function injectScript(src) {\n    const script = document.createElement('script');\n    script.src = src;\n    script.async = false;\n    document.head.appendChild(script);\n  }\n  function injectStylesheet(src) {\n    const cssNode = document.createElement('link');\n    cssNode.setAttribute('rel', 'stylesheet');\n    cssNode.setAttribute('href', src);\n    document.head.appendChild(cssNode);\n  }\n  function inject(filename) { isJS(filename) ? injectScript(filename) : injectStylesheet(filename); }\n\n  function injectGA4(currentContact) {\n    if (!_infl.hub.features.includes('google_analytics4')) {\n      return\n    }\n    // AI-GEN START - Cursor\n    const siteSettings = Discourse.SiteSettings;\n    const tracking_id = siteSettings.influitive_hub_google_analytics_4_tracking_id ||\n      siteSettings.influitive_google_analytics_4_tracking_id;\n\n    if (!siteSettings.influitive_disable_user_tracking_cookies && tracking_id != null) {\n      injectScript(`https://www.googletagmanager.com/gtag/js?id=${tracking_id}`);\n      const script = document.createElement('script');\n\n      var scriptText = `\n        window.dataLayer = window.dataLayer || [];\\n\n        function gtag(){dataLayer.push(arguments);}\\n\n        gtag('js', new Date());\\n\n      `\n      if (currentContact != null) {\n        scriptText += `gtag('set', { 'user_id': '${currentContact.id}' });\\n`;\n      }\n\n      const influitive_ga4_tracking_id = siteSettings.influitive_hub_google_analytics_4_tracking_id;\n      if (influitive_ga4_tracking_id != '') {\n        scriptText += `gtag('config', '${influitive_ga4_tracking_id}');\\n`;\n      }\n\n      const hub_ga_tracking_id = siteSettings.influitive_google_analytics_4_tracking_id;\n      if (hub_ga_tracking_id != '') {\n        scriptText += `gtag('config', '${hub_ga_tracking_id}');\\n`;\n      }\n\n      script.text = scriptText;\n\n      script.async = false;\n      script.id = 'infl-ga4';\n      var head = document.getElementsByTagName(\"head\")[0];\n      head.insertBefore(script, head.firstChild);\n    }\n  }\n\n  function injectGA(currentContact, hubId) {\n    const siteSettings = Discourse.SiteSettings;\n    if (!siteSettings.influitive_disable_user_tracking_cookies && siteSettings.influitive_hub_google_analytics_tracking_id != null) {\n      const script = document.createElement('script');\n\n      //ESR-468: Onetrust Cookie Management needs us to add a class attribute and text/plain type for user consent\n      //hubId is vmware\n      if (hubId === '46a3915d-3953-465b-a09a-6d6afcfb83a2') {\n        script.className = 'optanon-category-C0002';\n        script.type = 'text/plain'\n      }\n\n      var scriptText = \"(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\\n\";\n      scriptText += `ga('create', '${siteSettings.influitive_hub_google_analytics_tracking_id}', 'auto', 'influitive', {'allowLinker': true});\\n`;\n      scriptText += \"ga('influitive.require', 'linkid', 'linkid.js');\\n\";\n      scriptText += \"ga('influitive.require', 'linker');\\n\";\n\n      if (currentContact != null) {\n        scriptText += `ga('influitive.set', 'userId', '${currentContact.id}');\\n`;\n      }\n      scriptText += \"ga('influitive.send', 'pageview');\\n\";\n\n      if (siteSettings.influitive_google_analytics_tracking_id != '') {\n        scriptText += `ga('create', '${siteSettings.influitive_google_analytics_tracking_id}', 'auto', '${siteSettings.influitive_subdomain}');\\n`;\n        scriptText += `ga('${siteSettings.influitive_subdomain}.require', 'linkid', 'linkid.js');\\n`;\n        scriptText += `ga('${siteSettings.influitive_subdomain}.require', 'linker');\\n`;\n\n        if (currentContact != null) {\n          scriptText += `ga('${siteSettings.influitive_subdomain}.set', 'userId', '${currentContact.id}');\\n`;\n        }\n\n        scriptText += `ga('${siteSettings.influitive_subdomain}.send', 'pageview');`;\n        // AI-GEN END\n      }\n\n      script.text = scriptText;\n\n      script.async = false;\n      script.id = 'infl-ga';\n      var head = document.getElementsByTagName(\"head\")[0];\n      head.insertBefore(script, head.firstChild);\n    }\n  }\n\n  function enablePusher(obj) {\n    if (!obj.pusherKey) return;\n\n    var pusher = new Pusher(obj.pusherKey);\n    var channel = pusher.subscribe(obj.hub.id);\n\n    channel.bind('activity_feed_update', function(data) {\n      window.dispatchEvent(new Event('influitive:activity-feed-update'));\n    });\n  }\n\n  // DEEP LINKER HELPER FUNCTION\n  function injectDeepLinkHelper() {\n    (function() {\n      let deepLinkUrl = document.URL;\n      deepLinkUrl = decodeURI(deepLinkUrl);\n      const schemeRegex = /^(https?):\\/\\//;\n      const influnetLink = deepLinkUrl.replace(schemeRegex, 'influnet://');\n      window.location = influnetLink;\n    })();\n  }\n\n  if (window._infl && window._infl.assets && Object.keys(window._infl.assets).length > 0) {\n    var standaloneChallengeViewInstance;\n    var ChallengeModalViewSafeGuard = function ChallengeModalViewSafeGuard() {\n      return {\n        open: function open(challenge) {\n          return standaloneChallengeViewInstance ? standaloneChallengeViewInstance.open(challenge) : window.location = \"/challenges/\" + challenge.id;\n        }\n      };\n    };\n\n    // TODO: maybe we can move this plugin and store in advance\n    $.get('/api/company_config').then(function(configResponse) {\n      const config = unnest(configResponse);\n      const tokenUrl = config.hub.tokenUrl;\n      const baseUrl = config.api.url;\n      const hubId = config.hub.id;\n\n      return $.post(tokenUrl).then(function(token) {\n        $.ajax({\n          url: baseUrl + '/api/c2_homepage/infl_window_object',\n          method: 'get',\n          headers: { \"X_JWT_TOKEN\": token, \"X_ORG_ID\": hubId }\n        }).then(function(data) {\n          window._infl = window._infl || {};\n          for (var attr in data) {\n            window._infl[attr] = data[attr];\n          }\n          window._infl.C2HomepageEnabled = true;\n          window._infl.discourseHomepage = true;\n          window._inflTheme = window._infl['branding'] || { themeColorPrimary: '#007EA7' };\n          window.inflComp = {};\n\n          // Set View constructor to an initial value to guard against instantiation\n          // before real ChallengeModalView is loaded\n          window.inflComp.ChallengeModalView = ChallengeModalViewSafeGuard;\n\n          window.addEventListener('challenge-player:modal:ready', () => {\n            // Real challengeModalView is loaded meaning the safeguard has been overwritten\n            // assign an instance of the real challengeModalView so that already\n            // instantiated safeguard instances will now use it\n            standaloneChallengeViewInstance = window.inflComp.ChallengeModalView();\n          });\n\n          enablePusher(window._infl);\n\n          injectGA(window._infl.currentContact, hubId);\n          injectGA4(window._infl.currentContact);\n          if (navigator.userAgent.includes('iPhone')\n            && !navigator.userAgent.includes('maven')\n            && window._infl.currentUser.hasLoggedIntoMaven) {\n            injectDeepLinkHelper();\n          }\n\n          if (!document.querySelector('[data-infl-script]')) {\n            window._infl.assets['infl-fe'].forEach(inject);\n            window._infl.assets['community_feed'].forEach(inject);\n          }\n        });\n      }).catch(function(err, response, other) {\n        // public discussion mode\n        if (err.status === 401) {\n          window._infl.assets['infl-fe'].forEach(inject)\n          injectGA(null, hubId);\n          injectGA4(null);\n        }\n        document.getElementById('main-outlet').classList.add('public-homepage');\n      });\n    });\n  } else {\n    // Use orchestrator since assets aren't loaded by Discourse\n    $.get('/api/plugin_assets/discourse-fe-orchestrator').then(function(response) {\n      response.data.assets.default.forEach(inject);\n    });\n  }\n\n  window.app = {};\n  window.app.analytics = {\n    logEvent : function(name, parameters, callback) {\n      console.log(\"app.analytics is not enabled on this page\");\n        if (callback !== undefined) {\n          callback();\n        }\n    }\n  }\n})();\n\n"]}