/*
 Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function n(a){if(!a||a.type!=CKEDITOR.NODE_ELEMENT||"form"!=a.getName())return[];for(var d=[],c=["style","className"],b=0;b<c.length;b++){var e=a.$.elements.namedItem(c[b]);e&&(e=new CKEDITOR.dom.element(e),d.push([e,e.nextSibling]),e.remove())}return d}function k(a,d){if(a&&a.type==CKEDITOR.NODE_ELEMENT&&"form"==a.getName()&&0<d.length)for(var c=d.length-1;0<=c;c--){var b=d[c][0],e=d[c][1];e?b.insertBefore(e):b.appendTo(a)}}function q(a,d){var c=n(a),b={},e=a.$;d||(b["class"]=e.className||
"",e.className="");b.inline=e.style.cssText||"";d||(e.style.cssText="position: static; overflow: visible");k(c);return b}function r(a,d){var c=n(a),b=a.$;"class"in d&&(b.className=d["class"]);"inline"in d&&(b.style.cssText=d.inline);k(c)}function t(a){!a.editable().isInline()&&a.editable().hasFocus&&(a.toolbox.focus(),a.focus())}CKEDITOR.plugins.add("maximize",{lang:"af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",
icons:"maximize",hidpi:!0,init:function(a){function d(){var g=h.getViewPaneSize();a.resize(g.width,g.height,null,!0)}function c(){var g=a.getCommand("maximize");g.state===CKEDITOR.TRISTATE_ON&&g.exec()}if(a.elementMode!=CKEDITOR.ELEMENT_MODE_INLINE){var b=a.lang,e=CKEDITOR.document,h=e.getWindow(),l,m,p,n=CKEDITOR.TRISTATE_OFF;a.addCommand("maximize",{modes:{wysiwyg:!CKEDITOR.env.iOS,source:!CKEDITOR.env.iOS},readOnly:1,editorFocus:!1,exec:function(){var g=a.container.getFirst(function(a){return a.type==
CKEDITOR.NODE_ELEMENT&&a.hasClass("cke_inner")}),b=a.ui.space("contents");if("wysiwyg"==a.mode){var f=a.getSelection();l=f&&f.getRanges();m=h.getScrollPosition()}else{var c=a.editable().$;l=!CKEDITOR.env.ie&&[c.selectionStart,c.selectionEnd];m=[c.scrollLeft,c.scrollTop]}if(this.state==CKEDITOR.TRISTATE_OFF){h.on("resize",d);p=h.getScrollPosition();for(f=a.container;f=f.getParent();)f.setCustomData("maximize_saved_styles",q(f)),f.setStyle("z-index",a.config.baseFloatZIndex-5);b.setCustomData("maximize_saved_styles",
q(b,!0));g.setCustomData("maximize_saved_styles",q(g,!0));b={overflow:CKEDITOR.env.webkit?"":"hidden",width:0,height:0};e.getDocumentElement().setStyles(b);!CKEDITOR.env.gecko&&e.getDocumentElement().setStyle("position","fixed");CKEDITOR.env.gecko&&CKEDITOR.env.quirks||e.getBody().setStyles(b);CKEDITOR.env.ie?setTimeout(function(){h.$.scrollTo(0,0)},0):h.$.scrollTo(0,0);g.setStyle("position",CKEDITOR.env.gecko&&CKEDITOR.env.quirks?"fixed":"absolute");g.$.offsetLeft;g.setStyles({"z-index":a.config.baseFloatZIndex-
5,left:"0px",top:"0px"});g.addClass("cke_maximized");d();b=g.getDocumentPosition();g.setStyles({left:-1*b.x+"px",top:-1*b.y+"px"});CKEDITOR.env.gecko&&t(a)}else if(this.state==CKEDITOR.TRISTATE_ON){h.removeListener("resize",d);for(var f=[b,g],k=0;k<f.length;k++)r(f[k],f[k].getCustomData("maximize_saved_styles")),f[k].removeCustomData("maximize_saved_styles");for(f=a.container;f=f.getParent();)r(f,f.getCustomData("maximize_saved_styles")),f.removeCustomData("maximize_saved_styles");CKEDITOR.env.ie?
setTimeout(function(){h.$.scrollTo(p.x,p.y)},0):h.$.scrollTo(p.x,p.y);g.removeClass("cke_maximized");CKEDITOR.env.webkit&&(g.setStyle("display","inline"),setTimeout(function(){g.setStyle("display","block")},0));a.fire("resize",{outerHeight:a.container.$.offsetHeight,contentsHeight:b.$.offsetHeight,outerWidth:a.container.$.offsetWidth})}this.toggleState();"wysiwyg"==a.mode?l?(CKEDITOR.env.gecko&&t(a),a.getSelection().selectRanges(l),(c=a.getSelection().getStartElement())&&c.scrollIntoView(!0)):h.$.scrollTo(m.x,
m.y):(l&&(c.selectionStart=l[0],c.selectionEnd=l[1]),c.scrollLeft=m[0],c.scrollTop=m[1]);l=m=null;n=this.state;a.fire("maximize",this.state)},canUndo:!1});a.ui.addButton&&a.ui.addButton("Maximize",{isToggle:!0,label:b.maximize.maximize,command:"maximize",toolbar:"tools,10"});a.on("mode",function(){var b=a.getCommand("maximize");b.setState(b.state==CKEDITOR.TRISTATE_DISABLED?CKEDITOR.TRISTATE_DISABLED:n)},null,null,100);if(a.config.maximize_historyIntegration){var k=a.config.maximize_historyIntegration===
CKEDITOR.HISTORY_NATIVE?"popstate":"hashchange";h.on(k,c);a.on("destroy",function(){h.removeListener(k,c)})}}}});CKEDITOR.config.maximize_historyIntegration=CKEDITOR.HISTORY_NATIVE})();