import { r as registerInstance, j as createEvent, h, g as getElement } from './index-aeac5cad.js';
import './_commonjsHelpers-91fffb88.js';
import { K as Key } from './index-df45deab.js';
import { d as dist } from './index-fdd60c34.js';
import { d as dist$1 } from './index-6b5931f4.js';

const sv = {
  Submit: "Skicka",
  "No valid API key.": "Ingen giltig API-nyckel.",
};

function create(language) {
  return dist.create({
    sv,
  }, language);
}

const styleCss = ".sc-payfunc-onboard-h{display:block;max-width:40em}";

const Onboard = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.create = createEvent(this, "create", 7);
  }
  async componentWillLoad() {
    this.merchant = await Key.unpack(this.apiKey, "public", "account", "private");
    this.t = create(this.element);
    if (!this.number)
      this.number = dist$1.Identifier.generate(16);
  }
  onCreate(event) {
    this.create.emit(event.detail);
  }
  render() {
    const t = this.t;
    return !this.merchant ? (h("p", null, this.t("No valid API key."))) : ([
      h("smoothly-notifier", null, h("payfunc-onboard-form", { merchant: this.merchant, account: this.account, "api-key": this.apiKey, number: this.number, "response-timer": this.responseTimer }), h("merchant-terms", { merchant: this.merchant, buttonName: t("Submit") }), h("card-logotypes", null)),
    ]);
  }
  get element() { return getElement(this); }
};
Onboard.style = styleCss;

export { Onboard as payfunc_onboard };
