/* Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ !function(){function e(e,i){var s,o=e.config,l=i.lang,r=new CKEDITOR.style(i.styleDefinition),f=new a({entries:i.entries,styleVariable:i.styleVariable,styleDefinition:i.styleDefinition});e.addCommand(i.commandName,{exec:function(e,i){var a=i.newStyle,s=i.oldStyle,o=e.getSelection().getRanges()[0],l=void 0===a;(s||a)&&(s&&o.collapsed&&n({editor:e,range:o,style:s}),l?e.removeStyle(s):(s&&!t(s,a)&&e.removeStyle(s),e.applyStyle(a)))},refresh:function(e,t){r.checkApplicable(t,e,e.activeFilter)||this.setState(CKEDITOR.TRISTATE_DISABLED)}}),s=e.getCommand(i.commandName),e.ui.addRichCombo(i.comboName,{label:l.label,title:l.panelTitle,command:i.commandName,toolbar:"styles,"+i.order,defaultValue:"cke-default",allowedContent:r,requiredContent:r,contentTransformations:"span"===i.styleDefinition.element?[[{element:"font",check:"span",left:function(e){return!!e.attributes.size||!!e.attributes.align||!!e.attributes.face},right:function(e){var t=" x-small small medium large x-large xx-large 48px".split(" ");e.name="span",e.attributes.size&&(e.styles["font-size"]=t[e.attributes.size],delete e.attributes.size),e.attributes.align&&(e.styles["text-align"]=e.attributes.align,delete e.attributes.align),e.attributes.face&&(e.styles["font-family"]=e.attributes.face,delete e.attributes.face)}}]]:null,panel:{css:[CKEDITOR.skin.getPath("editor")].concat(o.contentsCss),multiSelect:!1,attributes:{"aria-label":l.panelTitle}},init:function(){var t="("+e.lang.common.optionDefault+")";this.startGroup(l.panelTitle),this.add(this.defaultValue,t,t),f.addToCombo(this)},onClick:function(t){var n=this.getValue();e.focus(),e.fire("saveSnapshot"),e.execCommand(i.commandName,{newStyle:f.getStyle(t),oldStyle:f.getStyle(n)}),e.fire("saveSnapshot")},onRender:function(){e.on("selectionChange",function(t){var n=this.getValue();(t=f.getMatchingValue(e,t.data.path))?t!=n&&this.setValue(t):this.setValue("",i.defaultLabel)},this),s.on("state",function(){this.setState(s.state)},this)},refresh:function(){this.setState(s.state)}})}function t(e,t){if(!(e instanceof CKEDITOR.style&&t instanceof CKEDITOR.style))return!1;var n=function(e,t){var n=e.getDefinition().attributes,i=t.getDefinition().attributes;return CKEDITOR.tools.objectCompare(n,i)}(e,t),i=function(e,t){return CKEDITOR.style.getStyleText(e.getDefinition())===CKEDITOR.style.getStyleText(t.getDefinition())}(e,t);return n&&i}function n(e){var t,n,a,s=e.editor,o=e.range,l=e.style;if(t=s.elementPath(),e=t.contains(function(e){return l.checkElementRemovable(e)})){if(n=o.checkBoundaryOfElement(e,CKEDITOR.START),a=o.checkBoundaryOfElement(e,CKEDITOR.END),n&&a){for(n=o.createBookmark();t=e.getFirst();)t.insertBefore(e);e.remove(),o.moveToBookmark(n)}else n||a?o.moveToPosition(e,n?CKEDITOR.POSITION_BEFORE_START:CKEDITOR.POSITION_AFTER_END):(o.splitElement(e),o.moveToPosition(e,CKEDITOR.POSITION_AFTER_END)),i(o,t.elements.slice(),e);s.getSelection().selectRanges([o])}}function i(e,t,n){var a=t.pop();if(a){if(n)return i(e,t,a.equals(n)?null:n);n=a.clone(),e.insertNode(n),e.moveToPosition(n,CKEDITOR.POSITION_AFTER_START),i(e,t)}}var a=CKEDITOR.tools.createClass({$:function(e){var t=e.entries.split(";");this._.data={},this._.names=[];for(var n=0;n