import{r as s,h as r}from"./p-b891c2f1.js";import{_ as t}from"./p-684c85b4.js";import"./p-aafd8ea4.js";import{a}from"./p-6fd3642a.js";import"./p-112455b1.js";import"./p-1c2e2695.js";const o=class{constructor(r){s(this,r)}renderEmpty(){return r("slot",{name:"empty"},t("User not found.","surecart"))}async handleSubmit(s){this.loading=!0,this.error="";try{const{password:r,password_confirm:o}=await s.target.getFormJson();if(r!==o)throw{message:t("Passwords do not match.","surecart")};await a({path:"wp/v2/users/me",method:"PATCH",data:{password:r}}),this.successUrl?window.location.assign(this.successUrl):this.loading=!1}catch(s){this.error=(null==s?void 0:s.message)||t("Something went wrong","surecart"),this.loading=!1}}render(){return r("sc-dashboard-module",{class:"customer-details",error:this.error},r("span",{slot:"heading"},this.heading||t("Update Password","surecart")," "),r("sc-card",null,r("sc-form",{onScFormSubmit:s=>this.handleSubmit(s)},r("sc-input",{label:t("New Password","surecart"),name:"password",type:"password",required:!0}),r("sc-input",{label:t("Confirm New Password","surecart"),name:"password_confirm",type:"password",required:!0}),r("div",null,r("sc-button",{type:"primary",full:!0,submit:!0},t("Update Password","surecart"))))),this.loading&&r("sc-block-ui",{spinner:!0}))}};o.style=":host{display:block;position:relative}";export{o as sc_wordpress_password_edit}