import{Command as h,Plugin as s}from"@ckeditor/ckeditor5-core";import{findOptimalInsertionRange as p,toWidget as g,Widget as f}from"@ckeditor/ckeditor5-widget";import{IconHorizontalLine as z}from"@ckeditor/ckeditor5-icons";import{ButtonView as L,MenuBarMenuListItemButtonView as E}from"@ckeditor/ckeditor5-ui";/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class c extends h{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=y(n,t,e)}execute(){const e=this.editor.model;e.change(t=>{const n=t.createElement("horizontalLine");e.insertObject(n,null,null,{setSelection:"after"})})}}function y(o,e,t){const n=b(o,t);return e.checkChild(n,"horizontalLine")}function b(o,e){const n=p(o,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}function w(o,{insertAt:e}={}){if(typeof document>"u")return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",window.litNonce&&n.setAttribute("nonce",window.litNonce),e==="top"&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=o:n.appendChild(document.createTextNode(o))}w(".ck-editor__editable .ck-horizontal-line{display:flow-root}.ck-content hr{background:#dedede;border:0;height:4px;margin:15px 0}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class d extends s{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.t,l=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),l.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:i})=>i.createEmptyElement("hr")}),l.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:i})=>{const u=n("Horizontal line"),a=i.createContainerElement("div",null,i.createEmptyElement("hr"));return i.addClass("ck-horizontal-line",a),i.setCustomProperty("hr",!0,a),x(a,i,u)}}),l.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new c(e))}}function x(o,e,t){return e.setCustomProperty("horizontalLine",!0,o),g(o,e,{label:t})}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class m extends s{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",()=>{const t=this._createButton(L);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(E))}_createButton(e){const t=this.editor,n=t.locale,l=t.commands.get("horizontalLine"),r=new e(t.locale),i=n.t;return r.set({label:i("Horizontal line"),icon:z}),r.bind("isEnabled").to(l,"isEnabled"),this.listenTo(r,"execute",()=>{t.execute("horizontalLine"),t.editing.view.focus()}),r}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class H extends s{static get requires(){return[d,m,f]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}export{H as HorizontalLine,c as HorizontalLineCommand,d as HorizontalLineEditing,m as HorizontalLineUI};
