!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=function(t){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)},n=function(t){var n=t.selection.getNode();return"A"===n.tagName&&""===t.dom.getAttrib(n,"href")?n.id||n.name:""},a=function(t,n){var e=t.selection.getNode();"A"===e.tagName&&""===t.dom.getAttrib(e,"href")?(e.removeAttribute("name"),e.id=n,t.undoManager.add()):(t.focus(),t.selection.collapse(!0),t.execCommand("mceInsertContent",!1,t.dom.createHTML("a",{id:n})))},e=function(o){var t=n(o);o.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"Id"}]},buttons:[{type:"submit",name:"ok",text:"Ok",primary:!0},{type:"cancel",name:"cancel",text:"Cancel"}],initialData:{id:t},onSubmit:function(t){var n,e;n=o,e=t.getData().id,(r(e)?(a(n,e),0):(n.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),1))||t.close()}})},o=function(t){t.addCommand("mceAnchor",function(){e(t)})},i=function(o){return function(t){for(var n=0;n