import { r as registerInstance, j as createEvent, h, g as getElement } from './index-07845439.js';
import { I as Identifier } from './index-265fba1f.js';
import { K as Key } from './index-e20749b7.js';
import { d as dist } from './index-63517df5.js';
import './index-b6cf748e.js';
import './_commonjsHelpers-8fe71198.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", "customer", "private");
    this.t = create(this.element);
    if (!this.number)
      this.number = 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("ig-onboard-form", { cosmetic: this.cosmetic, merchant: this.merchant, customer: this.customer, "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 };
