text: (function(){var t=BX.namespace("BX.Intranet.UserProfile");if(t.ProfilePost){return}t.ProfilePost=function(t){this.init(t)};t.ProfilePost.prototype={init:function(t){this.managerInstance=t.managerInstance;this.options=t.options;this.loaderNode=BX("intranet-user-profile-about-loader");this.wrapperNode=BX("intranet-user-profile-about-wrapper");this.containerNode=BX("intranet-user-profile-post-container");this.editLinkNode=BX("intranet-user-profile-post-edit-link");this.stubButtonNode=BX("intranet-user-profile-post-edit-stub-button");this.loader=null;this.LHEEventNode=BX("div"+this.options.profilePostData.lheId);this.getData();this.managerInstance.processSliderCloseEvent({entityType:"profilePost",callback:function(){BX.cleanNode(this.wrapperNode);this.getData()}.bind(this)});if(this.editLinkNode){BX.bind(this.editLinkNode,"click",function(){this.getFormData()}.bind(this))}if(this.stubButtonNode){BX.bind(this.stubButtonNode,"click",function(){this.getFormData()}.bind(this))}if(this.LHEEventNode){BX.addCustomEvent(this.LHEEventNode,"OnProfilePostFormAfterShow",function(t,e){this.OnProfilePostFormAfterShow(t,e)}.bind(this));BX.addCustomEvent(this.LHEEventNode,"OnClickSubmit",function(t){this.OnClickSubmit(t)}.bind(this));BX.addCustomEvent(this.LHEEventNode,"OnClickCancel",function(t){this.setContainerEditMode(false);this.showPostContainer(true)}.bind(this))}},getData:function(){BX.addClass(this.loaderNode,"intranet-user-profile-loader-getdata");this.loader=this.managerInstance.showLoader({node:this.loaderNode,loader:this.loader});BX.ajax.runComponentAction(this.managerInstance.componentName,"getProfileBlogPost",{mode:"class",signedParameters:this.managerInstance.signedParameters,data:{}}).then(function(t){this.managerInstance.hideLoader({node:this.loaderNode,loader:this.loader});BX.removeClass(this.loaderNode,"intranet-user-profile-loader-getdata");this.setContainerEmpty(!BX.type.isNotEmptyObject(t.data));if(BX.type.isNotEmptyObject(t.data)){this.showData(t.data)}}.bind(this),function(t){this.managerInstance.hideLoader({node:this.loaderNode,loader:this.loader});BX.removeClass(this.loaderNode,"intranet-user-profile-loader-getdata")}.bind(this))},setContainerEmpty:function(t){if(this.containerNode){if(t){BX.addClass(this.containerNode,"intranet-user-profile-container-empty")}else{BX.removeClass(this.containerNode,"intranet-user-profile-container-empty")}}},setContainerEditMode:function(t){if(this.containerNode){if(t){BX.addClass(this.containerNode,"intranet-user-profile-container-editmode")}else{BX.removeClass(this.containerNode,"intranet-user-profile-container-editmode")}}},showData:function(t){if(!this.wrapperNode){return}this.showPostContainer(true);if(BX.type.isNotEmptyObject(t)&&BX.type.isNotEmptyObject(t.additionalParams)&&BX.type.isNotEmptyObject(t.additionalParams.POST)){var e=t.additionalParams.POST;if(BX.type.isNotEmptyString(e.TITLE)){this.wrapperNode.appendChild(BX.create("DIV",{props:{className:"intranet-user-profile-container-body-title"},html:e.TITLE}))}if(BX.type.isNotEmptyString(t.html)){this.wrapperNode.appendChild(BX.create("DIV",{props:{className:"intranet-user-profile-about"},html:t.html}))}if(BX.type.isNotEmptyObject(e.UF_RENDERED)){BX.Intranet.UserProfile.Utils.processAjaxBlock({data:e.UF_RENDERED,className:"intranet-user-profile-about-props",containerNode:this.wrapperNode})}}},getFormData:function(){this.showPostContainer(false);this.setContainerEditMode(true);this.managerInstance.showLoader({node:this.loaderNode,loader:this.loader});BX.ajax.runComponentAction(this.managerInstance.componentName,"getProfileBlogPostForm",{mode:"class",signedParameters:this.managerInstance.signedParameters,data:{}}).then(function(t){this.managerInstance.hideLoader({node:this.loaderNode,loader:this.loader});this.showFormData(t.data)}.bind(this),function(t){this.managerInstance.hideLoader({node:this.loaderNode,loader:this.loader});this.showPostContainer(true)}.bind(this))},showPostContainer:function(t){if(!this.wrapperNode){return}this.wrapperNode.style.display=!!t?"block":"none"},showFormData:function(t){if(this.LHEEventNode){BX.onCustomEvent(this.LHEEventNode,"OnShowLHE",["show"]);BX.onCustomEvent(this.LHEEventNode,"OnProfilePostFormAfterShow",[t])}},OnProfilePostFormAfterShow:function(t){t=!!t?t:{};var e=BX.type.isNotEmptyString(t.DETAIL_TEXT)?t.DETAIL_TEXT:"",i={};if(BX.type.isNotEmptyObject(t.UF)&&BX.type.isNotEmptyObject(t.UF.UF_BLOG_POST_FILE)){i["UF_BLOG_POST_FILE"]={USER_TYPE_ID:"disk_file",FIELD_NAME:"UF_BLOG_POST_FILE[]",VALUE:BX.clone(t.UF.UF_BLOG_POST_FILE.VALUE)}}LHEPostForm.reinitData(this.options.profilePostData.lheId,e,i)},OnClickSubmit:function(t){var e=t.oEditor.GetContent(),i=t.formID,o=BX.type.isNotEmptyString(i)?BX(i):null,n=BX.type.isNotEmptyString(i)?BX("lhe_button_submit_"+i):null;if(o){var a=BX.ajax.prepareForm(o);this.sendFormData({text:e,submitButton:n,additionalData:a.data})}},sendFormData:function(t){this.showButtonWait(t.submitButton,true);if(BX.type.isNotEmptyString(t.text)){BX.ajax.runComponentAction(this.managerInstance.componentName,"sendProfileBlogPostForm",{mode:"class",signedParameters:this.managerInstance.signedParameters,data:{params:{text:t.text,additionalData:t.additionalData}}}).then(function(e){this.showButtonWait(t.submitButton,false);BX.onCustomEvent(this.LHEEventNode,"OnShowLHE",["hide"]);BX.cleanNode(this.wrapperNode);this.getData();this.setContainerEditMode(false)}.bind(this),function(e){this.setContainerEditMode(false);this.showButtonWait(t.submitButton,false)}.bind(this))}else{BX.ajax.runComponentAction(this.managerInstance.componentName,"deleteProfileBlogPost",{mode:"class",signedParameters:this.managerInstance.signedParameters,data:{params:{}}}).then(function(e){this.showButtonWait(t.submitButton,false);BX.onCustomEvent(this.LHEEventNode,"OnShowLHE",["hide"]);BX.cleanNode(this.wrapperNode);this.getData();this.setContainerEditMode(false)}.bind(this),function(e){this.setContainerEditMode(false);this.showButtonWait(t.submitButton,false)}.bind(this))}},showButtonWait:function(t,e){if(t){if(!!e){BX.addClass(t,"ui-btn-clock")}else{BX.removeClass(t,"ui-btn-clock")}}}}})();
  //# sourceMappingURL=profilepost.map.js