CKEDITOR.plugins.add('styles',{requires:['selection'],init:function(a){a.on('contentDom',function(){a.document.setCustomData('cke_includeReadonly',!a.config.disableReadonlyStyling);});}});CKEDITOR.editor.prototype.attachStyleStateChange=function(a,b){var c=this._.styleStateChangeCallbacks;if(!c){c=this._.styleStateChangeCallbacks=[];this.on('selectionChange',function(d){for(var e=0;e<c.length;e++){var f=c[e],g=f.style.checkActive(d.data.path)?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF;f.fn.call(this,g);}});}c.push({style:a,fn:b});};CKEDITOR.STYLE_BLOCK=1;CKEDITOR.STYLE_INLINE=2;CKEDITOR.STYLE_OBJECT=3;(function(){var a={address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1},b={a:1,embed:1,hr:1,img:1,li:1,object:1,ol:1,table:1,td:1,tr:1,th:1,ul:1,dl:1,dt:1,dd:1,form:1},c=/\s*(?:;\s*|$)/,d=/#\((.+?)\)/g,e=CKEDITOR.dom.walker.bookmark(0,1),f=CKEDITOR.dom.walker.whitespaces(1);CKEDITOR.style=function(H,I){if(I){H=CKEDITOR.tools.clone(H);z(H.attributes,I);z(H.styles,I);}var J=this.element=(H.element||'*').toLowerCase();this.type=a[J]?CKEDITOR.STYLE_BLOCK:b[J]?CKEDITOR.STYLE_OBJECT:CKEDITOR.STYLE_INLINE;this._={definition:H};};CKEDITOR.style.prototype={apply:function(H){G.call(this,H,false);},remove:function(H){G.call(this,H,true);},applyToRange:function(H){var I=this;return(I.applyToRange=I.type==CKEDITOR.STYLE_INLINE?h:I.type==CKEDITOR.STYLE_BLOCK?l:I.type==CKEDITOR.STYLE_OBJECT?j:null).call(I,H);},removeFromRange:function(H){var I=this;return(I.removeFromRange=I.type==CKEDITOR.STYLE_INLINE?i:I.type==CKEDITOR.STYLE_BLOCK?m:I.type==CKEDITOR.STYLE_OBJECT?k:null).call(I,H);},applyToObject:function(H){y(H,this);},checkActive:function(H){var L=this;switch(L.type){case CKEDITOR.STYLE_BLOCK:return L.checkElementRemovable(H.block||H.blockLimit,true);case CKEDITOR.STYLE_OBJECT:case CKEDITOR.STYLE_INLINE:var I=H.elements;for(var J=0,K;J<I.length;J++){K=I[J];if(L.type==CKEDITOR.STYLE_INLINE&&(K==H.block||K==H.blockLimit))continue;if(L.type==CKEDITOR.STYLE_OBJECT&&!(K.getName() in b))continue;if(L.checkElementRemovable(K,true))return true;}}return false;},checkApplicable:function(H){switch(this.type){case CKEDITOR.STYLE_INLINE:case CKEDITOR.STYLE_BLOCK:break;case CKEDITOR.STYLE_OBJECT:return H.lastElement.getAscendant(this.element,true);}return true;},checkElementRemovable:function(H,I){if(!H||H.isReadOnly())return false;var J=this._.definition,K;if(H.getName()==this.element){if(!I&&!H.hasAttributes())return true;K=A(J);if(K._length){for(var L in K){if(L=='_length')continue;
var M=H.getAttribute(L)||'';if(L=='style'?F(K[L],D(M,false)):K[L]==M){if(!I)return true;}else if(I)return false;}if(I)return true;}else return true;}var N=B(this)[H.getName()];if(N){if(!(K=N.attributes))return true;for(var O=0;O<K.length;O++){L=K[O][0];var P=H.getAttribute(L);if(P){var Q=K[O][1];if(Q===null||typeof Q=='string'&&P==Q||Q.test(P))return true;}}}return false;},buildPreview:function(H){var I=this._.definition,J=[],K=I.element;if(K=='bdo')K='span';J=['<',K];var L=I.attributes;if(L)for(var M in L)J.push(' ',M,'="',L[M],'"');var N=CKEDITOR.style.getStyleText(I);if(N)J.push(' style="',N,'"');J.push('>',H||I.name,'</',K,'>');return J.join('');}};CKEDITOR.style.getStyleText=function(H){var I=H._ST;if(I)return I;I=H.styles;var J=H.attributes&&H.attributes.style||'',K='';if(J.length)J=J.replace(c,';');for(var L in I){var M=I[L],N=(L+':'+M).replace(c,';');if(M=='inherit')K+=N;else J+=N;}if(J.length)J=D(J);J+=K;return H._ST=J;};function g(H){var I,J;while(H=H.getParent()){if(H.getName()=='body')break;if(H.getAttribute('data-nostyle'))I=H;else if(!J){var K=H.getAttribute('contentEditable');if(K=='false')I=H;else if(K=='true')J=1;}}return I;};function h(H){var al=this;var I=H.document;if(H.collapsed){var J=x(al,I);H.insertNode(J);H.moveToPosition(J,CKEDITOR.POSITION_BEFORE_END);return;}var K=al.element,L=al._.definition,M,N=L.includeReadonly;if(N==undefined)N=I.getCustomData('cke_includeReadonly');var O=CKEDITOR.dtd[K]||(M=true,CKEDITOR.dtd.span);H.enlarge(CKEDITOR.ENLARGE_ELEMENT,1);H.trim();var P=H.createBookmark(),Q=P.startNode,R=P.endNode,S=Q,T,U=g(Q),V=g(R);if(U)S=U.getNextSourceNode(true);if(V)R=V;if(S.getPosition(R)==CKEDITOR.POSITION_FOLLOWING)S=0;while(S){var W=false;if(S.equals(R)){S=null;W=true;}else{var X=S.type,Y=X==CKEDITOR.NODE_ELEMENT?S.getName():null,Z=Y&&S.getAttribute('contentEditable')=='false',aa=Y&&S.getAttribute('data-nostyle');if(Y&&S.data('cke-bookmark')){S=S.getNextSourceNode(true);continue;}if(!Y||O[Y]&&!aa&&(!Z||N)&&(S.getPosition(R)|CKEDITOR.POSITION_PRECEDING|CKEDITOR.POSITION_IDENTICAL|CKEDITOR.POSITION_IS_CONTAINED)==CKEDITOR.POSITION_PRECEDING+CKEDITOR.POSITION_IDENTICAL+CKEDITOR.POSITION_IS_CONTAINED&&(!L.childRule||L.childRule(S))){var ab=S.getParent();if(ab&&((ab.getDtd()||CKEDITOR.dtd.span)[K]||M)&&(!L.parentRule||L.parentRule(ab))){if(!T&&(!Y||!CKEDITOR.dtd.$removeEmpty[Y]||(S.getPosition(R)|CKEDITOR.POSITION_PRECEDING|CKEDITOR.POSITION_IDENTICAL|CKEDITOR.POSITION_IS_CONTAINED)==CKEDITOR.POSITION_PRECEDING+CKEDITOR.POSITION_IDENTICAL+CKEDITOR.POSITION_IS_CONTAINED)){T=new CKEDITOR.dom.range(I);
T.setStartBefore(S);}if(X==CKEDITOR.NODE_TEXT||Z||X==CKEDITOR.NODE_ELEMENT&&!S.getChildCount()){var ac=S,ad;while((W=!ac.getNext(e))&&(ad=ac.getParent(),O[ad.getName()])&&(ad.getPosition(Q)|CKEDITOR.POSITION_FOLLOWING|CKEDITOR.POSITION_IDENTICAL|CKEDITOR.POSITION_IS_CONTAINED)==CKEDITOR.POSITION_FOLLOWING+CKEDITOR.POSITION_IDENTICAL+CKEDITOR.POSITION_IS_CONTAINED&&(!L.childRule||L.childRule(ad)))ac=ad;T.setEndAfter(ac);}}else W=true;}else W=true;S=S.getNextSourceNode(aa||Z);}if(W&&T&&!T.collapsed){var ae=x(al,I),af=ae.hasAttributes(),ag=T.getCommonAncestor(),ah={styles:{},attrs:{},blockedStyles:{},blockedAttrs:{}},ai,aj,ak;while(ae&&ag){if(ag.getName()==K){for(ai in L.attributes){if(ah.blockedAttrs[ai]||!(ak=ag.getAttribute(aj)))continue;if(ae.getAttribute(ai)==ak)ah.attrs[ai]=1;else ah.blockedAttrs[ai]=1;}for(aj in L.styles){if(ah.blockedStyles[aj]||!(ak=ag.getStyle(aj)))continue;if(ae.getStyle(aj)==ak)ah.styles[aj]=1;else ah.blockedStyles[aj]=1;}}ag=ag.getParent();}for(ai in ah.attrs)ae.removeAttribute(ai);for(aj in ah.styles)ae.removeStyle(aj);if(af&&!ae.hasAttributes())ae=null;if(ae){T.extractContents().appendTo(ae);u(al,ae);T.insertNode(ae);ae.mergeSiblings();if(!CKEDITOR.env.ie)ae.$.normalize();}else{ae=new CKEDITOR.dom.element('span');T.extractContents().appendTo(ae);T.insertNode(ae);u(al,ae);ae.remove(true);}T=null;}}H.moveToBookmark(P);H.shrink(CKEDITOR.SHRINK_TEXT);};function i(H){H.enlarge(CKEDITOR.ENLARGE_ELEMENT,1);var I=H.createBookmark(),J=I.startNode;if(H.collapsed){var K=new CKEDITOR.dom.elementPath(J.getParent()),L;for(var M=0,N;M<K.elements.length&&(N=K.elements[M]);M++){if(N==K.block||N==K.blockLimit)break;if(this.checkElementRemovable(N)){var O;if(H.collapsed&&(H.checkBoundaryOfElement(N,CKEDITOR.END)||(O=H.checkBoundaryOfElement(N,CKEDITOR.START)))){L=N;L.match=O?'start':'end';}else{N.mergeSiblings();if(N.getName()==this.element)t(this,N);else v(N,B(this)[N.getName()]);}}}if(L){var P=J;for(M=0;true;M++){var Q=K.elements[M];if(Q.equals(L))break;else if(Q.match)continue;else Q=Q.clone();Q.append(P);P=Q;}P[L.match=='start'?'insertBefore':'insertAfter'](L);}}else{var R=I.endNode,S=this;function T(){var W=new CKEDITOR.dom.elementPath(J.getParent()),X=new CKEDITOR.dom.elementPath(R.getParent()),Y=null,Z=null;for(var aa=0;aa<W.elements.length;aa++){var ab=W.elements[aa];if(ab==W.block||ab==W.blockLimit)break;if(S.checkElementRemovable(ab))Y=ab;}for(aa=0;aa<X.elements.length;aa++){ab=X.elements[aa];if(ab==X.block||ab==X.blockLimit)break;if(S.checkElementRemovable(ab))Z=ab;
}if(Z)R.breakParent(Z);if(Y)J.breakParent(Y);};T();var U=J.getNext();while(!U.equals(R)){var V=U.getNextSourceNode();if(U.type==CKEDITOR.NODE_ELEMENT&&this.checkElementRemovable(U)){if(U.getName()==this.element)t(this,U);else v(U,B(this)[U.getName()]);if(V.type==CKEDITOR.NODE_ELEMENT&&V.contains(J)){T();V=J.getNext();}}U=V;}}H.moveToBookmark(I);};function j(H){var I=H.getCommonAncestor(true,true),J=I.getAscendant(this.element,true);J&&!J.isReadOnly()&&y(J,this);};function k(H){var I=H.getCommonAncestor(true,true),J=I.getAscendant(this.element,true);if(!J)return;var K=this,L=K._.definition,M=L.attributes,N=CKEDITOR.style.getStyleText(L);if(M)for(var O in M)J.removeAttribute(O,M[O]);if(L.styles)for(var P in L.styles){if(!L.styles.hasOwnProperty(P))continue;J.removeStyle(P);}};function l(H){var I=H.createBookmark(true),J=H.createIterator();J.enforceRealBlocks=true;if(this._.enterMode)J.enlargeBr=this._.enterMode!=CKEDITOR.ENTER_BR;var K,L=H.document,M;while(K=J.getNextParagraph()){if(!K.isReadOnly()){var N=x(this,L,K);n(K,N);}}H.moveToBookmark(I);};function m(H){var M=this;var I=H.createBookmark(1),J=H.createIterator();J.enforceRealBlocks=true;J.enlargeBr=M._.enterMode!=CKEDITOR.ENTER_BR;var K;while(K=J.getNextParagraph()){if(M.checkElementRemovable(K))if(K.is('pre')){var L=M._.enterMode==CKEDITOR.ENTER_BR?null:H.document.createElement(M._.enterMode==CKEDITOR.ENTER_P?'p':'div');L&&K.copyAttributes(L);n(K,L);}else t(M,K,1);}H.moveToBookmark(I);};function n(H,I){var J=!I;if(J){I=H.getDocument().createElement('div');H.copyAttributes(I);}var K=I&&I.is('pre'),L=H.is('pre'),M=K&&!L,N=!K&&L;if(M)I=s(H,I);else if(N)I=r(J?[H.getHtml()]:p(H),I);else H.moveChildren(I);I.replace(H);if(K)o(I);else if(J)w(I);};function o(H){var I;if(!((I=H.getPrevious(f))&&I.is&&I.is('pre')))return;var J=q(I.getHtml(),/\n$/,'')+'\n\n'+q(H.getHtml(),/^\n/,'');if(CKEDITOR.env.ie)H.$.outerHTML='<pre>'+J+'</pre>';else H.setHtml(J);I.remove();};function p(H){var I=/(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,J=H.getName(),K=q(H.getOuterHtml(),I,function(M,N,O){return N+'</pre>'+O+'<pre>';}),L=[];K.replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi,function(M,N){L.push(N);});return L;};function q(H,I,J){var K='',L='';H=H.replace(/(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+data-cke-bookmark.*?\/span>$)/gi,function(M,N,O){N&&(K=N);O&&(L=O);return '';});return K+H.replace(I,J)+L;};function r(H,I){var J;if(H.length>1)J=new CKEDITOR.dom.documentFragment(I.getDocument());for(var K=0;
K<H.length;K++){var L=H[K];L=L.replace(/(\r\n|\r)/g,'\n');L=q(L,/^[ \t]*\n/,'');L=q(L,/\n$/,'');L=q(L,/^[ \t]+|[ \t]+$/g,function(N,O,P){if(N.length==1)return '&nbsp;';else if(!O)return CKEDITOR.tools.repeat('&nbsp;',N.length-1)+' ';else return ' '+CKEDITOR.tools.repeat('&nbsp;',N.length-1);});L=L.replace(/\n/g,'<br>');L=L.replace(/[ \t]{2,}/g,function(N){return CKEDITOR.tools.repeat('&nbsp;',N.length-1)+' ';});if(J){var M=I.clone();M.setHtml(L);J.append(M);}else I.setHtml(L);}return J||I;};function s(H,I){var J=H.getBogus();J&&J.remove();var K=H.getHtml();K=q(K,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,'');K=K.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi,'$1');K=K.replace(/([ \t\n\r]+|&nbsp;)/g,' ');K=K.replace(/<br\b[^>]*>/gi,'\n');if(CKEDITOR.env.ie){var L=H.getDocument().createElement('div');L.append(I);I.$.outerHTML='<pre>'+K+'</pre>';I.copyAttributes(L.getFirst());I=L.getFirst().remove();}else I.setHtml(K);return I;};function t(H,I){var J=H._.definition,K=CKEDITOR.tools.extend({},J.attributes,B(H)[I.getName()]),L=J.styles,M=CKEDITOR.tools.isEmpty(K)&&CKEDITOR.tools.isEmpty(L);for(var N in K){if((N=='class'||H._.definition.fullMatch)&&I.getAttribute(N)!=C(N,K[N]))continue;M=I.hasAttribute(N);I.removeAttribute(N);}for(var O in L){if(H._.definition.fullMatch&&I.getStyle(O)!=C(O,L[O],true))continue;M=M||!!I.getStyle(O);I.removeStyle(O);}if(M)!CKEDITOR.dtd.$block[I.getName()]||H._.enterMode==CKEDITOR.ENTER_BR&&!I.hasAttributes()?w(I):I.renameNode(H._.enterMode==CKEDITOR.ENTER_P?'p':'div');};function u(H,I){var J=H._.definition,K=J.attributes,L=J.styles,M=B(H),N=I.getElementsByTag(H.element);for(var O=N.count();--O>=0;)t(H,N.getItem(O));for(var P in M){if(P!=H.element){N=I.getElementsByTag(P);for(O=N.count()-1;O>=0;O--){var Q=N.getItem(O);v(Q,M[P]);}}}};function v(H,I){var J=I&&I.attributes;if(J)for(var K=0;K<J.length;K++){var L=J[K][0],M;if(M=H.getAttribute(L)){var N=J[K][1];if(N===null||N.test&&N.test(M)||typeof N=='string'&&M==N)H.removeAttribute(L);}}w(H);};function w(H){if(!H.hasAttributes())if(CKEDITOR.dtd.$block[H.getName()]){var I=H.getPrevious(f),J=H.getNext(f);if(I&&(I.type==CKEDITOR.NODE_TEXT||!I.isBlockBoundary({br:1})))H.append('br',1);if(J&&(J.type==CKEDITOR.NODE_TEXT||!J.isBlockBoundary({br:1})))H.append('br');H.remove(true);}else{var K=H.getFirst(),L=H.getLast();H.remove(true);if(K){K.type==CKEDITOR.NODE_ELEMENT&&K.mergeSiblings();if(L&&!K.equals(L)&&L.type==CKEDITOR.NODE_ELEMENT)L.mergeSiblings();}}};function x(H,I,J){var K,L=H._.definition,M=H.element;
if(M=='*')M='span';K=new CKEDITOR.dom.element(M,I);if(J)J.copyAttributes(K);K=y(K,H);if(I.getCustomData('doc_processing_style')&&K.hasAttribute('id'))K.removeAttribute('id');else I.setCustomData('doc_processing_style',1);return K;};function y(H,I){var J=I._.definition,K=J.attributes,L=CKEDITOR.style.getStyleText(J);if(K)for(var M in K)H.setAttribute(M,K[M]);if(L)H.setAttribute('style',L);return H;};function z(H,I){for(var J in H)H[J]=H[J].replace(d,function(K,L){return I[L];});};function A(H){var I=H._AC;if(I)return I;I={};var J=0,K=H.attributes;if(K)for(var L in K){J++;I[L]=K[L];}var M=CKEDITOR.style.getStyleText(H);if(M){if(!I.style)J++;I.style=M;}I._length=J;return H._AC=I;};function B(H){if(H._.overrides)return H._.overrides;var I=H._.overrides={},J=H._.definition.overrides;if(J){if(!CKEDITOR.tools.isArray(J))J=[J];for(var K=0;K<J.length;K++){var L=J[K],M,N,O;if(typeof L=='string')M=L.toLowerCase();else{M=L.element?L.element.toLowerCase():H.element;O=L.attributes;}N=I[M]||(I[M]={});if(O){var P=N.attributes=N.attributes||[];for(var Q in O)P.push([Q.toLowerCase(),O[Q]]);}}}return I;};function C(H,I,J){var K=new CKEDITOR.dom.element('span');K[J?'setStyle':'setAttribute'](H,I);return K[J?'getStyle':'getAttribute'](H);};function D(H,I){var J;if(I!==false){var K=new CKEDITOR.dom.element('span');K.setAttribute('style',H);J=K.getAttribute('style')||'';}else J=H;J=J.replace(/(font-family:)(.*?)(?=;|$)/,function(L,M,N){var O=N.split(',');for(var P=0;P<O.length;P++)O[P]=CKEDITOR.tools.trim(O[P].replace(/["']/g,''));return M+O.join(',');});return J.replace(/\s*([;:])\s*/,'$1').replace(/([^\s;])$/,'$1;').replace(/,\s+/g,',').replace(/\"/g,'').toLowerCase();};function E(H){var I={};H.replace(/&quot;/g,'"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(J,K,L){I[K]=L;});return I;};function F(H,I){typeof H=='string'&&(H=E(H));typeof I=='string'&&(I=E(I));for(var J in H){if(!(J in I&&(I[J]==H[J]||H[J]=='inherit'||I[J]=='inherit')))return false;}return true;};function G(H,I){var J=H.getSelection(),K=J.getRanges(),L=I?this.removeFromRange:this.applyToRange,M,N=K.createIterator();while(M=N.getNextRange())L.call(this,M);J.selectRanges(K);H.removeCustomData('doc_processing_style');};})();CKEDITOR.styleCommand=function(a){this.style=a;};CKEDITOR.styleCommand.prototype.exec=function(a){var c=this;a.focus();var b=a.document;if(b)if(c.state==CKEDITOR.TRISTATE_OFF)c.style.apply(b);else if(c.state==CKEDITOR.TRISTATE_ON)c.style.remove(b);return!!b;};CKEDITOR.stylesSet=new CKEDITOR.resourceManager('','stylesSet');
CKEDITOR.addStylesSet=CKEDITOR.tools.bind(CKEDITOR.stylesSet.add,CKEDITOR.stylesSet);CKEDITOR.loadStylesSet=function(a,b,c){CKEDITOR.stylesSet.addExternal(a,b,'');CKEDITOR.stylesSet.load(a,c);};CKEDITOR.editor.prototype.getStylesSet=function(a){if(!this._.stylesDefinitions){var b=this,c=b.config.stylesCombo_stylesSet||b.config.stylesSet||'default';if(c instanceof Array){b._.stylesDefinitions=c;a(c);return;}var d=c.split(':'),e=d[0],f=d[1],g=CKEDITOR.plugins.registered.styles.path;CKEDITOR.stylesSet.addExternal(e,f?d.slice(1).join(':'):g+'styles/'+e+'.js','');CKEDITOR.stylesSet.load(e,function(h){b._.stylesDefinitions=h[e];a(b._.stylesDefinitions);});}else a(this._.stylesDefinitions);};
