fcf.module({
  name: "fcfControls:templates/password.wrapper.js",
  dependencies: ["fcfControls:templates/view.wrapper.js"],
  module: function(BaseWrapper){
    return class PasswordWrapperEx extends BaseWrapper{

      constructor(a_initializeOptions){
        super(a_initializeOptions);
      }

      async initialize(){
        await super.initialize();
        let element = fcf.select(this.getDomElement(), "input")[0];
        if (element){
          if (fcf.str(this.getArg("value")) != fcf.str(element.value) && fcf.str(element.value) !== "*******")
            this._setArg("value", element.value);
        }
      }


      onInput(a_event){
        if (typeof this.getArg("value") === "boolean") {
          a_event.target.value = a_event.data;
          this._setArg("value", a_event.data);
        } else {
          this._setArg("value", a_event.target.value);
        }
      }
    };
  }
});
