var TF_Editor_Item=function(){function t(t){this.editor=t,this.isDragging=!1,this.initEditor(this.editor)}var e=t.prototype;return e.reinitializeEditors=function(t){var e=this;t.querySelectorAll(".tf-editor-wrapper").forEach(function(t){e.initEditor(t)})},e.initEditors=function(t){var e=this;t.querySelectorAll(".tf-editor-wrapper").forEach(function(t){e.initEditor(t)})},e.initEditor=function(t){var e=this,i=t.querySelector("textarea");i&&(this.maybeDestroyEditor(i),window.WfEditor&&!document.querySelector('script[data-asset-name="plg_editors_tinymce"]')?(window.WfEditor.settings.theme_buttons1="bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull,formatselect,forecolor,bullist,numlist,link,imgmanager,removeformat,fullscreen",window.WfEditor.settings.theme_buttons2="",window.WfEditor.settings.theme_buttons3="",window.WfEditor.settings.theme_buttons4="",window.WfEditor.create([i])):(i={target:i,menubar:!1,license_key:"gpl",plugins:["code","media","lists","visualblocks","link","autolink","image","fullscreen"],toolbar:"bold italic underline | alignleft aligncenter alignright alignjustify | formatselect forecolor |bullist numlist | link image removeformat fullscreen code",valid_elements:"*[*]",extended_valid_elements:"a[*],button[*],img[*],iframe[*],div[*],span[*],input[*],form[*]"},t.dataset.plugins&&(i.plugins=JSON.parse(t.dataset.plugins)||i.plugins),t.dataset.toolbar&&(i.toolbar=JSON.parse(t.dataset.toolbar)||i.toolbar),tinymce.init(i).then(function(t){e.editor.tinymceinstance=t[0]})))},e.maybeDestroyEditor=function(t){t=t.id,t=tinymce.get(t);t&&t.destroy()},t}(),TF_Editors_Loader=function(){function t(){this.debounceTimer=null,this.init(),this.initEvents()}var e=t.prototype;return e.initEvents=function(){this.setupSubformOrderListener()},e.setupSubformOrderListener=function(){var e,i=this,t=document.querySelectorAll(".subform-repeatable-container");t.length&&(e=new MutationObserver(function(t){t.forEach(function(t){var e=t.target;"attributes"===t.type&&e.classList.contains("subform-repeatable-group")&&"true"!==e.getAttribute("aria-grabbed")&&"true"!==e.getAttribute("draggable")&&(i.debounceTimer&&clearTimeout(i.debounceTimer),i.debounceTimer=setTimeout(function(){e.querySelectorAll(".tf-editor-wrapper").forEach(function(t){new TF_Editor_Item(t)})},100))})}),t.forEach(function(t){e.observe(t,{childList:!0,subtree:!0,attributes:!0})}))},e.init=function(){var t,e;window.IntersectionObserver&&(t=document.querySelectorAll(".tf-editor-wrapper"))&&(e=new IntersectionObserver(function(t,e){t.forEach(function(t){t.isIntersecting&&(new TF_Editor_Item(t.target),e.unobserve(t.target))})},{rootMargin:"0px 0px 0px 0px"}),t.forEach(function(t){e.observe(t)}))},t}();document.addEventListener("DOMContentLoaded",function(){new TF_Editors_Loader});

