'use strict';

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

const index$1 = require('./index-df541290.js');
const index$3 = require('./index-13b50665.js');
const index$2 = require('./index-fe50ed35.js');
const index = require('./index-aa81d689.js');
require('./_commonjsHelpers-5bbc2693.js');
require('./index-c277d1ea.js');

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

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

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

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

exports.payfunc_onboard = Onboard;
