import{isEmpty}from"../../base/helpers.mjs";import{FormView}from"../base.mjs";import{CheckboxInputView,StringInputView,PasswordInputView,ButtonInputView}from"../input.mjs";class UserFormView extends FormView{static fieldSets={User:{username:{label:"Username",class:StringInputView,config:{required:!0,editable:!1,pattern:"^[a-zA-Z0-9_]{2,}$",minlength:2,maxlength:128}},first_name:{label:"First Name",class:StringInputView},last_name:{label:"Last Name",class:StringInputView}},Permissions:{admin:{label:"Administrator",class:CheckboxInputView}},Password:{new_password:{label:"New Password",class:PasswordInputView},repeat_password:{label:"Repeat Password",class:PasswordInputView}}};async build(){let e=await super.build();return isEmpty(this.values)||"enfugue"===this.values.username&&this.inputViews.filter((e=>"admin"===e.fieldName))[0].disable(),e}}export{UserFormView};
