/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
 */
"use strict";NEW_CKEDITOR.plugins.add("autogrow",{init:function(e){e.elementMode!=NEW_CKEDITOR.ELEMENT_MODE_INLINE&&e.on("instanceReady",(function(){e.editable().isInline()?e.ui.space("contents").setStyle("height","auto"):function(e){var t,o,n,i,a,r=e.config.autoGrow_bottomSpace||0,m=void 0!==e.config.autoGrow_minHeight?e.config.autoGrow_minHeight:200,d=e.config.autoGrow_maxHeight||1/0,c=!e.config.autoGrow_maxHeight;e.addCommand("autogrow",{exec:w,modes:{wysiwyg:1},readOnly:1,canUndo:!1,editorFocus:!1});var u={contentDom:1,key:1,selectionChange:1,insertElement:1,mode:1};for(var g in u)e.on(g,(function(e){"wysiwyg"==e.editor.mode&&setTimeout((function(){l()?t=null:(w(),c||w())}),100)}));function s(){o=e.document,n=o[NEW_CKEDITOR.env.ie?"getBody":"getDocumentElement"](),i=NEW_CKEDITOR.env.quirks?o.getBody():o.getDocumentElement();var t=NEW_CKEDITOR.env.quirks?i:i.findOne("body");t&&(t.setStyle("height","auto"),t.setStyle("min-height",NEW_CKEDITOR.env.safari?"0%":"auto")),a=NEW_CKEDITOR.dom.element.createFromHtml('<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">'+(NEW_CKEDITOR.env.webkit?"&nbsp;":"")+"</span>",o)}function l(){var t=e.getCommand("maximize");return!e.window||t&&t.state==NEW_CKEDITOR.TRISTATE_ON}function E(){n.append(a);var e=a.getDocumentPosition(o).y+a.$.offsetHeight;return a.remove(),e}function w(){c&&i.setStyle("overflow-y","hidden");var o=e.window.getViewPaneSize().height,n=E();n+=r,n=Math.max(n,m),(n=Math.min(n,d))!=o&&t!=n&&(n=e.fire("autoGrow",{currentHeight:o,newHeight:n}).newHeight,e.resize(null,n,!0),t=n),c||(n<d&&i.$.scrollHeight>i.$.clientHeight?i.setStyle("overflow-y","hidden"):i.removeStyle("overflow-y"))}e.on("afterCommandExec",(function(e){"maximize"==e.data.name&&"wysiwyg"==e.editor.mode&&(e.data.command.state==NEW_CKEDITOR.TRISTATE_ON?i.removeStyle("overflow-y"):w())})),e.on("contentDom",s),s(),e.config.autoGrow_onStartup&&e.editable().isVisible()&&e.execCommand("autogrow")}(e)}))}});