@ckeditor/ckeditor5-find-and-replace 44.3.0 → 45.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -18,7 +18,7 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
18
18
 
19
19
  The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
20
20
 
21
- * Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
21
+ * es-toolkit - Copyright (c) 2024 Viva Republica, Inc.
22
22
 
23
23
  Trademarks
24
24
  ----------
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(i){e.setAttribute(i,t[i])}))}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},128:e=>{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},501:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(758),r=i.n(n),s=i(935),a=i.n(s)()(r());a.push([e.id,'.ck-vertical-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck-vertical-form .ck-button:focus:after{display:none}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck.ck-responsive-form .ck-button:focus:after{display:none}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-number,.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border-radius:0;margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}.ck.ck-responsive-form>.ck-button:last-child:not(:focus),.ck.ck-responsive-form>.ck-button:nth-last-child(2):not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}',""]);const o=a},584:(e,t,i)=>{e.exports=i(237)("./src/utils.js")},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n<t.length;n++)if(t[n].identifier===e){i=n;break}return i}function n(e,n){for(var s={},a=[],o=0;o<e.length;o++){var c=e[o],l=n.base?c[0]+n.base:c[0],d=s[l]||0,h="".concat(l," ").concat(d);s[l]=d+1;var u=i(h),f={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==u)t[u].references++,t[u].updater(f);else{var p=r(f,n);n.byIndex=o,t.splice(o,0,{identifier:h,updater:p,references:1})}a.push(h)}return a}function r(e,t){var i=t.domAPI(t);i.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,r){var s=n(e=e||[],r=r||{});return function(e){e=e||[];for(var a=0;a<s.length;a++){var o=i(s[a]);t[o].references--}for(var c=n(e,r),l=0;l<s.length;l++){var d=i(s[l]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}s=c}}},629:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(758),r=i.n(n),s=i(935),a=i.n(s)()(r());a.push([e.id,".ck-find-result{background:var(--ck-color-highlight-background);color:var(--ck-color-text)}.ck-find-result_selected{background:#ff9633}",""]);const o=a},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function n(e,t,n,r){var s;if(n)s="";else{s="",r.supports&&(s+="@supports (".concat(r.supports,") {")),r.media&&(s+="@media ".concat(r.media," {"));var a=void 0!==r.layer;a&&(s+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),s+=r.css,a&&(s+="}"),r.media&&(s+="}"),r.supports&&(s+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,s);else{var o=document.createTextNode(s),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(o,c[t]):e.appendChild(o)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,i=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(i,t,!1,e)},remove:function(e){n(i,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(n)for(var o=0;o<this.length;o++){var c=this[o][0];null!=c&&(a[c]=!0)}for(var l=0;l<e.length;l++){var d=[].concat(e[l]);n&&a[d[0]]||(void 0!==s&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=s),i&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=i):d[2]=i),r&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=r):d[4]="".concat(r)),t.push(d))}},t}},979:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(758),r=i.n(n),s=i(935),a=i.n(s)()(r());a.push([e.id,".ck.ck-find-and-replace-form{max-width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{display:flex}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions.ck-find-and-replace-form__inputs .ck-results-counter,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs.ck-find-and-replace-form__inputs .ck-results-counter{position:absolute}.ck.ck-find-and-replace-form{width:400px}.ck.ck-find-and-replace-form:focus{outline:none}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-content:stretch;align-items:center;flex:1 1 auto;flex-direction:row;flex-wrap:wrap;margin:0;padding:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view .ck-input,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view .ck-input{min-width:50px;width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-items:flex-start}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{color:var(--ck-color-base-border);top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{flex:0 0 100%;padding-top:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-right:0}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-switchbutton{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{max-width:100%;width:300px}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input{flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input .ck-labeled-field-view{flex:1 0 auto;margin-bottom:var(--ck-spacing-standard);width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type .ck-button__label{text-align:center;width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view){flex:1 1 auto;flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button .ck-button__label{text-align:center;width:100%}}",""]);const o=a}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={id:n,exports:{}};return e[n](s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{FindAndReplace:()=>we,FindAndReplaceEditing:()=>_e,FindAndReplaceUI:()=>v,FindAndReplaceUtils:()=>ee,FindCommand:()=>x,FindNextCommand:()=>A,FindPreviousCommand:()=>F,ReplaceAllCommand:()=>C,ReplaceCommand:()=>V});var e=i(782),t=i(311),r=i(584),s=i(591),a=i.n(s),o=i(639),c=i.n(o),l=i(128),d=i.n(l),h=i(21),u=i.n(h),f=i(51),p=i.n(f),m=i(501),g={attributes:{"data-cke":!0}};g.setAttributes=u(),g.insert=d().bind(null,"head"),g.domAPI=c(),g.insertStyleElement=p();a()(m.A,g);m.A&&m.A.locals&&m.A.locals;var k=i(979),_={attributes:{"data-cke":!0}};_.setAttributes=u(),_.insert=d().bind(null,"head"),_.domAPI=c(),_.insertStyleElement=p();a()(k.A,_);k.A&&k.A.locals&&k.A.locals;class w extends t.View{constructor(i){super(i);const n=i.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",((e,t)=>e>0&&!t)),this._findInputView=this._createInputField(n("Find in text…")),this._findPrevButtonView=this._createButton({label:n("Previous result"),class:"ck-button-prev",icon:e.icons.previousArrow,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:n("Next result"),class:"ck-button-next",icon:e.icons.previousArrow,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(n("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:n("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:n("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:n("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new r.FocusTracker,this._keystrokes=new r.KeystrokeHandler,this._focusables=new t.ViewCollection,this.focusCycler=new t.FocusCycler({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,t.submitHandler)({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const e=this.locale,i=e.t,n=new t.View(e);return this._findInputView.fieldView.on("input",(()=>{this.isDirty=!0})),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findPrevious:e})=>e)),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findNext:e})=>e)),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:e},t)=>e&&t)),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",((e,t)=>e||!t?"":i("Tip: Find some text first in order to replace it."))),n.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),n}_onFindButtonExecute(){if(this._textToFind)this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});else{const e=this.t;this._findInputView.errorText=e("Text to find must not be empty.")}}_injectFindResultsCounter(){const e=this.locale,i=e.t,n=this.bindTemplate,s=new t.View(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",((e,t)=>i("%0 of %1",[e,t]))),s.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",n.if("isDirty","ck-hidden")]},children:[{text:n.to("_resultsCounterText")}]});const a=()=>{const t=this._findInputView.fieldView.element;if(!t||!(0,r.isVisible)(t))return;const i=new r.Rect(s.element).width,n="ltr"===e.uiLanguageDirection?"paddingRight":"paddingLeft";t.style[n]=i?`calc( 2 * var(--ck-spacing-standard) + ${i}px )`:""};this.on("change:_resultsCounterText",a,{priority:"low"}),this.on("change:isDirty",a,{priority:"low"}),this._findInputView.template.children[0].children.push(s)}_createAdvancedOptionsCollapsible(){const e=this.locale.t,i=new t.CollapsibleView(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return i.set({label:e("Advanced options"),isCollapsed:!0}),i}_createActionButtonsDiv(){const e=new t.View(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:e},t)=>e&&t)),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replaceAll:e},t)=>e&&t)),this._replaceButtonView.on("execute",(()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})})),this._replaceAllButtonView.on("execute",(()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()})),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),e.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),e}_createMatchCaseSwitch(){const e=this.locale.t,i=new t.SwitchButtonView(this.locale);return i.set({label:e("Match case"),withText:!0}),i.bind("isOn").to(this,"_matchCase"),i.on("execute",(()=>{this._matchCase=!this._matchCase,this.isDirty=!0})),i}_createWholeWordsOnlySwitch(){const e=this.locale.t,i=new t.SwitchButtonView(this.locale);return i.set({label:e("Whole words only"),withText:!0}),i.bind("isOn").to(this,"_wholeWordsOnly"),i.on("execute",(()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0})),i}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach((e=>{this._focusables.add(e),this._focusTracker.add(e.element)}))}_initKeystrokeHandling(){const e=e=>e.stopPropagation(),t=e=>{e.stopPropagation(),e.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",(e=>{t(e),this._findNextButtonView.fire("execute")})),this._keystrokes.set("shift+f3",(e=>{t(e),this._findPrevButtonView.fire("execute")})),this._keystrokes.set("enter",(e=>{const i=e.target;i===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e)):i!==this._replaceInputView.fieldView.element||this.isDirty||(this._replaceButtonView.fire("execute"),t(e))})),this._keystrokes.set("shift+enter",(e=>{e.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e))})),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e)}_createButton(e){const i=new t.ButtonView(this.locale);return i.set(e),i}_createInputField(e,i){const n=new t.LabeledFieldView(this.locale,t.createLabeledInputText);return n.label=e,n.class=i,n}}const b='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286l-3.857-4.596z"/><path d="M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306zm-3.4-5.715c.562.305.742 1.106.354 1.494-.388.388-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.469 6.469 0 0 1 3.1.784z"/><path d="M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0zm11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0z"/></svg>';class v extends e.Plugin{static get requires(){return[t.Dialog]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const e=this.editor,i="dropdown"===e.config.get("findAndReplace.uiType"),n=e.commands.get("find"),r=this.editor.t;e.ui.componentFactory.add("findAndReplace",(()=>{let r;return i?(r=this._createDropdown(),r.bind("isEnabled").to(n)):r=this._createDialogButtonForToolbar(),e.keystrokes.set("Ctrl+F",((i,s)=>{if(n.isEnabled){if(r instanceof t.DropdownView){const e=r.buttonView;e.isOn||e.fire("execute")}else r.isOn?e.plugins.get("Dialog").view.focus():r.fire("execute");s()}})),r})),i||e.ui.componentFactory.add("menuBar:findAndReplace",(()=>this._createDialogButtonForMenuBar())),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const e=this.editor,i=e.locale.t,n=(0,t.createDropdown)(e.locale);return n.once("change:isOpen",(()=>{this.formView=this._createFormView(),this.formView.children.add(new t.FormHeaderView(e.locale,{label:i("Find and replace")}),0),n.panelView.children.add(this.formView)})),n.on("change:isOpen",((e,t,i)=>{i?this._setupFormView():this.fire("searchReseted")}),{priority:"low"}),n.buttonView.set({icon:b,label:i("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),n}_createDialogButtonForToolbar(){const e=this.editor,i=this._createButton(t.ButtonView),n=e.plugins.get("Dialog");return i.set({tooltip:!0}),i.bind("isOn").to(n,"id",(e=>"findAndReplace"===e)),i.on("execute",(()=>{i.isOn?n.hide():this._showDialog()})),i}_createDialogButtonForMenuBar(){const e=this._createButton(t.MenuBarMenuListItemButtonView),i=this.editor.plugins.get("Dialog"),n=this.editor.plugins.get("Dialog");return e.set({role:"menuitemcheckbox",isToggleable:!0}),e.bind("isOn").to(n,"id",(e=>"findAndReplace"===e)),e.on("execute",(()=>{"findAndReplace"!==i.id?this._showDialog():i.hide()})),e}_createButton(e){const t=this.editor,i=t.commands.get("find"),n=new e(t.locale),r=t.locale.t;return n.bind("isEnabled").to(i),n.set({icon:b,label:r("Find and replace"),keystroke:"CTRL+F"}),n}_showDialog(){const e=this.editor,i=e.plugins.get("Dialog"),n=e.locale.t;this.formView||(this.formView=this._createFormView()),i.show({id:"findAndReplace",title:n("Find and replace"),content:this.formView,position:t.DialogViewPosition.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const e=this.editor,i=new((0,t.CssTransitionDisablerMixin)(w))(e.locale),n=e.commands,r=this.editor.plugins.get("FindAndReplaceEditing").state;i.bind("highlightOffset").to(r,"highlightedOffset"),i.listenTo(r.results,"change",(()=>{i.matchCount=r.results.length}));const s=n.get("findNext"),a=n.get("findPrevious"),o=n.get("replace"),c=n.get("replaceAll");return i.bind("_areCommandsEnabled").to(s,"isEnabled",a,"isEnabled",o,"isEnabled",c,"isEnabled",((e,t,i,n)=>({findNext:e,findPrevious:t,replace:i,replaceAll:n}))),i.delegate("findNext","findPrevious","replace","replaceAll").to(this),i.on("change:isDirty",((e,t,i)=>{i&&this.fire("searchReseted")})),i}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class x extends e.Command{constructor(e,t){super(e),this.isEnabled=!0,this.affectsData=!1,this._state=t}execute(e,{matchCase:t,wholeWords:i}={}){const{editor:n}=this,{model:r}=n,s=n.plugins.get("FindAndReplaceUtils");let a,o="";a="string"==typeof e?(...n)=>({results:s.findByTextCallback(e,{matchCase:t,wholeWords:i})(...n),searchText:e}):e;const c=a;a=(...e)=>{const t=c(...e);return t&&"searchText"in t&&(o=t.searchText),t};const l=r.document.getRootNames().reduce(((e,t)=>s.updateFindResultFromRange(r.createRangeIn(r.document.getRoot(t)),r,a,e)),null);return this._state.clear(r),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),this._state.searchText=o,a&&(this._state.lastSearchCallback=a),this._state.matchCase=!!t,this._state.matchWholeWords=!!i,{results:l,findCallback:a}}}class y extends((0,r.ObservableMixin)()){constructor(e){super(),this.set("results",new r.Collection),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",((t,{removed:i,index:n})=>{if(Array.from(i).length){let t=!1;if(e.change((n=>{for(const r of i)this.highlightedResult===r&&(t=!0),e.markers.has(r.marker.name)&&n.removeMarker(r.marker)})),t){const e=n>=this.results.length?0:n;this.highlightedResult=this.results.get(e)}}})),this.on("change:highlightedResult",(()=>{this.refreshHighlightOffset(e)}))}clear(e){this.searchText="",e.change((t=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],n=e.markers.get(`findResultHighlighted:${i}`);n&&t.removeMarker(n)}[...this.results].forEach((({marker:e})=>{t.removeMarker(e)}))})),this.results.clear()}refreshHighlightOffset(e){const{highlightedResult:t,results:i}=this;this.highlightedOffset=t?R(e,[...i]).indexOf(t)+1:0}}function R(e,t){const i={before:-1,same:0,after:1,different:1};return e.document.getRootNames().flatMap((e=>t.filter((t=>t.marker.getStart().root.rootName===e)).sort(((e,t)=>i[e.marker.getStart().compareWith(t.marker.getStart())]))))}class T extends e.Command{constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this._isEnabledBasedOnSelection=!1}_replace(e,t){const{model:i}=this.editor,n=t.marker.getRange();i.canEditAt(n)&&i.change((r=>{if("$graveyard"===n.root.rootName)return void this._state.results.remove(t);let s={};for(const e of n.getItems())if(e.is("$text")||e.is("$textProxy")){s=e.getAttributes();break}i.insertContent(r.createText(e,s),n),this._state.results.has(t)&&this._state.results.remove(t)}))}}class V extends T{execute(e,t){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){const e=R(this.editor.model,[...this._state.results]);this._state.highlightedResult=e[i%e.length]}}}class C extends T{execute(e,t){const{editor:i}=this,{model:n}=i,s=i.plugins.get("FindAndReplaceUtils"),a=t instanceof r.Collection?t:n.document.getRootNames().reduce(((e,i)=>s.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(i)),n,s.findByTextCallback(t,this._state),e)),null);a.length&&n.change((()=>{[...a].forEach((t=>{this._replace(e,t)}))}))}}class A extends e.Command{constructor(e,t){super(e),this.affectsData=!1,this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,"change",(()=>{this.isEnabled=this._state.results.length>1}))}refresh(){this.isEnabled=this._state.results.length>1}execute(){const e=this._state.results,t=e.getIndex(this._state.highlightedResult),i=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(i)}}class F extends A{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),t=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(t)}}const E="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const B=E||O||Function("return this")();const I=B.Symbol;const S=function(e,t){for(var i=-1,n=null==e?0:e.length,r=Array(n);++i<n;)r[i]=t(e[i],i,e);return r};const D=Array.isArray;var P=Object.prototype,N=P.hasOwnProperty,M=P.toString,j=I?I.toStringTag:void 0;const W=function(e){var t=N.call(e,j),i=e[j];try{e[j]=void 0;var n=!0}catch(e){}var r=M.call(e);return n&&(t?e[j]=i:delete e[j]),r};var $=Object.prototype.toString;const H=function(e){return $.call(e)};var L=I?I.toStringTag:void 0;const K=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":L&&L in Object(e)?W(e):H(e)};const U=function(e){return null!=e&&"object"==typeof e};const z=function(e){return"symbol"==typeof e||U(e)&&"[object Symbol]"==K(e)};var q=I?I.prototype:void 0,Y=q?q.toString:void 0;const Z=function e(t){if("string"==typeof t)return t;if(D(t))return S(t,e)+"";if(z(t))return Y?Y.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i};const G=function(e){return null==e?"":Z(e)};var J=/[\\^$.*+?()[\]{}|]/g,Q=RegExp(J.source);const X=function(e){return(e=G(e))&&Q.test(e)?e.replace(J,"\\$&"):e};class ee extends e.Plugin{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(e,t,i,n){const s=n||new r.Collection;return t.change((n=>{[...e].forEach((({type:e,item:a})=>{if("elementStart"===e&&t.schema.checkChild(a,"$text")){let e=i({item:a,text:this.rangeToText(t.createRangeIn(a))});if(!e)return;"results"in e&&(e=e.results),e.forEach((e=>{const t=`findResult:${(0,r.uid)()}`,i=n.addMarker(t,{usingOperation:!1,affectsData:!1,range:n.createRange(n.createPositionAt(a,e.start),n.createPositionAt(a,e.end))}),o=function(e,t){const i=e.find((({marker:e})=>t.getStart().isBefore(e.getStart())));return i?e.getIndex(i):e.length}(s,i);(e=>s.find((t=>{const{marker:i}=t,n=i.getRange(),r=e.getRange();return n.isEqual(r)})))(i)||s.add({id:t,label:e.label,marker:i},o)}))}}))})),s}rangeToText(e){return Array.from(e.getItems({shallow:!0})).reduce(((e,t)=>t.is("$text")||t.is("$textProxy")?e+t.data:`${e}\n`),"")}findByTextCallback(e,t){let i="gu";t.matchCase||(i+="i");let n=`(${X(e)})`;if(t.wholeWords){const t="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+t).test(e)||(n=`(^|${t}|_)${n}`),new RegExp(t+"$").test(e)||(n=`${n}(?=_|${t}|$)`)}const r=new RegExp(n,i);return function({text:e}){return[...e.matchAll(r)].map(te)}}}function te(e){const t=e.length-1;let i=e.index;return 3===e.length&&(i+=e[1].length),{label:e[t],start:i,end:i+e[t].length}}const ie=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const ne=function(){return B.Date.now()};var re=/\s/;const se=function(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t};var ae=/^\s+/;const oe=function(e){return e?e.slice(0,se(e)+1).replace(ae,""):e};var ce=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,de=/^0o[0-7]+$/i,he=parseInt;const ue=function(e){if("number"==typeof e)return e;if(z(e))return NaN;if(ie(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ie(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=oe(e);var i=le.test(e);return i||de.test(e)?he(e.slice(2),i?2:8):ce.test(e)?NaN:+e};var fe=Math.max,pe=Math.min;const me=function(e,t,i){var n,r,s,a,o,c,l=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var i=n,s=r;return n=r=void 0,l=t,a=e.apply(s,i)}function p(e){var i=e-c;return void 0===c||i>=t||i<0||h&&e-l>=s}function m(){var e=ne();if(p(e))return g(e);o=setTimeout(m,function(e){var i=t-(e-c);return h?pe(i,s-(e-l)):i}(e))}function g(e){return o=void 0,u&&n?f(e):(n=r=void 0,a)}function k(){var e=ne(),i=p(e);if(n=arguments,r=this,c=e,i){if(void 0===o)return function(e){return l=e,o=setTimeout(m,t),d?f(e):a}(c);if(h)return clearTimeout(o),o=setTimeout(m,t),f(c)}return void 0===o&&(o=setTimeout(m,t)),a}return t=ue(t)||0,ie(i)&&(d=!!i.leading,s=(h="maxWait"in i)?fe(ue(i.maxWait)||0,t):s,u="trailing"in i?!!i.trailing:u),k.cancel=function(){void 0!==o&&clearTimeout(o),l=0,n=c=r=o=void 0},k.flush=function(){return void 0===o?a:g(ne())},k};var ge=i(629),ke={attributes:{"data-cke":!0}};ke.setAttributes=u(),ke.insert=d().bind(null,"head"),ke.domAPI=c(),ke.insertStyleElement=p();a()(ge.A,ke);ge.A&&ge.A.locals&&ge.A.locals;class _e extends e.Plugin{constructor(){super(...arguments),this._onDocumentChange=()=>{const e=new Set,t=new Set,i=this.editor.model,{results:n}=this.state,r=i.document.differ.getChanges(),s=i.document.differ.getChangedMarkers();r.forEach((n=>{n.position&&("$text"===n.name||n.position.nodeAfter&&i.schema.isInline(n.position.nodeAfter)?(e.add(n.position.parent),[...i.markers.getMarkersAtPosition(n.position)].forEach((e=>{t.add(e.name)}))):"insert"===n.type&&n.position.nodeAfter&&e.add(n.position.nodeAfter))})),s.forEach((({name:e,data:{newRange:i}})=>{i&&"$graveyard"===i.start.root.rootName&&t.add(e)})),e.forEach((e=>{[...i.markers.getMarkersIntersectingRange(i.createRangeIn(e))].forEach((e=>t.add(e.name)))})),t.forEach((e=>{n.has(e)&&(n.get(e)===this.state.highlightedResult&&(this.state.highlightedResult=null),n.remove(e))}));const a=[],o=this.editor.plugins.get("FindAndReplaceUtils");e.forEach((e=>{const t=o.updateFindResultFromRange(i.createRangeOn(e),i,this.state.lastSearchCallback,n);a.push(...t)})),s.forEach((e=>{if(e.data.newRange){const t=o.updateFindResultFromRange(e.data.newRange,i,this.state.lastSearchCallback,n);a.push(...t)}})),!this.state.highlightedResult&&a.length?this.state.highlightedResult=a[0]:this.state.refreshHighlightOffset(i)}}static get requires(){return[ee]}static get pluginName(){return"FindAndReplaceEditing"}static get isOfficialPlugin(){return!0}init(){this.state=new y(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",((e,t,i,n)=>{const{model:r}=this.editor;r.change((e=>{if(n){const t=n.marker.name.split(":")[1],i=r.markers.get(`findResultHighlighted:${t}`);i&&e.removeMarker(i)}if(i){const t=i.marker.name.split(":")[1];e.addMarker(`findResultHighlighted:${t}`,{usingOperation:!1,affectsData:!1,range:i.marker.getRange()})}}))}));const e=me(((e,t,i)=>{if(i){const e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(i.marker.getRange());(0,r.scrollViewportToShowTarget)({target:e.viewRangeToDom(t),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel),this.on("change:_isSearchActive",((e,t,i)=>{i?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)}))}find(e,t){return this._isSearchActive=!0,this.editor.execute("find",e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new x(this.editor,this.state)),this.editor.commands.add("findNext",new A(this.editor,this.state)),this.editor.commands.add("findPrevious",new F(this.editor,this.state)),this.editor.commands.add("replace",new V(this.editor,this.state)),this.editor.commands.add("replaceAll",new C(this.editor,this.state))}_defineConverters(){const{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":t}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":t}}}})}}class we extends e.Plugin{static get requires(){return[_e,v]}static get pluginName(){return"FindAndReplace"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),i=t.state;e.on("findNext",((e,n)=>{n?(i.searchText=n.searchText,t.find(n.searchText,n)):this.editor.execute("findNext")})),e.on("findPrevious",((e,n)=>{n&&i.searchText!==n.searchText?t.find(n.searchText):this.editor.execute("findPrevious")})),e.on("replace",((e,n)=>{i.searchText!==n.searchText&&t.find(n.searchText);const r=i.highlightedResult;r&&this.editor.execute("replace",n.replaceText,r)})),e.on("replaceAll",((e,n)=>{i.searchText!==n.searchText&&t.find(n.searchText),this.editor.execute("replaceAll",n.replaceText,i.results)})),e.on("searchReseted",(()=>{i.clear(this.editor.model),t.stop()}))}}})(),(window.CKEditor5=window.CKEditor5||{}).findAndReplace=n})();
5
+ */(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(i){e.setAttribute(i,t[i])}))}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},128:e=>{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},355:(e,t,i)=>{e.exports=i(237)("./src/icons.js")},501:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(758),s=i.n(n),r=i(935),a=i.n(r)()(s());a.push([e.id,'.ck-vertical-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck-vertical-form .ck-button:focus:after{display:none}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck.ck-responsive-form .ck-button:focus:after{display:none}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-number,.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border-radius:0;margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}.ck.ck-responsive-form>.ck-button:last-child:not(:focus),.ck.ck-responsive-form>.ck-button:nth-last-child(2):not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}',""]);const o=a},584:(e,t,i)=>{e.exports=i(237)("./src/utils.js")},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n<t.length;n++)if(t[n].identifier===e){i=n;break}return i}function n(e,n){for(var r={},a=[],o=0;o<e.length;o++){var c=e[o],l=n.base?c[0]+n.base:c[0],d=r[l]||0,h="".concat(l," ").concat(d);r[l]=d+1;var u=i(h),f={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==u)t[u].references++,t[u].updater(f);else{var p=s(f,n);n.byIndex=o,t.splice(o,0,{identifier:h,updater:p,references:1})}a.push(h)}return a}function s(e,t){var i=t.domAPI(t);i.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,s){var r=n(e=e||[],s=s||{});return function(e){e=e||[];for(var a=0;a<r.length;a++){var o=i(r[a]);t[o].references--}for(var c=n(e,s),l=0;l<r.length;l++){var d=i(r[l]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}r=c}}},629:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(758),s=i.n(n),r=i(935),a=i.n(r)()(s());a.push([e.id,".ck-find-result{background:var(--ck-color-highlight-background);color:var(--ck-color-text)}.ck-find-result_selected{background:#ff9633}",""]);const o=a},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function n(e,t,n,s){var r;if(n)r="";else{r="",s.supports&&(r+="@supports (".concat(s.supports,") {")),s.media&&(r+="@media ".concat(s.media," {"));var a=void 0!==s.layer;a&&(r+="@layer".concat(s.layer.length>0?" ".concat(s.layer):""," {")),r+=s.css,a&&(r+="}"),s.media&&(r+="}"),s.supports&&(r+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,r);else{var o=document.createTextNode(r),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(o,c[t]):e.appendChild(o)}}var s={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=s.singletonCounter++,i=s.singleton||(s.singleton=e.insertStyleElement(e));return{update:function(e){n(i,t,!1,e)},remove:function(e){n(i,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,s,r){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(n)for(var o=0;o<this.length;o++){var c=this[o][0];null!=c&&(a[c]=!0)}for(var l=0;l<e.length;l++){var d=[].concat(e[l]);n&&a[d[0]]||(void 0!==r&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),i&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=i):d[2]=i),s&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=s):d[4]="".concat(s)),t.push(d))}},t}},979:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(758),s=i.n(n),r=i(935),a=i.n(r)()(s());a.push([e.id,".ck.ck-find-and-replace-form{max-width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{display:flex}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions.ck-find-and-replace-form__inputs .ck-results-counter,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs.ck-find-and-replace-form__inputs .ck-results-counter{position:absolute}.ck.ck-find-and-replace-form{width:400px}.ck.ck-find-and-replace-form:focus{outline:none}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-content:stretch;align-items:center;flex:1 1 auto;flex-direction:row;flex-wrap:wrap;margin:0;padding:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view .ck-input,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view .ck-input{min-width:50px;width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-items:flex-start}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{color:var(--ck-color-base-border);top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{flex:0 0 100%;padding-top:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-right:0}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-switchbutton{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{max-width:100%;width:300px}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input{flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input .ck-labeled-field-view{flex:1 0 auto;margin-bottom:var(--ck-spacing-standard);width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type .ck-button__label{text-align:center;width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view){flex:1 1 auto;flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button .ck-button__label{text-align:center;width:100%}}",""]);const o=a}},t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var r=t[n]={id:n,exports:{}};return e[n](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{FindAndReplace:()=>N,FindAndReplaceEditing:()=>P,FindAndReplaceUI:()=>x,FindAndReplaceUtils:()=>E,FindCommand:()=>v,FindNextCommand:()=>A,FindPreviousCommand:()=>F,ReplaceAllCommand:()=>C,ReplaceCommand:()=>T});var e=i(782),t=i(355),s=i(311),r=i(584),a=i(591),o=i.n(a),c=i(639),l=i.n(c),d=i(128),h=i.n(d),u=i(21),f=i.n(u),p=i(51),m=i.n(p),k=i(501),g={attributes:{"data-cke":!0}};g.setAttributes=f(),g.insert=h().bind(null,"head"),g.domAPI=l(),g.insertStyleElement=m();o()(k.A,g);k.A&&k.A.locals&&k.A.locals;var _=i(979),w={attributes:{"data-cke":!0}};w.setAttributes=f(),w.insert=h().bind(null,"head"),w.domAPI=l(),w.insertStyleElement=m();o()(_.A,w);_.A&&_.A.locals&&_.A.locals;class b extends s.View{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(e){super(e);const i=e.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",((e,t)=>e>0&&!t)),this._findInputView=this._createInputField(i("Find in text…")),this._findPrevButtonView=this._createButton({label:i("Previous result"),class:"ck-button-prev",icon:t.IconPreviousArrow,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:i("Next result"),class:"ck-button-next",icon:t.IconPreviousArrow,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(i("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:i("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:i("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:i("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new r.FocusTracker,this._keystrokes=new r.KeystrokeHandler,this._focusables=new s.ViewCollection,this.focusCycler=new s.FocusCycler({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,s.submitHandler)({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const e=this.locale,t=e.t,i=new s.View(e);return this._findInputView.fieldView.on("input",(()=>{this.isDirty=!0})),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findPrevious:e})=>e)),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findNext:e})=>e)),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:e},t)=>e&&t)),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",((e,i)=>e||!i?"":t("Tip: Find some text first in order to replace it."))),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(this._textToFind)this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});else{const e=this.t;this._findInputView.errorText=e("Text to find must not be empty.")}}_injectFindResultsCounter(){const e=this.locale,t=e.t,i=this.bindTemplate,n=new s.View(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",((e,i)=>t("%0 of %1",[e,i]))),n.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const a=()=>{const t=this._findInputView.fieldView.element;if(!t||!(0,r.isVisible)(t))return;const i=new r.Rect(n.element).width,s="ltr"===e.uiLanguageDirection?"paddingRight":"paddingLeft";t.style[s]=i?`calc( 2 * var(--ck-spacing-standard) + ${i}px )`:""};this.on("change:_resultsCounterText",a,{priority:"low"}),this.on("change:isDirty",a,{priority:"low"}),this._findInputView.template.children[0].children.push(n)}_createAdvancedOptionsCollapsible(){const e=this.locale.t,t=new s.CollapsibleView(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e("Advanced options"),isCollapsed:!0}),t}_createActionButtonsDiv(){const e=new s.View(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:e},t)=>e&&t)),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replaceAll:e},t)=>e&&t)),this._replaceButtonView.on("execute",(()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})})),this._replaceAllButtonView.on("execute",(()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()})),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),e.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),e}_createMatchCaseSwitch(){const e=this.locale.t,t=new s.SwitchButtonView(this.locale);return t.set({label:e("Match case"),withText:!0}),t.bind("isOn").to(this,"_matchCase"),t.on("execute",(()=>{this._matchCase=!this._matchCase,this.isDirty=!0})),t}_createWholeWordsOnlySwitch(){const e=this.locale.t,t=new s.SwitchButtonView(this.locale);return t.set({label:e("Whole words only"),withText:!0}),t.bind("isOn").to(this,"_wholeWordsOnly"),t.on("execute",(()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0})),t}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach((e=>{this._focusables.add(e),this._focusTracker.add(e.element)}))}_initKeystrokeHandling(){const e=e=>e.stopPropagation(),t=e=>{e.stopPropagation(),e.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",(e=>{t(e),this._findNextButtonView.fire("execute")})),this._keystrokes.set("shift+f3",(e=>{t(e),this._findPrevButtonView.fire("execute")})),this._keystrokes.set("enter",(e=>{const i=e.target;i===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e)):i!==this._replaceInputView.fieldView.element||this.isDirty||(this._replaceButtonView.fire("execute"),t(e))})),this._keystrokes.set("shift+enter",(e=>{e.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e))})),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e)}_createButton(e){const t=new s.ButtonView(this.locale);return t.set(e),t}_createInputField(e,t){const i=new s.LabeledFieldView(this.locale,s.createLabeledInputText);return i.label=e,i.class=t,i}}class x extends e.Plugin{static get requires(){return[s.Dialog]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}formView;constructor(e){super(e),e.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const e=this.editor,t="dropdown"===e.config.get("findAndReplace.uiType"),i=e.commands.get("find"),n=this.editor.t;e.ui.componentFactory.add("findAndReplace",(()=>{let n;return t?(n=this._createDropdown(),n.bind("isEnabled").to(i)):n=this._createDialogButtonForToolbar(),e.keystrokes.set("Ctrl+F",((t,r)=>{if(i.isEnabled){if(n instanceof s.DropdownView){const e=n.buttonView;e.isOn||e.fire("execute")}else n.isOn?e.plugins.get("Dialog").view.focus():n.fire("execute");r()}})),n})),t||e.ui.componentFactory.add("menuBar:findAndReplace",(()=>this._createDialogButtonForMenuBar())),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const e=this.editor,i=e.locale.t,n=(0,s.createDropdown)(e.locale);return n.once("change:isOpen",(()=>{this.formView=this._createFormView(),this.formView.children.add(new s.FormHeaderView(e.locale,{label:i("Find and replace")}),0),n.panelView.children.add(this.formView)})),n.on("change:isOpen",((e,t,i)=>{i?this._setupFormView():this.fire("searchReseted")}),{priority:"low"}),n.buttonView.set({icon:t.IconFindReplace,label:i("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),n}_createDialogButtonForToolbar(){const e=this.editor,t=this._createButton(s.ButtonView),i=e.plugins.get("Dialog");return t.set({tooltip:!0}),t.bind("isOn").to(i,"id",(e=>"findAndReplace"===e)),t.on("execute",(()=>{t.isOn?i.hide():this._showDialog()})),t}_createDialogButtonForMenuBar(){const e=this._createButton(s.MenuBarMenuListItemButtonView),t=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return e.set({role:"menuitemcheckbox",isToggleable:!0}),e.bind("isOn").to(i,"id",(e=>"findAndReplace"===e)),e.on("execute",(()=>{"findAndReplace"!==t.id?this._showDialog():t.hide()})),e}_createButton(e){const i=this.editor,n=i.commands.get("find"),s=new e(i.locale),r=i.locale.t;return s.bind("isEnabled").to(n),s.set({icon:t.IconFindReplace,label:r("Find and replace"),keystroke:"CTRL+F"}),s}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.formView||(this.formView=this._createFormView()),t.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:s.DialogViewPosition.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const e=this.editor,t=new((0,s.CssTransitionDisablerMixin)(b))(e.locale),i=e.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state;t.bind("highlightOffset").to(n,"highlightedOffset"),t.listenTo(n.results,"change",(()=>{t.matchCount=n.results.length}));const r=i.get("findNext"),a=i.get("findPrevious"),o=i.get("replace"),c=i.get("replaceAll");return t.bind("_areCommandsEnabled").to(r,"isEnabled",a,"isEnabled",o,"isEnabled",c,"isEnabled",((e,t,i,n)=>({findNext:e,findPrevious:t,replace:i,replaceAll:n}))),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",((e,t,i)=>{i&&this.fire("searchReseted")})),t}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class v extends e.Command{_state;constructor(e,t){super(e),this.isEnabled=!0,this.affectsData=!1,this._state=t}execute(e,{matchCase:t,wholeWords:i}={}){const{editor:n}=this,{model:s}=n,r=n.plugins.get("FindAndReplaceUtils");let a,o="";a="string"==typeof e?(...n)=>({results:r.findByTextCallback(e,{matchCase:t,wholeWords:i})(...n),searchText:e}):e;const c=a;a=(...e)=>{const t=c(...e);return t&&"searchText"in t&&(o=t.searchText),t};const l=s.document.getRootNames().reduce(((e,t)=>r.updateFindResultFromRange(s.createRangeIn(s.document.getRoot(t)),s,a,e)),null);return this._state.clear(s),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),this._state.searchText=o,a&&(this._state.lastSearchCallback=a),this._state.matchCase=!!t,this._state.matchWholeWords=!!i,{results:l,findCallback:a}}}class y extends((0,r.ObservableMixin)()){constructor(e){super(),this.set("results",new r.Collection),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",((t,{removed:i,index:n})=>{if(Array.from(i).length){let t=!1;if(e.change((n=>{for(const s of i)this.highlightedResult===s&&(t=!0),e.markers.has(s.marker.name)&&n.removeMarker(s.marker)})),t){const e=n>=this.results.length?0:n;this.highlightedResult=this.results.get(e)}}})),this.on("change:highlightedResult",(()=>{this.refreshHighlightOffset(e)}))}clear(e){this.searchText="",e.change((t=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],n=e.markers.get(`findResultHighlighted:${i}`);n&&t.removeMarker(n)}[...this.results].forEach((({marker:e})=>{t.removeMarker(e)}))})),this.results.clear()}refreshHighlightOffset(e){const{highlightedResult:t,results:i}=this;this.highlightedOffset=t?V(e,[...i]).indexOf(t)+1:0}}function V(e,t){const i={before:-1,same:0,after:1,different:1};return e.document.getRootNames().flatMap((e=>t.filter((t=>t.marker.getStart().root.rootName===e)).sort(((e,t)=>i[e.marker.getStart().compareWith(t.marker.getStart())]))))}class R extends e.Command{_state;constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this._isEnabledBasedOnSelection=!1}_replace(e,t){const{model:i}=this.editor,n=t.marker.getRange();i.canEditAt(n)&&i.change((s=>{if("$graveyard"===n.root.rootName)return void this._state.results.remove(t);let r={};for(const e of n.getItems())if(e.is("$text")||e.is("$textProxy")){r=e.getAttributes();break}i.insertContent(s.createText(e,r),n),this._state.results.has(t)&&this._state.results.remove(t)}))}}class T extends R{execute(e,t){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){const e=V(this.editor.model,[...this._state.results]);this._state.highlightedResult=e[i%e.length]}}}class C extends R{execute(e,t){const{editor:i}=this,{model:n}=i,s=i.plugins.get("FindAndReplaceUtils"),a=t instanceof r.Collection?t:n.document.getRootNames().reduce(((e,i)=>s.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(i)),n,s.findByTextCallback(t,this._state),e)),null);a.length&&n.change((()=>{[...a].forEach((t=>{this._replace(e,t)}))}))}}class A extends e.Command{_state;constructor(e,t){super(e),this.affectsData=!1,this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,"change",(()=>{this.isEnabled=this._state.results.length>1}))}refresh(){this.isEnabled=this._state.results.length>1}execute(){const e=this._state.results,t=e.getIndex(this._state.highlightedResult),i=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(i)}}class F extends A{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),t=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(t)}}function B(e){if(null==e)return"";if(Array.isArray(e))return e.map(B).join(",");const t=String(e);return"0"===t&&Object.is(Number(e),-0)?"-0":t}class E extends e.Plugin{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(e,t,i,n){const s=n||new r.Collection;return t.change((n=>{[...e].forEach((({type:e,item:a})=>{if("elementStart"===e&&t.schema.checkChild(a,"$text")){let e=i({item:a,text:this.rangeToText(t.createRangeIn(a))});if(!e)return;"results"in e&&(e=e.results),e.forEach((e=>{const t=`findResult:${(0,r.uid)()}`,i=n.addMarker(t,{usingOperation:!1,affectsData:!1,range:n.createRange(n.createPositionAt(a,e.start),n.createPositionAt(a,e.end))}),o=function(e,t){const i=e.find((({marker:e})=>t.getStart().isBefore(e.getStart())));return i?e.getIndex(i):e.length}(s,i);(e=>s.find((t=>{const{marker:i}=t,n=i.getRange(),s=e.getRange();return n.isEqual(s)})))(i)||s.add({id:t,label:e.label,marker:i},o)}))}}))})),s}rangeToText(e){return Array.from(e.getItems({shallow:!0})).reduce(((e,t)=>t.is("$text")||t.is("$textProxy")?e+t.data:`${e}\n`),"")}findByTextCallback(e,t){let i="gu";t.matchCase||(i+="i");let n=`(${s=e,function(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}(B(s))})`;var s;if(t.wholeWords){const t="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+t).test(e)||(n=`(^|${t}|_)${n}`),new RegExp(t+"$").test(e)||(n=`${n}(?=_|${t}|$)`)}const r=new RegExp(n,i);return function({text:e}){return[...e.matchAll(r)].map(I)}}}function I(e){const t=e.length-1;let i=e.index;return 3===e.length&&(i+=e[1].length),{label:e[t],start:i,end:i+e[t].length}}function O(e,t,{signal:i,edges:n}={}){let s,r=null;const a=null!=n&&n.includes("leading"),o=null==n||n.includes("trailing"),c=()=>{null!==r&&(e.apply(s,r),s=void 0,r=null)};let l=null;const d=()=>{null!=l&&clearTimeout(l),l=setTimeout((()=>{l=null,o&&c(),u()}),t)},h=()=>{null!==l&&(clearTimeout(l),l=null)},u=()=>{h(),s=void 0,r=null},f=function(...e){if(i?.aborted)return;s=this,r=e;const t=null==l;d(),a&&t&&c()};return f.schedule=d,f.cancel=u,f.flush=()=>{h(),c()},i?.addEventListener("abort",u,{once:!0}),f}var D=i(629),S={attributes:{"data-cke":!0}};S.setAttributes=f(),S.insert=h().bind(null,"head"),S.domAPI=l(),S.insertStyleElement=m();o()(D.A,S);D.A&&D.A.locals&&D.A.locals;class P extends e.Plugin{static get requires(){return[E]}static get pluginName(){return"FindAndReplaceEditing"}static get isOfficialPlugin(){return!0}state;init(){this.state=new y(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",((e,t,i,n)=>{const{model:s}=this.editor;s.change((e=>{if(n){const t=n.marker.name.split(":")[1],i=s.markers.get(`findResultHighlighted:${t}`);i&&e.removeMarker(i)}if(i){const t=i.marker.name.split(":")[1];e.addMarker(`findResultHighlighted:${t}`,{usingOperation:!1,affectsData:!1,range:i.marker.getRange()})}}))}));const e=function(e,t=0,i={}){"object"!=typeof i&&(i={});const{signal:n,leading:s=!1,trailing:r=!0,maxWait:a}=i,o=Array(2);let c;s&&(o[0]="leading"),r&&(o[1]="trailing");let l=null;const d=O((function(...t){c=e.apply(this,t),l=null}),t,{signal:n,edges:o}),h=function(...t){if(null!=a)if(null===l)l=Date.now();else if(Date.now()-l>=a)return c=e.apply(this,t),l=Date.now(),d.cancel(),d.schedule(),c;return d.apply(this,t),c};return h.cancel=d.cancel,h.flush=()=>(d.flush(),c),h}(((e,t,i)=>{if(i){const e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(i.marker.getRange());(0,r.scrollViewportToShowTarget)({target:e.viewRangeToDom(t),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel),this.on("change:_isSearchActive",((e,t,i)=>{i?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)}))}find(e,t){return this._isSearchActive=!0,this.editor.execute("find",e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new v(this.editor,this.state)),this.editor.commands.add("findNext",new A(this.editor,this.state)),this.editor.commands.add("findPrevious",new F(this.editor,this.state)),this.editor.commands.add("replace",new T(this.editor,this.state)),this.editor.commands.add("replaceAll",new C(this.editor,this.state))}_defineConverters(){const{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":t}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":t}}}})}_onDocumentChange=()=>{const e=new Set,t=new Set,i=this.editor.model,{results:n}=this.state,s=i.document.differ.getChanges(),r=i.document.differ.getChangedMarkers();s.forEach((n=>{n.position&&("$text"===n.name||n.position.nodeAfter&&i.schema.isInline(n.position.nodeAfter)?(e.add(n.position.parent),[...i.markers.getMarkersAtPosition(n.position)].forEach((e=>{t.add(e.name)}))):"insert"===n.type&&n.position.nodeAfter&&e.add(n.position.nodeAfter))})),r.forEach((({name:e,data:{newRange:i}})=>{i&&"$graveyard"===i.start.root.rootName&&t.add(e)})),e.forEach((e=>{[...i.markers.getMarkersIntersectingRange(i.createRangeIn(e))].forEach((e=>t.add(e.name)))})),t.forEach((e=>{n.has(e)&&(n.get(e)===this.state.highlightedResult&&(this.state.highlightedResult=null),n.remove(e))}));const a=[],o=this.editor.plugins.get("FindAndReplaceUtils");e.forEach((e=>{const t=o.updateFindResultFromRange(i.createRangeOn(e),i,this.state.lastSearchCallback,n);a.push(...t)})),r.forEach((e=>{if(e.data.newRange){const t=o.updateFindResultFromRange(e.data.newRange,i,this.state.lastSearchCallback,n);a.push(...t)}})),!this.state.highlightedResult&&a.length?this.state.highlightedResult=a[0]:this.state.refreshHighlightOffset(i)}}class N extends e.Plugin{static get requires(){return[P,x]}static get pluginName(){return"FindAndReplace"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),i=t.state;e.on("findNext",((e,n)=>{n?(i.searchText=n.searchText,t.find(n.searchText,n)):this.editor.execute("findNext")})),e.on("findPrevious",((e,n)=>{n&&i.searchText!==n.searchText?t.find(n.searchText):this.editor.execute("findPrevious")})),e.on("replace",((e,n)=>{i.searchText!==n.searchText&&t.find(n.searchText);const s=i.highlightedResult;s&&this.editor.execute("replace",n.replaceText,s)})),e.on("replaceAll",((e,n)=>{i.searchText!==n.searchText&&t.find(n.searchText),this.editor.execute("replaceAll",n.replaceText,i.results)})),e.on("searchReseted",(()=>{i.clear(this.editor.model),t.stop()}))}}})(),(window.CKEditor5=window.CKEditor5||{}).findAndReplace=n})();
@@ -0,0 +1 @@
1
+ !function(e){const t=e.be=e.be||{};t.dictionary=Object.assign(t.dictionary||{},{"Advanced options":"Дадатковыя параметры",Find:"Знайсці","Find and replace":"Знайсці і замяніць","Find in text…":"Знайсці ў тэксце…","Find in the document":"Знайсці ў дакуменце","Match case":"З улікам рэгістру","Next result":"Наступны вынік","Previous result":"Папярэдні вынік",Replace:"Замяніць","Replace all":"Замяніць усё","Replace with…":"Замяніць на…","Text to find must not be empty.":"Тэкст для пошуку не павінен быць пустым.","Tip: Find some text first in order to replace it.":"Падказка: спачатку знайдзіце тэкст, каб замяніць яго.","Whole words only":"Толькі слова цалкам"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -10,7 +10,7 @@
10
10
  {
11
11
  "type": "Button",
12
12
  "name": "findAndReplace",
13
- "iconPath": "theme/icons/find-replace.svg"
13
+ "iconPath": "@ckeditor/ckeditor5-icons/theme/icons/find-replace.svg"
14
14
  }
15
15
  ]
16
16
  }
package/dist/index.js CHANGED
@@ -2,10 +2,11 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import { icons, Plugin, Command } from '@ckeditor/ckeditor5-core/dist/index.js';
5
+ import { Plugin, Command } from '@ckeditor/ckeditor5-core/dist/index.js';
6
+ import { IconPreviousArrow, IconFindReplace } from '@ckeditor/ckeditor5-icons/dist/index.js';
6
7
  import { View, ViewCollection, FocusCycler, submitHandler, CollapsibleView, SwitchButtonView, ButtonView, LabeledFieldView, createLabeledInputText, Dialog, DropdownView, createDropdown, FormHeaderView, MenuBarMenuListItemButtonView, DialogViewPosition, CssTransitionDisablerMixin } from '@ckeditor/ckeditor5-ui/dist/index.js';
7
8
  import { FocusTracker, KeystrokeHandler, isVisible, Rect, ObservableMixin, Collection, uid, scrollViewportToShowTarget } from '@ckeditor/ckeditor5-utils/dist/index.js';
8
- import { escapeRegExp, debounce } from 'lodash-es';
9
+ import { escapeRegExp, debounce } from 'es-toolkit/compat';
9
10
 
10
11
  /**
11
12
  * The find and replace form view class.
@@ -87,14 +88,14 @@ import { escapeRegExp, debounce } from 'lodash-es';
87
88
  this._findPrevButtonView = this._createButton({
88
89
  label: t('Previous result'),
89
90
  class: 'ck-button-prev',
90
- icon: icons.previousArrow,
91
+ icon: IconPreviousArrow,
91
92
  keystroke: 'Shift+F3',
92
93
  tooltip: true
93
94
  });
94
95
  this._findNextButtonView = this._createButton({
95
96
  label: t('Next result'),
96
97
  class: 'ck-button-next',
97
- icon: icons.previousArrow,
98
+ icon: IconPreviousArrow,
98
99
  keystroke: 'F3',
99
100
  tooltip: true
100
101
  });
@@ -510,8 +511,6 @@ import { escapeRegExp, debounce } from 'lodash-es';
510
511
  }
511
512
  }
512
513
 
513
- var loupeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286l-3.857-4.596z\"/><path d=\"M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306zm-3.4-5.715c.562.305.742 1.106.354 1.494-.388.388-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.469 6.469 0 0 1 3.1.784z\"/><path d=\"M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0zm11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0z\"/></svg>";
514
-
515
514
  /**
516
515
  * The default find and replace UI.
517
516
  *
@@ -632,7 +631,7 @@ var loupeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"
632
631
  priority: 'low'
633
632
  });
634
633
  dropdownView.buttonView.set({
635
- icon: loupeIcon,
634
+ icon: IconFindReplace,
636
635
  label: t('Find and replace'),
637
636
  keystroke: 'CTRL+F',
638
637
  tooltip: true
@@ -694,7 +693,7 @@ var loupeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"
694
693
  // Button should be disabled when in source editing mode. See #10001.
695
694
  buttonView.bind('isEnabled').to(findCommand);
696
695
  buttonView.set({
697
- icon: loupeIcon,
696
+ icon: IconFindReplace,
698
697
  label: t('Find and replace'),
699
698
  keystroke: 'CTRL+F'
700
699
  });