import{r as e,j as b}from"./vendor-ClLR6ncd.js";import{aT as r,y,p as v}from"./index-OtVJl4GC.js";import"./lodash-ZyeDnt0e.js";import{u as A}from"./model-B67jE2jA.js";const R=o=>o===r,N="Password in fields must be the same",l=e.createContext();function G(){return e.useContext(l)}function O({children:o}){const h=A(),f=y(v.super),[x,u]=e.useState(""),[t,i]=e.useState(""),[c,m]=e.useState(""),[a,w]=e.useState(!1),d=t===c,p=!a&&t.length===0,C=s=>f&&s===h,P=s=>s===r&&!a&&t.length!==0,S=s=>P(s)||!d||p&&s!==r,n=e.useCallback(()=>{u(""),i(""),m("")},[]),g=e.useCallback(()=>{n(),w(!1)},[n]),E={externalAuthentication:a,setExternalAuthentication:w,resetInputs:g,resetPasswords:n,currentPassword:x,setCurrentPassword:u,newPassword:t,setNewPassword:i,repeatPassword:c,setRepeatPassword:m,isInvalidInput:S,buildErrorMessage:s=>P(s)?`"${r}" is special username for access to AllegroGraph without password. Please change name or remove the password`:d?p?"Password must not be empty":"":N,isSuperuserChangeOwnPassword:C};return b.jsx(l.Provider,{value:E,children:o})}export{O as N,R as i,G as u};
