import { r as registerInstance, h, F as Fragment } from './index-f1d2a96f.js';
import { o as openWormhole } from './consumer-7a54eb9f.js';
import { g as getProcessorData } from './processor-6e16ca02.js';

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

const ScOrderSubmit = class {
  constructor(hostRef) {
    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 } = getProcessorData(this.processors, 'paypal', this.mode);
    if (!client_id && !account_id)
      return null;
    return (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 (h(Fragment, null, this.processor === 'paypal' && this.renderPayPalButton(['paypal']), this.processor === 'paypal-card' && this.renderPayPalButton(['card']), 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 && h("sc-icon", { name: this.icon, slot: "prefix" }), h("slot", null), this.showTotal && (h("span", null, '\u00A0', h("sc-total", null))))));
  }
};
openWormhole(ScOrderSubmit, ['busy', 'loading', 'paying', 'processors', 'processor', 'mode', 'currencyCode', 'order'], false);
ScOrderSubmit.style = scOrderSubmitCss;

export { ScOrderSubmit as sc_order_submit };
