/* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ (function(){function m(a){CKEDITOR.tools.extend(this,a);this.queue=[];this.init?this.init(CKEDITOR.tools.bind(function(){for(var a;a=this.queue.pop();)a.call(this);this.ready=!0},this)):this.ready=!0}function p(a){var b=a.config.codeSnippet_codeClass,e=/\r?\n/g,h=new CKEDITOR.dom.element("textarea");a.widgets.add("codeSnippet",{allowedContent:"pre; code(language-*)",requiredContent:"pre",styleableElements:"pre",template:'\x3cpre\x3e\x3ccode class\x3d"'+b+'"\x3e\x3c/code\x3e\x3c/pre\x3e',dialog:"codeSnippet", pathName:a.lang.codesnippet.pathName,mask:!0,parts:{pre:"pre",code:"code"},highlight:function(){var d=this,c=this.data,b=function(a){d.parts.code.setHtml(n?a:a.replace(e,"\x3cbr\x3e"))};b(CKEDITOR.tools.htmlEncode(c.code));a._.codesnippet.highlighter.highlight(c.code,c.lang,function(d){a.fire("lockSnapshot");b(d);a.fire("unlockSnapshot")})},data:function(){var a=this.data,b=this.oldData;a.code&&this.parts.code.setHtml(CKEDITOR.tools.htmlEncode(a.code));b&&a.lang!=b.lang&&this.parts.code.removeClass("language-"+ b.lang);a.lang&&(this.parts.code.addClass("language-"+a.lang),this.highlight());this.oldData=CKEDITOR.tools.copy(a)},upcast:function(d,c){if("pre"==d.name){for(var g=[],e=d.children,k,l=e.length-1;0<=l;l--)k=e[l],k.type==CKEDITOR.NODE_TEXT&&k.value.match(q)||g.push(k);var f;if(1==g.length&&"code"==(f=g[0]).name&&1==f.children.length&&f.children[0].type==CKEDITOR.NODE_TEXT){if(g=a._.codesnippet.langsRegex.exec(f.attributes["class"]))c.lang=g[1];h.setHtml(f.getHtml());c.code=h.getValue();f.addClass(b); return d}}},downcast:function(a){var c=a.getFirst("code");c.children.length=0;c.removeClass(b);c.add(new CKEDITOR.htmlParser.text(CKEDITOR.tools.htmlEncode(this.data.code)));return a}});var q=/^[\s\n\r]*$/}var n=!CKEDITOR.env.ie||8