"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/email-address/aliases-dynamic"],{2367:(e,n,t)=>{t.r(n),t.d(n,{default:()=>m});var a=t(89);const i=a.Locale.getSection("smb.components.forms.email-address");class o extends a.AddRemoveDynamicSubForm{_initConfiguration(e){super._initConfiguration({addButtonTitle:i.lmsg("buttonAddMailAlias"),removeButtonTitle:i.lmsg("buttonRemoveMailAlias"),...e})}_onInitDynamic(){super._onInitDynamic(),this.domainNameFieldId="general-generalSection-domain",document.getElementById("general-generalSection-domain")||(this.domainNameFieldId="general-vcard-domain"),document.getElementById(this.domainNameFieldId)&&document.getElementById(this.domainNameFieldId).addEventListener("change",(()=>{this.onDomainChange()})),this.onDomainChange()}_isAddButtonDisabled(){try{return Smb.Views.User.isExternalMailUsed()}catch{}return!1}_bindDynamicContent(e,n){const t=document.createElement("span");t.className="aliasDomainName";const i=e.querySelectorAll(".field-value input");return(0,a.render)(i[i.length-1],t,"after"),super._bindDynamicContent(e,n)}_initRemoveButtonWrapper(e){const n=`${this._removeButtonId}-${this._getRandomNumber()}`,t=e.querySelectorAll(".aliasDomainName");return(0,a.render)(t[t.length-1],`<span id="${n}" class="${this._removeButtonId}"></span>`,"after"),n}_onUpdateDynamic(){super._onUpdateDynamic(),this.onDomainChange()}onDomainChange(){const e=this.getDomainName();this._componentElement.querySelectorAll(".aliasDomainName").forEach((n=>{n.innerHTML=` @${e}`}))}getDomainName(){const e=this._getConfigParam("domainName");if(e)return e;const n=document.getElementById(this.domainNameFieldId);return"general-vcard-domain"===this.domainNameFieldId?n.value:n.options[n.selectedIndex].text}}const m=e=>new o(e)}}]);
//# sourceMappingURL=aliases-dynamic.js.map?50b57c0c5da545f36262