CKEDITOR.dialog.add("specialchar",(function(e){var t,n,a,l,i,o,r,s=e.lang.specialchar;return a=function(n){var a;"a"==(n=n.data?n.data.getTarget():new CKEDITOR.dom.element(n)).getName()&&(a=n.getChild(0).getHtml())&&(n.removeClass("cke_light_background"),t.hide(),(n=e.document.createElement("span")).setHtml(a),e.insertText(n.getText()))},l=CKEDITOR.tools.addFunction(a),o=function(e,a){var l;if("span"==(a=a||e.data.getTarget()).getName()&&(a=a.getParent()),"a"==a.getName()&&(l=a.getChild(0).getHtml())){n&&i(null,n);var o=t.getContentElement("info","htmlPreview").getElement();t.getContentElement("info","charPreview").getElement().setHtml(l),o.setHtml(CKEDITOR.tools.htmlEncode(l)),a.getParent().addClass("cke_light_background"),n=a}},i=function(e,a){"span"==(a=a||e.data.getTarget()).getName()&&(a=a.getParent()),"a"==a.getName()&&(t.getContentElement("info","charPreview").getElement().setHtml("&nbsp;"),t.getContentElement("info","htmlPreview").getElement().setHtml("&nbsp;"),a.getParent().removeClass("cke_light_background"),n=void 0)},r=CKEDITOR.tools.addFunction((function(t){var n,l=(t=new CKEDITOR.dom.event(t)).getTarget();n=t.getKeystroke();var r="rtl"==e.lang.dir;switch(n){case 38:(n=l.getParent().getParent().getPrevious())&&((n=n.getChild([l.getParent().getIndex(),0])).focus(),i(null,l),o(null,n)),t.preventDefault();break;case 40:(n=l.getParent().getParent().getNext())&&(n=n.getChild([l.getParent().getIndex(),0]))&&1==n.type&&(n.focus(),i(null,l),o(null,n)),t.preventDefault();break;case 32:a({data:t}),t.preventDefault();break;case r?37:39:(n=l.getParent().getNext())?1==(n=n.getChild(0)).type?(n.focus(),i(null,l),o(null,n),t.preventDefault(!0)):i(null,l):(n=l.getParent().getParent().getNext())&&((n=n.getChild([0,0]))&&1==n.type?(n.focus(),i(null,l),o(null,n),t.preventDefault(!0)):i(null,l));break;case r?39:37:(n=l.getParent().getPrevious())?((n=n.getChild(0)).focus(),i(null,l),o(null,n),t.preventDefault(!0)):(n=l.getParent().getParent().getPrevious())?((n=n.getLast().getChild(0)).focus(),i(null,l),o(null,n),t.preventDefault(!0)):i(null,l)}})),{title:s.title,minWidth:430,minHeight:280,buttons:[CKEDITOR.dialog.cancelButton],charColumns:17,onLoad:function(){for(var t,n,a=this.definition.charColumns,i=e.config.specialChars,o=CKEDITOR.tools.getNextId()+"_specialchar_table_label",c=['<table role="listbox" aria-labelledby="'+o+'" style="width: 320px; height: 100%; border-collapse: separate;" align="center" cellspacing="2" cellpadding="2" border="0">'],g=0,d=i.length;g<d;){c.push('<tr role="presentation">');for(var u=0;u<a;u++,g++)if(t=i[g]){t instanceof Array?(n=t[1],t=t[0]):(n=t.replace("&","").replace(";","").replace("#",""),n=s[n]||t);var p="cke_specialchar_label_"+g+"_"+CKEDITOR.tools.getNextNumber();c.push('<td class="cke_dark_background" style="cursor: default" role="presentation"><a href="javascript: void(0);" role="option" aria-posinset="'+(g+1)+'"',' aria-setsize="'+d+'"',' aria-labelledby="'+p+'"',' class="cke_specialchar" title="',CKEDITOR.tools.htmlEncode(n),'" onkeydown="CKEDITOR.tools.callFunction( '+r+', event, this )" onclick="CKEDITOR.tools.callFunction('+l+', this); return false;" tabindex="-1"><span style="margin: 0 auto;cursor: inherit">'+t+'</span><span class="cke_voice_label" id="'+p+'">'+n+"</span></a></td>")}c.push("</tr>")}c.push("</tbody></table>",'<span id="'+o+'" class="cke_voice_label">'+s.options+"</span>"),this.getContentElement("info","charContainer").getElement().setHtml(c.join(""))},contents:[{id:"info",label:e.lang.common.generalTab,title:e.lang.common.generalTab,padding:0,align:"top",elements:[{type:"hbox",align:"top",widths:["320px","90px"],children:[{type:"html",id:"charContainer",html:"",onMouseover:o,onMouseout:i,focus:function(){var e=this.getElement().getElementsByTag("a").getItem(0);setTimeout((function(){e.focus(),o(null,e)}),0)},onShow:function(){var e=this.getElement().getChild([0,0,0,0,0]);setTimeout((function(){e.focus(),o(null,e)}),0)},onLoad:function(e){t=e.sender}},{type:"hbox",align:"top",widths:["100%"],children:[{type:"vbox",align:"top",children:[{type:"html",html:"<div></div>"},{type:"html",id:"charPreview",className:"cke_dark_background",style:"border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:"<div>&nbsp;</div>"},{type:"html",id:"htmlPreview",className:"cke_dark_background",style:"border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:"<div>&nbsp;</div>"}]}]}]}]}]}}));