{"version":3,"file":"main.7FScaD.js","sources":["theme-187/virtual:theme","theme-187/discourse/components/add-to-homescreen.gjs","theme-187/discourse/connectors/below-footer/add-to-homescreen-outlet.gjs","theme-187/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(187);\n\nexport function themePrefix(key) {\n  return `theme_translations.187.${key}`;\n}\n","/* eslint-disable ember/no-side-effects */\nimport Component from \"@glimmer/component\";\nimport { tracked } from \"@glimmer/tracking\";\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 DButton from \"discourse/components/d-button\";\nimport HomeLogo from \"discourse/components/header/home-logo\";\nimport concatClass from \"discourse/helpers/concat-class\";\nimport icon from \"discourse/helpers/d-icon\";\nimport { bind } from \"discourse/lib/decorators\";\nimport discourseLater from \"discourse/lib/later\";\nimport { i18n } from \"discourse-i18n\";\n\nexport default class AddToHomescreen extends Component {\n  @service capabilities;\n  @service currentUser;\n  @service keyValueStore;\n  @service site;\n\n  @tracked hasHiddenPopup = this.keyValueStore.getItem(\"hasHiddenPopup\");\n  @tracked showPopupTimer = false;\n  @tracked arrowUp = window.matchMedia(\"(orientation: landscape)\").matches;\n  @tracked animate = false;\n\n  constructor() {\n    super(...arguments);\n\n    discourseLater(() => {\n      if (this.isDestroying || this.isDestroyed) {\n        return;\n      }\n\n      this.showPopupTimer = true;\n    }, settings.popup_timer);\n  }\n\n  get shouldRender() {\n    const appleMobile = this.capabilities.isIOS || this.capabilities.isIpadOS;\n    const isPWA = this.capabilities.isPwa;\n    const isHub = this.capabilities.wasLaunchedFromDiscourseHub;\n\n    if (\n      this.currentUser &&\n      this.showPopupTimer &&\n      appleMobile &&\n      !this.hasHiddenPopup &&\n      !isPWA &&\n      !isHub\n    ) {\n      discourseLater(() => {\n        this.animate = true;\n      }, 125);\n      return true;\n    }\n  }\n\n  get PWALabel() {\n    return i18n(themePrefix(\"pwa_text\"), {\n      siteTitle: this.site.siteSettings.title,\n    });\n  }\n\n  @action\n  setup() {\n    if (this.capabilities.isIpadOS) {\n      this.arrowUp = true;\n      return;\n    }\n\n    window\n      .matchMedia(\"(orientation: landscape)\")\n      .addEventListener(\"change\", this.handleOrientationChange);\n  }\n\n  @action\n  teardown() {\n    window\n      .matchMedia(\"(orientation: landscape)\")\n      .removeEventListener(\"change\", this.handleOrientationChange);\n  }\n\n  @action\n  hidePopup() {\n    this.keyValueStore.setItem(\"hasHiddenPopup\", true);\n    this.hasHiddenPopup = true;\n  }\n\n  @bind\n  handleOrientationChange(event) {\n    this.arrowUp = event.matches;\n  }\n\n  <template>\n    {{#if this.shouldRender}}\n      <DButton\n        @action={{this.hidePopup}}\n        @icon=\"xmark\"\n        class=\"add-to-homescreen-outlet__button btn-flat\"\n      />\n      <div\n        {{didInsert this.setup}}\n        {{willDestroy this.teardown}}\n        class={{concatClass\n          \"add-to-homescreen-outlet__content\"\n          (if this.animate \"animate\")\n        }}\n      >\n        <HomeLogo />\n        <span class=\"add-to-homescreen__description\">\n          {{htmlSafe this.PWALabel}}\n          {{#if this.arrowUp}}\n            {{icon \"arrow-up\"}}\n          {{else}}\n            {{icon \"arrow-down\"}}\n          {{/if}}\n        </span>\n      </div>\n    {{/if}}\n  </template>\n}\n","/* eslint-disable ember/no-classic-components, ember/require-tagless-components */\nimport Component from \"@ember/component\";\nimport { classNames } from \"@ember-decorators/component\";\nimport AddToHomescreen from \"../../components/add-to-homescreen\";\n\n@classNames(\"below-footer-outlet\", \"add-to-homescreen-outlet\")\nexport default class AddToHomescreenOutlet extends Component {\n  <template><AddToHomescreen /></template>\n}\n","import * as Mod1 from \"./discourse/components/add-to-homescreen\";\nimport * as Mod2 from \"./discourse/connectors/below-footer/add-to-homescreen-outlet.gjs\";\nconst compatModules = {\n  \"discourse/components/add-to-homescreen\": Mod1,\n  \"discourse/connectors/below-footer/add-to-homescreen-outlet\": Mod2,\n};\nexport default compatModules;\n"],"names":["settings","getObjectForTheme","AddToHomescreen","Component","dt7948","g","this","prototype","service","capabilities","i","currentUser","keyValueStore","site","tracked","getItem","hasHiddenPopup","showPopupTimer","window","matchMedia","matches","arrowUp","animate","constructor","super","arguments","discourseLater","isDestroying","isDestroyed","popup_timer","shouldRender","appleMobile","isIOS","isIpadOS","isPWA","isPwa","isHub","wasLaunchedFromDiscourseHub","PWALabel","i18n","siteTitle","siteSettings","title","setup","addEventListener","handleOrientationChange","n","action","teardown","removeEventListener","hidePopup","setItem","event","bind","setComponentTemplate","createTemplateFactory","id","block","moduleName","scope","DButton","concatClass","didInsert","willDestroy","HomeLogo","htmlSafe","icon","isStrictMode","AddToHomescreenOutlet","c","classNames","compatModules","Mod1"],"mappings":"mvCAEaA,EAAWC,EAAkB;ACc3B,MAAMC,UAAwBC,SAAAC,OAAAC,EAAAC,KAAAC,0BAC1CC,GAAA,CAAAC,QAAAL,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,yBACAC,GAAA,CAAAG,QAAAP,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,2BACAC,GAAA,CAAAI,QAAAR,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,kBACAC,GAAA,CAAAK,QAAAT,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,4BAEAO,GAAA,WAAA,OAAyBR,KAAKM,cAAcG,QAAQ,iBAAA,EAAA,CAAAC,QAAAZ,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,4BACpDO,GAAA,WAAA,OAAyB,CAAA,EAAA,CAAAG,QAAAb,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,qBACzBO,GAAA,WAAA,OAAkBI,OAAOC,WAAW,4BAA4BC,OAAO,EAAA,CAAAC,QA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