'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-cd6fab62.js');
const consumer = require('./consumer-1372755b.js');
const processor = require('./processor-94c05c73.js');

const scOrderSubmitCss = "sc-order-submit{display:block;width:auto}";

const ScOrderSubmit = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    /** The button type. */
    this.type = 'primary';
    /** The button's size. */
    this.size = 'medium';
    /** Show a full-width button. */
    this.full = true;
    /** Is this created in "test" mode */
    this.mode = 'live';
    /** Currency Code */
    this.currencyCode = 'usd';
  }
  renderPayPalButton(buttons) {
    const { client_id, account_id } = processor.getProcessorData(this.processors, 'paypal', this.mode);
    if (!client_id && !account_id)
      return null;
    return (index.h("sc-paypal-buttons", { buttons: buttons, busy: this.busy, mode: this.mode, order: this.order, "currency-code": this.currencyCode, "client-id": client_id, "merchant-id": account_id, label: "checkout", color: "blue" }));
  }
  render() {
    return (index.h(index.Fragment, null, this.processor === 'paypal' && this.renderPayPalButton(['paypal']), this.processor === 'paypal-card' && this.renderPayPalButton(['card']), index.h("sc-button", { hidden: this.processor !== 'stripe', submit: true, type: this.type, size: this.size, full: this.full, loading: this.loading || this.paying, disabled: this.loading || this.paying || this.busy }, !!this.icon && index.h("sc-icon", { name: this.icon, slot: "prefix" }), index.h("slot", null), this.showTotal && (index.h("span", null, '\u00A0', index.h("sc-total", null))))));
  }
};
consumer.openWormhole(ScOrderSubmit, ['busy', 'loading', 'paying', 'processors', 'processor', 'mode', 'currencyCode', 'order'], false);
ScOrderSubmit.style = scOrderSubmitCss;

exports.sc_order_submit = ScOrderSubmit;
