!function(e,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var t=s();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(Depicter,(()=>(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const{Layer:s,env:t}=window.Depicter;class r extends s{constructor(e,s,r,o,i,a){super(e,s,r,o,i,a),this.type="form:message",this.frame.classList.add(`${t.prefix}-form-message-layer`)}_setupContent(){const e=this.holder.composer?.survey?.form??this.element.closest("form"),s=e?.getAttribute("data-local-id")||e?.id;this.holder.composer.layersById[s]&&(this.formLayer=this.holder.composer.layersById[s]),this.formLayer&&this.formLayer.on("formSubmitted, formSubmitError",this._onFormSubmit.bind(this)),this.successMessage=this.element.querySelector(`.${t.prefix}-message-success`),this.errorMessage=this.element.querySelector(`.${t.prefix}-message-error`),this.holder.composer?.survey?(this.element.style.display="none",this.holder.composer.on("surveyPreventProceed",(()=>{this.composer.navigator.currentIndex===this.holder.index&&(this.element.style.display="")})),this.holder.composer.on("changeStart",(()=>{this.element.style.display="none"}))):this._hideMessages()}_hideMessages(){this.successMessage&&(this.successMessage.style.display="none"),this.errorMessage&&(this.errorMessage.style.display="none")}_onFormSubmit(e){this._hideMessages(),"formSubmitted"===e?this.successMessage&&(this.successMessage.style.display="block"):this.errorMessage&&(this.errorMessage.style.display="block")}}return window.Depicter.externalLayers["form:message"]=r,window.Depicter.externalLayers["survey:errorMessage"]=r,e})()));