var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, Host, h, Prop, Element, Fragment, State } from '@stencil/core';
import { HEARTLAND_PRIVACY_URL, HEARTLAND_TOS_URL, HEARTLAND_GOOGLE_PRIVACY_POLICY_URL, HEARTLAND_GOOGLE_TREMS_SERVICE_URL, GLOBALPAYMENTS_TOS_URL, GLOBALPAYMENTS_PRIVACY_URL, GLOBALPAYMENTS_CONTENT, HEARTLAND_CONTENT, } from '../../constants/misc';
import { sanitizeVegaComponent } from '../../utils/component';
import { InjectVegaGlobalSlimmer, InjectVegaSlimmer } from 'vega-slimmer/core';
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../helpers/slimmers/component-usage-runtime-metrics';
import { VegaInternalThemeManager } from '../../helpers/theme/internal-theme-manager';
import { BrandSwitchControllerSlimmer } from '../../helpers/slimmers/brand-switch-state-controller-slimmer';
/**
 * @vegaVersion 1.3.0
 */
export class VegaAppFooter {
  constructor() {
    this.globalSlimmers = {};
    this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
    this.brandSwitchControllerSlimmer = new BrandSwitchControllerSlimmer();
    this.googlePrivacyPolicyUrl = HEARTLAND_GOOGLE_PRIVACY_POLICY_URL;
    this.googleTermsOfServiceUrl = HEARTLAND_GOOGLE_TREMS_SERVICE_URL;
    this.currentBranding = VegaInternalThemeManager.getBranding();
    /**
     * Specifies the content to be displayed in the app footer.
     *
     * By default, it includes Heartland's official copyright message
     *    with a reference to the current year.
     *
     * @vegaVersion 1.15.0
     * @defaultValue © {{currentYear}} Global Payments Inc. All rights reserved.
     */
    this.content = this.getDefaultContent();
    /**
     * Specifies the label or text to be displayed
     *    for the Terms of Use link in the app footer.
     *
     * @vegaVersion 1.15.0
     */
    this.termOfUseLabel = 'Terms of Use';
    /**
     * Specifies the URL or web address that the Terms of Use link
     *    in the app footer should navigate to when clicked.
     *
     * @vegaVersion 1.15.0
     * @defaultValue https://www.globalpayments.com/terms-of-use
     */
    this.termOfUseUrl = this.getDefaultTermsOfUseUrl();
    /**
     * Specifies the target window or browsing context in which
     *    the Terms of Use URL should be opened
     *    when the user clicks on the link.
     *
     * @vegaVersion 1.27.3
     */
    this.termOfUseUrlTarget = '_self';
    /**
     * Specifies the label or text to be displayed
     *    for the Privacy Policy link in the app footer.
     *
     * @vegaVersion 1.15.0
     */
    this.privacyPolicyLabel = 'Privacy Policy';
    /**
     * Specifies the URL or web address that the
     *    Privacy Policy link in the app footer should
     *    navigate to when clicked.
     *
     * @vegaVersion 1.15.0
     * @defaultValue https://www.globalpayments.com/privacy-statement
     */
    this.privacyPolicyUrl = this.getDefaultPrivacyPolicyUrl();
    /**
     * Specifies the target window or browsing context
     *    in which the Privacy Policy URL should be opened
     *    when the user clicks on the link.
     *
     * @vegaVersion 1.27.3
     */
    this.privacyPolicyUrlTarget = '_self';
    /**
     * Specifies whether to hide the default Term of Use
     *    and Privacy Policy links.
     *
     * @vegaVersion 1.35.1
     */
    this.hideDefaultLinks = false;
    /**
     * Specifies additional links that can be included
     *    in the app footer.
     *
     * @vegaVersion 1.15.0
     */
    this.additionalLinks = [];
    /**
     * Specifies whether the app footer should display
     *    a predetermined disclaimer message and link
     *    to indicate that the site uses Google reCAPTCHA.
     *
     * @vegaVersion 1.3.0
     */
    this.showDisclaimer = false;
    /**
     * Specifies the target window or tab when the user clicks
     *    on the Disclaimer link in the app footer.
     *
     * @vegaVersion 1.27.3
     */
    this.disclaimerUrlTarget = '_self';
  }
  render() {
    return sanitizeVegaComponent(h(Host, { class: "v-text-center" },
      this.renderContent(),
      this.renderLinks(),
      this.renderDisclaimer()), this.host);
  }
  getDefaultContent() {
    return VegaInternalThemeManager.getBranding() === 'heartland'
      ? HEARTLAND_CONTENT
      : GLOBALPAYMENTS_CONTENT;
  }
  getDefaultTermsOfUseUrl() {
    return VegaInternalThemeManager.getBranding() === 'heartland'
      ? HEARTLAND_TOS_URL
      : GLOBALPAYMENTS_TOS_URL;
  }
  getDefaultPrivacyPolicyUrl() {
    return VegaInternalThemeManager.getBranding() === 'heartland'
      ? HEARTLAND_PRIVACY_URL
      : GLOBALPAYMENTS_PRIVACY_URL;
  }
  renderContent() {
    return (h("div", { class: "vega-app-footer-content" }, this.content !== GLOBALPAYMENTS_CONTENT && this.content !== HEARTLAND_CONTENT
      ? this.content
      : this.getDefaultContent()));
  }
  renderLinks() {
    return (h("div", { class: "vega-link" },
      !this.hideDefaultLinks ? this.renderDefaultLinks() : null,
      this.additionalLinks.length ? this.renderAdditionalLinks() : null));
  }
  renderDefaultLinks() {
    return (h(Fragment, null,
      h("a", { id: this.termOfUseUrlId, target: this.termOfUseUrlTarget, href: this.getTermsOfUseUrl() }, this.termOfUseLabel),
      h("span", { class: "v-separator" }),
      h("a", { id: this.privacyPolicyUrlId, target: this.privacyPolicyUrlTarget, href: this.getPrivacyPolicyUrl() }, this.privacyPolicyLabel)));
  }
  getTermsOfUseUrl() {
    return this.termOfUseUrl !== HEARTLAND_TOS_URL && this.termOfUseUrl !== GLOBALPAYMENTS_TOS_URL
      ? this.termOfUseUrl
      : this.getDefaultTermsOfUseUrl();
  }
  getPrivacyPolicyUrl() {
    return this.privacyPolicyUrl !== HEARTLAND_PRIVACY_URL &&
      this.privacyPolicyUrl !== GLOBALPAYMENTS_PRIVACY_URL
      ? this.privacyPolicyUrl
      : this.getDefaultPrivacyPolicyUrl();
  }
  renderAdditionalLinks() {
    return (h(Fragment, null,
      !this.hideDefaultLinks ? h("span", { class: "v-separator" }) : null,
      this.additionalLinks.map((link, index) => {
        return (link.URL &&
          link.label && (h(Fragment, null,
          h("a", { id: link.id, target: link.target, href: link.URL }, link.label),
          this.additionalLinks.length === index + 1 ? null : (h("span", { class: "v-separator" })))));
      })));
  }
  renderDisclaimer() {
    return (this.showDisclaimer && (h("div", { class: "vega-app-footer-disclaimer" },
      h("div", { class: "h-separator" }),
      h("div", { class: "vega-app-footer-disclaimer-content vega-link" },
        "This site is protected by reCAPTCHA and the",
        ' ',
        h("a", { target: this.disclaimerUrlTarget, href: this.googlePrivacyPolicyUrl },
          ' ',
          "Google Privacy Policy",
          ' '),
        ' ',
        "and",
        ' ',
        h("a", { target: this.disclaimerUrlTarget, href: this.googleTermsOfServiceUrl },
          ' ',
          "Google Terms of Service",
          ' '),
        "apply."))));
  }
  static get is() { return "vega-app-footer"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["vega-app-footer.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["vega-app-footer.css"]
  }; }
  static get properties() { return {
    "content": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.15.0"
          }, {
            "name": "defaultValue",
            "text": "\u00A9 {{currentYear}} Global Payments Inc. All rights reserved."
          }],
        "text": "Specifies the content to be displayed in the app footer.\n\nBy default, it includes Heartland's official copyright message\n   with a reference to the current year."
      },
      "attribute": "content",
      "reflect": false,
      "defaultValue": "this.getDefaultContent()"
    },
    "termOfUseLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.15.0"
          }],
        "text": "Specifies the label or text to be displayed\n   for the Terms of Use link in the app footer."
      },
      "attribute": "term-of-use-label",
      "reflect": false,
      "defaultValue": "'Terms of Use'"
    },
    "termOfUseUrl": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.15.0"
          }, {
            "name": "defaultValue",
            "text": "https://www.globalpayments.com/terms-of-use"
          }],
        "text": "Specifies the URL or web address that the Terms of Use link\n   in the app footer should navigate to when clicked."
      },
      "attribute": "term-of-use-url",
      "reflect": false,
      "defaultValue": "this.getDefaultTermsOfUseUrl()"
    },
    "termOfUseUrlTarget": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "LinkTargetType",
        "resolved": "\"_blank\" | \"_self\"",
        "references": {
          "LinkTargetType": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.27.3"
          }],
        "text": "Specifies the target window or browsing context in which\n   the Terms of Use URL should be opened\n   when the user clicks on the link."
      },
      "attribute": "term-of-use-url-target",
      "reflect": false,
      "defaultValue": "'_self'"
    },
    "termOfUseUrlId": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.54.0"
          }],
        "text": "Specifies the unique identifier for the Terms of Use Link."
      },
      "attribute": "term-of-use-url-id",
      "reflect": false
    },
    "privacyPolicyLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.15.0"
          }],
        "text": "Specifies the label or text to be displayed\n   for the Privacy Policy link in the app footer."
      },
      "attribute": "privacy-policy-label",
      "reflect": false,
      "defaultValue": "'Privacy Policy'"
    },
    "privacyPolicyUrl": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.15.0"
          }, {
            "name": "defaultValue",
            "text": "https://www.globalpayments.com/privacy-statement"
          }],
        "text": "Specifies the URL or web address that the\n   Privacy Policy link in the app footer should\n   navigate to when clicked."
      },
      "attribute": "privacy-policy-url",
      "reflect": false,
      "defaultValue": "this.getDefaultPrivacyPolicyUrl()"
    },
    "privacyPolicyUrlTarget": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "LinkTargetType",
        "resolved": "\"_blank\" | \"_self\"",
        "references": {
          "LinkTargetType": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.27.3"
          }],
        "text": "Specifies the target window or browsing context\n   in which the Privacy Policy URL should be opened\n   when the user clicks on the link."
      },
      "attribute": "privacy-policy-url-target",
      "reflect": false,
      "defaultValue": "'_self'"
    },
    "privacyPolicyUrlId": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.54.0"
          }],
        "text": "Specifies the unique identifier for the Privacy Policy Link."
      },
      "attribute": "privacy-policy-url-id",
      "reflect": false
    },
    "hideDefaultLinks": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.35.1"
          }],
        "text": "Specifies whether to hide the default Term of Use\n   and Privacy Policy links."
      },
      "attribute": "hide-default-links",
      "reflect": false,
      "defaultValue": "false"
    },
    "additionalLinks": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "VegaAppFooterLink[]",
        "resolved": "VegaAppFooterLink[]",
        "references": {
          "VegaAppFooterLink": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.15.0"
          }],
        "text": "Specifies additional links that can be included\n   in the app footer."
      },
      "defaultValue": "[]"
    },
    "showDisclaimer": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.3.0"
          }],
        "text": "Specifies whether the app footer should display\n   a predetermined disclaimer message and link\n   to indicate that the site uses Google reCAPTCHA."
      },
      "attribute": "show-disclaimer",
      "reflect": false,
      "defaultValue": "false"
    },
    "disclaimerUrlTarget": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "LinkTargetType",
        "resolved": "\"_blank\" | \"_self\"",
        "references": {
          "LinkTargetType": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.27.3"
          }],
        "text": "Specifies the target window or tab when the user clicks\n   on the Disclaimer link in the app footer."
      },
      "attribute": "disclaimer-url-target",
      "reflect": false,
      "defaultValue": "'_self'"
    }
  }; }
  static get states() { return {
    "currentBranding": {}
  }; }
  static get elementRef() { return "host"; }
}
__decorate([
  InjectVegaGlobalSlimmer()
], VegaAppFooter.prototype, "globalSlimmers", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaAppFooter.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaAppFooter.prototype, "brandSwitchControllerSlimmer", void 0);
