'use strict';

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

const index$1 = require('./index-df541290.js');
const index$3 = require('./index-fe328b96.js');
const index$2 = require('./index-c12b8888.js');
const index = require('./index-b7493032.js');
require('./index-0b6f1dd9.js');
require('./_commonjsHelpers-10109b76.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", "customer", "private");
    this.t = create(this.element);
    if (!this.number)
      this.number = index$3.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("ig-onboard-form", { cosmetic: this.cosmetic, merchant: this.merchant, customer: this.customer, "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;
