import { r as registerInstance, h } from './index-8dc1a0b7.js';
import { c as coreState } from './core-6e4b87fa.js';
import './_commonjsHelpers-66ac50f5.js';
import './index-2f7827f5.js';
import './runStore-08a7baa7.js';
import { s as src } from './index-313b8a90.js';
import { e as userUpdatePasswordMutationGQL } from './Mutations-823a697d.js';

const AuthResetPasswordForm = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.updatePasswordFormId = "updatePassword";
  }
  async formEventHandler({ detail }) {
    if (detail.formId != this.updatePasswordFormId)
      return;
    return this.updatePassword(detail);
  }
  async updatePassword(detail) {
    const userInput = {};
    Object.keys(detail).map((value) => {
      if (detail[value].key) {
        userInput[detail[value].key] = detail[value].value;
      }
    });
    await coreState.client.mutate({
      mutation: src(userUpdatePasswordMutationGQL),
      variables: {
        userPasswordInput: userInput,
      },
    });
  }
  render() {
    return (h("corejam-box", null, h("corejam-box", { bWidthBottom: 1, bColor: "gray-400", mb: 8, mt: 12 }, h("corejam-type", { as: "h3", size: "xl" }, "Update Password")), h("corejam-form-container", { name: this.updatePasswordFormId }, h("corejam-box", { flex: true, mb: 8 }, h("corejam-box", { w: "6" }, h("corejam-form-input", { name: "oldPassword", type: "password", formId: this.updatePasswordFormId, label: "Current Password", placeholder: "Current password" }))), h("corejam-box", { flex: true, mb: 8 }, h("corejam-box", { w: "6" }, h("corejam-form-input", { name: "password", type: "password", formId: this.updatePasswordFormId, label: "New Password", placeholder: "New password" }))), h("corejam-box", { flex: true, mb: 8 }, h("corejam-box", { w: "6" }, h("corejam-form-input", { name: "passwordConfirm", type: "password", formId: this.updatePasswordFormId, label: "Confirm Password", placeholder: "Confirm password" }))), h("corejam-form-submit", { formId: this.updatePasswordFormId }, h("corejam-type", { size: "sm", weight: "bold", transform: "uppercase", decoration: "underline" }, "Save")))));
  }
};

export { AuthResetPasswordForm as auth_reset_password_form };
