'use strict';

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

const index = require('./index-8277cbb3.js');
const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
const index_module = require('./index.module-f8c8495f.js');
require('./jsonpointer-11327262.js');
const cjs = require('./cjs-1066ec21.js');
require('./JSS-8503a151.js');
require('./mixins-4761d472.js');
require('./useRegistrationFormState-4fe5b770.js');
const emailRegistrationView = require('./email-registration-view-306c8878.js');
const useInstantAccessRegistration = require('./useInstantAccessRegistration-2398df36.js');

const InstantAccessRegistration = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.ignored = true;
    /**
     * @uiName Email field label
     */
    this.emailLabel = "Email";
    /**
     * @uiName First name field label
     */
    this.firstNameLabel = "First Name";
    /**
     * @uiName Last name field label
     */
    this.lastNameLabel = "Last Name";
    /**
     * @uiName Register button text
     */
    this.registerLabel = "Start Referring";
    /**
     * Require your participants to enter their first and last name.
     *
     * @uiName Include name fields
     */
    this.includeName = false;
    /**
     * @uiName Hide border
     * @uiGroup Card style
     */
    this.hideBorder = false;
    /**
     * Display this message when a required field has not been filled out.
     *
     * @uiName Required field message
     * @uiWidget textArea
     * @uiGroup Error messages
     */
    this.requiredFieldErrorMessage = "Cannot be empty";
    /**
     * Display this message when the given email is invalid.
     *
     * @uiName Invalid email message
     * @uiWidget textArea
     * @uiGroup Error messages
     */
    this.invalidEmailErrorMessage = "Please enter a valid email address";
    /**
     * Display this message when the form submission unexpectedly fails.
     *
     * @uiName Network error message
     * @uiWidget textArea
     * @uiGroup Error messages
     */
    this.networkErrorMessage = "There was a problem signing you in. Please wait a moment and try again. If this problem continues, contact Support for help resolving this issue.";
    /**
     * @uiName Top padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingTop = "large";
    /**
     * @uiName Right padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingRight = "large";
    /**
     * @uiName Bottom padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingBottom = "large";
    /**
     * @uiName Left padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingLeft = "large";
    /**
     * @uiName Background color
     * @uiWidget color
     * @uiGroup Card style
     * @uiType string
     */
    this.backgroundColor = "var(--sqm-portal-background)";
    /**
     * @undocumented
     * @uiType boolean
     */
    this.includeCookies = false;
    domContextHooks_module.h$1(this);
  }
  disconnectedCallback() { }
  render() {
    const { states, callbacks } = index_module.isDemo()
      ? useRegistrationDemo(this)
      : useInstantAccessRegistration.useInstantAccessRegistration(this);
    const content = {
      emailLabel: this.emailLabel,
      registerLabel: this.registerLabel,
      firstNameLabel: this.firstNameLabel,
      lastNameLabel: this.lastNameLabel,
      includeName: this.includeName,
      hideBorder: this.hideBorder,
      invalidEmailErrorMessage: this.invalidEmailErrorMessage,
      requiredFieldErrorMessage: this.requiredFieldErrorMessage,
      paddingTop: this.paddingTop,
      paddingBottom: this.paddingBottom,
      paddingLeft: this.paddingLeft,
      paddingRight: this.paddingRight,
      backgroundColor: this.backgroundColor,
      // slots
      topSlot: index.h("slot", { name: "top" }),
      bottomSlot: index.h("slot", { name: "bottom" }),
    };
    return (index.h(emailRegistrationView.EmailRegistrationView, { states: states, callbacks: callbacks, content: content }));
  }
};
function useRegistrationDemo(props) {
  const submit = async (_event) => {
    index_module.setUserIdentity({
      id: "referrer@example.com",
      accountId: "referrer@example.com",
      jwt: "eyJraWQiOiJlNjI2NzQxNy1jMzZlLTRlM2EtYjM5NS1lYTFmY2YyNmU3YzIiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjbVZtWlhKeVpYSkFaWGhoYlhCc1pTNWpiMjA9OmNtVm1aWEp5WlhKQVpYaGhiWEJzWlM1amIyMD1AdGVzdF9heGJndGF0dzF0Y2NwOnVzZXJzIiwicGFzc3dvcmRsZXNzIjp0cnVlLCJpc3MiOiJodHRwczovL3N0YWdpbmcucmVmZXJyYWxzYWFzcXVhdGNoLmNvbS8iLCJleHAiOjE2ODA4ODU5MTksImlhdCI6MTY4MDc5OTUxOX0.kjmTVVf_BTb-uMNKnadLyNLxMFwpkefsY02O3iAfBVIJJZZfeZMwunPlKsS3Vbp28aYRClBjH5Wj4pYxDn23D0CdZx8KNCqiJ8yF6149O9SPMkRseoJkliqS6LyvMOEDjGDkuLfcC8_hq1AHBXFt5BdCtWOk1gwf_5R9A0w5gXEIvprBzbNDLbuo88bVAlrmFNvfttXXryrpUeruMal7cBKuy02YblBrB4kKoyJiprU5GLEjciBA4A56u8TwQc0kbsPf2YcQaJsY_IvkC7S1u4sPyObpq6iF6Ed8UYHAo6nU5KjZXyVtoUyeIS11mf_6OtDO6LyMNHV2FtEUUDdPCg",
    });
  };
  return cjs.cjs({
    states: {
      loading: false,
      error: "",
    },
    callbacks: {
      submit,
    },
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
}

exports.sqm_instant_access_registration = InstantAccessRegistration;
