import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { o as openWormhole } from './consumer.js';
import { d as defineCustomElement$7 } from './sc-alert2.js';
import { d as defineCustomElement$6 } from './sc-block-ui2.js';
import { d as defineCustomElement$5 } from './sc-divider2.js';
import { d as defineCustomElement$4 } from './sc-icon2.js';
import { d as defineCustomElement$3 } from './sc-spinner2.js';
import { d as defineCustomElement$2 } from './sc-stripe-payment-request2.js';

const scExpressPaymentCss = ":host{display:block}";

const ScExpressPayment$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
  }
  onPaymentRequestLoaded() {
    this.hasPaymentOptions = true;
  }
  renderStripePaymentRequest() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
    if (!((_c = (_b = (_a = this === null || this === void 0 ? void 0 : this.order) === null || _a === void 0 ? void 0 : _a.processor_data) === null || _b === void 0 ? void 0 : _b.stripe) === null || _c === void 0 ? void 0 : _c.publishable_key) || !((_f = (_e = (_d = this === null || this === void 0 ? void 0 : this.order) === null || _d === void 0 ? void 0 : _d.processor_data) === null || _e === void 0 ? void 0 : _e.stripe) === null || _f === void 0 ? void 0 : _f.account_id)) {
      return '';
    }
    return (h("sc-stripe-payment-request", { formId: this.formId, debug: this.debug, order: this.order, stripeAccountId: (_j = (_h = (_g = this === null || this === void 0 ? void 0 : this.order) === null || _g === void 0 ? void 0 : _g.processor_data) === null || _h === void 0 ? void 0 : _h.stripe) === null || _j === void 0 ? void 0 : _j.account_id, publishableKey: (_m = (_l = (_k = this === null || this === void 0 ? void 0 : this.order) === null || _k === void 0 ? void 0 : _k.processor_data) === null || _l === void 0 ? void 0 : _l.stripe) === null || _m === void 0 ? void 0 : _m.publishable_key }));
  }
  render() {
    return (h(Host, { class: { 'is-empty': !this.hasPaymentOptions && !this.debug } }, this.renderStripePaymentRequest(), (this.hasPaymentOptions || this.debug) && h("sc-divider", { style: { '--spacing': 'calc(var(--sc-form-row-spacing)/2)' } }, this.dividerText), this.busy && h("sc-block-ui", null)));
  }
  static get style() { return scExpressPaymentCss; }
}, [0, "sc-express-payment", {
    "processor": [1],
    "formId": [8, "form-id"],
    "busy": [4],
    "order": [16],
    "dividerText": [1, "divider-text"],
    "debug": [4],
    "hasPaymentOptions": [1028, "has-payment-options"]
  }, [[0, "scPaymentRequestLoaded", "onPaymentRequestLoaded"]]]);
openWormhole(ScExpressPayment$1, ['order', 'formId', 'busy'], false);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["sc-express-payment", "sc-alert", "sc-block-ui", "sc-divider", "sc-icon", "sc-spinner", "sc-stripe-payment-request"];
  components.forEach(tagName => { switch (tagName) {
    case "sc-express-payment":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, ScExpressPayment$1);
      }
      break;
    case "sc-alert":
      if (!customElements.get(tagName)) {
        defineCustomElement$7();
      }
      break;
    case "sc-block-ui":
      if (!customElements.get(tagName)) {
        defineCustomElement$6();
      }
      break;
    case "sc-divider":
      if (!customElements.get(tagName)) {
        defineCustomElement$5();
      }
      break;
    case "sc-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$4();
      }
      break;
    case "sc-spinner":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "sc-stripe-payment-request":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}
defineCustomElement$1();

const ScExpressPayment = ScExpressPayment$1;
const defineCustomElement = defineCustomElement$1;

export { ScExpressPayment, defineCustomElement };
