{"version":3,"file":"main.6LuTWi.js","sources":["theme-30/virtual:theme","theme-30/discourse/components/footer.gjs","theme-30/discourse/components/privacy-button.gjs","theme-30/discourse/api-initializers/initializer.gjs","theme-30/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(30);\n\nexport function themePrefix(key) {\n  return `theme_translations.30.${key}`;\n}\n","import Component from \"@glimmer/component\";\nimport { get } from \"@ember/helper\";\nimport dIcon from \"discourse/ui-kit/helpers/d-icon\";\nimport { i18n } from \"discourse-i18n\";\nimport { service } from \"@ember/service\";\nimport { tracked } from \"@glimmer/tracking\";\nimport { action } from \"@ember/object\";\nimport { on } from \"@ember/modifier\";\n\nexport default class Footer extends Component {\n  \n  @service appEvents;\n  \n  @tracked message = \"Waiting for event...\";\n\n  currentYear = new Date().getFullYear();\n\n\n  constructor() {\n    super(...arguments);\n    this.appEvents.on(\"cookie-banner:loaded\", this, this.reactToEvent);\n  }\n\n  willDestroy() {\n    this.appEvents.off(\"cookie-banner:loaded\", this, this.reactToEvent);\n    super.willDestroy();\n  }\n\n  @action\n  reactToEvent(complianceLinksCount) {\n    this.message = complianceLinksCount;\n  }\n\n  get showCaliforniaLink() {\n    // the event from the Cookie Compliance script fires if it is a hard page reload (and sends the message # of links payload)\n    // given SPA nature of Discourse - we do a second check to see if the compliance links *aleady* exist, because the event is fired only on hard reload\n    return this.message === 2 || this.doComplianceLinksExist;\n  }\n\n  get doComplianceLinksExist() {\n    const listItemSize = document.querySelectorAll('#compliance-universal-container ul > li').length - 1; \n    return listItemSize === 2;\n  }\n\n  <template>\n    <footer class=\"footer\">\n      <div class=\"footer__wrap\">\n        <div class=\"footer__social\">\n          {{#each settings.footer_social_links as |link|}}\n            <a\n              class=\"footer__social-link\"\n              href={{link.url}}\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n              aria-label={{link.label}}\n            >{{dIcon link.icon}}</a>\n          {{/each}}\n        </div>\n\n        <div class=\"footer__logo\">\n          <img\n            src={{get settings.theme_uploads \"wordmark-footer-dark\"}}\n            alt=\"HubSpot\"\n          />\n        </div>\n\n        <p class=\"footer__copyright\">{{i18n\n            (themePrefix \"footer.copyright\")\n            year=this.currentYear\n          }}</p>\n\n        <nav class=\"footer__legal\" aria-label=\"Legal links\">\n          <ul>\n            {{#each settings.footer_legal_links as |link|}}\n              <li>\n                <a\n                  class=\"footer__legal-link\"\n                  href={{link.url}} \n                  target=\"_blank\"\n                  rel=\"noopener noreferrer\"\n                >{{i18n (themePrefix link.label)}}</a>\n              </li>\n            {{/each}}\n            <li>\n              <a href=\"#\" data-link-name=\"manage-cookies\" class=\"footer__legal-link\" role=\"button\" {{on \"click\" this.followLink}}>\n                {{i18n (themePrefix \"privacy.manage_cookies\")}}\n              </a>\n            </li>\n            {{#if this.showCaliforniaLink }}\n            <li class=\"ccpc-list-item\">\n              <img\n                src=\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGFyaWEtbGFiZWw9IkNhbGlmb3JuaWEgQ29uc3VtZXIgUHJpdmFjeSBBY3QgKENDUEEpIE9wdC1PdXQgSWNvbiIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMzAgMTQiIGNsYXNzPSJocy1wcml2YWN5LWNob2ljZXMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMwIDE0OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGc+PGcgaWQ9ImZpbmFsLS0tZGVjLjExLTIwMjBfMV8iPjxnIGlkPSJfeDMwXTIwOC1vdXItdG9nZ2xlXzJfIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTI3NS4wMDAwMDAsIC0yMDAuMDAwMDAwKSI+PG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y0wLjItLTAuMi0wLjItMC42LDAtMC44bDAsMEwyMC44LDdsLTIuMi0yLjJjLTAuMi0wLjItMC4yLTAuNiwwLTAuOGMwLjItMC4yLDAuNi0wLjIsMC44LDBsMCwwbDIuMiwyLjJMMjMuOCw0QzI0LDMuOCwyNC40LDMuOCwyNC42LDR6Ij48L3BhdGg+PHBhdGggaWQ9InkiIGZpbGw9IiMwMDY2RkYiIGQ9Ik0xMi43LDQuMWMwLjIsMC4yLDAuMywwLjYsMC4xLDAuOGwwLDBMOC42LDkuOEM4LjUsOS45LDguNCwxMCw4LjMsMTBjLTAuMiwwLjEtMC41LDAuMS0wLjctMC4xbDAsMEw1LjQsNy43Yy0wLjItLTAuMi0wLjItMC42LDAtMC44YzAuMi0wLjIsMC42LTAuMiwwLjgsMGwwLDBMOCw4LjZsMy44LTQuNUMxMiwzLjksMTIuNCwzLjksMTIuNyw0LjF6Ij48L3BhdGg+PC9nPjwvZz48L2c+PC9nPjwvc3ZnPg==\"\n                alt=\"CCPC privacy icon\"\n              />\n              <a href=\"#\" data-link-name=\"privacy-choices\" class=\"footer__legal-link\" role=\"button\" {{on \"click\" this.followLink}}>\n                {{i18n (themePrefix \"privacy.your_privacy_choices\")}}\n              </a>\n            </li>\n             {{/if}}\n          </ul>\n        </nav>\n      </div>\n    </footer>\n  </template>\n\n  @action\n  followLink(event) {\n    event.preventDefault();\n    const name = event.currentTarget.dataset.linkName; \n    const complianceContainerElement = document.querySelector('#compliance-universal-container');\n    if (name === \"manage-cookies\") {\n      complianceContainerElement.querySelector('li.hs-footer-cookie-settings > a')?.click();\n    } else if (name === \"privacy-choices\") {\n      complianceContainerElement.querySelector('li.hs-opt-out-settings > a')?.click();\n    }\n  }\n}\n","/* eslint-disable ember/template-no-invalid-interactive */\nimport Component from \"@glimmer/component\";\nimport { get } from \"@ember/helper\";\nimport { tracked } from \"@glimmer/tracking\";\nimport DButton from \"discourse/components/d-button\";\nimport DModal from \"discourse/components/d-modal\";\nimport { service } from \"@ember/service\";\nimport { i18n } from \"discourse-i18n\";\nimport { getOwner } from \"@ember/application\";\nimport { action } from \"@ember/object\";\nimport { on } from \"@ember/modifier\";\n\nexport default class PrivacyButton extends Component {\n  @service router;\n\n  @tracked modalIsVisible = false;\n\n  currentYear = new Date().getFullYear();\n\n  showModal = () => {\n    this.modalIsVisible = true;\n  };\n\n  closeModal = () => {\n    this.modalIsVisible = false;\n  };\n\n  @action\n  manageCookies() {\n    // this DOM element is added by the discourse-cookie-banner plugin dynamically\n    document.querySelector(\"#compliance-universal-container .hs-footer-cookie-settings > a\").click();\n  }\n\n  get isTopicPage() {\n    return this.router.currentRouteName?.startsWith(\"topic\");\n  }\n\n  get isCategoryPage() {\n    return ( \n      this.router.currentRouteName === \"discovery.categories\" ||\n      this.router.currentRouteName === \"discovery.category\"\n    );\n  }\n\n\n  get shouldDisplayOnTopicPage() {   \n    const controller = getOwner(this).lookup(\"controller:topic\");\n    const model = controller?.model ?? null;\n    return model?.posts_count > 20;\n  }\n\n  get shouldDisplayOnCategoryPage() {\n    const topicsCount = this.router.currentRoute.attributes?.category?.totalTopicCount ?? 0;\n    return topicsCount > 20;\n  }\n\n  get shouldShowButton() {\n    if (\n      this.router.currentRouteName === \"discovery.latest\"\n    ) {\n      return true;\n    } else if (this.isTopicPage) {\n      return this.shouldDisplayOnTopicPage;\n    } else if (this.isCategoryPage) {\n      return this.shouldDisplayOnCategoryPage;\n    }\n    return false;\n  }\n\n  /** \n   * The dynamic compliance <li> elements are injected by the discourse-cookie-banner plugin - \n   * specifically by the external compliance scripts that are included there. This container ensures that we can access those elements at all times,\n   * as the footer is not always available, nor is the sidebar.\n  */\n\n  <template>\n    <div id=\"compliance-universal-container\" style=\"display: none;\">\n      <ul><li>Compliance Placeholder</li></ul>\n    </div>\n    {{#if this.shouldShowButton}}\n    <DButton\n      @icon=\"plus\"\n      @translatedLabel=\"Privacy\"\n      @action={{this.showModal}}\n      class=\"btn-default custom-privacy-button\"\n    />\n    {{/if}}\n    {{#if this.modalIsVisible}}\n    <DModal @title=\"Privacy Management\" @closeModal={{ this.closeModal }} class=\"custom-privacy-modal\">\n      <div class=\"footer__logo\">\n        <img\n          src={{get settings.theme_uploads \"wordmark-footer-dark\"}}\n          alt=\"HubSpot\"\n          class=\"dark-logo\"\n        />\n        <img\n          src={{get settings.theme_uploads \"wordmark-footer-light\"}}\n          alt=\"HubSpot\"\n          class=\"light-logo\"\n        />\n      </div>\n      <p>\n        <a style=\"text-decoration: underline;\" target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://legal.hubspot.com/privacy-policy\">\n        {{i18n (themePrefix \"privacy.privacy_policy\")}}\n      </a>\n      </p>\n      <p>\n        <a style=\"text-decoration: underline;\" target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://legal.hubspot.com/cookie-policy\">\n        {{i18n (themePrefix \"privacy.cookie_policy\")}}\n      </a>\n      </p>\n      <p>\n        <a style=\"text-decoration: underline;\" class=\"privacy-manage-cookies-button\" {{on \"click\" this.manageCookies}}>\n        {{i18n (themePrefix \"privacy.manage_cookies\")}}\n      </a>\n      </p>\n      <p class=\"privacy-modal-copyright\">\n        {{i18n\n            (themePrefix \"footer.copyright\")\n            year=this.currentYear\n          }}\n        </p>\n    </DModal>\n  {{/if}}\n  </template>\n}\n","import { apiInitializer } from \"discourse/lib/api\";\nimport { i18n } from \"discourse-i18n\";\nimport Footer from \"../components/footer\";\nimport PrivacyButton from \"../components/privacy-button\";\n\n\n\nexport default apiInitializer((api) => {\n  \n  // Footer\n  api.renderInOutlet(\n    \"main-outlet-bottom\",\n    <template>\n      {{#if @outletArgs.showFooter}}\n        <Footer />\n      {{/if}}\n    </template>\n  );\n\n  // Privacy button\n  api.renderInOutlet(\n    \"above-main-container\",\n    <template>\n      <PrivacyButton />\n    </template>\n  );\n\n  // Privacy section in sidebar\n  api.addSidebarSection(\n    (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {\n      return class extends BaseCustomSidebarSection {\n        name = \"privacy\";\n        text = i18n(themePrefix(\"privacy.title\"));\n\n        links = [\n          new (class extends BaseCustomSidebarSectionLink {\n            name = \"privacy-policy\";\n            href = \"https://legal.hubspot.com/privacy-policy\";\n            title = i18n(themePrefix(\"privacy.privacy_policy\"));\n            text = i18n(themePrefix(\"privacy.privacy_policy\"));\n            prefixType = \"icon\";\n            prefixValue = \"lc-shield-user\";\n          })(),\n          new (class extends BaseCustomSidebarSectionLink {\n            name = \"cookie-policy\";\n            href = \"https://legal.hubspot.com/cookie-policy\";\n            title = i18n(themePrefix(\"privacy.cookie_policy\"));\n            text = i18n(themePrefix(\"privacy.cookie_policy\"));\n            prefixType = \"icon\";\n            prefixValue = \"lc-cookie\";\n          })()\n        ];\n      };\n    }\n  );\n});\n","import * as Mod1 from \"./discourse/api-initializers/initializer\";\nimport * as Mod2 from \"./discourse/components/footer\";\nimport * as Mod3 from \"./discourse/components/privacy-button\";\nconst compatModules = {\n  \"discourse/api-initializers/initializer\": Mod1,\n  \"discourse/components/footer\": Mod2,\n  \"discourse/components/privacy-button\": Mod3,\n};\nexport { compatModules };\nexport default compatModules;\n"],"names":["settings","getObjectForTheme","themePrefix","key","Footer","Component","dt7948","g","this","prototype","service","appEvents","i","tracked","message","currentYear","Date","getFullYear","constructor","super","arguments","on","reactToEvent","willDestroy","off","complianceLinksCount","n","action","showCaliforniaLink","doComplianceLinksExist","document","querySelectorAll","length","setComponentTemplate","createTemplateFactory","id","block","moduleName","scope","dIcon","get","i18n","isStrictMode","followLink","event","preventDefault","name","currentTarget","dataset","linkName","complianceContainerElement","querySelector","click","PrivacyButton","router","modalIsVisible","showModal","closeModal","manageCookies","isTopicPage","currentRouteName","startsWith","isCategoryPage","shouldDisplayOnTopicPage","controller","getOwner","lookup","model","posts_count","shouldDisplayOnCategoryPage","currentRoute","attributes","category","totalTopicCount","shouldShowButton","DButton","DModal","initializer","apiInitializer","api","renderInOutlet","templateOnly","addSidebarSection","BaseCustomSidebarSection","BaseCustomSidebarSectionLink","text","links","href","title","prefixType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