/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
!function(){function validateContent(ed,content){var args={no_events:!0,format:"raw"},settings={};if(extend(settings,ed.settings),args.content=content,ed.settings.validate){args.format="html",args.load=!0,ed.onBeforeGetContent.dispatch(ed,args),settings.verify_html=!1,settings.forced_root_block=!1,settings.validate=!0;var parser=new DomParser(settings,ed.schema),serializer=new HtmlSerializer(settings,ed.schema);args.content=serializer.serialize(parser.parse(args.content),args),args.get=!0,ed.onPostProcess.dispatch(ed,args),content=args.content}return content}var Entities=tinymce.html.Entities,each=tinymce.each,extend=tinymce.extend,DomParser=tinymce.html.DomParser,HtmlSerializer=tinymce.html.Serializer,Dispatcher=tinymce.util.Dispatcher;tinymce.PluginManager.add("core",function(ed,url){function isEmpty(){return"TEXTAREA"===elm.nodeName?""==elm.value:""==elm.innerHTML}function insertContent(value){return value=Entities.decode(value),value&&("TEXTAREA"===elm.nodeName?elm.value=value:elm.innerHTML=value),!0}function isFakeRoot(node){return node&&1==node.nodeType&&node.hasAttribute("data-mce-root")}function fakeRootBlock(){ed.settings.editable_root="rootblock",ed.onPreInit.add(function(){function isEmptyRoot(node){return/^(&nbsp;|&#160;|\s|\u00a0|)$/.test(node.innerHTML)}var selection=ed.selection,dom=ed.dom;ed.schema.addValidElements("#mce:root[id|data-mce-root]"),ed.schema.children["mce:root"]=ed.schema.children.body,ed.schema.children.body["mce:root"]={},ed.serializer.addAttributeFilter("data-mce-root",function(nodes){for(var i=nodes.length;i--;)nodes[i].unwrap()}),ed.serializer.addAttributeFilter("data-mce-bogus",function(nodes){for(var i=nodes.length;i--;)nodes[i].remove()}),ed.onBeforeSetContent.add(function(editor,o){o.content||(o.content='<br data-mce-bogus="1">'),o.content='<mce:root id="'+ed.settings.editable_root+'" data-mce-root="1">'+o.content+"</mce:root>"}),ed.onSetContent.add(function(ed,o){var rng,root=dom.get(ed.settings.editable_root);root&&(isEmptyRoot(root)&&(root.innerHTML='<br data-mce-bogus="1">'),rng=dom.createRng(),rng.setStart(root,0),rng.setEnd(root,0),selection.setRng(rng))}),ed.onSaveContent.add(function(ed,o){"&nbsp;"===o.content&&(o.content="")}),ed.undoManager.onBeforeAdd.add(function(um,level){var container=ed.dom.create("div",{},level.content);isFakeRoot(container.firstChild)&&(level.content=container.firstChild.innerHTML)})})}var store;ed.onUpdateMedia=new Dispatcher,ed.onWfEditorSave=new Dispatcher;var contentLoaded=!1,elm=ed.getElement(),startup_content_html=ed.settings.startup_content_html||"";ed.onBeforeRenderUI.add(function(){if(startup_content_html&&elm&&!contentLoaded&&isEmpty())return contentLoaded=!0,insertContent(startup_content_html)}),ed.onKeyUp.add(function(ed,e){var quoted="&ldquo;{$selection}&rdquo;";"de"==ed.settings.language&&(quoted="&bdquo;{$selection}&ldquo;"),("'"===e.key||'"'==e.key)&&e.shiftKey&&e.ctrlKey&&(ed.undoManager.add(),ed.execCommand("mceReplaceContent",!1,quoted))}),ed.onExecCommand.add(function(ed,cmd,ui,val,args){"Undo"!=cmd&&"Redo"!=cmd&&"mceReApply"!=cmd&&"mceRepaint"!=cmd&&(store={cmd:cmd,ui:ui,value:val,args:args})}),ed.addShortcut("ctrl+alt+z","","mceReApply"),ed.addCommand("mceReApply",function(){if(store&&store.cmd)return ed.execCommand(store.cmd,store.ui,store.value,store.args)}),ed.onPreInit.add(function(){ed.onUpdateMedia.add(function(ed,o){function updateSrcSet(elm,o){var srcset=elm.getAttribute("srcset");if(srcset){for(var sets=srcset.split(","),i=0;i<sets.length;i++){var values=sets[i].trim().split(" ");o.before==values[0]&&(values[0]=o.after),sets[i]=values.join(" ")}elm.setAttribute("srcset",sets.join(","))}}o.before&&o.after&&(each(ed.dom.select("img,poster"),function(elm){var src=elm.getAttribute("src"),val=src.substring(0,src.indexOf("?"));if(val==o.before){var after=o.after,stamp="?"+(new Date).getTime();src.indexOf("?")!==-1&&after.indexOf("?")===-1&&(after+=stamp),ed.dom.setAttribs(elm,{src:after,"data-mce-src":o.after})}elm.getAttribute("srcset")&&updateSrcSet(elm,o)}),each(ed.dom.select("a[href]"),function(elm){var href=ed.dom.getAttrib(elm,"href");href==o.before&&ed.dom.setAttribs(elm,{href:o.after,"data-mce-href":o.after})}))}),ed.onWfEditorSave.add(function(ed,o){o.content=validateContent(ed,o.content)})}),0==ed.settings.forced_root_block&&0!=ed.settings.editable_root&&fakeRootBlock(),tinymce.util.isFakeRoot=isFakeRoot})}();