{"version":3,"file":"virtual_main.js","sources":["theme-47/virtual:init-settings","theme-47/virtual:theme","theme-47/discourse/components/search-icon.gjs","theme-47/discourse/components/search-banner.gjs","theme-47/discourse/api-initializers/init-search-banner.js","theme-47/virtual:main"],"sourcesContent":["import { registerSettings } from \"discourse/lib/theme-settings-store\";\n\nregisterSettings(47, {\n  \"show_on\": \"top_menu\",\n  \"plugin_outlet\": \"above-main-container\",\n  \"background_image_light\": null,\n  \"background_image_dark\": null,\n  \"tile_background_image\": false,\n  \"show_for\": \"everyone\",\n  \"special_style\": \"basic style (default)\"\n});\n","import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(47);\n\nexport function themePrefix(key) {\n  return `theme_translations.47.${key}`;\n}\n","import Component from \"@glimmer/component\";\nimport DButton from \"discourse/components/d-button\";\nimport concatClass from \"discourse/helpers/concat-class\";\n\nexport default class SearchIcon extends Component {\n  get advancedSearchButtonHref() {\n    return \"/search?expanded=true\";\n  }\n\n  <template>\n    <DButton\n      @icon=\"magnifying-glass\"\n      @translatedLabel={{@buttonText}}\n      @title=\"search.open_advanced\"\n      class={{concatClass \"btn search-icon\" @buttonClass}}\n      @href={{this.advancedSearchButtonHref}}\n    />\n  </template>\n}\n","import Component from \"@glimmer/component\";\nimport { concat } from \"@ember/helper\";\nimport { action } from \"@ember/object\";\nimport didInsert from \"@ember/render-modifiers/modifiers/did-insert\";\nimport willDestroy from \"@ember/render-modifiers/modifiers/will-destroy\";\nimport { service } from \"@ember/service\";\nimport { htmlSafe } from \"@ember/template\";\nimport PluginOutlet from \"discourse/components/plugin-outlet\";\nimport SearchMenu from \"discourse/components/search-menu\";\nimport { defaultHomepage } from \"discourse/lib/utilities\";\nimport { i18n } from \"discourse-i18n\";\nimport SearchIcon from \"./search-icon\";\n\nexport default class SearchBanner extends Component {\n  @service router;\n  @service siteSettings;\n  @service currentUser;\n\n  @action\n  willDestroy() {\n    super.willDestroy(...arguments);\n    document.documentElement.classList.remove(\"display-search-banner\");\n  }\n\n  get displayForRoute() {\n    const showOn = settings.show_on;\n    const currentRouteName = this.router.currentRouteName;\n\n    if (showOn === \"homepage\") {\n      return currentRouteName === `discovery.${defaultHomepage()}`;\n    } else if (showOn === \"top_menu\") {\n      return this.siteSettings.top_menu\n        .split(\"|\")\n        .some((m) => `discovery.${m}` === currentRouteName);\n    } else if (showOn === \"discovery\") {\n      return currentRouteName.startsWith(\"discovery.\");\n    } else {\n      // \"all\"\n      return (\n        currentRouteName !== \"full-page-search\" &&\n        !currentRouteName.startsWith(\"admin.\")\n      );\n    }\n  }\n\n  get displayForUser() {\n    const showFor = settings.show_for;\n    return (\n      showFor === \"everyone\" ||\n      (showFor === \"logged_out\" && !this.currentUser) ||\n      (showFor === \"logged_in\" && this.currentUser)\n    );\n  }\n\n  get buttonText() {\n    const buttonText = i18n(themePrefix(\"search_banner.search_button_text\"));\n    // this is required for when the English (US) locale is empty\n    // and the site locale is set to another language\n    // otherwise the English (US) fallback key is rendered as the button text\n    // https://meta.discourse.org/t/bug-with-search-banner-search-button-text-shown-in-search-banner-theme-component/273628\n    if (buttonText.includes(\"theme_translations\")) {\n      return false;\n    }\n\n    return buttonText;\n  }\n\n  get shouldDisplay() {\n    return this.displayForRoute && this.displayForUser;\n  }\n\n  @action\n  didInsert() {\n    // Setting a class on <html> from a component is not great\n    // but we need it for backwards compatibility\n    document.documentElement.classList.add(\"display-search-banner\");\n  }\n\n  <template>\n    {{#if this.shouldDisplay}}\n      <div\n        class=\"{{concat settings.plugin_outlet '-outlet'}}\n          search-banner welcome-banner\"\n      >\n        <div\n          class=\"custom-search-banner welcome-banner__inner-wrapper\"\n          {{didInsert this.didInsert}}\n          {{willDestroy this.willDestroy}}\n        >\n          <div class=\"wrap custom-search-banner-wrap welcome-banner__wrap\">\n            <div class=\"custom-search-banner-headline\">\n              {{htmlSafe (i18n (themePrefix \"search_banner.headline\"))}}\n            </div>\n            <PluginOutlet @name=\"search-banner-below-headline\" />\n            <p>{{htmlSafe (i18n (themePrefix \"search_banner.subhead\"))}}</p>\n            <div class=\"search-menu welcome-banner__search-menu\">\n              {{#unless this.buttonText}}\n                <SearchIcon />\n              {{/unless}}\n              <SearchMenu @searchInputId=\"custom-search-input\" />\n              {{#if this.buttonText}}\n                <SearchIcon\n                  @buttonText={{this.buttonText}}\n                  @buttonClass=\"has-search-button-text\"\n                />\n              {{/if}}\n            </div>\n            <PluginOutlet @name=\"search-banner-below-input\" />\n          </div>\n        </div>\n      </div>\n    {{/if}}\n  </template>\n}\n","import { apiInitializer } from \"discourse/lib/api\";\nimport SearchBanner from \"../components/search-banner\";\n\nexport default apiInitializer((api) => {\n  api.renderInOutlet(\n    settings.plugin_outlet === \"above-main-container\"\n      ? \"above-main-container\"\n      : \"below-site-header\",\n    SearchBanner\n  );\n\n  api.forceDropdownForMenuPanels(\"search-menu-panel\");\n});\n","import \"virtual:init-settings\";\n\nconst themeCompatModules = {};\nimport * as Mod1 from \"./discourse/api-initializers/init-search-banner\";\nthemeCompatModules[\"discourse/api-initializers/init-search-banner\"] = Mod1;\n\nimport * as Mod2 from \"./discourse/components/search-banner\";\nthemeCompatModules[\"discourse/components/search-banner\"] = Mod2;\n\nimport * as Mod3 from \"./discourse/components/search-icon\";\nthemeCompatModules[\"discourse/components/search-icon\"] = Mod3;\n\nexport default themeCompatModules;\n"],"names":["registerSettings","show_on","plugin_outlet","background_image_light","background_image_dark","tile_background_image","show_for","special_style","settings","getObjectForTheme","themePrefix","key","SearchIcon","Component","advancedSearchButtonHref","setComponentTemplate","createTemplateFactory","id","block","moduleName","scope","DButton","concatClass","isStrictMode","this","SearchBanner","dt7948","g","prototype","service","router","i","siteSettings","currentUser","willDestroy","super","arguments","document","documentElement","classList","remove","n","action","displayForRoute","showOn","currentRouteName","defaultHomepage","top_menu","split","some","m","startsWith","displayForUser","showFor","buttonText","i18n","includes","shouldDisplay","didInsert","add","concat","htmlSafe","PluginOutlet","SearchMenu","initSearchBanner","apiInitializer","api","renderInOutlet","for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