").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||s.includes("
"))&&(s=`
${s}
`),e=s),o=this.editor.data.htmlProcessor.toView(e)}var s;const r=new v(this,"inputTransformation"),a=n.getData("application/ckeditor5-editor-id")||null;this.fire(r,{content:o,dataTransfer:n,sourceEditorId:a,targetRanges:t.targetRanges,method:t.method}),r.stop.called&&e.stop(),i.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((e,i)=>{if(i.content.isEmpty)return;const n=this.editor.data.toModel(i.content,"$clipboardHolder");0!=n.childCount&&(e.stop(),t.change((()=>{this.fire("contentInsertion",{content:n,method:i.method,sourceEditorId:i.sourceEditorId,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((e,t)=>{t.resultRange=o._pasteFragmentWithMarkers(t.content)}),{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,n=(e,i)=>{const n=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(n,t.selection,e.name)};this.listenTo(i,"copy",n,{priority:"low"}),this.listenTo(i,"cut",((t,i)=>{e.model.canEditAt(e.model.document.selection)?n(t,i):i.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((t,n)=>{const o=e.data.toView(n.content,{isClipboardPipeline:!0});i.fire("clipboardOutput",{dataTransfer:n.dataTransfer,content:o,method:n.method})}),{priority:"low"}),this.listenTo(i,"clipboardOutput",((i,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",Ud(e.data.htmlProcessor.domConverter,n.content)),n.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),"cut"==n.method&&e.model.deleteContent(t.selection)}),{priority:"low"})}}class Xd{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class Zd extends cd{_buffer;constructor(e,t){super(e),this._buffer=new Xd(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,n=e.text||"",o=n.length;let s=i.selection;if(e.selection?s=e.selection:e.range&&(s=t.createSelection(e.range)),!t.canEditAt(s))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,(e=>{this._buffer.lock();const a=Array.from(i.selection.getAttributes());t.deleteContent(s),n&&t.insertContent(e.createText(n,a),s),r?e.setSelection(r):s.is("documentSelection")||e.setSelection(s),this._buffer.unlock(),this._buffer.input(o)}))}}const eh=["insertText","insertReplacementText"],th=[...eh,"insertCompositionText"];class ih extends Gs{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(ur);const t=r.isAndroid?th:eh,i=e.document;i.on("beforeinput",((n,o)=>{if(!this.isEnabled)return;const{data:s,targetRanges:r,inputType:a,domEvent:l,isComposing:c}=o;if(!t.includes(a))return;this.focusObserver.flush();const u=new v(i,"insertText");i.fire(u,new Zs(e,l,{text:s,selection:e.createSelection(r),isComposing:c})),u.stop.called&&n.stop()})),r.isAndroid||i.on("compositionend",((t,{data:n,domEvent:o})=>{this.isEnabled&&n&&i.fire("insertText",new Zs(e,o,{text:n,isComposing:!0}))}),{priority:"low"})}observe(){}stopObserving(){}}class nh extends ad{_typingQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.editing.mapper,o=t.document.selection;this._typingQueue=new oh(e),i.addObserver(ih);const s=new Zd(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",s),e.commands.add("input",s),this.listenTo(i.document,"beforeinput",(()=>{this._typingQueue.flush("next beforeinput")}),{priority:"high"}),this.listenTo(i.document,"insertText",((e,a)=>{const{text:l,selection:c}=a;if(i.document.selection.isFake&&c&&i.document.selection.isSimilar(c)&&a.preventDefault(),c&&Array.from(c.getRanges()).some((e=>!e.isCollapsed))&&a.preventDefault(),!s.isEnabled)return void a.preventDefault();let u;c&&(u=Array.from(c.getRanges()).filter((e=>e.root.is("rootElement"))).map((e=>n.toModelRange(e))).map((e=>ec(e,t.schema)||e))),u&&u.length||(u=Array.from(o.getRanges()));let d=l;if(r.isAndroid){const e=Array.from(u[0].getItems()).reduce(((e,t)=>e+(t.is("$textProxy")?t.data:"")),"");if(e&&(e.length<=d.length?d.startsWith(e)&&(d=d.substring(e.length),u[0].start=u[0].start.getShiftedBy(e.length)):e.startsWith(d)&&(u[0].start=u[0].start.getShiftedBy(d.length),d="")),0==d.length&&u[0].isCollapsed)return}const h={text:d,selection:t.createSelection(u)};this._typingQueue.push(h,Boolean(a.isComposing)),a.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented")})),r.isAndroid?this.listenTo(i.document,"keydown",((e,n)=>{!o.isCollapsed&&229==n.keyCode&&i.document.isComposing&&sh(t,s)})):this.listenTo(i.document,"compositionstart",(()=>{o.isCollapsed||sh(t,s)}),{priority:"high"}),this.listenTo(i.document,"mutations",((e,{mutations:t})=>{if(this._typingQueue.hasAffectedElements())for(const{node:e}of t){const t=rh(e,n),i=n.toModelElement(t);if(this._typingQueue.isElementAffected(i))return void this._typingQueue.flush("mutations")}})),this.listenTo(i.document,"compositionend",(()=>{this._typingQueue.flush("before composition end")}),{priority:"high"}),this.listenTo(i.document,"compositionend",(()=>{this._typingQueue.flush("after composition end");const e=[];if(this._typingQueue.hasAffectedElements())for(const t of this._typingQueue.flushAffectedElements()){const i=n.toViewElement(t);i&&e.push({type:"children",node:i})}!e.length&&r.isAndroid||i.document.fire("mutations",{mutations:e})}),{priority:"lowest"})}destroy(){super.destroy(),this._typingQueue.destroy()}}class oh{editor;flushDebounced=Wi((()=>this.flush("timeout")),50);_queue=[];_isComposing=!1;_affectedElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e,t){const i={text:e.text};if(e.selection){i.selectionRanges=[];for(const t of e.selection.getRanges())i.selectionRanges.push(jr.fromRange(t)),this._affectedElements.add(t.start.parent)}this._queue.push(i),this._isComposing||=t,this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const i=e.selectionRanges.map((e=>function(e){const t=e.toRange();return e.detach(),"$graveyard"==t.root.rootName?null:t}(e))).filter((e=>!!e));i.length&&(t.selection=this.editor.model.createSelection(i))}return t}flush(e){const t=this.editor,i=t.model,n=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const o=t.commands.get("insertText").buffer;i.enqueueChange(o.batch,(()=>{for(o.lock();this._queue.length;){const e=this.shift();t.execute("insertText",e)}o.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1})),n.scrollToTheSelection()}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){const e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}}function sh(e,t){if(!t.isEnabled)return;const i=t.buffer;i.lock(),e.enqueueChange(i.batch,(()=>{e.deleteContent(e.document.selection)})),i.unlock()}function rh(e,t){let i=e.is("$text")?e.parent:e;for(;!t.toModelElement(i);)i=i.parent;return i}class ah extends cd{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new Xd(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,(n=>{this._buffer.lock();const o=n.createSelection(e.selection||i.selection);if(!t.canEditAt(o))return;const s=e.sequence||1,r=o.isCollapsed;if(o.isCollapsed&&t.modifySelection(o,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(s))return void this._replaceEntireContentWithParagraph(n);if(this._shouldReplaceFirstBlockWithParagraph(o,s))return void this.editor.execute("paragraph",{selection:o});if(o.isCollapsed)return;let a=0;o.getFirstRange().getMinimalFlatRanges().forEach((e=>{a+=ee(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),t.deleteContent(o,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(a),n.setSelection(o),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i);if(!i.isCollapsed||!i.containsEntireContent(n))return!1;if(!t.schema.checkChild(n,"paragraph"))return!1;const o=n.getChild(0);return!o||!o.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i),o=e.createElement("paragraph");e.remove(e.createRangeIn(n)),e.insert(o,n),e.setSelection(o,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const n=e.getFirstPosition(),o=i.schema.getLimitElement(n),s=o.getChild(0);return n.parent==s&&!!e.containsEntireContent(s)&&!!i.schema.checkChild(o,"paragraph")&&"paragraph"!=s.name}}const lh="word",ch="selection",uh="backward",dh="forward",hh={deleteContent:{unit:ch,direction:uh},deleteContentBackward:{unit:"codePoint",direction:uh},deleteWordBackward:{unit:lh,direction:uh},deleteHardLineBackward:{unit:ch,direction:uh},deleteSoftLineBackward:{unit:ch,direction:uh},deleteContentForward:{unit:"character",direction:dh},deleteWordForward:{unit:lh,direction:dh},deleteHardLineForward:{unit:ch,direction:dh},deleteSoftLineForward:{unit:ch,direction:dh}};class mh extends Gs{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",(()=>{i++})),t.on("keyup",(()=>{i=0})),t.on("beforeinput",((n,o)=>{if(!this.isEnabled)return;const{targetRanges:s,domEvent:a,inputType:l}=o,c=hh[l];if(!c)return;const u={direction:c.direction,unit:c.unit,sequence:i};u.unit==ch&&(u.selectionToRemove=e.createSelection(s[0])),"deleteContentBackward"===l&&(r.isAndroid&&(u.sequence=1),function(e){if(1!=e.length||e[0].isCollapsed)return!1;const t=e[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let i=0;for(const{nextPosition:e,item:n}of t){if(e.parent.is("$text")){const t=e.parent.data,n=e.offset;if(ui(t,n)||di(t,n)||mi(t,n))continue;i++}else(n.is("containerElement")||n.is("emptyElement"))&&i++;if(i>1)return!0}return!1}(s)&&(u.unit=ch,u.selectionToRemove=e.createSelection(s)));const d=new jo(t,"delete",s[0]);t.fire(d,new Zs(e,a,u)),d.stop.called&&n.stop()})),r.isBlink&&function(e){const t=e.view,i=t.document;let n=null,o=!1;function s(e){return e==Rt.backspace||e==Rt.delete}function r(e){return e==Rt.backspace?uh:dh}i.on("keydown",((e,{keyCode:t})=>{n=t,o=!1})),i.on("keyup",((a,{keyCode:l,domEvent:c})=>{const u=i.selection,d=e.isEnabled&&l==n&&s(l)&&!u.isCollapsed&&!o;if(n=null,d){const e=u.getFirstRange(),n=new jo(i,"delete",e),o={unit:ch,direction:r(l),selectionToRemove:u};i.fire(n,new Zs(t,c,o))}})),i.on("beforeinput",((e,{inputType:t})=>{const i=hh[t];s(n)&&i&&i.direction==r(n)&&(o=!0)}),{priority:"high"}),i.on("beforeinput",((e,{inputType:t,data:i})=>{n==Rt.delete&&"insertText"==t&&""==i&&e.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class gh extends ad{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.model.document;t.addObserver(mh),this._undoOnBackspace=!1;const o=new ah(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new ah(e,"backward")),this.listenTo(i,"delete",((n,o)=>{i.isComposing||o.preventDefault();const{direction:s,sequence:r,selectionToRemove:a,unit:l}=o,c="forward"===s?"deleteForward":"delete",u={sequence:r};if("selection"==l){const t=Array.from(a.getRanges()).map((t=>e.editing.mapper.toModelRange(t))).map((t=>ec(t,e.model.schema)||t));u.selection=e.model.createSelection(t)}else u.unit=l;e.execute(c,u),t.scrollToTheSelection()}),{priority:"low"}),this.listenTo(i,"keydown",((o,s)=>{if(i.isComposing||s.keyCode!=Rt.backspace||!n.selection.isCollapsed)return;const r=e.model.schema.getLimitElement(n.selection),a=e.model.createPositionAt(r,0);if(a.isTouching(n.selection.getFirstPosition())){s.preventDefault();const n=e.model.schema.getNearestSelectionRange(a,"forward");if(!n)return;const o=t.createSelection(e.editing.mapper.toViewRange(n)),r=o.getFirstRange(),l=new jo(document,"delete",r),c={unit:"selection",direction:"backward",selectionToRemove:o};i.fire(l,new Zs(t,s.domEvent,c))}})),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",((t,i)=>{this._undoOnBackspace&&"backward"==i.direction&&1==i.sequence&&"codePoint"==i.unit&&(this._undoOnBackspace=!1,e.execute("undo"),i.preventDefault(),t.stop())}),{context:"$capture"}),this.listenTo(n,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class fh extends ad{static get requires(){return[nh,gh]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}function ph(e,t){let i=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce(((e,{item:n})=>n.is("$text")||n.is("$textProxy")?e+n.data:(i=t.createPositionAfter(n),"")),""),range:t.createRange(i,e.end)}}class bh extends(G()){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",((t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(e,"change:data",((e,t)=>{!t.isUndo&&t.isLocal&&this._evaluateTextBeforeSelection("data",{batch:t})}))}_evaluateTextBeforeSelection(e,t={}){const i=this.model,n=i.document.selection,o=i.createRange(i.createPositionAt(n.focus.parent,0),n.focus),{text:s,range:r}=ph(o,i),a=this.testCallback(s);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const i=Object.assign(t,{text:s,range:r});"object"==typeof a&&Object.assign(i,a),this.fire(`matched:${e}`,i)}}}class wh extends ad{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.locale,o=t.document.selection;this.listenTo(i.document,"arrowKey",((e,t)=>{if(!o.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==Rt.arrowright,s=t.keyCode==Rt.arrowleft;if(!i&&!s)return;const r=n.contentLanguageDirection;let a=!1;a="ltr"===r&&i||"rtl"===r&&s?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()}),{context:"$text",priority:"highest"}),this.listenTo(o,"change:range",((e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&xh(o.getFirstPosition(),this.attributes)||this._restoreGravity())})),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,o=n.getFirstPosition();return!(this._isGravityOverridden||o.isAtStart&&vh(n,t)||!xh(o,t)||(e&&kh(e),vh(n,t)&&xh(o,t,!0)?_h(i,t):this._overrideGravity(),0))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,o=n.getFirstPosition();return this._isGravityOverridden?(e&&kh(e),this._restoreGravity(),xh(o,t,!0)?_h(i,t):yh(i,t,o),!0):o.isAtStart?!!vh(n,t)&&(e&&kh(e),yh(i,t,o),!0):!vh(n,t)&&xh(o,t,!0)?(e&&kh(e),yh(i,t,o),!0):!!Ch(o,t)&&(o.isAtEnd&&!vh(n,t)&&xh(o,t)?(e&&kh(e),yh(i,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}_enableClickingAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view.document;e.editing.view.addObserver(wc),e.editing.view.addObserver(vc);let o=!1,s=!1;this.listenTo(n,"touchstart",(()=>{s=!1,o=!0})),this.listenTo(n,"mousedown",(()=>{s=!0})),this.listenTo(n,"selectionChange",(()=>{const e=this.attributes;if(!s&&!o)return;if(s=!1,o=!1,!i.isCollapsed)return;if(!vh(i,e))return;const n=i.getFirstPosition();xh(n,e)&&(n.isAtStart||xh(n,e,!0)?_h(t,e):this._isGravityOverridden||this._overrideGravity())}))}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection,i=this.attributes;this.listenTo(e,"insertContent",(()=>{const n=t.getFirstPosition();vh(t,i)&&xh(n,i)&&_h(e,i)}),{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view;let o=!1,s=!1;this.listenTo(n.document,"delete",((e,t)=>{o="backward"===t.direction}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{if(!o)return;const e=i.getFirstPosition();s=vh(i,this.attributes)&&!Ch(e,this.attributes)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{o&&(o=!1,s||e.model.enqueueChange((()=>{const e=i.getFirstPosition();vh(i,this.attributes)&&xh(e,this.attributes)&&(e.isAtStart||xh(e,this.attributes,!0)?_h(t,this.attributes):this._isGravityOverridden||this._overrideGravity())})))}),{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((e=>e.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function vh(e,t){for(const i of t)if(e.hasAttribute(i))return!0;return!1}function yh(e,t,i){const n=i.nodeBefore;e.change((i=>{if(n){const t=[],o=e.schema.isObject(n)&&e.schema.isInline(n);for(const[i,s]of n.getAttributes())!e.schema.checkAttribute("$text",i)||o&&!1===e.schema.getAttributeProperties(i).copyFromObject||t.push([i,s]);i.setSelectionAttribute(t)}else i.removeSelectionAttribute(t)}))}function _h(e,t){e.change((e=>{e.removeSelectionAttribute(t)}))}function kh(e){e.preventDefault()}function Ch(e,t){return xh(e.getShiftedBy(-1),t)}function xh(e,t,i=!1){const{nodeBefore:n,nodeAfter:o}=e;for(const e of t){const t=n?n.getAttribute(e):void 0,s=o?o.getAttribute(e):void 0;if((!i||void 0!==t&&void 0!==s)&&s!==t)return!0}return!1}function Ah(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return e.map(Ah).join(",");const t=String(e);return"0"===t&&Object.is(Number(e),-0)?"-0":t}function Th(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function Eh(e,t,i,n){return n.createRange(Sh(e,t,i,!0,n),Sh(e,t,i,!1,n))}function Sh(e,t,i,n,o){let s=e.textNode||(n?e.nodeBefore:e.nodeAfter),r=null;for(;s&&s.getAttribute(t)==i;)r=s,s=n?s.previousSibling:s.nextSibling;return r?o.createPositionAt(r,n?"before":"after"):e}function Ph(e,t,i,n){const o=e.editing.view,s=new Set;o.document.registerPostFixer((o=>{const r=e.model.document.selection;let a=!1;if(r.hasAttribute(t)){const l=Eh(r.getFirstPosition(),t,r.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(n)&&(o.addClass(n,e),s.add(e),a=!0)}return a})),e.conversion.for("editingDowncast").add((e=>{function t(){o.change((e=>{for(const t of s.values())e.removeClass(n,t),s.delete(t)}))}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})}))}function*Ih(e,t){for(const i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i)}Th('"'),Th("'"),Th("'"),Th('"'),Th('"'),Th("'");class Vh extends cd{execute(){this.editor.model.change((e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})}))}enterBlock(e){const t=this.editor.model,i=t.document.selection,n=t.schema,o=i.isCollapsed,s=i.getFirstRange(),r=s.start.parent,a=s.end.parent;if(n.isLimit(r)||n.isLimit(a))return o||r!=a||t.deleteContent(i),!1;if(o){const t=Ih(e.model.schema,i.getAttributes());return Oh(e,s.start),e.setSelectionAttribute(t),!0}{const n=!(s.start.isAtStart&&s.end.isAtEnd),o=r==a;if(t.deleteContent(i,{leaveUnmerged:n}),n){if(o)return Oh(e,i.focus),!0;e.setSelection(a,0)}}return!1}}function Oh(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}const Rh={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Lh extends Gs{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",((e,t)=>{i=t.shiftKey})),t.on("beforeinput",((n,o)=>{if(!this.isEnabled)return;let s=o.inputType;r.isSafari&&i&&"insertParagraph"==s&&(s="insertLineBreak");const a=o.domEvent,l=Rh[s];if(!l)return;const c=new jo(t,"enter",o.targetRanges[0]);t.fire(c,new Zs(e,a,{isSoft:l.isSoft})),c.stop.called&&n.stop()}))}observe(){}stopObserving(){}}class Bh extends ad{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,i=t.document,n=this.editor.t;t.addObserver(Lh),e.commands.add("enter",new Vh(e)),this.listenTo(i,"enter",((n,o)=>{i.isComposing||o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class Mh extends cd{execute(){const e=this.editor.model,t=e.document;e.change((i=>{!function(e,t,i){const n=i.isCollapsed,o=i.getFirstRange(),s=o.start.parent,r=o.end.parent,a=s==r;if(n){const n=Ih(e.schema,i.getAttributes());Nh(e,t,o.end),t.removeSelectionAttribute(i.getAttributeKeys()),t.setSelectionAttribute(n)}else{const n=!(o.start.isAtStart&&o.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:n}),a?Nh(e,t,i.focus):n&&t.setSelection(r,0)}}(e,i,t.selection),this.fire("afterExecute",{writer:i})}))}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return!1;const n=t.getFirstRange(),o=n.start.parent,s=n.end.parent;return!Fh(o,e)&&!Fh(s,e)||o===s}(e.schema,t.selection)}}function Nh(e,t,i){const n=t.createElement("softBreak");e.insertContent(n,i),t.setSelection(n,"after")}function Fh(e,t){return!e.is("rootElement")&&(t.isLimit(e)||Fh(e.parent,t))}class Dh extends ad{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,i=e.conversion,n=e.editing.view,o=n.document,s=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),n.addObserver(Lh),e.commands.add("shiftEnter",new Mh(e)),this.listenTo(o,"enter",((t,i)=>{o.isComposing||i.preventDefault(),i.isSoft&&(e.execute("shiftEnter"),n.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a soft break (a<br> element)"),keystroke:"Shift+Enter"}]})}}class zh extends(R()){_stack=[];add(e,t){const i=this._stack,n=i[0];this._insertDescriptor(e);const o=i[0];n===o||Hh(n,o)||this.fire("change:top",{oldDescriptor:n,newDescriptor:o,writer:t})}remove(e,t){const i=this._stack,n=i[0];this._removeDescriptor(e);const o=i[0];n===o||Hh(n,o)||this.fire("change:top",{oldDescriptor:n,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex((t=>t.id===e.id));if(Hh(e,t[i]))return;i>-1&&t.splice(i,1);let n=0;for(;t[n]&&(o=t[n],s=e,o.priority>s.priority||!(o.priority/.test(e),n=/<\/pre>/.test(e);return(!i||!n)&&(i?"first":n?"last":("first"===t||"middle"===t)&&"middle")}(e,s),e.length||s?function(e,t){return t.some((t=>!t.isVoid&&!!new RegExp(`<${t.name}( .*?)?>`).test(e)))}(e,t)?ci(e,o++):function(e,t){return t.some((t=>new RegExp(`${t.name}>`).test(e)))}(e,t)?ci(e,--o):ci(e,"middle"===s||"last"===s?0:o):""))).join("").trimEnd()}(e):e}const sA=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function rA(e,t,i,n){t&&function(e,t,i){if(t.attributes)for(const[n]of Object.entries(t.attributes))e.removeAttribute(n,i);if(t.styles)for(const n of Object.keys(t.styles))e.removeStyle(n,i);t.classes&&e.removeClass(t.classes,i)}(e,t,n),i&&aA(e,i,n)}function aA(e,t,i){if(t.attributes)for(const[n,o]of Object.entries(t.attributes))e.setAttribute(n,o,i);t.styles&&e.setStyle(t.styles,i),t.classes&&e.addClass(t.classes,i)}function lA(e,t,i,n,o){const s=t.getAttribute(i),r={};for(const e of["attributes","styles","classes"]){if(e!=n){s&&s[e]&&(r[e]=s[e]);continue}if("classes"==n){const t=new Set(s&&s.classes||[]);o(t),t.size&&(r[e]=Array.from(t));continue}const t=new Map(Object.entries(s&&s[e]||{}));o(t),t.size&&(r[e]=Object.fromEntries(t))}Object.keys(r).length?t.is("documentSelection")?e.setSelectionAttribute(i,r):e.setAttribute(i,r,t):s&&(t.is("documentSelection")?e.removeSelectionAttribute(i):e.removeAttribute(i,t))}function cA(e,t,i){for(const n of t.getItems({shallow:!0})){const t=n.getAttribute(e);t&&t.attributes&&Object.keys(t.attributes).length?Object.keys(t).length>1&&i.setAttribute(e,{attributes:t.attributes},n):i.removeAttribute(e,n)}}function uA(e){return`html${t=e,function(e){const t=function(e){return Array.from(e.match(sA)??[])}(function(e){return"string"!=typeof e&&(e=Ah(e)),e.replace(/['\u2019]/g,"")}(e).trim());let i="";for(let e=0;ei.writer.createElement(e,{htmlContent:t.getCustomProperty("$rawContent")})}function hA(e,{view:t,isInline:i}){const n=e.t;return(e,{writer:o})=>{const s=n("HTML object"),r=mA(t,e,o),a=e.getAttribute(uA(t));return o.addClass("html-object-embed__content",r),a&&aA(o,a,r),jh(o.createContainerElement(i?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},r),o,{label:s})}}function mA(e,t,i){return i.createRawElement(e,null,((e,i)=>{i.setContentOf(e,t.getAttribute("htmlContent"))}))}function gA({model:e,view:t},i){return(n,{writer:o,consumable:s})=>{if(!n.hasAttribute(e))return null;const r=o.createContainerElement(t),a=n.getAttribute(e);return s.consume(n,`attribute:${e}`),aA(o,a,r),r.getFillerOffset=()=>null,i?jh(r,o):r}}function fA({priority:e,view:t}){return(i,n)=>{if(!i)return;const{writer:o}=n,s=o.createAttributeElement(t,null,{priority:e});return aA(o,i,s),s}}function pA({view:e},t){return i=>{i.on(`element:${e}`,((e,i,n)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const o=t.processViewAttributes(i.viewItem,n);o&&n.writer.setAttribute(uA(i.viewItem.name),o,i.modelRange)}),{priority:"low"})}}function bA({view:e,model:t}){return i=>{i.on(`attribute:${uA(e)}:${t}`,((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:o}=t;rA(i.writer,n,o,i.mapper.toViewElement(t.item))}))}}const wA=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDiv"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],vA=[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{isFormatting:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}];class yA extends ad{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const e of wA)this.registerBlockElement(e);for(const e of vA)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){const i=new Set;for(const n of this._getMatchingViewDefinitions(e)){if(t)for(const e of this._getReferences(n.model))i.add(e);i.add(n)}return i}getDefinitionsForModel(e){return this._definitions.filter((t=>t.model==e))}_getMatchingViewDefinitions(e){return this._definitions.filter((t=>t.view&&function(e,t){return"string"==typeof e?e===t:e instanceof RegExp&&e.test(t)}(e,t.view)))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter((t=>t.model==e));for(const{modelSchema:n}of i)if(n)for(const i of t)for(const t of zt(n[i]||[])){const i=this._definitions.filter((e=>e.model==t));for(const n of i)t!==e&&(yield*this._getReferences(n.model),yield n)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter((([,t])=>t.model==e.model));if(0!=t.length)for(const[i,n]of t)this._definitions[i]=jt({},n,e,((e,t)=>Array.isArray(e)?e.concat(t):void 0));else this._definitions.push(e)}}class _A extends ad{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new co,this._disallowedAttributes=new co,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[yA,lm]}loadAllowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,i=TA(t);this.allowElement(e),i.forEach((e=>this.allowAttributes(e)))}}loadDisallowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,i=TA(t);0==i.length?this.disallowElement(e):i.forEach((e=>this.disallowAttributes(e)))}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t)}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){const{consumable:i}=t;return kA(e,this._disallowedAttributes,i),function(e,{attributes:t,classes:i,styles:n}){return t.length||i.length||n.length?{...t.length&&{attributes:CA(e,t)},...n.length&&{styles:xA(e,n)},...i.length&&{classes:i}}:null}(e,kA(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&"string"==typeof e.appliesToBlock)for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",(()=>{this._fireRegisterEvent(e)}),{priority:k.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",(()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)}),{priority:k.highest+1})}_registerElementHandlers(){this.on("register",((e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new x("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()}),{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer((t=>{const i=e.document.differ.getChanges();let n=!1;const o=this._getCoupledAttributesMap();for(const e of i){if("attribute"!=e.type||null!==e.attributeNewValue)continue;const i=o.get(e.attributeKey);if(i)for(const{item:o}of e.range.getWalker())for(const e of i)o.hasAttribute(e)&&(t.removeAttribute(e,o),n=!0)}return n})),this.listenTo(t,"change:attribute",((i,{attributeKeys:n})=>{const o=new Set,s=this._getCoupledAttributesMap();for(const e of n){if(t.hasAttribute(e))continue;const i=s.get(e);if(i)for(const e of i)t.hasAttribute(e)&&o.add(e)}0!=o.size&&e.change((e=>{for(const t of o)e.removeSelectionAttribute(t)}))}))}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer((t=>{const i=e.document.differ.getChanges();let n=!1;for(const o of i)if("insert"===o.type&&"$text"!==o.name)for(const i of o.attributes.keys())i.startsWith("html")&&i.endsWith("Attributes")&&(e.schema.checkAttribute(o.name,i)||(t.removeAttribute(i,o.position.nodeAfter),n=!0));return n}))}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,i=t.model.schema,n=t.conversion,{view:o,model:s}=e;i.register(s,e.modelSchema),o&&(i.extend(e.model,{allowAttributes:[uA(o),"htmlContent"]}),t.data.registerRawContentMatcher({name:o}),n.for("upcast").elementToElement({view:o,model:dA(e),converterPriority:k.low+2}),n.for("upcast").add(pA(e,this)),n.for("editingDowncast").elementToStructure({model:{name:s,attributes:[uA(o)]},view:hA(t,e)}),n.for("dataDowncast").elementToElement({model:s,view:(e,{writer:t})=>mA(o,e,t)}),n.for("dataDowncast").add(bA(e)))}_registerBlockElement(e){const t=this.editor,i=t.model.schema,n=t.conversion,{view:o,model:s}=e;if(!i.isRegistered(e.model)){if(!e.modelSchema)return;if(i.register(e.model,e.modelSchema),!o)return;n.for("upcast").elementToElement({model:s,view:o,converterPriority:k.low+2}),n.for("downcast").elementToElement({model:s,view:(t,{writer:i})=>e.isEmpty?i.createEmptyElement(o):i.createContainerElement(o)})}o&&(i.extend(e.model,{allowAttributes:uA(o)}),n.for("upcast").add(pA(e,this)),n.for("downcast").add(bA(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,n=t.conversion,o=e.model;if(!e.appliesToBlock&&(i.extend("$text",{allowAttributes:o}),e.attributeProperties&&i.setAttributeProperties(o,e.attributeProperties),n.for("upcast").add(function({view:e,model:t,allowEmpty:i},n){return t=>{t.on(`element:${e}`,((e,t,s)=>{let r=n.processViewAttributes(t.viewItem,s);if(r||s.consumable.test(t.viewItem,{name:!0})){if(r=r||{},s.consumable.consume(t.viewItem,{name:!0}),t.modelRange||(t=Object.assign(t,s.convertChildren(t.viewItem,t.modelCursor))),i&&t.modelRange.isCollapsed&&Object.keys(r).length){const e=s.writer.createElement("htmlEmptyElement");if(!s.safeInsert(e,t.modelCursor))return;const i=s.getSplitParts(e);return t.modelRange=s.writer.createRange(t.modelRange.start,s.writer.createPositionAfter(i[i.length-1])),s.updateConversionResult(e,t),void o(e,r,s)}for(const e of t.modelRange.getItems())o(e,r,s)}}),{priority:"low"})};function o(e,i,n){if(n.schema.checkAttribute(e,t)){const o=function(e,t){const i=Ht(e);let n="attributes";for(n in t)i[n]="classes"==n?Array.from(new Set([...e[n]||[],...t[n]])):{...e[n],...t[n]};return i}(i,e.getAttribute(t)||{});n.writer.setAttribute(t,o,e)}}}(e,this)),n.for("downcast").attributeToElement({model:o,view:fA(e)}),e.allowEmpty)){if(i.setAttributeProperties(o,{copyFromObject:!1}),!i.isRegistered("htmlEmptyElement")){i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const e=e=>Array.from(e.getAttributeKeys()).some((e=>e.startsWith("html")));t.model.document.registerPostFixer((i=>{const n=t.model.document.differ.getChanges(),o=new Set;for(const t of n)if("remove"!==t.type){if("attribute"===t.type&&null===t.attributeNewValue)for(const{item:i}of t.range)i.is("element","htmlEmptyElement")&&!e(i)&&o.add(i);if("insert"===t.type&&t.position.nodeAfter){const n=t.position.nodeAfter;for(const{item:t}of i.createRangeOn(n))t.is("element","htmlEmptyElement")&&!e(t)&&o.add(t)}}for(const e of o)i.remove(e);return o.size>0}))}t.data.htmlProcessor.domConverter.registerInlineObjectMatcher((t=>t.name==e.view&&t.isEmpty&&Array.from(t.getAttributeKeys()).length?{name:!0}:null)),n.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:gA(e,!0)}),n.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:gA(e)})}}}function kA(e,t,i){const n=t.matchAll(e)||[],o=e.document.stylesProcessor;return n.reduce(((t,{match:n})=>{for(const[s,r]of n.attributes||[])if("style"==s){const n=r,s=o.getRelatedStyles(n).filter((e=>e.split("-").length>n.split("-").length)).sort(((e,t)=>t.split("-").length-e.split("-").length));for(const n of s)i.consume(e,{styles:[n]})&&t.styles.push(n);i.consume(e,{styles:[n]})&&t.styles.push(n)}else if("class"==s){const n=r;i.consume(e,{classes:[n]})&&t.classes.push(n)}else i.consume(e,{attributes:[s]})&&t.attributes.push(s);return t}),{attributes:[],classes:[],styles:[]})}function CA(e,t){const i={};for(const n of t){const t=e.getAttribute(n);void 0!==t&&dt(n)&&(i[n]=t)}return i}function xA(e,t){const i=new Ao(e.document.stylesProcessor);for(const n of t){const t=e.getStyle(n);void 0!==t&&i.set(n,t)}return Object.fromEntries(i.getStylesEntries())}function AA(e,t){const{name:i}=e,n=e[t];return se(n)?Object.entries(n).map((([e,n])=>({name:i,[t]:{[e]:n}}))):Array.isArray(n)?n.map((e=>({name:i,[t]:[e]}))):[e]}function TA(e){const{name:t,attributes:i,classes:n,styles:o}=e,s=[];return i&&s.push(...AA({name:t,attributes:i},"attributes")),n&&s.push(...AA({name:t,classes:n},"classes")),o&&s.push(...AA({name:t,styles:o},"styles")),s}class EA extends ad{static get requires(){return[_A]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(_A);e.on("register:pre",((t,i)=>{if("codeBlock"!==i.model)return;const n=this.editor,o=n.model.schema,s=n.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),s.for("upcast").add(function(e){return t=>{t.on("element:code",((t,i,n)=>{const o=i.viewItem,s=o.parent;function r(t,o){const s=e.processViewAttributes(t,n);s&&n.writer.setAttribute(o,s,i.modelRange)}s&&s.is("element","pre")&&(r(s,"htmlPreAttributes"),r(o,"htmlContentAttributes"))}),{priority:"low"})}}(e)),s.for("downcast").add((e=>{e.on("attribute:htmlPreAttributes:codeBlock",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:o}=t,s=i.mapper.toViewElement(t.item).parent;rA(i.writer,n,o,s)})),e.on("attribute:htmlContentAttributes:codeBlock",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:o}=t,s=i.mapper.toViewElement(t.item);rA(i.writer,n,o,s)}))})),t.stop()}))}}class SA extends ad{static get requires(){return[_A]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(_A).on("register",((e,t)=>{const i=t,n=this.editor,o=n.model.schema,s=n.conversion;if(!i.paragraphLikeModel)return;if(o.isRegistered(i.model)||o.isRegistered(i.paragraphLikeModel))return;const r={model:i.paragraphLikeModel,view:i.view};o.register(i.model,i.modelSchema),o.register(r.model,{inheritAllFrom:"$block"}),s.for("upcast").elementToElement({view:i.view,model:(e,{writer:t})=>this._hasBlockContent(e)?t.createElement(i.model):t.createElement(r.model),converterPriority:k.low+.5}),s.for("downcast").elementToElement({view:i.view,model:i.model}),this._addAttributeConversion(i),s.for("downcast").elementToElement({view:r.view,model:r.model}),this._addAttributeConversion(r),e.stop()}))}_hasBlockContent(e){const t=this.editor.editing.view,i=t.domConverter.blockElements;for(const n of t.createRangeIn(e).getItems())if(n.is("element")&&i.includes(n.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,i=t.conversion,n=t.plugins.get(_A);t.model.schema.extend(e.model,{allowAttributes:uA(e.view)}),i.for("upcast").add(pA(e,n)),i.for("downcast").add(bA(e))}}class PA extends ad{static get requires(){return[yA,Bh]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){const i=e.plugins.get(yA),n=[];for(const e of t)"model"in e&&"view"in e&&(i.registerBlockElement({view:e.view,model:e.model}),n.push(e.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:n}}),i.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:n}})}}function IA(e,t,i){const n=e.createRangeOn(t);for(const{item:e}of n.getWalker())if(e.is("element",i))return e}class VA extends ad{static get requires(){return[_A]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(_A);n.on("register:figure",(()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",((t,i,n)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("image"))return;const s=e.processViewAttributes(o,n);s&&n.writer.setAttribute("htmlFigureAttributes",s,i.modelRange)}),{priority:"low"})}}(n))})),n.on("register:img",((o,s)=>{"imageBlock"!==s.model&&"imageInline"!==s.model||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(function(e){return t=>{t.on("element:img",((t,i,n)=>{if(!i.modelRange)return;const o=i.viewItem,s=e.processViewAttributes(o,n);s&&n.writer.setAttribute("htmlImgAttributes",s,i.modelRange)}),{priority:"low"})}}(n)),i.for("downcast").add((e=>{function t(t,i){e.on(`attribute:${i}:imageBlock`,((e,i,n)=>{if(!n.consumable.test(i.item,e.name))return;const{attributeOldValue:o,attributeNewValue:s}=i,r=n.mapper.toViewElement(i.item),a=IA(n.writer,r,t);a&&(rA(n.writer,o,s,a),n.consumable.consume(i.item,e.name))}),{priority:"low"}),"a"===t&&e.on("attribute:linkHref:imageBlock",((e,t,i)=>{if(!i.consumable.consume(t.item,"attribute:htmlLinkAttributes:imageBlock"))return;const n=i.mapper.toViewElement(t.item),o=IA(i.writer,n,"a");aA(i.writer,t.item.getAttribute("htmlLinkAttributes"),o)}),{priority:"low"})}var i;i="htmlImgAttributes",e.on(`attribute:${i}:imageInline`,((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:o}=t,s=i.mapper.toViewElement(t.item);rA(i.writer,n,o,s)}),{priority:"low"}),t("img","htmlImgAttributes"),t("figure","htmlFigureAttributes"),t("a","htmlLinkAttributes")})),e.plugins.has("LinkImage")&&i.for("upcast").add(function(e,t){const i=t.plugins.get("ImageUtils");return t=>{t.on("element:a",((t,n,o)=>{const s=n.viewItem;if(!i.findViewImgElement(s))return;const r=n.modelCursor.parent;if(!r.is("element","imageBlock"))return;const a=e.processViewAttributes(s,o);a&&o.writer.setAttribute("htmlLinkAttributes",a,r)}),{priority:"low"})}}(n,e)),o.stop())}))}}class OA extends ad{static get requires(){return[_A]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,n=this.editor.plugins.get(_A),o=this.editor.plugins.get(yA),s=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:s}),n.on("register:figure",(()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",((t,i,n)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("media"))return;const s=e.processViewAttributes(o,n);s&&n.writer.setAttribute("htmlFigureAttributes",s,i.modelRange)}),{priority:"low"})}}(n))})),n.on(`register:${s}`,((e,o)=>{"media"===o.model&&(t.extend("media",{allowAttributes:[uA(s),"htmlFigureAttributes"]}),i.for("upcast").add(function(e,t){const i=(i,n,o)=>{!function(t,i){const s=e.processViewAttributes(t,o);s&&o.writer.setAttribute(i,s,n.modelRange)}(n.viewItem,uA(t))};return e=>{e.on(`element:${t}`,i,{priority:"low"})}}(n,s)),i.for("dataDowncast").add(function(e){return t=>{function i(e,i){t.on(`attribute:${i}:media`,((t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const{attributeOldValue:o,attributeNewValue:s}=i,r=n.mapper.toViewElement(i.item),a=IA(n.writer,r,e);rA(n.writer,o,s,a)}))}i(e,uA(e)),i("figure","htmlFigureAttributes")}}(s)),e.stop())}))}}class RA extends ad{static get requires(){return[_A]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(_A);e.on("register:script",((t,i)=>{const n=this.editor,o=n.model.schema,s=n.conversion;o.register("htmlScript",i.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),n.data.registerRawContentMatcher({name:"script"}),s.for("upcast").elementToElement({view:"script",model:dA(i)}),s.for("upcast").add(pA(i,e)),s.for("downcast").elementToElement({model:"htmlScript",view:(e,{writer:t})=>mA("script",e,t)}),s.for("downcast").add(bA(i)),t.stop()}))}}const LA=["width","max-width","min-width","height","min-height","max-height"];class BA extends ad{static get requires(){return[_A]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(_A),o=e.plugins.get("TableUtils");n.on("register:figure",(()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",((t,i,n)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("table"))return;const s=e.processViewAttributes(o,n);s&&n.writer.setAttribute("htmlFigureAttributes",s,i.modelRange)}),{priority:"low"})}}(n))})),n.on("register:table",((s,r)=>{"table"===r.model&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(function(e){return t=>{t.on("element:table",((t,i,n)=>{if(!i.modelRange)return;const o=i.viewItem;n.consumable.consume(o,{classes:"table"}),s(o,"htmlTableAttributes");for(const e of o.getChildren())e.is("element","thead")&&s(e,"htmlTheadAttributes"),e.is("element","tbody")&&s(e,"htmlTbodyAttributes");function s(t,o){const s=e.processViewAttributes(t,n);s&&n.writer.setAttribute(o,s,i.modelRange)}}),{priority:"low"})}}(n)),i.for("downcast").add((e=>{function t(t,i){e.on(`attribute:${i}:table`,((e,n,o)=>{if(!o.consumable.test(n.item,e.name))return;const s=o.mapper.toViewElement(n.item),r=IA(o.writer,s,t);if(r)if(o.consumable.consume(n.item,e.name),"htmlTableAttributes"===i&&s!==r){const e=MA(n.attributeOldValue),t=MA(n.attributeNewValue);rA(o.writer,e.tableAttributes,t.tableAttributes,r),rA(o.writer,e.figureAttributes,t.figureAttributes,s)}else rA(o.writer,n.attributeOldValue,n.attributeNewValue,r)}))}t("table","htmlTableAttributes"),t("figure","htmlFigureAttributes"),t("thead","htmlTheadAttributes"),t("tbody","htmlTbodyAttributes")})),e.model.document.registerPostFixer(function(e,t){return i=>{const n=e.document.differ.getChanges();let o=!1;for(const e of n){if("attribute"!=e.type||"headingRows"!=e.attributeKey)continue;const n=e.range.start.nodeAfter,s=n.getAttribute("htmlTheadAttributes"),r=n.getAttribute("htmlTbodyAttributes");s&&!e.attributeNewValue?(i.removeAttribute("htmlTheadAttributes",n),o=!0):r&&e.attributeNewValue==t.getRows(n)&&(i.removeAttribute("htmlTbodyAttributes",n),o=!0)}return o}}(e.model,o)),s.stop())}))}}function MA(e){const t={},i={...e};if(!e||!("styles"in e))return{figureAttributes:t,tableAttributes:i};i.styles={};for(const[n,o]of Object.entries(e.styles))LA.includes(n)?t.styles={...t.styles,[n]:o}:i.styles={...i.styles,[n]:o};return{figureAttributes:t,tableAttributes:i}}class NA extends ad{static get requires(){return[_A]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(_A);e.on("register:style",((t,i)=>{const n=this.editor,o=n.model.schema,s=n.conversion;o.register("htmlStyle",i.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),n.data.registerRawContentMatcher({name:"style"}),s.for("upcast").elementToElement({view:"style",model:dA(i)}),s.for("upcast").add(pA(i,e)),s.for("downcast").elementToElement({model:"htmlStyle",view:(e,{writer:t})=>mA("style",e,t)}),s.for("downcast").add(bA(i)),t.stop()}))}}class FA extends ad{static get requires(){return[_A]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(_A),o=e.plugins.get("ListEditing"),s=e.plugins.get("ListUtils"),r=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:aA}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:aA}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:aA}),n.on("register",((e,o)=>{if(!r.includes(o.view))return;if(e.stop(),t.checkAttribute("$block","htmlLiAttributes"))return;const s=r.map((e=>uA(e)));t.extend("$listItem",{allowAttributes:s}),i.for("upcast").add((e=>{e.on("element:ul",DA("htmlUlAttributes",n),{priority:"low"}),e.on("element:ol",DA("htmlOlAttributes",n),{priority:"low"}),e.on("element:li",DA("htmlLiAttributes",n),{priority:"low"})}))})),o.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:n,previousNodeInList:o}of t)if(o){if(o.getAttribute("listType")==n.getAttribute("listType")){const t=zA(o.getAttribute("listType")),s=o.getAttribute(t);!cl(n.getAttribute(t),s)&&i.model.schema.checkAttribute(n,t)&&(i.setAttribute(t,s,n),e.return=!0)}if(o.getAttribute("listItemId")==n.getAttribute("listItemId")){const t=o.getAttribute("htmlLiAttributes");!cl(n.getAttribute("htmlLiAttributes"),t)&&i.model.schema.checkAttribute(n,"htmlLiAttributes")&&(i.setAttribute("htmlLiAttributes",t,n),e.return=!0)}}})),o.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:n}of t){const t=n.getAttribute("listType");!s.isNumberedListType(t)&&n.getAttribute("htmlOlAttributes")&&(i.removeAttribute("htmlOlAttributes",n),e.return=!0),s.isNumberedListType(t)&&n.getAttribute("htmlUlAttributes")&&(i.removeAttribute("htmlUlAttributes",n),e.return=!0)}}))}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",((t,i)=>{e.model.change((t=>{for(const n of i){const i=zA(n.getAttribute("listType"));e.model.schema.checkAttribute(n,i)&&t.setAttribute(i,{},n)}}))}))}}function DA(e,t){return(i,n,o)=>{const s=n.viewItem;n.modelRange||Object.assign(n,o.convertChildren(n.viewItem,n.modelCursor));const r=t.processViewAttributes(s,o);for(const t of n.modelRange.getItems({shallow:!0}))t.hasAttribute("listItemId")&&(t.hasAttribute("htmlUlAttributes")||t.hasAttribute("htmlOlAttributes")||o.writer.model.schema.checkAttribute(t,e)&&o.writer.setAttribute(e,r||{},t))}}function zA(e){return"numbered"===e||"customNumbered"==e?"htmlOlAttributes":"htmlUlAttributes"}class HA extends ad{static get requires(){return[_A]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(_A);n.on("register:hr",((e,o)=>{"horizontalLine"===o.model&&(t.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),i.for("upcast").add(pA(o,n)),i.for("downcast").add((e=>{e.on("attribute:htmlHrAttributes:horizontalLine",((e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:o}=t,s=i.mapper.toViewElement(t.item),r=IA(i.writer,s,"hr");r&&(rA(i.writer,n,o,r),i.consumable.consume(t.item,e.name))}),{priority:"low"})})),e.stop())}))}}class UA extends ad{static get requires(){return[_A,yA]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(_A),t=this.editor.plugins.get(yA);e.on("register:$customElement",((i,n)=>{i.stop();const o=this.editor,s=o.model.schema,r=o.conversion,a=o.editing.view.domConverter.unsafeElements,l=o.data.htmlProcessor.domConverter.preElements;s.register(n.model,n.modelSchema),s.extend(n.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),r.for("upcast").elementToElement({view:/.*/,model:(i,s)=>{if("$comment"==i.name)return null;if(!function(e){try{document.createElement(e)}catch{return!1}return!0}(i.name))return null;if(t.getDefinitionsForView(i.name).size)return null;a.includes(i.name)||a.push(i.name),l.includes(i.name)||l.push(i.name);const r=s.writer.createElement(n.model,{htmlElementName:i.name}),c=e.processViewAttributes(i,s);let u;if(c&&s.writer.setAttribute("htmlCustomElementAttributes",c,r),i.is("element","template")&&i.getCustomProperty("$rawContent"))u=i.getCustomProperty("$rawContent");else{const e=new _c(i.document).createDocumentFragment(i),t=o.data.htmlProcessor.domConverter.viewToDom(e),n=t.firstChild;for(;n.firstChild;)t.appendChild(n.firstChild);n.remove(),u=o.data.htmlProcessor.htmlWriter.getHtml(t)}s.writer.setAttribute("htmlContent",u,r);for(const{item:e}of o.editing.view.createRangeIn(i))s.consumable.consume(e,{name:!0});return r},converterPriority:"low"}),r.for("editingDowncast").elementToElement({model:{name:n.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const i=e.getAttribute("htmlElementName"),n=t.createRawElement(i);return e.hasAttribute("htmlCustomElementAttributes")&&aA(t,e.getAttribute("htmlCustomElementAttributes"),n),n}}),r.for("dataDowncast").elementToElement({model:{name:n.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const i=e.getAttribute("htmlElementName"),n=e.getAttribute("htmlContent"),o=t.createRawElement(i,null,((e,t)=>{t.setContentOf(e,n)}));return e.hasAttribute("htmlCustomElementAttributes")&&aA(t,e.getAttribute("htmlCustomElementAttributes"),o),o}})}))}}function*$A(e,t,i){if(t)if(!(Symbol.iterator in t)&&t.is("documentSelection")&&t.isCollapsed)e.schema.checkAttributeInSelection(t,i)&&(yield t);else for(const n of function(e,t,i){return!(Symbol.iterator in t)&&(t.is("node")||t.is("$text")||t.is("$textProxy"))?e.schema.checkAttribute(t,i)?[e.createRangeOn(t)]:[]:e.schema.getValidRanges(e.createSelection(t).getRanges(),i)}(e,t,i))yield*n.getItems({shallow:!0})}function qA(e){const t=e.map((e=>e.replace("+","\\+")));return new RegExp(`^image\\/(${t.join("|")})$`)}function jA(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class WA extends ad{static get pluginName(){return"ImageUploadUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("uploadImage",(()=>this._createToolbarButton())),e.ui.componentFactory.add("imageUpload",(()=>this._createToolbarButton())),e.ui.componentFactory.add("menuBar:uploadImage",(()=>this._createMenuBarButton("standalone"))),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("uploadImage"),o=t.config.get("image.upload.types"),s=qA(o),r=new e(t.locale),a=i.t;return r.set({acceptedType:o.map((e=>`image/${e}`)).join(","),allowMultipleFiles:!0,label:a("Upload from computer"),icon:''}),r.bind("isEnabled").to(n),r.on("done",((e,i)=>{const n=Array.from(i).filter((e=>s.test(e.type)));n.length&&(t.execute("uploadImage",{file:n}),t.editing.view.focus())})),r}_createToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this.editor.commands.get("uploadImage"),n=this._createButton(Qu);return n.tooltip=!0,n.bind("label").to(t,"isImageSelected",i,"isAccessAllowed",((t,i)=>e(i?t?"Replace image from computer":"Upload image from computer":"You have no image upload permissions."))),n}_createDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(Qu);return i.withText=!0,i.bind("label").to(t,"isImageSelected",(t=>e(t?"Replace from computer":"Upload from computer"))),i.on("execute",(()=>{t.dropdownView.isOpen=!1})),i}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createButton(td);switch(i.withText=!0,e){case"standalone":i.label=t("Image from computer");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("From computer")}return i}}class GA extends ad{static get pluginName(){return"ImageUploadProgress"}static get isOfficialPlugin(){return!0}placeholder;constructor(e){super(e),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}uploadStatusChange=(e,t,i)=>{const n=this.editor,o=t.item,s=o.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const r=n.plugins.get("ImageUtils"),a=n.plugins.get(sg),l=s?t.attributeNewValue:null,c=this.placeholder,u=n.editing.mapper.toViewElement(o),d=i.writer;if("reading"==l)return KA(u,d),void JA(r,c,u,d);if("uploading"==l){const e=a.loaders.get(s);return KA(u,d),void(e?(YA(u,d),function(e,t,i,n){const o=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),o),i.on("change:uploadedPercent",((e,t,i)=>{n.change((e=>{e.setStyle("width",i+"%",o)}))}))}(u,d,e,n.editing.view),function(e,t,i,n){if(n.data){const o=e.findViewImgElement(t);i.setAttribute("src",n.data,o)}}(r,u,d,e)):JA(r,c,u,d))}"complete"==l&&a.loaders.get(s)&&function(e,t,i){const n=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),n),setTimeout((()=>{i.change((e=>e.remove(e.createRangeOn(n))))}),3e3)}(u,d,n.editing.view),function(e,t){XA(e,t,"progressBar")}(u,d),YA(u,d),function(e,t){t.removeClass("ck-appear",e)}(u,d)}}function KA(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function JA(e,t,i,n){i.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",i);const o=e.findViewImgElement(i);o.getAttribute("src")!==t&&n.setAttribute("src",t,o),QA(i,"placeholder")||n.insert(n.createPositionAfter(o),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(n))}function YA(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),XA(e,t,"placeholder")}function QA(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function XA(e,t,i){const n=QA(e,i);n&&t.remove(t.createRangeOn(n))}class ZA extends fd{static get pluginName(){return"Notification"}static get isOfficialPlugin(){return!0}init(){this.on("show:warning",((e,t)=>{window.alert(t.message)}),{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class eT extends cd{constructor(e){super(e),this.set("isAccessAllowed",!0)}refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=zt(e.file),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach(((e,t)=>{const s=i.getSelectedElement();if(t&&s&&n.isImage(s)){const t=this.editor.model.createPositionAfter(s);this._uploadImage(e,o,t)}else this._uploadImage(e,o)}))}_uploadImage(e,t,i){const n=this.editor,o=n.plugins.get(sg).createLoader(e),s=n.plugins.get("ImageUtils");o&&s.insertImage({...t,uploadId:o.id},i)}}class tT extends ad{static get requires(){return[sg,ZA,Qd,gf]}static get pluginName(){return"ImageUploadEditing"}static get isOfficialPlugin(){return!0}_uploadImageElements;_uploadedImages=new Map;constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,o=e.plugins.get(sg),s=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),a=qA(e.config.get("image.upload.types")),l=new eT(e);e.commands.add("uploadImage",l),e.commands.add("imageUpload",l),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add((e=>e.on("element:img",((e,t,i)=>{if(!i.consumable.test(t.viewItem,{attributes:["data-ck-upload-id"]}))return;const n=t.viewItem.getAttribute("data-ck-upload-id");if(!n)return;const[s]=Array.from(t.modelRange.getItems({shallow:!0})),r=o.loaders.get(n);s&&(i.writer.setAttribute("uploadId",n,s),i.consumable.consume(t.viewItem,{attributes:["data-ck-upload-id"]}),r&&r.data&&i.writer.setAttribute("uploadStatus",r.status,s))}),{priority:"low"}))),this.listenTo(e.editing.view.document,"clipboardInput",((t,i)=>{if(n=i.dataTransfer,Array.from(n.types).includes("text/html")&&""!==n.getData("text/html"))return;var n;const o=Array.from(i.dataTransfer.files).filter((e=>!!e&&a.test(e.type)));if(o.length&&(t.stop(),e.model.change((t=>{i.targetRanges&&t.setSelection(i.targetRanges.map((t=>e.editing.mapper.toModelRange(t)))),e.execute("uploadImage",{file:o})})),!e.commands.get("uploadImage").isAccessAllowed)){const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("You have no image upload permissions."),{namespace:"image"})}})),this.listenTo(r,"inputTransformation",((t,i)=>{const r=Array.from(e.editing.view.createRangeIn(i.content)).map((e=>e.item)).filter((e=>function(e,t){return!(!e.isInlineImageView(t)||!t.getAttribute("src")||!t.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!t.getAttribute("src").match(/^blob:/g))}(s,e)&&!e.getAttribute("uploadProcessed"))).map((e=>{return{promise:(t=e,new Promise(((e,i)=>{const o=t.getAttribute("src");fetch(o).then((e=>e.blob())).then((t=>{const i=jA(t,o),n=i.replace("image/",""),s=new File([t],`image.${n}`,{type:i});e(s)})).catch((t=>t&&"TypeError"===t.name?function(e){return function(e){return new Promise(((t,i)=>{const o=n.document.createElement("img");o.addEventListener("load",(()=>{const e=n.document.createElement("canvas");e.width=o.width,e.height=o.height,e.getContext("2d").drawImage(o,0,0),e.toBlob((e=>e?t(e):i()))})),o.addEventListener("error",(()=>i())),o.src=e}))}(e).then((t=>{const i=jA(t,e),n=i.replace("image/","");return new File([t],`image.${n}`,{type:i})}))}(o).then(e).catch(i):i(t)))}))),imageElement:e};var t}));if(!r.length)return;const a=new _c(e.editing.view.document);for(const e of r){a.setAttribute("uploadProcessed",!0,e.imageElement);const t=o.createLoader(e.promise);t&&(a.setAttribute("src","",e.imageElement),a.setAttribute("uploadId",t.id,e.imageElement))}})),e.editing.view.document.on("dragover",((e,t)=>{t.preventDefault()})),t.on("change",(()=>{const i=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),n=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,s="$graveyard"==t.position.root.rootName;for(const t of iT(e,i)){const i=t.getAttribute("uploadId"),r=t.getAttribute("uploadStatus");if(!i||"complete"==r)continue;const a=o.loaders.get(i);a?s?n.has(i)||Array.from(this._uploadImageElements.get(i)).every((e=>"$graveyard"==e.root.rootName))&&a.abort():(n.add(i),this._uploadImageElements.has(i)?this._uploadImageElements.get(i).add(t):this._uploadImageElements.set(i,new Set([t])),"idle"==a.status&&this._readAndUpload(a)):!s&&this._uploadedImages.has(i)&&e.model.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","complete",t),this.fire("uploadComplete",{data:this._uploadedImages.get(i),imageElement:t})}))}}})),this.on("uploadComplete",((e,{imageElement:t,data:i})=>{const n=i.urls?i.urls:i;this.editor.model.change((e=>{e.setAttribute("src",n.default,t),this._parseAndSetSrcsetAttributeOnImage(n,t,e),s.setImageNaturalSizeAttributes(t)}))}),{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"))}_readAndUpload(e){const t=this.editor,i=t.model,n=t.locale.t,o=t.plugins.get(sg),s=t.plugins.get(ZA),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},(t=>{const i=l.get(e.id);for(const e of i)t.setAttribute("uploadStatus","reading",e)})),e.read().then((()=>{const o=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Uploading image"));for(const n of l.get(e.id)){if(r.isSafari){const e=t.editing.mapper.toViewElement(n),i=a.findViewImgElement(e);t.editing.view.once("render",(()=>{if(!i.parent)return;const e=t.editing.view.domConverter.mapViewToDom(i.parent);if(!e)return;const n=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=n}))}i.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","uploading",n)}))}return o})).then((o=>{i.enqueueChange({isUndoable:!1},(i=>{for(const t of l.get(e.id))i.setAttribute("uploadStatus","complete",t),this.fire("uploadComplete",{data:o,imageElement:t});t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Image upload complete")),this._uploadedImages.set(e.id,o)})),c()})).catch((o=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Error during image upload")),"error"!==e.status&&"aborted"!==e.status)throw o;"error"==e.status&&o&&s.showWarning(o,{title:n("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},(t=>{for(const i of l.get(e.id))"$graveyard"!==i.root.rootName&&t.remove(i)})),c()}));function c(){i.enqueueChange({isUndoable:!1},(t=>{for(const i of l.get(e.id))t.removeAttribute("uploadId",i),t.removeAttribute("uploadStatus",i);l.delete(e.id)})),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0;const o=Object.keys(e).filter((e=>{const t=parseInt(e,10);if(!isNaN(t))return n=Math.max(n,t),!0})).map((t=>`${e[t]} ${t}w`)).join(", ");if(""!=o){const e={srcset:o};t.hasAttribute("width")||t.hasAttribute("height")||(e.width=n),i.setAttributes(e,t)}}_registerConverters(e){const{conversion:t,plugins:i}=this.editor,n=i.get(sg),o=i.get(gf);t.for("dataDowncast").add((t=>{t.on(`attribute:uploadId:${e}`,((e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n.loaders.get(t.attributeNewValue);if(!s||!s.data)return null;const r=i.mapper.toViewElement(t.item),a=o.findViewImgElement(r);a&&(i.consumable.consume(t.item,e.name),i.writer.setAttribute("data-ck-upload-id",s.id,a))}))}))}}function iT(e,t){const i=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter((e=>i.isImage(e.item))).map((e=>e.item))}class nT extends ad{static get pluginName(){return"ImageUpload"}static get isOfficialPlugin(){return!0}static get requires(){return[tT,WA,GA]}}class oT extends Hi{urlInputView;keystrokes;constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new oi,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-url"],tabindex:"-1"},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),vf({view:this}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){const e=this.locale,t=e.t,i=new yf(e,Af);return i.bind("label").to(this,"isImageSelected",(e=>t(e?"Update image URL":"Insert image via URL"))),i.bind("isEnabled").to(this),i.fieldView.inputMode="url",i.fieldView.placeholder="https://example.com/image.png",i.fieldView.bind("value").to(this,"imageURLInputValue",(e=>e||"")),i.fieldView.on("input",(()=>{this.imageURLInputValue=i.fieldView.element.value.trim()})),i}focus(){this.urlInputView.focus()}}class sT extends ad{_imageInsertUI;_formView;static get pluginName(){return"ImageInsertViaUrlUI"}static get isOfficialPlugin(){return!0}static get requires(){return[qf,eg]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",(()=>this._createToolbarButton())),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",(()=>this._createMenuBarButton("standalone")))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon='',t.on("execute",(()=>{this._showModal()})),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(Bn);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert image via URL"))),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(Bn);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert via URL"))),t}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createInsertUrlButton(Yu);switch(i.withText=!0,e){case"standalone":i.label=t("Image via URL");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("Via URL")}return i}_createInsertUrlView(){const e=this.editor,t=e.locale,i=e.commands.get("replaceImageSource"),n=e.commands.get("insertImage"),o=new oT(t);return o.bind("isImageSelected").to(this._imageInsertUI),o.bind("isEnabled").toMany([n,i],"isEnabled",((...e)=>e.some((e=>e)))),o}_showModal(){const e=this.editor,t=e.locale.t,i=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",(()=>this._handleSave())));const n=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=n.value||"",i.show({id:"insertImageViaUrl",title:t("Image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:t("Cancel"),withText:!0,onExecute:()=>i.hide()},{label:this._imageInsertUI.isImageSelected?t("Save"):t("Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}}class rT extends ad{static get pluginName(){return"ImageInsertViaUrl"}static get isOfficialPlugin(){return!0}static get requires(){return[sT,qf]}}function aT(e){return!!e&&e.is("element","table")}function lT(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function cT(e){const t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class uT extends cd{refresh(){const e=this.editor,t=C_(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,"caption"),this.isEnabled?this.value=!!lT(t):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change((t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)}))}_showTableCaption(e,t){const i=this.editor.model,n=C_(i.document.selection),o=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||e.createElement("caption");i.insertContent(o,n,"end"),t&&e.setSelection(o,"in")}_hideTableCaption(e){const t=this.editor.model,i=C_(t.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),o=lT(i);n._saveCaption(i,o),t.deleteContent(e.createSelection(o,"on"))}}class dT extends ad{_savedCaptionsMap=new WeakMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,i=e.editing.view,n=e.t,o=e.config.get("table.tableCaption.useCaptionElement");var s;t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new uT(this.editor)),o&&e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","caption"),positionOffset:"end"}),e.conversion.for("upcast").elementToElement({view:cT,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>aT(e.parent)?t.createContainerElement(o?"caption":"figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!aT(e.parent))return null;const s=t.createEditableElement(o?"caption":"figcaption");return t.setCustomProperty("tableCaption",!0,s),s.placeholder=n("Enter table caption"),Yn({view:i,element:s,keepOnFocus:!0}),Jh(s,t)}}),(s=e.model).document.registerPostFixer((e=>function(e,t){const i=t.document.differ.getChanges();let n=!1;for(const t of i){if("insert"!=t.type)continue;const i=t.position.parent;if(i.is("element","table")||"table"==t.name){const o="table"==t.name?t.position.nodeAfter:i,s=Array.from(o.getChildren()).filter((e=>e.is("element","caption"))),r=s.shift();if(!r)continue;for(const t of s)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),o,"end"),n=!0),n=!!s.length||n}}return n}(e,s)))}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?ea.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class hT extends ad{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,i=e.t;e.ui.componentFactory.add("toggleTableCaption",(n=>{const o=e.commands.get("toggleTableCaption"),s=new Bn(n);return s.set({icon:Qf,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(o,"value","isEnabled"),s.bind("label").to(o,"value",(e=>i(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),o.value){const i=function(e){const t=C_(e);return t?lT(t):null}(e.model.document.selection),n=e.editing.mapper.toViewElement(i);if(!n)return;t.scrollToTheSelection(),t.change((e=>{e.addClass("table__caption_highlighted",n)}))}e.editing.view.focus()})),s}))}}function mT(e){if(e.is("$text")||e.is("$textProxy"))return e.data;const t=e;let i="",n=null;for(const e of t.getChildren()){const t=mT(e);n&&n.is("element")&&(i+="\n"),i+=t,n=e}return i}const gT={"(":")","[":"]","{":"}"};class fT extends cd{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,i=t.document.selection,n="string"==typeof e.mention?{id:e.mention}:e.mention,o=n.id,s=e.range||i.getFirstRange();if(!t.canEditAt(s))return;const r=e.text||o,a=bT({_text:r,id:o},n);if(!o.startsWith(e.marker))throw new x("mentioncommand-incorrect-id",this);t.change((e=>{const n=si(i.getAttributes()),o=new Map(n.entries());o.set("mention",a);const l=t.insertContent(e.createText(r,o),s),c=l.start.nodeBefore,u=l.end.nodeAfter,d=u&&u.is("$text")&&u.data.startsWith(" ");let h=!1;if(c&&u&&c.is("$text")&&u.is("$text")){const e=c.data.slice(-1),t=e in gT,i=t&&u.data.startsWith(gT[e]);h=t&&i}h||d||t.insertContent(e.createText(" ",n),s.start.getShiftedBy(r.length))}))}}class pT extends ad{static get pluginName(){return"MentionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,i=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",attributes:"data-mention",classes:"mention"},model:{key:"mention",value:e=>wT(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:yT}),e.conversion.for("downcast").add(vT),i.registerPostFixer((e=>function(e,t,i){const n=t.differ.getChanges();let o=!1;for(const t of n){if("attribute"==t.type)continue;const n=t.position;if("$text"==t.name){const t=n.textNode&&n.textNode.nextSibling;o=kT(n.textNode,e)||o,o=kT(t,e)||o,o=kT(n.nodeBefore,e)||o,o=kT(n.nodeAfter,e)||o}if("$text"!=t.name&&"insert"==t.type){const t=n.nodeAfter;for(const i of e.createRangeIn(t).getItems())o=kT(i,e)||o}if("insert"==t.type&&i.isInline(t.name)){const t=n.nodeAfter&&n.nodeAfter.nextSibling;o=kT(n.nodeBefore,e)||o,o=kT(t,e)||o}}return o}(e,i,t.schema))),i.registerPostFixer((e=>function(e,t){const i=t.differ.getChanges();let n=!1;for(const t of i)if("attribute"===t.type&&"mention"!=t.attributeKey){const i=t.range.start.nodeBefore,o=t.range.end.nodeAfter;for(const s of[i,o])_T(s)&&s.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,s),n=!0)}return n}(e,i))),i.registerPostFixer((e=>function(e,t){const i=t.selection,n=i.focus;return!!(i.isCollapsed&&i.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(n))&&(e.removeSelectionAttribute("mention"),!0)}(e,i))),e.commands.add("mention",new fT(e))}}function bT(e,t){return Object.assign({uid:_()},e,t||{})}function wT(e,t){const i=e.getAttribute("data-mention"),n=e.getChild(0);if(n)return bT({id:i,_text:n.data},t)}function vT(e){e.on("attribute:mention",((e,t,i)=>{const n=t.attributeNewValue;if(!t.item.is("$textProxy")||!n)return;const o=t.range.start;(o.textNode||o.nodeAfter).data!=n._text&&i.consumable.consume(t.item,e.name)}),{priority:"highest"})}function yT(e,{writer:t}){if(!e)return;const i={class:"mention","data-mention":e.id},n={id:e.uid,priority:20};return t.createAttributeElement("span",i,n)}function _T(e){return!(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))&&e.data!=e.getAttribute("mention")._text}function kT(e,t){return!!_T(e)&&(t.removeAttribute("mention",e),!0)}class CT extends Cu{selected;position;constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e{i?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))})),this.listenTo(this.domElement,"click",(()=>{this.fire("execute")}))}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}}class AT extends dn{item;marker;highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const TT=[Rt.arrowup,Rt.arrowdown,Rt.esc],ET=[Rt.enter,Rt.tab];class ST extends ad{_mentionsView;_mentionsConfigurations;_balloon;_items=new Xt;_lastRequested;_requestFeedDebounced;static get pluginName(){return"MentionUI"}static get isOfficialPlugin(){return!0}static get requires(){return[hm]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=Wi(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||ET,i=TT.concat(t);this._balloon=e.plugins.get(hm),e.editing.view.document.on("keydown",((e,n)=>{var o;o=n.keyCode,i.includes(o)&&this._isUIVisible&&(n.preventDefault(),e.stop(),n.keyCode==Rt.arrowdown&&this._mentionsView.selectNext(),n.keyCode==Rt.arrowup&&this._mentionsView.selectPrevious(),t.includes(n.keyCode)&&this._mentionsView.executeSelected(),n.keyCode==Rt.esc&&this._hideUIAndRemoveMarker())}),{priority:"highest"}),mn({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const n=e.config.get("mention.feeds");for(const e of n){const{feed:t,marker:i,dropdownLimit:n}=e;if(!RT(i))throw new x("mentionconfig-incorrect-marker",null,{marker:i});const o={marker:i,feedCallback:"function"==typeof t?t.bind(this.editor):OT(t),itemRenderer:e.itemRenderer,dropdownLimit:n};this._mentionsConfigurations.set(i,o)}this._setupTextWatcher(n),this.listenTo(e,"change:isReadOnly",(()=>{this._hideUIAndRemoveMarker()})),this.on("requestFeed:response",((e,t)=>this._handleFeedResponse(t))),this.on("requestFeed:error",(()=>this._hideUIAndRemoveMarker()))}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new CT(e);return t.items.bindTo(this._items).using((i=>{const{item:n,marker:o}=i,{dropdownLimit:s}=this._mentionsConfigurations.get(o),r=s||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=r)return null;const a=new AT(e),l=this._renderItem(n,o);return l.delegate("execute").to(a),a.children.add(l),a.item=n,a.marker=o,a.on("execute",(()=>{t.fire("execute",{item:n,marker:o})})),a})),t.on("execute",((e,t)=>{const i=this.editor,n=i.model,o=t.item,s=t.marker,r=i.model.markers.get("mention"),a=n.createPositionAt(n.document.selection.focus),l=n.createPositionAt(r.getStart()),c=n.createRange(l,a);this._hideUIAndRemoveMarker(),i.execute("mention",{mention:o,text:o.text,marker:s,range:c}),i.editing.view.focus()})),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:i}=this._mentionsConfigurations.get(e),n=i(t);n instanceof Promise?n.then((i=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:i,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:i,marker:e,feedText:t})})).catch((t=>{this.fire("requestFeed:error",{error:t}),A("mention-feed-callback-error",{marker:e})})):this.fire("requestFeed:response",{feed:n,marker:e,feedText:t})}_setupTextWatcher(e){const t=this.editor,i=e.map((e=>({...e,pattern:VT(e.marker,e.minimumCharacters||0)}))),n=new bh(t.model,function(e){return t=>{const i=IT(e,t);if(!i)return!1;let n=0;0!==i.position&&(n=i.position-1);const o=t.substring(n);return i.pattern.test(o)}}(i));n.on("matched",((e,n)=>{const o=IT(i,n.text),s=t.model.document.selection.focus,r=t.model.createPositionAt(s.parent,o.position);if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),i=e.nodeBefore;return t||i&&i.is("$text")&&i.hasAttribute("mention")}(s)||function(e){const t=e.nodeAfter;return t&&t.is("$text")&&t.hasAttribute("mention")}(r))return void this._hideUIAndRemoveMarker();const a=function(e,t){let i=0;0!==e.position&&(i=e.position-1);const n=VT(e.marker,0);return t.substring(i).match(n)[2]}(o,n.text),l=o.marker.length+a.length,c=s.getShiftedBy(-l),u=s.getShiftedBy(-a.length),d=t.model.createRange(c,u);if(LT(t)){const e=t.model.markers.get("mention");t.model.change((t=>{t.updateMarker(e,{range:d})}))}else t.model.change((e=>{e.addMarker("mention",{range:d,usingOperation:!1,affectsData:!1})}));this._requestFeedDebounced(o.marker,a)})),n.on("unmatched",(()=>{this._hideUIAndRemoveMarker()}));const o=t.commands.get("mention");return n.bind("isEnabled").to(o),n}_handleFeedResponse(e){const{feed:t,marker:i}=e;if(!LT(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:i})}const n=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(n):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0,balloonClassName:"ck-mention-balloon"}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),LT(this.editor)&&this.editor.model.change((e=>e.removeMarker("mention"))),this._mentionsView.position=void 0}_renderItem(e,t){const i=this.editor;let n,o=e.id;const s=this._getItemRenderer(t);if(s){const t=s(e);"string"!=typeof t?n=new xT(i.locale,t):o=t}if(!n){const e=new Bn(i.locale);e.label=o,e.withText=!0,n=e}return n}_getBalloonPanelPositionData(e,t){const i=this.editor,n=i.editing,o=n.view.domConverter,s=n.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const n=s.toViewRange(t);return Ze.getDomRangeRects(o.viewRangeToDom(n)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:PT(t,i.locale.uiLanguageDirection)}}}function PT(e,t){const i={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(i,e)?[i[e]]:"rtl"!==t?[i.caret_se,i.caret_sw,i.caret_ne,i.caret_nw]:[i.caret_sw,i.caret_se,i.caret_nw,i.caret_ne]}function IT(e,t){let i;for(const n of e){const e=t.lastIndexOf(n.marker);e>0&&!t.substring(e-1).match(n.pattern)||(!i||e>=i.position)&&(i={marker:n.marker,position:e,minimumCharacters:n.minimumCharacters,pattern:n.pattern})}return i}function VT(e,t){const i=0==t?"*":`{${t},}`,n=r.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return e=e.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&"),new RegExp(`(?:^|[ ${n}])(${e})(.${i})$`,"u")}function OT(e){return t=>e.filter((e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())))}function RT(e){return!!e}function LT(e){return e.model.markers.has("mention")}function BT(e){if(e)throw e}var MT=i(849);function NT(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function FT(e){return e&&"object"==typeof e?"position"in e||"type"in e?zT(e.position):"start"in e||"end"in e?zT(e):"line"in e||"column"in e?DT(e):"":""}function DT(e){return HT(e&&e.line)+":"+HT(e&&e.column)}function zT(e){return DT(e&&e.start)+"-"+DT(e&&e.end)}function HT(e){return e&&"number"==typeof e?e:1}class UT extends Error{constructor(e,t,i){super(),"string"==typeof t&&(i=t,t=void 0);let n="",o={},s=!1;if(t&&(o="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!o.cause&&e&&(s=!0,n=e.message,o.cause=e),!o.ruleId&&!o.source&&"string"==typeof i){const e=i.indexOf(":");-1===e?o.ruleId=i:(o.source=i.slice(0,e),o.ruleId=i.slice(e+1))}if(!o.place&&o.ancestors&&o.ancestors){const e=o.ancestors[o.ancestors.length-1];e&&(o.place=e.position)}const r=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=r?r.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=r?r.line:void 0,this.name=FT(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&"string"==typeof o.cause.stack?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}UT.prototype.file="",UT.prototype.name="",UT.prototype.reason="",UT.prototype.message="",UT.prototype.stack="",UT.prototype.column=void 0,UT.prototype.line=void 0,UT.prototype.ancestors=void 0,UT.prototype.cause=void 0,UT.prototype.fatal=void 0,UT.prototype.place=void 0,UT.prototype.ruleId=void 0,UT.prototype.source=void 0;const $T=function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');KT(e);let i,n=0,o=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1);return o<0?"":e.slice(n,o)}if(t===e)return"";let r=-1,a=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(o=s):(a=-1,o=r));return n===o?o=r:o<0&&(o=e.length),e.slice(n,o)},qT=function(e){if(KT(e),0===e.length)return".";let t,i=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){i=n;break}}else t||(t=!0);return i<0?47===e.codePointAt(0)?"/":".":1===i&&47===e.codePointAt(0)?"//":e.slice(0,i)},jT=function(e){KT(e);let t,i=e.length,n=-1,o=0,s=-1,r=0;for(;i--;){const a=e.codePointAt(i);if(47!==a)n<0&&(t=!0,n=i+1),46===a?s<0?s=i:1!==r&&(r=1):s>-1&&(r=-1);else if(t){o=i+1;break}}return s<0||n<0||0===r||1===r&&s===n-1&&s===o+1?"":e.slice(s,n)},WT=function(...e){let t,i=-1;for(;++i2){if(n=o.lastIndexOf("/"),n!==o.length-1){n<0?(o="",s=0):(o=o.slice(0,n),s=o.length-1-o.lastIndexOf("/")),r=l,a=0;continue}}else if(o.length>0){o="",s=0,r=l,a=0;continue}t&&(o=o.length>0?o+"/..":"..",s=2)}else o.length>0?o+="/"+e.slice(r+1,l):o=e.slice(r+1,l),s=l-r-1;r=l,a=0}else 46===i&&a>-1?a++:a=-1}return o}(e,!t);return 0!==i.length||t||(i="."),i.length>0&&47===e.codePointAt(e.length-1)&&(i+="/"),t?"/"+i:i}(t)},GT="/";function KT(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const JT=function(){return"/"};function YT(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}const QT=["history","path","basename","stem","extname","dirname"];class XT{constructor(e){let t;t=e?YT(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":JT(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i,n=-1;for(;++nt.length;let r;s&&t.push(n);try{r=e.apply(this,t)}catch(e){if(s&&i)throw e;return n(e)}s||(r&&r.then&&"function"==typeof r.then?r.then(o,n):r instanceof Error?n(r):o(r))};function n(e,...n){i||(i=!0,t(e,...n))}function o(e){n(null,e)}}(a,o)(...r):n(null,...r)}}(null,...t)},use:function(i){if("function"!=typeof i)throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}};return t}()}copy(){const e=new oE;let t=-1;for(;++t0){let[n,...s]=t;const r=i[o][1];NT(r)&&NT(n)&&(n=MT(!0,r,n)),i[o]=[e,n,...s]}}}}const sE=(new oE).freeze();function rE(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function aE(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function lE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cE(e){if(!NT(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function uE(e,t,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function dE(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new XT(e)}function hE(e,t){const i=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let n=0,o=i.indexOf(t);for(;-1!==o;)n++,o=i.indexOf(t,o+t.length);return n}const mE=AE(/[A-Za-z]/),gE=AE(/[\dA-Za-z]/),fE=AE(/[#-'*+\--9=?A-Z^-~]/);function pE(e){return null!==e&&(e<32||127===e)}const bE=AE(/\d/),wE=AE(/[\dA-Fa-f]/),vE=AE(/[!-/:-@[-`{-~]/);function yE(e){return null!==e&&e<-2}function _E(e){return null!==e&&(e<0||32===e)}function kE(e){return-2===e||-1===e||32===e}const CE=AE(/\p{P}|\p{S}/u),xE=AE(/\s/);function AE(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const TE=function(e){if(null==e)return SE;if("function"==typeof e)return EE(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let i=-1;for(;++i":"")+")"})}return u;function u(){let c,u,d,h=PE;if((!t||s(o,a,l[l.length-1]||void 0))&&(h=function(e){return Array.isArray(e)?e:"number"==typeof e?[true,e]:null==e?PE:[e]}(i(o,l)),h[0]===IE))return h;if("children"in o&&o.children){const t=o;if(t.children&&h[0]!==VE)for(u=(n?t.children.length:-1)+r,d=l.concat(t);u>-1&&u0?{type:"text",value:s}:void 0),!1===s?n.lastIndex=i+1:(a!==i&&u.push({type:"text",value:e.value.slice(a,i)}),Array.isArray(s)?u.push(...s):s&&u.push(s),a=i+d[0].length,c=!0),!n.global)break;d=n.exec(e.value)}return c?(a?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let i=t[0],n=i.indexOf(")");const o=hE(e,"(");let s=hE(e,")");for(;-1!==n&&o>s;)e+=i.slice(0,n+1),i=i.slice(n+1),n=i.indexOf(")"),s++;return[e,i]}(i+n);if(!r[0])return!1;const a={type:"link",title:null,url:s+t+r[0],children:[{type:"text",value:t+r[0]}]};return r[1]?[a,{type:"text",value:r[1]}]:a}function WE(e,t,i,n){return!(!GE(n,!0)||/[-\d_]$/.test(i))&&{type:"link",title:null,url:"mailto:"+t+"@"+i,children:[{type:"text",value:t+"@"+i}]}}function GE(e,t){const i=e.input.charCodeAt(e.index-1);return(0===e.index||xE(i)||CE(i))&&(!t||47!==i)}function KE(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function JE(){this.buffer()}function YE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function QE(){this.buffer()}function XE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ZE(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=KE(this.sliceSerialize(e)).toLowerCase(),i.label=t}function eS(e){this.exit(e)}function tS(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=KE(this.sliceSerialize(e)).toLowerCase(),i.label=t}function iS(e){this.exit(e)}function nS(e,t,i,n){const o=i.createTracker(n);let s=o.move("[^");const r=i.enter("footnoteReference"),a=i.enter("reference");return s+=o.move(i.safe(i.associationId(e),{after:"]",before:s})),a(),r(),s+=o.move("]"),s}function oS(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,i,n,o){const s=n.createTracker(o);let r=s.move("[^");const a=n.enter("footnoteDefinition"),l=n.enter("label");return r+=s.move(n.safe(n.associationId(e),{before:r,after:"]"})),l(),r+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),r+=s.move((t?"\n":" ")+n.indentLines(n.containerFlow(e,s.current()),t?rS:sS))),a(),r},footnoteReference:nS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function sS(e,t,i){return 0===t?e:rS(e,0,i)}function rS(e,t,i){return(i?"":" ")+e}nS.peek=function(){return"["};const aS=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function lS(e){this.enter({type:"delete",children:[]},e)}function cS(e){this.exit(e)}function uS(e,t,i,n){const o=i.createTracker(n),s=i.enter("strikethrough");let r=o.move("~~");return r+=i.containerPhrasing(e,{...o.current(),before:r,after:"~"}),r+=o.move("~~"),s(),r}function dS(e){return e.length}function hS(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function mS(e,t,i){return">"+(i?"":" ")+e}function gS(e,t){return fS(e,t.inConstruct,!0)&&!fS(e,t.notInConstruct,!1)}function fS(e,t,i){if("string"==typeof t&&(t=[t]),!t||0===t.length)return i;let n=-1;for(;++n",...l.current()})),c+=l.move(">")):(a=i.enter("destinationRaw"),c+=l.move(i.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=i.enter(`title${s}`),c+=l.move(" "+o),c+=l.move(i.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),c+=l.move(")"),r(),c}function OS(e,t,i,n){const o=e.referenceType,s=i.enter("imageReference");let r=i.enter("label");const a=i.createTracker(n);let l=a.move("![");const c=i.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),r();const u=i.stack;i.stack=[],r=i.enter("reference");const d=i.safe(i.associationId(e),{before:l,after:"]",...a.current()});return r(),i.stack=u,s(),"full"!==o&&c&&c===d?"shortcut"===o?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function RS(e,t,i){let n=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(n);)o+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s\u007F]/.test(e.url))}function BS(e,t,i,n){const o=vS(i),s='"'===o?"Quote":"Apostrophe",r=i.createTracker(n);let a,l;if(LS(e,i)){const t=i.stack;i.stack=[],a=i.enter("autolink");let n=r.move("<");return n+=r.move(i.containerPhrasing(e,{before:n,after:">",...r.current()})),n+=r.move(">"),a(),i.stack=t,n}a=i.enter("link"),l=i.enter("label");let c=r.move("[");return c+=r.move(i.containerPhrasing(e,{before:c,after:"](",...r.current()})),c+=r.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),c+=r.move("<"),c+=r.move(i.safe(e.url,{before:c,after:">",...r.current()})),c+=r.move(">")):(l=i.enter("destinationRaw"),c+=r.move(i.safe(e.url,{before:c,after:e.title?" ":")",...r.current()}))),l(),e.title&&(l=i.enter(`title${s}`),c+=r.move(" "+o),c+=r.move(i.safe(e.title,{before:c,after:o,...r.current()})),c+=r.move(o),l()),c+=r.move(")"),a(),c}function MS(e,t,i,n){const o=e.referenceType,s=i.enter("linkReference");let r=i.enter("label");const a=i.createTracker(n);let l=a.move("[");const c=i.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),r();const u=i.stack;i.stack=[],r=i.enter("reference");const d=i.safe(i.associationId(e),{before:l,after:"]",...a.current()});return r(),i.stack=u,s(),"full"!==o&&c&&c===d?"shortcut"===o?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function NS(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function FS(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}IS.peek=function(){return"<"},VS.peek=function(){return"!"},OS.peek=function(){return"!"},RS.peek=function(){return"`"},BS.peek=function(e,t,i){return LS(e,i)?"<":"["},MS.peek=function(){return"["};const DS=TE(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function zS(e,t,i,n){const o=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(i),s=i.enter("strong"),r=i.createTracker(n),a=r.move(o+o);let l=r.move(i.containerPhrasing(e,{after:o,before:a,...r.current()}));const c=l.charCodeAt(0),u=kS(n.before.charCodeAt(n.before.length-1),c,o);u.inside&&(l=yS(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=kS(n.after.charCodeAt(0),d,o);h.inside&&(l=l.slice(0,-1)+yS(d));const m=r.move(o+o);return s(),i.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+m}zS.peek=function(e,t,i){return i.options.strong||"*"};const HS={blockquote:function(e,t,i,n){const o=i.enter("blockquote"),s=i.createTracker(n);s.move("> "),s.shift(2);const r=i.indentLines(i.containerFlow(e,s.current()),mS);return o(),r},break:pS,code:function(e,t,i,n){const o=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(i),s=e.value||"",r="`"===o?"GraveAccent":"Tilde";if(bS(e,i)){const e=i.enter("codeIndented"),t=i.indentLines(s,wS);return e(),t}const a=i.createTracker(n),l=o.repeat(Math.max(function(e,t){const i=String(e);let n=i.indexOf(t),o=n,s=0,r=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==n;)n===o?++s>r&&(r=s):s=1,o=n+t.length,n=i.indexOf(t,o);return r}(s,o)+1,3)),c=i.enter("codeFenced");let u=a.move(l);if(e.lang){const t=i.enter(`codeFencedLang${r}`);u+=a.move(i.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=i.enter(`codeFencedMeta${r}`);u+=a.move(" "),u+=a.move(i.safe(e.meta,{before:u,after:"\n",encode:["`"],...a.current()})),t()}return u+=a.move("\n"),s&&(u+=a.move(s+"\n")),u+=a.move(l),c(),u},definition:function(e,t,i,n){const o=vS(i),s='"'===o?"Quote":"Apostrophe",r=i.enter("definition");let a=i.enter("label");const l=i.createTracker(n);let c=l.move("[");return c+=l.move(i.safe(i.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=i.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(i.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=i.enter("destinationRaw"),c+=l.move(i.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=i.enter(`title${s}`),c+=l.move(" "+o),c+=l.move(i.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),r(),c},emphasis:CS,hardBreak:pS,heading:function(e,t,i,n){const o=Math.max(Math.min(6,e.depth||1),1),s=i.createTracker(n);if(PS(e,i)){const t=i.enter("headingSetext"),n=i.enter("phrasing"),r=i.containerPhrasing(e,{...s.current(),before:"\n",after:"\n"});return n(),t(),r+"\n"+(1===o?"=":"-").repeat(r.length-(Math.max(r.lastIndexOf("\r"),r.lastIndexOf("\n"))+1))}const r="#".repeat(o),a=i.enter("headingAtx"),l=i.enter("phrasing");s.move(r+" ");let c=i.containerPhrasing(e,{before:"# ",after:"\n",...s.current()});return/^[\t ]/.test(c)&&(c=yS(c.charCodeAt(0))+c.slice(1)),c=c?r+" "+c:r,i.options.closeAtx&&(c+=" "+r),l(),a(),c},html:IS,image:VS,imageReference:OS,inlineCode:RS,link:BS,linkReference:MS,list:function(e,t,i,n){const o=i.enter("list"),s=i.bulletCurrent;let r=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(i):NS(i);const a=e.ordered?"."===r?")":".":function(e){const t=NS(e),i=e.options.bulletOther;if(!i)return"*"===t?"-":"*";if("*"!==i&&"+"!==i&&"-"!==i)throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+i+"`) to be different");return i}(i);let l=!(!t||!i.bulletLastUsed)&&r===i.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==r&&"-"!==r||!t||t.children&&t.children[0]||"list"!==i.stack[i.stack.length-1]||"listItem"!==i.stack[i.stack.length-2]||"list"!==i.stack[i.stack.length-3]||"listItem"!==i.stack[i.stack.length-4]||0!==i.indexStack[i.indexStack.length-1]||0!==i.indexStack[i.indexStack.length-2]||0!==i.indexStack[i.indexStack.length-3]||(l=!0),FS(i)===r&&t){let t=-1;for(;++t-1?t.start:1)+(!1===i.options.incrementListMarker?0:t.children.indexOf(e))+s);let r=s.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(r=4*Math.ceil(r/4));const a=i.createTracker(n);a.move(s+" ".repeat(r-s.length)),a.shift(r);const l=i.enter("listItem"),c=i.indentLines(i.containerFlow(e,a.current()),(function(e,t,i){return t?(i?"":" ".repeat(r))+e:(i?s:s+" ".repeat(r-s.length))+e}));return l(),c},paragraph:function(e,t,i,n){const o=i.enter("paragraph"),s=i.enter("phrasing"),r=i.containerPhrasing(e,n);return s(),o(),r},root:function(e,t,i,n){return(e.children.some((function(e){return DS(e)}))?i.containerPhrasing:i.containerFlow).call(i,e,n)},strong:zS,text:function(e,t,i,n){return i.safe(e.value,n)},thematicBreak:function(e,t,i){const n=(FS(i)+(i.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(i));return i.options.ruleSpaces?n.slice(0,-1):n}};function US(e){const t=e._align;this.enter({type:"table",align:t.map((function(e){return"none"===e?null:e})),children:[]},e),this.data.inTable=!0}function $S(e){this.exit(e),this.data.inTable=void 0}function qS(e){this.enter({type:"tableRow",children:[]},e)}function jS(e){this.exit(e)}function WS(e){this.enter({type:"tableCell",children:[]},e)}function GS(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KS));const i=this.stack[this.stack.length-1];i.type,i.value=t,this.exit(e)}function KS(e,t){return"|"===t?t:e}function JS(e){const t=e||{},i=t.tableCellPadding,n=t.tablePipeAlign,o=t.stringLength,s=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,i){let n=HS.inlineCode(e,t,i);return i.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,i,n){return a(function(e,t,i){const n=e.children;let o=-1;const s=[],r=t.enter("table");for(;++oc&&(c=e[u].length);++sl[s])&&(l[s]=e)}t.push(r)}r[u]=t,a[u]=n}var d;let h=-1;if("object"==typeof n&&"length"in n)for(;++hl[h]&&(l[h]=o),g[h]=o),m[h]=r}r.splice(1,0,m),a.splice(1,0,g),u=-1;const f=[];for(;++uo?0:o+t:t>o?o:t,i=i>0?i:0,n.length<1e4)s=Array.from(n),s.unshift(t,i),e.splice(...s);else for(i&&e.splice(t,i);r0?(ZS(e,e.length,0,t),e):t}const tP={}.hasOwnProperty;function iP(e){const t={};let i=-1;for(;++i0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}function yP(e,t,i,n){const o=n?n-1:Number.POSITIVE_INFINITY;let s=0;return function(n){return kE(n)?(e.enter(i),r(n)):t(n)};function r(n){return kE(n)&&s++999||93===a&&!s||null===a||91===a||_E(a))return i(a);if(93===a){e.exit("chunkString");const s=e.exit("gfmFootnoteCallString");return o.includes(KE(n.sliceSerialize(s)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):i(a)}return _E(a)||(s=!0),r++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),r++,l):l(t)}}function TP(e,t,i){const n=this,o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,r,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):i(t)}function c(t){if(a>999||93===t&&!r||null===t||91===t||_E(t))return i(t);if(93===t){e.exit("chunkString");const i=e.exit("gfmFootnoteDefinitionLabelString");return s=KE(n.sliceSerialize(i)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return _E(t)||(r=!0),a++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(s)||o.push(s),yP(e,h,"gfmFootnoteDefinitionWhitespace")):i(t)}function h(e){return t(e)}}function EP(e,t,i){return e.check(_P,t,e.attempt(kP,t,i))}function SP(e){e.exit("gfmFootnoteDefinition")}function PP(e,t,i){const n=[];let o=-1;for(;++o1?n(s):(e.consume(s),r++,a);if(r<2&&!t)return n(s);const c=e.exit("strikethroughSequenceTemporary"),u=_S(s);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),i(s)}},resolveAll:function(e,t){let i=-1;for(;++i0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let n=i.pop();for(;n;){for(const t of n)e.push(t);n=i.pop()}this.map.length=0}}function OP(e,t){let i=!1;const n=[];for(;t-1;){const e=n.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const o=t>-1?n.events[t][1].type:null,s="tableHead"===o||"tableRow"===o?y:a;return s===y&&n.parser.lazy[n.now().line]?i(e):s(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(o=!0,r+=1),l(e)}(t)}function l(t){return null===t?i(t):yE(t)?r>1?(r=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):i(t):kE(t)?yP(e,l,"whitespace")(t):(r+=1,o&&(o=!1,s+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),o=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||_E(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return n.interrupt=!1,n.parser.lazy[n.now().line]?i(t):(e.enter("tableDelimiterRow"),o=!1,kE(t)?yP(e,h,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t))}function h(t){return 45===t||58===t?g(t):124===t?(o=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),m):v(t)}function m(t){return kE(t)?yP(e,g,"whitespace")(t):g(t)}function g(t){return 58===t?(r+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),f):45===t?(r+=1,f(t)):null===t||yE(t)?w(t):v(t)}function f(t){return 45===t?(e.enter("tableDelimiterFiller"),p(t)):v(t)}function p(t){return 45===t?(e.consume(t),p):58===t?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(t))}function b(t){return kE(t)?yP(e,w,"whitespace")(t):w(t)}function w(i){return 124===i?h(i):(null===i||yE(i))&&o&&s===r?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):v(i)}function v(e){return i(e)}function y(t){return e.enter("tableRow"),_(t)}function _(i){return 124===i?(e.enter("tableCellDivider"),e.consume(i),e.exit("tableCellDivider"),_):null===i||yE(i)?(e.exit("tableRow"),t(i)):kE(i)?yP(e,_,"whitespace")(i):(e.enter("data"),k(i))}function k(t){return null===t||124===t||_E(t)?(e.exit("data"),_(t)):(e.consume(t),92===t?C:k)}function C(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function LP(e,t){let i,n,o,s=-1,r=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const h=new VP;for(;++si[2]+1){const t=i[2]+1,n=i[3]-i[2]-1;e.add(t,n,[])}}e.add(i[3]+1,0,[["exit",r,t]])}return void 0!==o&&(s.end=Object.assign({},NP(t.events,o)),e.add(o,0,[["exit",s,t]]),s=void 0),s}function MP(e,t,i,n,o){const s=[],r=NP(t.events,i);o&&(o.end=Object.assign({},r),s.push(["exit",o,t])),n.end=Object.assign({},r),s.push(["exit",n,t]),e.add(i+1,0,s)}function NP(e,t){const i=e[t],n="enter"===i[0]?"start":"end";return i[1][n]}const FP={name:"tasklistCheck",tokenize:function(e,t,i){const n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),o):i(t)};function o(t){return _E(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),s):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),s):i(t)}function s(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),r):i(t)}function r(n){return yE(n)?t(n):kE(n)?e.check({tokenize:DP},t,i)(n):i(n)}}};function DP(e,t,i){return yP(e,(function(e){return null===e?i(e):t(e)}),"whitespace")}const zP={};function HP(e){const t=e||zP,i=this.data(),n=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),s=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);n.push(function(e){return iP([{text:mP},{document:{91:{name:"gfmFootnoteDefinition",tokenize:TP,continuation:{tokenize:EP},exit:SP}},text:{91:{name:"gfmFootnoteCall",tokenize:AP},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:CP,resolveTo:xP}}},IP(e),{flow:{null:{name:"table",tokenize:RP,resolveAll:LP}}},{text:{91:FP}}])}(t)),o.push([{transforms:[qE],enter:{literalAutolink:FE,literalAutolinkEmail:DE,literalAutolinkHttp:DE,literalAutolinkWww:DE},exit:{literalAutolink:$E,literalAutolinkEmail:UE,literalAutolinkHttp:zE,literalAutolinkWww:HE}},{enter:{gfmFootnoteCallString:JE,gfmFootnoteCall:YE,gfmFootnoteDefinitionLabelString:QE,gfmFootnoteDefinition:XE},exit:{gfmFootnoteCallString:ZE,gfmFootnoteCall:eS,gfmFootnoteDefinitionLabelString:tS,gfmFootnoteDefinition:iS}},{canContainEols:["delete"],enter:{strikethrough:lS},exit:{strikethrough:cS}},{enter:{table:US,tableData:WS,tableHeader:WS,tableRow:qS},exit:{codeText:GS,table:$S,tableData:jS,tableHeader:jS,tableRow:jS}},{exit:{taskListCheckValueChecked:YS,taskListCheckValueUnchecked:YS,paragraph:QS}}]),s.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ME,notInConstruct:NE},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ME,notInConstruct:NE},{character:":",before:"[ps]",after:"\\/",inConstruct:ME,notInConstruct:NE}]},oS(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:aS}],handlers:{delete:uS}},JS(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:XS}}]}}(t))}class UP{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){const n=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return i&&$P(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),$P(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$P(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(es))return;const i=t.events.length;let o,a,l=i;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(o){a=t.events[l][1].end;break}o=!0}for(b(r),e=i;en;){const n=i[o];t.containerState=n[1],n[0].exit.call(t,e)}i.length=n}function w(){n.write([null]),o=void 0,n=void 0,t.containerState._closeFlow=void 0}}},KP={tokenize:function(e,t,i){return yP(e,e.attempt(this.parser.constructs.document,t,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},JP={resolve:function(e){return qP(e),e},tokenize:function(e,t){let i;return function(t){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?o(t):yE(t)?e.check(YP,s,o)(t):(e.consume(t),n)}function o(i){return e.exit("chunkContent"),e.exit("content"),t(i)}function s(t){return e.consume(t),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,n}}},YP={partial:!0,tokenize:function(e,t,i){const n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yP(e,o,"linePrefix")};function o(o){if(null===o||yE(o))return i(o);const s=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,i,t)(o)}}},QP={tokenize:function(e){const t=this,i=e.attempt(_P,(function(n){if(null!==n)return e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,i;e.consume(n)}),e.attempt(this.parser.constructs.flowInitial,n,yP(e,e.attempt(this.parser.constructs.flow,n,e.attempt(JP,n)),"linePrefix")));return i;function n(n){if(null!==n)return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,i;e.consume(n)}}},XP={resolveAll:iI()},ZP=tI("string"),eI=tI("text");function tI(e){return{resolveAll:iI("text"===e?nI:void 0),tokenize:function(t){const i=this,n=this.parser.constructs[e],o=t.attempt(n,s,r);return s;function s(e){return l(e)?o(e):r(e)}function r(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return l(e)?(t.exit("data"),o(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;const t=n[e];let o=-1;if(t)for(;++o=3&&(null===s||yE(s))?(e.exit("thematicBreak"),t(s)):i(s)}function r(t){return t===n?(e.consume(t),o++,r):(e.exit("thematicBreakSequence"),kE(t)?yP(e,s,"whitespace")(t):s(t))}}},sI={continuation:{tokenize:function(e,t,i){const n=this;return n.containerState._closeFlow=void 0,e.check(_P,(function(i){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,yP(e,t,"listItemIndent",n.containerState.size+1)(i)}),(function(i){return n.containerState.furtherBlankLines||!kE(i)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(i)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(aI,t,o)(i))}));function o(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,yP(e,e.attempt(sI,t,i),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,i){const n=this,o=n.events[n.events.length-1];let s=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,r=0;return function(t){const o=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!n.containerState.marker||t===n.containerState.marker:bE(t)){if(n.containerState.type||(n.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(oI,i,l)(t):l(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return i(t)};function a(t){return bE(t)&&++r<10?(e.consume(t),a):(!n.interrupt||r<2)&&(n.containerState.marker?t===n.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):i(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(_P,n.interrupt?i:c,e.attempt(rI,d,u))}function c(e){return n.containerState.initialBlankLine=!0,s++,d(e)}function u(t){return kE(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):i(t)}function d(i){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(i)}}},rI={partial:!0,tokenize:function(e,t,i){const n=this;return yP(e,(function(e){const o=n.events[n.events.length-1];return!kE(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):i(e)}),"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},aI={partial:!0,tokenize:function(e,t,i){const n=this;return yP(e,(function(e){const o=n.events[n.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(e):i(e)}),"listItemIndent",n.containerState.size+1)}},lI={continuation:{tokenize:function(e,t,i){const n=this;return function(t){return kE(t)?yP(e,o,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):o(t)};function o(n){return e.attempt(lI,t,i)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,i){const n=this;return function(t){if(62===t){const i=n.containerState;return i.open||(e.enter("blockQuote",{_container:!0}),i.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return i(t)};function o(i){return kE(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}};function cI(e,t,i,n,o,s,r,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){return 60===t?(e.enter(n),e.enter(o),e.enter(s),e.consume(t),e.exit(s),d):null===t||32===t||41===t||pE(t)?i(t):(e.enter(n),e.enter(r),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(t))};function d(i){return 62===i?(e.enter(s),e.consume(i),e.exit(s),e.exit(o),e.exit(n),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(i))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||yE(t)?i(t):(e.consume(t),92===t?m:h)}function m(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function g(o){return u||null!==o&&41!==o&&!_E(o)?u999||null===d||91===d||93===d&&!a||94===d&&!l&&"_hiddenFootnoteSupport"in r.parser.constructs?i(d):93===d?(e.exit(s),e.enter(o),e.consume(d),e.exit(o),e.exit(n),t):yE(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||yE(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a||(a=!kE(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function dI(e,t,i,n,o,s){let r;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(o),e.consume(t),e.exit(o),r=40===t?41:t,a):i(t)};function a(i){return i===r?(e.enter(o),e.consume(i),e.exit(o),e.exit(n),t):(e.enter(s),l(i))}function l(t){return t===r?(e.exit(s),a(r)):null===t?i(t):yE(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yP(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===r||null===t||yE(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===r||92===t?(e.consume(t),c):c(t)}}function hI(e,t){let i;return function n(o){return yE(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,n):kE(o)?yP(e,n,i?"linePrefix":"lineSuffix")(o):t(o)}}const mI={name:"definition",tokenize:function(e,t,i){const n=this;let o;return function(t){return e.enter("definition"),function(t){return uI.call(n,e,s,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function s(t){return o=KE(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),r):i(t)}function r(t){return _E(t)?hI(e,a)(t):a(t)}function a(t){return cI(e,l,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(gI,c,c)(t)}function c(t){return kE(t)?yP(e,u,"whitespace")(t):u(t)}function u(s){return null===s||yE(s)?(e.exit("definition"),n.parser.defined.push(o),t(s)):i(s)}}},gI={partial:!0,tokenize:function(e,t,i){return function(t){return _E(t)?hI(e,n)(t):i(t)};function n(t){return dI(e,o,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return kE(t)?yP(e,s,"whitespace")(t):s(t)}function s(e){return null===e||yE(e)?t(e):i(e)}}},fI={name:"codeIndented",tokenize:function(e,t,i){const n=this;return function(t){return e.enter("codeIndented"),yP(e,o,"linePrefix",5)(t)};function o(e){const t=n.events[n.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?s(e):i(e)}function s(t){return null===t?a(t):yE(t)?e.attempt(pI,s,a)(t):(e.enter("codeFlowValue"),r(t))}function r(t){return null===t||yE(t)?(e.exit("codeFlowValue"),s(t)):(e.consume(t),r)}function a(i){return e.exit("codeIndented"),t(i)}}},pI={partial:!0,tokenize:function(e,t,i){const n=this;return o;function o(t){return n.parser.lazy[n.now().line]?i(t):yE(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):yP(e,s,"linePrefix",5)(t)}function s(e){const s=n.events[n.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):yE(e)?o(e):i(e)}}},bI={name:"headingAtx",resolve:function(e,t){let i,n,o=e.length-2,s=3;return"whitespace"===e[s][1].type&&(s+=2),o-2>s&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(s===o-1||o-4>s&&"whitespace"===e[o-2][1].type)&&(o-=s+1===o?2:4),o>s&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[o][1].end},n={type:"chunkText",start:e[s][1].start,end:e[o][1].end,contentType:"text"},ZS(e,s,o-s+1,[["enter",i,t],["enter",n,t],["exit",n,t],["exit",i,t]])),e},tokenize:function(e,t,i){let n=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),o(t)}(t)};function o(t){return 35===t&&n++<6?(e.consume(t),o):null===t||_E(t)?(e.exit("atxHeadingSequence"),s(t)):i(t)}function s(i){return 35===i?(e.enter("atxHeadingSequence"),r(i)):null===i||yE(i)?(e.exit("atxHeading"),t(i)):kE(i)?yP(e,s,"whitespace")(i):(e.enter("atxHeadingText"),a(i))}function r(t){return 35===t?(e.consume(t),r):(e.exit("atxHeadingSequence"),s(t))}function a(t){return null===t||35===t||_E(t)?(e.exit("atxHeadingText"),s(t)):(e.consume(t),a)}}},wI={name:"setextUnderline",resolveTo:function(e,t){let i,n,o,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){i=s;break}"paragraph"===e[s][1].type&&(n=s)}else"content"===e[s][1].type&&e.splice(s,1),o||"definition"!==e[s][1].type||(o=s);const r={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",o?(e.splice(n,0,["enter",r,t]),e.splice(o+1,0,["exit",e[i][1],t]),e[i][1].end={...e[o][1].end}):e[i][1]=r,e.push(["exit",r,t]),e},tokenize:function(e,t,i){const n=this;let o;return function(t){let r,a=n.events.length;for(;a--;)if("lineEnding"!==n.events[a][1].type&&"linePrefix"!==n.events[a][1].type&&"content"!==n.events[a][1].type){r="paragraph"===n.events[a][1].type;break}return n.parser.lazy[n.now().line]||!n.interrupt&&!r?i(t):(e.enter("setextHeadingLine"),o=t,function(t){return e.enter("setextHeadingLineSequence"),s(t)}(t))};function s(t){return t===o?(e.consume(t),s):(e.exit("setextHeadingLineSequence"),kE(t)?yP(e,r,"lineSuffix")(t):r(t))}function r(n){return null===n||yE(n)?(e.exit("setextHeadingLine"),t(n)):i(n)}}},vI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yI=["pre","script","style","textarea"],_I={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,i){const n=this;let o,s,r,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),u):47===a?(e.consume(a),s=!0,m):63===a?(e.consume(a),o=3,n.interrupt?t:L):mE(a)?(e.consume(a),r=String.fromCharCode(a),g):i(a)}function u(s){return 45===s?(e.consume(s),o=2,d):91===s?(e.consume(s),o=5,a=0,h):mE(s)?(e.consume(s),o=4,n.interrupt?t:L):i(s)}function d(o){return 45===o?(e.consume(o),n.interrupt?t:L):i(o)}function h(o){return o==="CDATA[".charCodeAt(a++)?(e.consume(o),6===a?n.interrupt?t:T:h):i(o)}function m(t){return mE(t)?(e.consume(t),r=String.fromCharCode(t),g):i(t)}function g(a){if(null===a||47===a||62===a||_E(a)){const l=47===a,c=r.toLowerCase();return l||s||!yI.includes(c)?vI.includes(r.toLowerCase())?(o=6,l?(e.consume(a),f):n.interrupt?t(a):T(a)):(o=7,n.interrupt&&!n.parser.lazy[n.now().line]?i(a):s?p(a):b(a)):(o=1,n.interrupt?t(a):T(a))}return 45===a||gE(a)?(e.consume(a),r+=String.fromCharCode(a),g):i(a)}function f(o){return 62===o?(e.consume(o),n.interrupt?t:T):i(o)}function p(t){return kE(t)?(e.consume(t),p):x(t)}function b(t){return 47===t?(e.consume(t),x):58===t||95===t||mE(t)?(e.consume(t),w):kE(t)?(e.consume(t),b):x(t)}function w(t){return 45===t||46===t||58===t||95===t||gE(t)?(e.consume(t),w):v(t)}function v(t){return 61===t?(e.consume(t),y):kE(t)?(e.consume(t),v):b(t)}function y(t){return null===t||60===t||61===t||62===t||96===t?i(t):34===t||39===t?(e.consume(t),l=t,_):kE(t)?(e.consume(t),y):k(t)}function _(t){return t===l?(e.consume(t),l=null,C):null===t||yE(t)?i(t):(e.consume(t),_)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||_E(t)?v(t):(e.consume(t),k)}function C(e){return 47===e||62===e||kE(e)?b(e):i(e)}function x(t){return 62===t?(e.consume(t),A):i(t)}function A(t){return null===t||yE(t)?T(t):kE(t)?(e.consume(t),A):i(t)}function T(t){return 45===t&&2===o?(e.consume(t),I):60===t&&1===o?(e.consume(t),V):62===t&&4===o?(e.consume(t),B):63===t&&3===o?(e.consume(t),L):93===t&&5===o?(e.consume(t),R):!yE(t)||6!==o&&7!==o?null===t||yE(t)?(e.exit("htmlFlowData"),E(t)):(e.consume(t),T):(e.exit("htmlFlowData"),e.check(kI,M,E)(t))}function E(t){return e.check(CI,S,M)(t)}function S(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return null===t||yE(t)?E(t):(e.enter("htmlFlowData"),T(t))}function I(t){return 45===t?(e.consume(t),L):T(t)}function V(t){return 47===t?(e.consume(t),r="",O):T(t)}function O(t){if(62===t){const i=r.toLowerCase();return yI.includes(i)?(e.consume(t),B):T(t)}return mE(t)&&r.length<8?(e.consume(t),r+=String.fromCharCode(t),O):T(t)}function R(t){return 93===t?(e.consume(t),L):T(t)}function L(t){return 62===t?(e.consume(t),B):45===t&&2===o?(e.consume(t),L):T(t)}function B(t){return null===t||yE(t)?(e.exit("htmlFlowData"),M(t)):(e.consume(t),B)}function M(i){return e.exit("htmlFlow"),t(i)}}},kI={partial:!0,tokenize:function(e,t,i){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(_P,t,i)}}},CI={partial:!0,tokenize:function(e,t,i){const n=this;return function(t){return yE(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):i(t)};function o(e){return n.parser.lazy[n.now().line]?i(e):t(e)}}},xI={partial:!0,tokenize:function(e,t,i){const n=this;return function(t){return null===t?i(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o)};function o(e){return n.parser.lazy[n.now().line]?i(e):t(e)}}},AI={concrete:!0,name:"codeFenced",tokenize:function(e,t,i){const n=this,o={partial:!0,tokenize:function(e,t,i){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r};function r(t){return e.enter("codeFencedFence"),kE(t)?yP(e,l,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter("codeFencedFenceSequence"),c(t)):i(t)}function c(t){return t===s?(o++,e.consume(t),c):o>=a?(e.exit("codeFencedFenceSequence"),kE(t)?yP(e,u,"whitespace")(t):u(t)):i(t)}function u(n){return null===n||yE(n)?(e.exit("codeFencedFence"),t(n)):i(n)}}};let s,r=0,a=0;return function(t){return function(t){const i=n.events[n.events.length-1];return r=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===s?(a++,e.consume(t),l):a<3?i(t):(e.exit("codeFencedFenceSequence"),kE(t)?yP(e,c,"whitespace")(t):c(t))}function c(i){return null===i||yE(i)?(e.exit("codeFencedFence"),n.interrupt?t(i):e.check(xI,m,w)(i)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(i))}function u(t){return null===t||yE(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):kE(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yP(e,d,"whitespace")(t)):96===t&&t===s?i(t):(e.consume(t),u)}function d(t){return null===t||yE(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(t))}function h(t){return null===t||yE(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===s?i(t):(e.consume(t),h)}function m(t){return e.attempt(o,w,g)(t)}function g(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),f}function f(t){return r>0&&kE(t)?yP(e,p,"linePrefix",r+1)(t):p(t)}function p(t){return null===t||yE(t)?e.check(xI,m,w)(t):(e.enter("codeFlowValue"),b(t))}function b(t){return null===t||yE(t)?(e.exit("codeFlowValue"),p(t)):(e.consume(t),b)}function w(i){return e.exit("codeFenced"),t(i)}}},TI=document.createElement("i");function EI(e){const t="&"+e+";";TI.innerHTML=t;const i=TI.textContent;return(59!==i.charCodeAt(i.length-1)||"semi"===e)&&i!==t&&i}const SI={name:"characterReference",tokenize:function(e,t,i){const n=this;let o,s,r=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),o=31,s=gE,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=wE,c):(e.enter("characterReferenceValue"),o=7,s=bE,c(t))}function c(a){if(59===a&&r){const o=e.exit("characterReferenceValue");return s!==gE||EI(n.sliceSerialize(o))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):i(a)}return s(a)&&r++1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[i][1].end},h={...e[u][1].start};NI(d,-a),NI(h,a),s={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[i][1].end}},r={type:a>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},o={type:a>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[u][1].start}},n={type:a>1?"strong":"emphasis",start:{...s.start},end:{...r.end}},e[i][1].end={...s.start},e[u][1].start={...r.end},l=[],e[i][1].end.offset-e[i][1].start.offset&&(l=eP(l,[["enter",e[i][1],t],["exit",e[i][1],t]])),l=eP(l,[["enter",n,t],["enter",s,t],["exit",s,t],["enter",o,t]]),l=eP(l,PP(t.parser.constructs.insideSpan.null,e.slice(i+1,u),t)),l=eP(l,[["exit",o,t],["enter",r,t],["exit",r,t],["exit",n,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=eP(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,ZS(e,i-1,u-i+3,l),u=i+l.length-c-2;break}for(u=-1;++u-1){const e=r[0];"string"==typeof e?r[0]=e.slice(n):r.shift()}s>0&&r.push(e[o].slice(0,s))}return r}(r,e)}function g(){const{_bufferIndex:e,_index:t,line:i,column:o,offset:s}=n;return{_bufferIndex:e,_index:t,line:i,column:o,offset:s}}function f(e){l=void 0,d=e,h=h(e)}function p(e,t){t.restore()}function b(e,t){return function(i,o,s){let r,d,h,m;return Array.isArray(i)?f(i):"tokenize"in i?f([i]):function(e){return function(t){const i=null!==t&&e[t],n=null!==t&&e.null;return f([...Array.isArray(i)?i:i?[i]:[],...Array.isArray(n)?n:n?[n]:[]])(t)}}(i);function f(e){return r=e,d=0,0===e.length?s:p(e[d])}function p(e){return function(i){return m=function(){const e=g(),t=u.previous,i=u.currentConstruct,o=u.events.length,s=Array.from(a);return{from:o,restore:function(){n=e,u.previous=t,u.currentConstruct=i,u.events.length=o,a=s,v()}}}(),h=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name)?w():e.tokenize.call(t?Object.assign(Object.create(u),t):u,c,b,w)(i)}}function b(t){return l=!0,e(h,m),o}function w(e){return l=!0,m.restore(),++d13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||!(65535&~i)||65534==(65535&i)||i>1114111?"�":String.fromCodePoint(i)}const tV=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iV(e){return e.replace(tV,nV)}function nV(e,t,i){if(t)return t;if(35===i.charCodeAt(0)){const e=i.charCodeAt(1),t=120===e||88===e;return eV(i.slice(t?2:1),t?16:10)}return EI(i)||e}const oV={}.hasOwnProperty;function sV(t,i,n){return i&&"object"==typeof i&&(n=i,i=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(w),autolinkProtocol:u,autolinkEmail:u,atxHeading:o(f),blockQuote:o((function(){return{type:"blockquote",children:[]}})),characterEscape:u,characterReference:u,codeFenced:o(g),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(g,s),codeText:o((function(){return{type:"inlineCode",value:""}}),s),codeTextData:u,data:u,codeFlowValue:u,definition:o((function(){return{type:"definition",identifier:"",label:null,title:null,url:""}})),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o((function(){return{type:"emphasis",children:[]}})),hardBreakEscape:o(p),hardBreakTrailing:o(p),htmlFlow:o(b,s),htmlFlowData:u,htmlText:o(b,s),htmlTextData:u,image:o((function(){return{type:"image",title:null,url:"",alt:null}})),label:s,link:o(w),listItem:o((function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}})),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:o(v,(function(){this.data.expectingFirstListItemValue=!0})),listUnordered:o(v),paragraph:o((function(){return{type:"paragraph",children:[]}})),reference:function(){this.data.referenceType="collapsed"},referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(f),strong:o((function(){return{type:"strong",children:[]}})),thematicBreak:o((function(){return{type:"thematicBreak"}}))},exit:{atxHeading:a(),atxHeadingSequence:function(e){const t=this.stack[this.stack.length-1];if(!t.depth){const i=this.sliceSerialize(e).length;t.depth=i}},autolink:a(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:a(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:m,characterReferenceMarkerNumeric:m,characterReferenceValue:function(e){const t=this.sliceSerialize(e),i=this.data.characterReferenceType;let n;i?(n=eV(t,"characterReferenceMarkerNumeric"===i?10:16),this.data.characterReferenceType=void 0):n=EI(t);this.stack[this.stack.length-1].value+=n},characterReference:function(e){this.stack.pop().position.end=rV(e.end)},codeFenced:a((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0})),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){const e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){const e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:a((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")})),codeText:a((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),codeTextData:d,data:d,definition:a(),definitionDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.label=t,i.identifier=KE(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:a(),hardBreakEscape:a(h),hardBreakTrailing:a(h),htmlFlow:a((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlFlowData:d,htmlText:a((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlTextData:d,image:a((function(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0})),label:function(){const e=this.stack[this.stack.length-1],t=this.resume(),i=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===i.type){const t=e.children;i.children=t}else i.alt=t},labelText:function(e){const t=this.sliceSerialize(e),i=this.stack[this.stack.length-2];i.label=iV(t),i.identifier=KE(t).toLowerCase()},lineEnding:function(e){const i=this.stack[this.stack.length-1];if(this.data.atHardBreak)return i.children[i.children.length-1].position.end=rV(e.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(i.type)&&(u.call(this,e),d.call(this,e))},link:a((function(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0})),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:function(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.label=t,i.identifier=KE(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:a((function(){this.data.setextHeadingSlurpLineEnding=void 0})),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:a(),thematicBreak:a()}};aV(t,(e||{}).mdastExtensions||[]);const i={};return function(e){let o={type:"root",children:[]};const a={stack:[o],tokenStack:[],config:t,enter:r,exit:l,buffer:s,resume:c,data:i},u=[];let d=-1;for(;++d0){const e=a.tokenStack[a.tokenStack.length-1];(e[1]||cV).call(a,void 0,e[0])}for(o.position={start:rV(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:rV(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d((e,t)=>{const i=(t,i)=>(e.set(i,t),t),n=o=>{if(e.has(o))return e.get(o);const[s,r]=t[o];switch(s){case 0:case-1:return i(r,o);case 1:{const e=i([],o);for(const t of r)e.push(n(t));return e}case 2:{const e=i({},o);for(const[t,i]of r)e[n(t)]=n(i);return e}case 3:return i(new Date(r),o);case 4:{const{source:e,flags:t}=r;return i(new RegExp(e,t),o)}case 5:{const e=i(new Map,o);for(const[t,i]of r)e.set(n(t),n(i));return e}case 6:{const e=i(new Set,o);for(const t of r)e.add(n(t));return e}case 7:{const{name:e,message:t}=r;return i(new dV[e](t),o)}case 8:return i(BigInt(r),o);case"BigInt":return i(Object(BigInt(r)),o);case"ArrayBuffer":return i(new Uint8Array(r).buffer,r);case"DataView":{const{buffer:e}=new Uint8Array(r);return i(new DataView(e),r)}}return i(new dV[s](r),o)};return n})(new Map,e)(0),mV="",{toString:gV}={},{keys:fV}=Object,pV=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const i=gV.call(e).slice(8,-1);switch(i){case"Array":return[1,mV];case"Object":return[2,mV];case"Date":return[3,mV];case"RegExp":return[4,mV];case"Map":return[5,mV];case"Set":return[6,mV];case"DataView":return[1,i]}return i.includes("Array")?[1,i]:i.includes("Error")?[7,i]:[2,i]},bV=([e,t])=>0===e&&("function"===t||"symbol"===t),wV=(e,{json:t,lossy:i}={})=>{const n=[];return((e,t,i,n)=>{const o=(e,t)=>{const o=n.push(e)-1;return i.set(t,o),o},s=n=>{if(i.has(n))return i.get(n);let[r,a]=pV(n);switch(r){case 0:{let t=n;switch(a){case"bigint":r=8,t=n.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);t=null;break;case"undefined":return o([-1],n)}return o([r,t],n)}case 1:{if(a){let e=n;return"DataView"===a?e=new Uint8Array(n.buffer):"ArrayBuffer"===a&&(e=new Uint8Array(n)),o([a,[...e]],n)}const e=[],t=o([r,e],n);for(const t of n)e.push(s(t));return t}case 2:{if(a)switch(a){case"BigInt":return o([a,n.toString()],n);case"Boolean":case"Number":case"String":return o([a,n.valueOf()],n)}if(t&&"toJSON"in n)return s(n.toJSON());const i=[],l=o([r,i],n);for(const t of fV(n))!e&&bV(pV(n[t]))||i.push([s(t),s(n[t])]);return l}case 3:return o([r,n.toISOString()],n);case 4:{const{source:e,flags:t}=n;return o([r,{source:e,flags:t}],n)}case 5:{const t=[],i=o([r,t],n);for(const[i,o]of n)(e||!bV(pV(i))&&!bV(pV(o)))&&t.push([s(i),s(o)]);return i}case 6:{const t=[],i=o([r,t],n);for(const i of n)!e&&bV(pV(i))||t.push(s(i));return i}}const{message:l}=n;return o([r,{name:a,message:l}],n)};return s})(!(t||i),!!t,new Map,n)(e),n},vV="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?hV(wV(e,t)):structuredClone(e):(e,t)=>hV(wV(e,t));function yV(e){const t=[];let i=-1,n=0,o=0;for(;++i55295&&s<57344){const t=e.charCodeAt(i+1);s<56320&&t>56319&&t<57344?(r=String.fromCharCode(s,t),o=1):r="�"}else r=String.fromCharCode(s);r&&(t.push(e.slice(n,i),encodeURIComponent(r)),n=i+o+1,r=""),o&&(i+=o,o=0)}return t.join("")+e.slice(n)}function _V(e,t){const i=[{type:"text",value:"↩"}];return t>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),i}function kV(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const CV=AV("end"),xV=AV("start");function AV(e){return function(t){const i=t&&t.position&&t.position[e]||{};if("number"==typeof i.line&&i.line>0&&"number"==typeof i.column&&i.column>0)return{line:i.line,column:i.column,offset:"number"==typeof i.offset&&i.offset>-1?i.offset:void 0}}}function TV(e){const t=xV(e),i=CV(e);if(t&&i)return{start:t,end:i}}function EV(e,t){const i=t.referenceType;let n="]";if("collapsed"===i?n+="[]":"full"===i&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];const o=e.all(t),s=o[0];s&&"text"===s.type?s.value="["+s.value:o.unshift({type:"text",value:"["});const r=o[o.length-1];return r&&"text"===r.type?r.value+=n:o.push({type:"text",value:n}),o}function SV(e){const t=e.spread;return null==t?e.children.length>1:t}function PV(e){const t=String(e),i=/\r?\n|\r/g;let n=i.exec(t),o=0;const s=[];for(;n;)s.push(IV(t.slice(o,n.index),o>0,!0),n[0]),o=n.index+n[0].length,n=i.exec(t);return s.push(IV(t.slice(o),o>0,!1)),s.join("")}function IV(e,t,i){let n=0,o=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(i){let t=e.codePointAt(o-1);for(;9===t||32===t;)o--,t=e.codePointAt(o-1)}return o>n?e.slice(n,o):""}const VV={blockquote:function(e,t){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,i),e.applyData(t,i)},break:function(e,t){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,i),[e.applyData(t,i),{type:"text",value:"\n"}]},code:function(e,t){const i=t.value?t.value+"\n":"",n={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(n.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:i}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s},delete:function(e,t){const i={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},emphasis:function(e,t){const i={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},footnoteReference:function(e,t){const i="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),o=yV(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let r,a=e.footnoteCounts.get(n);void 0===a?(a=0,e.footnoteOrder.push(n),r=e.footnoteOrder.length):r=s+1,a+=1,e.footnoteCounts.set(n,a);const l={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const i={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},html:function(e,t){if(e.options.allowDangerousHtml){const i={type:"raw",value:t.value};return e.patch(t,i),e.applyData(t,i)}},imageReference:function(e,t){const i=String(t.identifier).toUpperCase(),n=e.definitionById.get(i);if(!n)return EV(e,t);const o={src:yV(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(o.title=n.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){const i={src:yV(t.url)};null!==t.alt&&void 0!==t.alt&&(i.alt=t.alt),null!==t.title&&void 0!==t.title&&(i.title=t.title);const n={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){const i={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,i);const n={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){const i=String(t.identifier).toUpperCase(),n=e.definitionById.get(i);if(!n)return EV(e,t);const o={href:yV(n.url||"")};null!==n.title&&void 0!==n.title&&(o.title=n.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){const i={href:yV(t.url)};null!==t.title&&void 0!==t.title&&(i.title=t.title);const n={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,i){const n=e.all(t),o=i?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const i=e.children;let n=-1;for(;!t&&++n0&&i.children.unshift({type:"text",value:" "}),i.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a0){const n={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},s=xV(t.children[1]),r=CV(t.children[t.children.length-1]);s&&r&&(n.position={start:s,end:r}),o.push(n)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){const i={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},tableRow:function(e,t,i){const n=i?i.children:void 0,o=0===(n?n.indexOf(t):1)?"th":"td",s=i&&"table"===i.type?i.align:void 0,r=s?s.length:t.children.length;let a=-1;const l=[];for(;++a0&&i.push({type:"text",value:"\n"}),i}function DV(e){let t=0,i=e.charCodeAt(t);for(;9===i||32===i;)t++,i=e.charCodeAt(t);return e.slice(t)}function zV(e,t){const i=function(e,t){const i=t||LV,n=new Map,o=new Map,s=new Map,r={...VV,...i.handlers},a={all:function(e){const t=[];if("children"in e){const i=e.children;let n=-1;for(;++n0&&d.push({type:"text",value:" "});let e="string"==typeof i?i:i(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const m=s[s.length-1];if(m&&"element"===m.type&&"p"===m.tagName){const e=m.children[m.children.length-1];e&&"text"===e.type?e.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...d)}else s.push(...d);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(s,!0)};e.patch(o,g),a.push(g)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...vV(r),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(i),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return o&&s.children.push({type:"text",value:"\n"},o),s}function HV(e,t){return e&&"run"in e?async function(i,n){const o=zV(i,{file:n,...t});await e.run(o,n)}:function(i,n){return zV(i,{file:n,...e||t})}}function UV(){return{type:"break"}}function $V(){return function(e){!function(e){RE(e,[/\r?\n|\r/g,UV])}(e)}}class qV{constructor(e,t,i){this.normal=t,this.property=e,i&&(this.space=i)}}function jV(e,t){const i={},n={};for(const t of e)Object.assign(i,t.property),Object.assign(n,t.normal);return new qV(i,n,t)}function WV(e){return e.toLowerCase()}qV.prototype.normal={},qV.prototype.property={},qV.prototype.space=void 0;class GV{constructor(e,t){this.attribute=t,this.property=e}}GV.prototype.attribute="",GV.prototype.booleanish=!1,GV.prototype.boolean=!1,GV.prototype.commaOrSpaceSeparated=!1,GV.prototype.commaSeparated=!1,GV.prototype.defined=!1,GV.prototype.mustUseProperty=!1,GV.prototype.number=!1,GV.prototype.overloadedBoolean=!1,GV.prototype.property="",GV.prototype.spaceSeparated=!1,GV.prototype.space=void 0;let KV=0;const JV=iO(),YV=iO(),QV=iO(),XV=iO(),ZV=iO(),eO=iO(),tO=iO();function iO(){return 2**++KV}const nO=Object.keys(t);class oO extends GV{constructor(e,i,n,o){let s=-1;if(super(e,i),sO(this,"space",o),"number"==typeof n)for(;++s"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function lO(e,t){return t in e?e[t]:t}function cO(e,t){return lO(e,t.toLowerCase())}const uO=rO({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:eO,acceptCharset:ZV,accessKey:ZV,action:null,allow:null,allowFullScreen:JV,allowPaymentRequest:JV,allowUserMedia:JV,alt:null,as:null,async:JV,autoCapitalize:null,autoComplete:ZV,autoFocus:JV,autoPlay:JV,blocking:ZV,capture:null,charSet:null,checked:JV,cite:null,className:ZV,cols:XV,colSpan:null,content:null,contentEditable:YV,controls:JV,controlsList:ZV,coords:XV|eO,crossOrigin:null,data:null,dateTime:null,decoding:null,default:JV,defer:JV,dir:null,dirName:null,disabled:JV,download:QV,draggable:YV,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:JV,formTarget:null,headers:ZV,height:XV,hidden:QV,high:XV,href:null,hrefLang:null,htmlFor:ZV,httpEquiv:ZV,id:null,imageSizes:null,imageSrcSet:null,inert:JV,inputMode:null,integrity:null,is:null,isMap:JV,itemId:null,itemProp:ZV,itemRef:ZV,itemScope:JV,itemType:ZV,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:JV,low:XV,manifest:null,max:null,maxLength:XV,media:null,method:null,min:null,minLength:XV,multiple:JV,muted:JV,name:null,nonce:null,noModule:JV,noValidate:JV,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:JV,optimum:XV,pattern:null,ping:ZV,placeholder:null,playsInline:JV,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:JV,referrerPolicy:null,rel:ZV,required:JV,reversed:JV,rows:XV,rowSpan:XV,sandbox:ZV,scope:null,scoped:JV,seamless:JV,selected:JV,shadowRootClonable:JV,shadowRootDelegatesFocus:JV,shadowRootMode:null,shape:null,size:XV,sizes:null,slot:null,span:XV,spellCheck:YV,src:null,srcDoc:null,srcLang:null,srcSet:null,start:XV,step:null,style:null,tabIndex:XV,target:null,title:null,translate:null,type:null,typeMustMatch:JV,useMap:null,value:YV,width:XV,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ZV,axis:null,background:null,bgColor:null,border:XV,borderColor:null,bottomMargin:XV,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:JV,declare:JV,event:null,face:null,frame:null,frameBorder:null,hSpace:XV,leftMargin:XV,link:null,longDesc:null,lowSrc:null,marginHeight:XV,marginWidth:XV,noResize:JV,noHref:JV,noShade:JV,noWrap:JV,object:null,profile:null,prompt:null,rev:null,rightMargin:XV,rules:null,scheme:null,scrolling:YV,standby:null,summary:null,text:null,topMargin:XV,valueType:null,version:null,vAlign:null,vLink:null,vSpace:XV,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:JV,disableRemotePlayback:JV,prefix:null,property:null,results:XV,security:null,unselectable:null},space:"html",transform:cO}),dO=rO({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:tO,accentHeight:XV,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:XV,amplitude:XV,arabicForm:null,ascent:XV,attributeName:null,attributeType:null,azimuth:XV,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:XV,by:null,calcMode:null,capHeight:XV,className:ZV,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:XV,diffuseConstant:XV,direction:null,display:null,dur:null,divisor:XV,dominantBaseline:null,download:JV,dx:null,dy:null,edgeMode:null,editable:null,elevation:XV,enableBackground:null,end:null,event:null,exponent:XV,externalResourcesRequired:null,fill:null,fillOpacity:XV,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:eO,g2:eO,glyphName:eO,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:XV,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:XV,horizOriginX:XV,horizOriginY:XV,id:null,ideographic:XV,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:XV,k:XV,k1:XV,k2:XV,k3:XV,k4:XV,kernelMatrix:tO,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:XV,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:XV,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:XV,overlineThickness:XV,paintOrder:null,panose1:null,path:null,pathLength:XV,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ZV,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:XV,pointsAtY:XV,pointsAtZ:XV,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tO,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tO,rev:tO,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tO,requiredFeatures:tO,requiredFonts:tO,requiredFormats:tO,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:XV,specularExponent:XV,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:XV,strikethroughThickness:XV,string:null,stroke:null,strokeDashArray:tO,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:XV,strokeOpacity:XV,strokeWidth:null,style:null,surfaceScale:XV,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tO,tabIndex:XV,tableValues:null,target:null,targetX:XV,targetY:XV,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tO,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:XV,underlineThickness:XV,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:XV,values:null,vAlphabetic:XV,vMathematical:XV,vectorEffect:null,vHanging:XV,vIdeographic:XV,version:null,vertAdvY:XV,vertOriginX:XV,vertOriginY:XV,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:XV,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lO}),hO=rO({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),mO=rO({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:cO}),gO=rO({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),fO=jV([aO,uO,hO,mO,gO],"html"),pO=jV([aO,dO,hO,mO,gO],"svg"),bO=/[A-Z]/g,wO=/-[a-z]/g,vO=/^data[-\w.:]+$/i;function yO(e,t){const i=WV(t);let n=t,o=GV;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&"data"===i.slice(0,4)&&vO.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(wO,kO);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!wO.test(e)){let i=e.replace(bO,_O);"-"!==i.charAt(0)&&(i="-"+i),t="data"+i}}o=oO}return new o(n,t)}function _O(e){return"-"+e.toLowerCase()}function kO(e){return e.charAt(1).toUpperCase()}const CO="http://www.w3.org/1999/xhtml",xO="http://www.w3.org/2000/svg",AO={}.hasOwnProperty;function TO(e,t){const i=function(e,t){switch(e.type){case"root":return function(e,t){const i=e.children||[];let n,o=0===i.length,s=-1;for(;++s";const t=document.createElement("template");return t.content.append(e),t.innerHTML}const IO=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],VO={}.hasOwnProperty;function OO(e,t){const i=t||{};function n(t,...i){let o=n.invalid;const s=n.handlers;if(t&&VO.call(t,e)){const i=String(t[e]);o=VO.call(s,i)?s[i]:n.unknown}if(o)return o.call(this,t,...i)}return n.handlers=i.handlers||{},n.invalid=i.invalid,n.unknown=i.unknown,n}const RO=/["&'<>`]/g,LO=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,BO=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,MO=/[|\\{}()[\]^$+*?.]/g,NO=new WeakMap;const FO=/[\dA-Fa-f]/,DO=/\d/,zO=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],HO={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},UO=["cent","copy","divide","gt","lt","not","para","times"],$O={}.hasOwnProperty,qO={};let jO;for(jO in HO)$O.call(HO,jO)&&(qO[HO[jO]]=jO);const WO=/[^\dA-Za-z]/;function GO(e,t,i){let n,o=function(e,t,i){const n=""+e.toString(16).toUpperCase();return i&&t&&!FO.test(String.fromCharCode(t))?n:n+";"}(e,t,i.omitOptionalSemicolons);if((i.useNamedReferences||i.useShortestReferences)&&(n=function(e,t,i,n){const o=String.fromCharCode(e);if($O.call(qO,o)){const e=qO[o],s="&"+e;return i&&zO.includes(e)&&!UO.includes(e)&&(!n||t&&61!==t&&WO.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,i.omitOptionalSemicolons,i.attribute)),(i.useShortestReferences||!n)&&i.useShortestReferences){const n=function(e,t,i){const n=""+String(e);return i&&t&&!DO.test(String.fromCharCode(t))?n:n+";"}(e,t,i.omitOptionalSemicolons);n.length|^->||--!>|"],QO=["<",">"];function XO(e){const t=[],i=String(e||"");let n=i.indexOf(","),o=0,s=!1;for(;!s;){-1===n&&(n=i.length,s=!0);const e=i.slice(o,n).trim();!e&&s||t.push(e),o=n+1,n=i.indexOf(",",o)}return t}function ZO(e,t){const i=t||{};return(""===e[e.length-1]?[...e,""]:e).join((i.padRight?" ":"")+","+(!1===i.padLeft?"":" ")).trim()}function eR(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tR(e){return e.join(" ").trim()}const iR=/[ \t\n\f\r]/g;function nR(e){return"object"==typeof e?"text"===e.type&&oR(e.value):oR(e)}function oR(e){return""===e.replace(iR,"")}const sR=lR(1),rR=lR(-1),aR=[];function lR(e){return function(t,i,n){const o=t?t.children:aR;let s=(i||0)+e,r=o[s];if(!n)for(;r&&nR(r);)s+=e,r=o[s];return r}}const cR={}.hasOwnProperty;function uR(e){return function(t,i,n){return cR.call(e,t.tagName)&&e[t.tagName](t,i,n)}}const dR=uR({body:function(e,t,i){const n=sR(i,t);return!n||"comment"!==n.type},caption:hR,colgroup:hR,dd:function(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,i){const n=sR(i,t);return Boolean(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:hR,html:function(e,t,i){const n=sR(i,t);return!n||"comment"!==n.type},li:function(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,i){const n=sR(i,t);return n?"element"===n.type&&("address"===n.tagName||"article"===n.tagName||"aside"===n.tagName||"blockquote"===n.tagName||"details"===n.tagName||"div"===n.tagName||"dl"===n.tagName||"fieldset"===n.tagName||"figcaption"===n.tagName||"figure"===n.tagName||"footer"===n.tagName||"form"===n.tagName||"h1"===n.tagName||"h2"===n.tagName||"h3"===n.tagName||"h4"===n.tagName||"h5"===n.tagName||"h6"===n.tagName||"header"===n.tagName||"hgroup"===n.tagName||"hr"===n.tagName||"main"===n.tagName||"menu"===n.tagName||"nav"===n.tagName||"ol"===n.tagName||"p"===n.tagName||"pre"===n.tagName||"section"===n.tagName||"table"===n.tagName||"ul"===n.tagName):!i||!("element"===i.type&&("a"===i.tagName||"audio"===i.tagName||"del"===i.tagName||"ins"===i.tagName||"map"===i.tagName||"noscript"===i.tagName||"video"===i.tagName))},rp:mR,rt:mR,tbody:function(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:gR,tfoot:function(e,t,i){return!sR(i,t)},th:gR,thead:function(e,t,i){const n=sR(i,t);return Boolean(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&"tr"===n.tagName}});function hR(e,t,i){const n=sR(i,t,!0);return!n||"comment"!==n.type&&!("text"===n.type&&nR(n.value.charAt(0)))}function mR(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function gR(e,t,i){const n=sR(i,t);return!n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}const fR=uR({body:function(e){const t=sR(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&nR(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,i){const n=rR(i,t),o=sR(e,-1,!0);return!(i&&n&&"element"===n.type&&"colgroup"===n.tagName&&dR(n,i.children.indexOf(n),i))&&Boolean(o&&"element"===o.type&&"col"===o.tagName)},head:function(e){const t=new Set;for(const i of e.children)if("element"===i.type&&("base"===i.tagName||"title"===i.tagName)){if(t.has(i.tagName))return!1;t.add(i.tagName)}const i=e.children[0];return!i||"element"===i.type},html:function(e){const t=sR(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,i){const n=rR(i,t),o=sR(e,-1);return(!i||!n||"element"!==n.type||"thead"!==n.tagName&&"tbody"!==n.tagName||!dR(n,i.children.indexOf(n),i))&&Boolean(o&&"element"===o.type&&"tr"===o.tagName)}}),pR={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function bR(e,t,i){const n=yO(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=e.settings.allowDangerousCharacters?0:1;let r,a=e.quote;if(!n.overloadedBoolean||i!==n.attribute&&""!==i?!n.boolean&&!n.overloadedBoolean||"string"==typeof i&&i!==n.attribute&&""!==i||(i=Boolean(i)):i=!0,null==i||!1===i||"number"==typeof i&&Number.isNaN(i))return"";const l=KO(n.attribute,Object.assign({},e.settings.characterReferences,{subset:pR.name[o][s]}));return!0===i?l:(i=Array.isArray(i)?(n.commaSeparated?ZO:tR)(i,{padLeft:!e.settings.tightCommaSeparatedLists}):String(i),e.settings.collapseEmptyAttributes&&!i?l:(e.settings.preferUnquoted&&(r=KO(i,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:pR.unquoted[o][s]}))),r!==i&&(e.settings.quoteSmart&&hE(i,a)>hE(i,e.alternative)&&(a=e.alternative),r=a+KO(i,Object.assign({},e.settings.characterReferences,{subset:("'"===a?pR.single:pR.double)[o][s],attribute:!0}))+a),l+(r?"="+r:r)))}const wR=["<","&"];function vR(e,t,i,n){return!i||"element"!==i.type||"script"!==i.tagName&&"style"!==i.tagName?KO(e.value,Object.assign({},n.settings.characterReferences,{subset:wR})):e.value}const yR=OO("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,i,n){return n.settings.bogusComments?""+KO(e.value,Object.assign({},n.settings.characterReferences,{subset:YO}))+">":"\x3c!--"+e.value.replace(JO,(function(e){return KO(e,Object.assign({},n.settings.characterReferences,{subset:QO}))}))+"--\x3e"},doctype:function(e,t,i,n){return""},element:function(e,t,i,n){const o=n.schema,s="svg"!==o.space&&n.settings.omitOptionalTags;let r="svg"===o.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;"html"===o.space&&"svg"===e.tagName&&(n.schema=pO);const c=function(e,t){const i=[];let n,o=-1;if(t)for(n in t)if(null!==t[n]&&void 0!==t[n]){const o=bR(e,n,t[n]);o&&i.push(o)}for(;++o")),a.push(u),r||s&&dR(e,t,i)||a.push(""+e.tagName+">"),a.join("")},raw:function(e,t,i,n){return n.settings.allowDangerousHtml?e.value:vR(e,0,i,n)},root:function(e,t,i,n){return n.all(e)},text:vR}}),_R={},kR={},CR=[];function xR(e,t){const i=t||_R,n=i.quote||'"',o='"'===n?"'":'"';if('"'!==n&&"'"!==n)throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:AR,all:TR,settings:{omitOptionalTags:i.omitOptionalTags||!1,allowParseErrors:i.allowParseErrors||!1,allowDangerousCharacters:i.allowDangerousCharacters||!1,quoteSmart:i.quoteSmart||!1,preferUnquoted:i.preferUnquoted||!1,tightAttributes:i.tightAttributes||!1,upperDoctype:i.upperDoctype||!1,tightDoctype:i.tightDoctype||!1,bogusComments:i.bogusComments||!1,tightCommaSeparatedLists:i.tightCommaSeparatedLists||!1,tightSelfClosing:i.tightSelfClosing||!1,collapseEmptyAttributes:i.collapseEmptyAttributes||!1,allowDangerousHtml:i.allowDangerousHtml||!1,voids:i.voids||IO,characterReferences:i.characterReferences||kR,closeSelfClosing:i.closeSelfClosing||!1,closeEmptyElements:i.closeEmptyElements||!1},schema:"svg"===i.space?pO:fO,quote:n,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function AR(e,t,i){return yR(e,t,i,this)}function TR(e){const t=[],i=e&&e.children||CR;let n=-1;for(;++n","")}}function DR(){return e=>{xS(e,"element",(e=>{"ul"!==e.tagName&&"ol"!==e.tagName&&"li"!==e.tagName||(e.children=e.children.filter((e=>"text"!==e.type||!!e.value.trim())),delete e.properties.className)}))}}function zR(){return e=>{xS(e,["root","element"],(e=>{if(!function(e){return("root"===e.type||"element"===e.type)&&e.children}(e))return;if(!e.children.some((e=>"raw"===e.type)))return;const t=document.createElement("template");t.innerHTML=xR({type:"root",children:e.children},{allowDangerousHtml:!0}),e.children=Array.from(t.content.childNodes).map((e=>LR(e)))}))}}function HR(e){const t={...this.data("settings"),...e};this.parser=function(e){return LR((!1===t.fragment?UR:$R)(e))}}function UR(e){return(new DOMParser).parseFromString(e,"text/html")}function $R(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const qR=function(e,t,i,n,o){const s=jR(t);if(null!=i&&("number"!=typeof i||i<0||i===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(!(null==n||n.type&&n.children))throw new Error("Expected valid `parent`");if(null==i!=(null==n))throw new Error("Expected both `index` and `parent`");return!!KR(e)&&s.call(o,e,i,n)},jR=function(e){if(null==e)return GR;if("string"==typeof e)return function(e){return WR((function(t){return t.tagName===e}))}(e);if("object"==typeof e)return function(e){const t=[];let i=-1;for(;++ic&&(c=e):e&&(void 0!==c&&c>-1&&l.push("\n".repeat(c)||" "),c=-1,l.push(e))}return l.join("")}function kL(e,t,i){return"element"===e.type?function(e,t,i){const n=AL(e,i),o=e.children||[];let s,r,a=-1,l=[];if(vL(e))return l;for(fL(e)||wL(e)&&hL(t,e,wL)?r="\n":bL(e)?(s=2,r=2):yL(e)&&(s=1,r=1);++a0;){const e=t.codePointAt(i-1);if(void 0===e||10!==e&&13!==e)break;i--}return t.slice(0,i)}function EL(e,t){const i=t.children;let n,o,s=-1;if("pre"===t.tagName)for(;++s1)for(;++tt&&"break"===e[i-1].type;)i--;return 0===t&&i===e.length?e:e.slice(t,i)}function LL(e,t){const i={type:"heading",depth:Number(t.tagName.charAt(1))||1,children:RL(e.all(t))};return e.patch(t,i),i}function BL(e,t){const i=t.properties||{},n={type:"image",url:e.resolve(String(i.src||"")||null),title:i.title?String(i.title):null,alt:i.alt?String(i.alt):""};return e.patch(t,n),n}function ML(e,t){const i={type:"inlineCode",value:_L(t)};return e.patch(t,i),i}function NL(e,t){const i=[],n=[],o=t||e.properties||{},s=FL(e),r=Math.min(Number.parseInt(String(o.size),10),0)||(o.multiple?4:1);let a=-1;for(;++a0?i:s,c=Math.min(l.length,r);for(a=-1;++a0&&(o.push(...t(s)),s=[]),o.push(i(e)))}return s.length>0&&(o.push(...t(s)),s=[]),o}function ZL(e){const t=e.data&&e.data.hName;return t?$L({type:"element",tagName:t,properties:{},children:[]}):DS(e)}function eB(e){return vV({...e,children:[]})}function tB(e,t){const i=t.properties||{},n="video"===t.tagName?String(i.poster||""):"";let o=String(i.src||""),s=-1,r=!1,a=e.all(t);if(xS({type:"root",children:a},(function(e){if("link"===e.type)return r=!0,IE})),r||JL(a))return a;for(;!o&&++s0){const n={type:"paragraph",children:i};return e.patch(t,n),n}}const nB=['"'];function oB(e,t){const i={type:"strong",children:e.all(t)};return e.patch(t,i),i}function sB(e,t){const i={type:"tableCell",children:e.all(t)};if(e.patch(t,i),t.properties){const e=t.properties.rowSpan,n=t.properties.colSpan;if(e||n){const t=i.data||(i.data={});e&&(t.hastUtilToMdastTemporaryRowSpan=e),n&&(t.hastUtilToMdastTemporaryColSpan=n)}}return i}function rB(){return{type:"tableCell",children:[]}}function aB(){return{type:"tableCell",children:[]}}function lB(){return{type:"tableRow",children:[]}}const cB={comment:function(e,t){const i={type:"html",value:"\x3c!--"+t.value+"--\x3e"};return e.patch(t,i),i},doctype:mB,root:function(e,t){let i=e.all(t);(e.options.document||JL(i))&&(i=YL(i));const n={type:"root",children:i};return e.patch(t,n),n},text:function(e,t){const i={type:"text",value:t.value};return e.patch(t,i),i}},uB={applet:mB,area:mB,basefont:mB,bgsound:mB,caption:mB,col:mB,colgroup:mB,command:mB,content:mB,datalist:mB,dialog:mB,element:mB,embed:mB,frame:mB,frameset:mB,isindex:mB,keygen:mB,link:mB,math:mB,menu:mB,menuitem:mB,meta:mB,nextid:mB,noembed:mB,noframes:mB,optgroup:mB,option:mB,param:mB,script:mB,shadow:mB,source:mB,spacer:mB,style:mB,svg:mB,template:mB,title:mB,track:mB,abbr:dB,acronym:dB,bdi:dB,bdo:dB,big:dB,blink:dB,button:dB,canvas:dB,cite:dB,data:dB,details:dB,dfn:dB,font:dB,ins:dB,label:dB,map:dB,marquee:dB,meter:dB,nobr:dB,noscript:dB,object:dB,output:dB,progress:dB,rb:dB,rbc:dB,rp:dB,rt:dB,rtc:dB,ruby:dB,slot:dB,small:dB,span:dB,sup:dB,sub:dB,tbody:dB,tfoot:dB,thead:dB,time:dB,address:hB,article:hB,aside:hB,body:hB,center:hB,div:hB,fieldset:hB,figcaption:hB,figure:hB,form:hB,footer:hB,header:hB,hgroup:hB,html:hB,legend:hB,main:hB,multicol:hB,nav:hB,picture:hB,section:hB,a:function(e,t){const i=t.properties||{},n=e.all(t),o={type:"link",url:e.resolve(String(i.href||"")||null),title:i.title?String(i.title):null,children:n};return e.patch(t,o),o},audio:tB,b:oB,base:function(e,t){e.baseFound||(e.frozenBaseUrl=String(t.properties&&t.properties.href||"")||void 0,e.baseFound=!0)},blockquote:function(e,t){const i={type:"blockquote",children:e.toFlow(e.all(t))};return e.patch(t,i),i},br:function(e,t){const i={type:"break"};return e.patch(t,i),i},code:ML,dir:GL,dl:function(e,t){const i=[],n=[];let o=-1;for(;++o0&&r.push({type:"listItem",spread:t.length>1,checked:null,children:t})}if(r.length>0){const i={type:"list",ordered:!1,start:null,spread:PL(r),children:r};return e.patch(t,i),i}},dt:qL,dd:qL,del:SL,em:OL,h1:LL,h2:LL,h3:LL,h4:LL,h5:LL,h6:LL,hr:function(e,t){const i={type:"thematicBreak"};return e.patch(t,i),i},i:OL,iframe:function(e,t){const i=t.properties||{},n=String(i.src||""),o=String(i.title||"");if(n&&o){const i={type:"link",title:null,url:e.resolve(n),children:[{type:"text",value:o}]};return e.patch(t,i),i}},img:BL,image:BL,input:function(e,t){const i=t.properties||{},n=String(i.value||i.placeholder||"");if(i.disabled||"hidden"===i.type||"file"===i.type)return;if("checkbox"===i.type||"radio"===i.type){const n={type:"text",value:i.checked?e.options.checked||"[x]":e.options.unchecked||"[ ]"};return e.patch(t,n),n}if("image"===i.type){const o=i.alt||n;if(o){const n={type:"image",url:e.resolve(String(i.src||"")||null),title:String(i.title||"")||null,alt:String(o)};return e.patch(t,n),n}return}let o=[];if(n)o=[[n,void 0]];else if("button"!==i.type&&"file"!==i.type&&"password"!==i.type&&"reset"!==i.type&&"submit"!==i.type&&i.list){const t=String(i.list),n=e.elementById.get(t);n&&"datalist"===n.tagName&&(o=NL(n,i))}if(0===o.length)return;if("password"===i.type&&(o[0]=["•".repeat(o[0][0].length),void 0]),"email"===i.type||"url"===i.type){const t=[];let n=-1;for(;++n1?o.charAt(1):o;return s&&"text"===s.type?s.value=a+s.value:n.unshift({type:"text",value:a}),r&&"text"===r.type?r.value+=l:n.push({type:"text",value:l}),n},s:SL,samp:ML,select:function(e,t){const i=NL(t);let n=-1;const o=[];for(;++n0){const i={type:"text",value:o.join(", ")};return e.patch(t,i),i}},strike:SL,strong:oB,summary:iB,table:function(e,t){if(e.inTable){const i={type:"text",value:_L(t)};return e.patch(t,i),i}e.inTable=!0;const{align:i,headless:n}=function(e){const t={align:[null],headless:!0};let i=0,n=0;return xS(e,(function(o){if("element"===o.type){if("table"===o.tagName&&e!==o)return VE;if("th"!==o.tagName&&"td"!==o.tagName||!o.properties)"thead"===o.tagName?t.headless=!1:"tr"===o.tagName&&(i++,n=0);else{if(!t.align[n]){const e=String(o.properties.align||"")||null;"center"!==e&&"left"!==e&&"right"!==e&&null!==e||(t.align[n]=e)}t.headless&&i<2&&"th"===o.tagName&&(t.headless=!1),n++}}})),t}(t),o=e.toSpecificContent(e.all(t),lB);n&&o.unshift({type:"tableRow",children:[]});let s=-1;for(;++s1||r>1){let e=s-1;for(;++er&&(r=e.length)}for(s=-1;++s0&&(t.children.unshift(...o),o=[]),n.push(t);else{const e=t;o.push(e)}}if(o.length>0){let e=n[n.length-1];e||(e=t(),n.push(e)),e.children.push(...o),o=[]}return n;function r(e){return e.type===i.type}}const _B={};function kB(e,t){const i=vV(e),n=t||_B,o=dL({newlines:!0===n.newlines}),s=function(e){return{all:fB,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...uB,...e.handlers},inTable:!1,nodeHandlers:{...cB,...e.nodeHandlers},one:pB,options:e,patch:bB,qNesting:0,resolve:wB,toFlow:vB,toSpecificContent:yB}}(n);let r;o(i),xS(i,(function(e){if(e&&"element"===e.type&&e.properties){const t=String(e.properties.id||"")||void 0;t&&!s.elementById.has(t)&&s.elementById.set(t,e)}}));const a=s.one(i,void 0);return r=a?Array.isArray(a)?{type:"root",children:a}:a:{type:"root",children:[]},xS(r,(function(e,t,i){if("text"===e.type&&void 0!==t&&i){const n=i.children[t-1];if(n&&n.type===e.type)return n.value+=e.value,i.children.splice(t,1),n.position&&e.position&&(n.position.end=e.position.end),t-1;if(e.value=e.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),!i||"heading"!==i.type&&"paragraph"!==i.type&&"root"!==i.type||(t||(e.value=e.value.replace(/^[\t ]+/,"")),t===i.children.length-1&&(e.value=e.value.replace(/[\t ]+$/,""))),!e.value)return i.children.splice(t,1),t}})),r}const CB={document:!0};function xB(e,t){return e&&"run"in e?async function(i,n){const o=kB(i,{...CB,...t});await e.run(o,n)}:function(t){return kB(t,{...CB,...e})}}const AB={}.hasOwnProperty;function TB(e,t){let i,n=-1;if(t.extensions)for(;++n"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:PB},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:PB},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:PB},{atBreak:!0,character:"~"}];function VB(e){return e.label||!e.identifier?e.label||"":iV(e.identifier)}function OB(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function RB(e,t,i,n){let o=n.join.length;for(;o--;){const s=n.join[o](e,t,i,n);if(!0===s||1===s)break;if("number"==typeof s)return"\n".repeat(1+s);if(!1===s)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const LB=/\r?\n|\r/g;function BB(e,t){const i=[];let n,o=0,s=0;for(;n=LB.exec(e);)r(e.slice(o,n.index)),i.push(n[0]),o=n.index+n[0].length,s++;return r(e.slice(o)),i.join("");function r(e){i.push(t(e,s,!e))}}function MB(e,t){return e-t}function NB(e,t){const i=/\\(?=[!-/:-@[-`{-~])/g,n=[],o=[],s=e+t;let r,a=-1,l=0;for(;r=i.exec(s);)n.push(r.index);for(;++a0&&("\r"===l||"\n"===l)&&"html"===u.type&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=t.createTracker(i),c.move(s.join("")));let h=t.handle(u,e,t,{...c.current(),after:d,before:l});r&&r===h.slice(0,1)&&(h=yS(r.charCodeAt(0))+h.slice(1));const m=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,r=void 0,m&&(s.length>0&&m.before&&l===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+yS(l.charCodeAt(0))),m.after&&(r=d)),c.move(h),s.push(h),l=h.slice(-1)}return n.pop(),s.join("")}(e,this,t)}function qB(e,t){return function(e,t,i){const n=t.indexStack,o=e.children||[],s=t.createTracker(i),r=[];let a=-1;for(n.push(-1);++a=c||e+1(e[t]=(e,t)=>{const i=xR(OR(t.tagName,t.properties),{allowDangerousHtml:!0,closeSelfClosing:!0}),n=i.indexOf(">"),o=i.slice(0,n+1),s=i.slice(n+1);return[{type:"html",value:o},...e.all(t),{type:"html",value:s}]},e)),{})}_buildProcessor(){this._processor=sE().use(HR).use(KB).use(xB,{handlers:this._getRawTagsHandlers()}).use(HP,{singleTilde:!0}).use($V).use(WB,{resourceLink:!0,emphasis:"_",rule:"-",handlers:{break:()=>"\n"},unsafe:[{character:"<"}]})}}function KB(){return function(e){xS(e,"element",((e,t,i)=>{null!==t&&"label"===e.tagName&&"element"===i.type&&"li"===i.tagName&&i.children.splice(t,1,...e.children)}))}}class JB{_htmlDP;_markdown2html;_html2markdown;constructor(e){this._htmlDP=new ja(e),this._markdown2html=new FR,this._html2markdown=new GB}keepHtml(e){this._html2markdown.keep(e)}toView(e){const t=this._markdown2html.parse(e);return this._htmlDP.toView(t)}toData(e){const t=this._htmlDP.toData(e);return this._html2markdown.parse(t)}registerRawContentMatcher(e){this._htmlDP.registerRawContentMatcher(e)}useFillerType(){}}class YB extends cd{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const n=function(e,t){const i=Yh(e,t).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}(e,i);return t.checkChild(n,"pageBreak")}(i,t,e)}execute(){const e=this.editor.model;e.change((t=>{const i=t.createElement("pageBreak");e.insertObject(i,null,null,{setSelection:"after"})}))}}class QB extends ad{static get pluginName(){return"PageBreakEditing"}static get licenseFeatureCode(){return"PB"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToStructure({model:"pageBreak",view:(e,{writer:t})=>t.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},t.createContainerElement("span",{style:"display: none"}))}),n.for("editingDowncast").elementToStructure({model:"pageBreak",view:(e,{writer:t})=>{const n=i("Page break"),o=t.createContainerElement("div"),s=t.createRawElement("span",{class:"page-break__label"},(function(e){e.innerText=i("Page break")}));return t.addClass("page-break",o),t.insert(t.createPositionAt(o,0),s),function(e,t,i){return t.setCustomProperty("pageBreak",!0,e),jh(e,t,{label:i})}(o,t,n)}}),n.for("upcast").elementToElement({view:e=>{const t="always"==e.getStyle("page-break-before"),i="always"==e.getStyle("page-break-after");if(!t&&!i)return null;if(1==e.childCount){const t=e.getChild(0);if(!t.is("element","span")||"none"!=t.getStyle("display"))return null}else if(e.childCount>1)return null;return{name:!0,styles:[...t?["page-break-before"]:[],...i?["page-break-after"]:[]],...e.hasClass("page-break")&&{classes:["page-break"]}}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new YB(e))}}class XB extends ad{static get pluginName(){return"PageBreakUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("pageBreak",(()=>{const e=this._createButton(Bn);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:pageBreak",(()=>this._createButton(Yu)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("pageBreak"),o=new e(t.locale),s=i.t;return o.set({label:s("Page break"),icon:''}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("pageBreak"),t.editing.view.focus()})),o}}class ZB extends Bn{styleDefinition;previewView;constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new Hi(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}class eM extends Hi{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new ei,this.keystrokes=new oi,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const i of t){const t=new ZB(e,i);this.children.add(t)}this.on("change:activeStyles",(()=>{for(const e of this.children)e.isOn=this.activeStyles.includes(e.styleDefinition.name)})),this.on("change:enabledStyles",(()=>{for(const e of this.children)e.isEnabled=this.enabledStyles.includes(e.styleDefinition.name)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);Sb({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}class tM extends Hi{gridView;labelView;constructor(e,t,i){super(e),this.labelView=new du(e),this.labelView.text=t,this.gridView=new eM(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}class iM extends Hi{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);const i=e.t;this.focusTracker=new ei,this.keystrokes=new oi,this.children=this.createCollection(),this.blockStylesGroupView=new tM(e,i("Block styles"),t.block),this.inlineStylesGroupView=new tM(e,i("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new wi,this._focusCycler=new Nn({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),t.block.length&&this.children.add(this.blockStylesGroupView),t.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const nM=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class oM extends ad{_htmlSupport;static get pluginName(){return"StyleUtils"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const i={block:[],inline:[]};for(const n of t){const t=[],o=[];for(const i of e.getDefinitionsForView(n.element)){const e="appliesToBlock"in i&&i.appliesToBlock;if(i.isBlock||e){if("string"==typeof e)t.push(e);else if(i.isBlock){const e=i;t.push(i.model),e.paragraphLikeModel&&t.push(e.paragraphLikeModel)}}else o.push(i.model)}const s=this.getStylePreview(n,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);t.length?i.block.push({...n,previewTemplate:s,modelElements:t,isBlock:!0}):i.inline.push({...n,previewTemplate:s,ghsAttributes:o})}return i}isStyleEnabledForBlock(e,t){const i=this.editor.model,n=this._htmlSupport.getGhsAttributeNameForElement(e.element);return!!i.schema.checkAttribute(t,n)&&e.modelElements.includes(t.name)}isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),n=t.getAttribute(i);return this.hasAllClasses(n,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const i=this.editor.model;for(const n of e.ghsAttributes)if(i.schema.checkAttributeInSelection(t,n))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const i of e.ghsAttributes){const n=this._getValueFromFirstAllowedNode(t,i);if(this.hasAllClasses(n,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:i,classes:n}=e;return{tag:(o=i,nM.includes(o)?"div":i),attributes:{class:n},children:t};var o}hasAllClasses(e,t){return z(e)&&(i=e,Boolean(i.classes)&&Array.isArray(i.classes))&&t.every((t=>e.classes.includes(t)));var i}configureGHSDataFilter({block:e,inline:t}){const i=this.editor.plugins.get("DataFilter");i.loadAllowedConfig(e.map(sM)),i.loadAllowedConfig(t.map(sM))}_getValueFromFirstAllowedNode(e,t){const i=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const n of e.getRanges())for(const e of n.getItems())if(i.checkAttribute(e,t))return e.getAttribute(t);return null}}function sM({element:e,classes:t}){return{name:e,classes:t}}class rM extends ad{static get pluginName(){return"StyleUI"}static get isOfficialPlugin(){return!0}static get requires(){return[oM]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),n=e.config.get("style.definitions"),o=i.normalizeConfig(t,n);e.ui.componentFactory.add("style",(t=>{const i=t.t,n=Pu(t),s=e.commands.get("style");return n.once("change:isOpen",(()=>{const e=new iM(t,o);n.panelView.children.add(e),e.delegate("execute").to(n),e.bind("activeStyles").to(s,"value"),e.bind("enabledStyles").to(s,"enabledStyles")})),n.bind("isEnabled").to(s),n.buttonView.withText=!0,n.buttonView.bind("label").to(s,"value",(e=>e.length>1?i("Multiple styles"):1===e.length?e[0]:i("Styles"))),n.bind("class").to(s,"value",(e=>{const t=["ck-style-dropdown"];return e.length>1&&t.push("ck-style-dropdown_multiple-active"),t.join(" ")})),n.on("execute",(t=>{e.execute("style",{styleName:t.source.styleDefinition.name}),e.editing.view.focus()})),n}))}}class aM extends cd{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(oM)}refresh(){const e=this.editor.model,t=e.document.selection,i=new Set,n=new Set;for(const e of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(e,t)&&n.add(e.name),this._styleUtils.isStyleActiveForInlineSelection(e,t)&&i.add(e.name);const o=Zt(t.getSelectedBlocks())||t.getFirstPosition().parent;if(o){const t=o.getAncestors({includeSelf:!0,parentFirst:!0});for(const o of t){if(o.is("rootElement"))break;for(const e of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(e,o)&&(n.add(e.name),this._styleUtils.isStyleActiveForBlock(e,o)&&i.add(e.name));if(e.schema.isObject(o))break}}this.enabledStyles=Array.from(n).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(i).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e))return void A("style-command-executed-with-incorrect-style-name");const i=this.editor.model,n=i.document.selection,o=this.editor.plugins.get("GeneralHtmlSupport"),s=[...this._styleDefinitions.inline,...this._styleDefinitions.block],r=s.filter((({name:e})=>this.value.includes(e))),a=s.find((({name:t})=>t==e)),l=void 0===t?!this.value.includes(a.name):t;i.change((()=>{let e;e=function(e){return"isBlock"in e}(a)?this._findAffectedBlocks(function(e){const t=Array.from(e.getSelectedBlocks());return t.length?t:[e.getFirstPosition().parent]}(n),a):[this._styleUtils.getAffectedInlineSelectable(a,n)];for(const t of e)l?o.addModelHtmlClass(a.element,a.classes,t):o.removeModelHtmlClass(a.element,lM(r,a),t)}))}_findAffectedBlocks(e,t){const i=new Set;for(const n of e){const e=n.getAncestors({includeSelf:!0,parentFirst:!0});for(const n of e){if(n.is("rootElement"))break;const e=this._styleUtils.getAffectedBlocks(t,n);if(e){for(const t of e)i.add(t);break}}}return i}}function lM(e,t){return e.reduce(((e,i)=>i.name===t.name?e:e.filter((e=>!i.classes.includes(e)))),t.classes)}class cM extends ad{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return"ListStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[oM,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(oM),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,i])=>{this._isStyleEnabledForBlock(t,i)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",((e,[t,i])=>{this._isStyleActiveForBlock(t,i)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,i])=>{const n=this._getAffectedBlocks(t,i);n&&(e.return=n,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",((e,[t,i])=>{const n=this._getStylePreview(t,i);n&&(e.return=n,e.stop())}),{priority:"high"}))}_isStyleEnabledForBlock(e,t){const i=this.editor.model;if(!["ol","ul","li"].includes(e.element))return!1;if(!this._listUtils.isListItemBlock(t))return!1;const n=this._htmlSupport.getGhsAttributeNameForElement(e.element);if("ol"==e.element||"ul"==e.element){if(!i.schema.checkAttribute(t,n))return!1;const o=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==o}return i.schema.checkAttribute(t,n)}_isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),n=t.getAttribute(i);return this._styleUtils.hasAllClasses(n,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?"li"==e.element?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:i,classes:n}=e;return"ol"==i||"ul"==i?{tag:i,attributes:{class:n},children:[{tag:"li",children:t}]}:"li"==i?{tag:"ol",children:[{tag:i,attributes:{class:n},children:t}]}:null}}class uM extends ad{_tableUtils;_styleUtils;static get pluginName(){return"TableStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[oM]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(oM),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,i])=>{this._isApplicable(t,i)&&(e.return=this._isStyleEnabledForBlock(t,i),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,i])=>{this._isApplicable(t,i)&&(e.return=this._getAffectedBlocks(t,i),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",((e,[{block:t}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(t.filter((e=>"figcaption"==e.element)).map((e=>({name:"caption",classes:e.classes}))))})))}_isApplicable(e,t){return["td","th"].includes(e.element)?"tableCell"==t.name:!!["thead","tbody"].includes(e.element)&&"table"==t.name}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const i=this._tableUtils.getCellLocation(t),n=t.parent.parent,o=n.getAttribute("headingRows")||0,s=n.getAttribute("headingColumns")||0,r=i.row0:i{"a"==t.element&&(e.return=this._isStyleEnabled(t,i),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",((e,[t,i])=>{"a"==t.element&&(e.return=this._isStyleActive(t,i),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",((e,[t,i])=>{if("a"!=t.element)return;const n=this._getAffectedSelectable(t,i);n&&(e.return=n,e.stop())}),{priority:"high"}))}_isStyleEnabled(e,t){const i=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const e of t.getRanges())for(const t of e.getItems())if((t.is("$textProxy")||i.schema.isInline(t))&&t.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const i=this.editor.model,n=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const i=t.getAttribute(n);if(this._styleUtils.hasAllClasses(i,e.classes))return!0}return!1}for(const o of t.getRanges())for(const t of o.getItems())if((t.is("$textProxy")||i.schema.isInline(t))&&t.hasAttribute("linkHref")){const i=t.getAttribute(n);return this._styleUtils.hasAllClasses(i,e.classes)}return!1}_getAffectedSelectable(e,t){const i=this.editor.model;if(t.isCollapsed){const e=t.getAttribute("linkHref");return Eh(t.getFirstPosition(),"linkHref",e,i)}const n=[];for(const e of t.getRanges()){const t=i.createRange(hM(e.start,"linkHref",!0,i),hM(e.end,"linkHref",!1,i));for(const e of t.getItems())(e.is("$textProxy")||i.schema.isInline(e))&&e.hasAttribute("linkHref")&&n.push(this.editor.model.createRangeOn(e))}return function(e){for(let t=1;t{const i=t.createElement("horizontalLine");e.insertObject(i,null,null,{setSelection:"after"})}))}}class fM extends ad{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),n.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t})=>{const n=i("Horizontal line"),o=t.createContainerElement("div",null,t.createEmptyElement("hr"));return t.addClass("ck-horizontal-line",o),t.setCustomProperty("hr",!0,o),function(e,t,i){return t.setCustomProperty("horizontalLine",!0,e),jh(e,t,{label:i})}(o,t,n)}}),n.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new gM(e))}}class pM extends ad{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",(()=>{const e=this._createButton(Bn);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(Yu)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("horizontalLine"),o=new e(t.locale),s=i.t;return o.set({label:s("Horizontal line"),icon:''}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),o}}class bM extends ad{static get requires(){return["ImageEditing","ImageUtils",Np]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,n,o)=>{const s=n.viewItem,r=i.findViewImgElement(s);if(!r)return;const a=r.findAncestor((e=>i.isBlockImageView(e)));if(t&&!a)return;const l={attributes:["href"]};if(!o.consumable.test(s,l))return;const c=s.getAttribute("href"),u=n.modelCursor.parent;u.is("element","imageBlock")&&(o.writer.setAttribute("linkHref",c,u),o.consumable.consume(s,l))}),{priority:"high"})}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",((e,i,n)=>{if(!n.consumable.consume(i.item,e.name))return;const o=n.mapper.toViewElement(i.item),s=n.writer,r=Array.from(o.getChildren()).find((e=>e.is("element","a"))),a=t.findViewImgElement(o),l=a.parent.is("element","picture")?a.parent:a;if(r)i.attributeNewValue?s.setAttribute("href",i.attributeNewValue,r):(s.move(s.createRangeOn(l),s.createPositionAt(o,0)),s.remove(r));else{const e=s.createContainerElement("a",{href:i.attributeNewValue});s.insert(s.createPositionAt(o,0),e),s.move(s.createRangeOn(l),s.createPositionAt(e,0))}}),{priority:"high"})}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(wM(i)),e.conversion.for("upcast").add(vM(e,i))}}function wM(e){return t=>{t.on(`attribute:${e.id}:imageBlock`,((t,i,n)=>{const o=n.mapper.toViewElement(i.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));if(s){if(i.attributeOldValue){for(const t in e.attributes)n.writer.removeAttribute(t,s);e.classes&&n.writer.removeClass(e.classes,s);for(const t in e.styles)n.writer.removeStyle(t,s)}if(i.attributeNewValue){for(const[t,i]of si(e.attributes))n.writer.setAttribute(t,i,s);e.classes&&n.writer.addClass(e.classes,s);for(const t in e.styles)n.writer.setStyle(t,e.styles[t],s)}}}))}}function vM(e,t){const i=e.plugins.has("ImageInlineEditing"),n=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,o,s)=>{const r=o.viewItem,a=n.findViewImgElement(r);if(!a)return;const l=a.findAncestor((e=>n.isBlockImageView(e)));if(i&&!l)return;const c=new co(t._createPattern()).match(r);if(!c)return;if(!s.consumable.test(r,c.match))return;const u=o.modelCursor.parent;u?.is("element","imageBlock")&&(s.writer.setAttribute(t.id,!0,u),s.consumable.consume(r,c.match))}),{priority:"high"})}}class yM extends ad{static get requires(){return[Np,Wp,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((t,i)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(i.preventDefault(),t.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",(i=>{const n=new Bn(i),o=e.plugins.get("LinkUI"),s=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:Dp,keystroke:xp,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addToolbarView():o._showUI(!0)})),n}))}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class _M extends cd{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=kM(i);this.isEnabled=function(e,t,i){const n=function(e,t){const i=Yh(e,t).start.parent;return i.isEmpty&&!i.is("rootElement")?i.parent:i}(e,i);return t.checkChild(n,"rawHtml")}(i,t,e),this.value=n?n.getAttribute("value")||"":null}execute(e){const t=this.editor.model,i=t.document.selection;t.change((n=>{let o;null!==this.value?o=kM(i):(o=n.createElement("rawHtml"),t.insertObject(o,null,null,{setSelection:"on"})),n.setAttribute("value",e,o)}))}}function kM(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}class CM extends ad{_widgetButtonViewReferences=new Set;static get pluginName(){return"HtmlEmbedEditing"}static get licenseFeatureCode(){return"HE"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:e=>(A("html-embed-provide-sanitize-function"),{html:e,hasChanged:!1})})}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new _M(e)),this._setupConversion()}_setupConversion(){const e=this.editor,t=e.t,i=e.editing.view,n=this._widgetButtonViewReferences,o=e.config.get("htmlEmbed");function s({editor:e,domElement:i,state:o,props:s}){i.textContent="";const a=i.ownerDocument;let l;if(o.isEditable){const e={isDisabled:!1,placeholder:s.textareaPlaceholder};l=r({domDocument:a,state:o,props:e}),i.append(l)}else if(o.showPreviews){const n={sanitizeHtml:s.sanitizeHtml};i.append(function({editor:e,domDocument:i,state:n,props:o}){const s=o.sanitizeHtml(n.getRawHtmlValue()),r=oe(i,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},n.getRawHtmlValue().length>0?t("No preview available"):t("Empty snippet content")),a=oe(i,"div",{class:"raw-html-embed__preview-content",dir:e.locale.contentLanguageDirection}),l=i.createRange().createContextualFragment(s.html);a.appendChild(l);return oe(i,"div",{class:"raw-html-embed__preview"},[r,a])}({domDocument:a,state:o,props:n,editor:e}))}else{const e={isDisabled:!0,placeholder:s.textareaPlaceholder};i.append(r({domDocument:a,state:o,props:e}))}const c={onEditClick:s.onEditClick,onSaveClick:()=>{s.onSaveClick(l.value)},onCancelClick:s.onCancelClick};i.prepend(function({editor:e,domDocument:t,state:i,props:o}){const s=oe(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(i.isEditable){const t=xM(e,"save",o.onSaveClick),i=xM(e,"cancel",o.onCancelClick);s.append(t.element,i.element),n.add(t).add(i)}else{const t=xM(e,"edit",o.onEditClick);s.append(t.element),n.add(t)}return s}({editor:e,domDocument:a,state:o,props:c}))}function r({domDocument:e,state:t,props:i}){const n=oe(e,"textarea",{placeholder:i.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=i.isDisabled,n.value=t.getRawHtmlValue(),n}this.editor.editing.view.on("render",(()=>{for(const e of n){if(e.element&&e.element.isConnected)return;e.destroy(),n.delete(e)}}),{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},(function(t){t.innerHTML=e.getAttribute("value")||""}))}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(n,{writer:r})=>{let a,l,c;const u=r.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(t){a=t,s({editor:e,domElement:t,state:l,props:c}),a.addEventListener("mousedown",(()=>{if(l.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==n&&t.change((e=>e.setSelection(n,"on")))}}),!0)})),d={makeEditable(){l=Object.assign({},l,{isEditable:!0}),s({domElement:a,editor:e,state:l,props:c}),i.change((e=>{e.setAttribute("data-cke-ignore-events","true",u)})),a.querySelector("textarea").focus()},save(t){t!==l.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel()},cancel(){l=Object.assign({},l,{isEditable:!1}),s({domElement:a,editor:e,state:l,props:c}),e.editing.view.focus(),i.change((e=>{e.removeAttribute("data-cke-ignore-events",u)}))}};l={showPreviews:o.showPreviews,isEditable:!1,getRawHtmlValue:()=>n.getAttribute("value")||""},c={sanitizeHtml:o.sanitizeHtml,textareaPlaceholder:t("Paste raw HTML here..."),onEditClick(){d.makeEditable()},onSaveClick(e){d.save(e)},onCancelClick(){d.cancel()}};const h=r.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":t("HTML snippet"),dir:e.locale.uiLanguageDirection},u);return r.setCustomProperty("rawHtmlApi",d,h),r.setCustomProperty("rawHtml",!0,h),jh(h,r,{label:t("HTML snippet"),hasSelectionHandle:!0})}})}}function xM(e,t,i){const{t:n}=e.locale,o=new Bn(e.locale),s=e.commands.get("htmlEmbed");return o.set({class:`raw-html-embed__${t}-button`,icon:Fp,tooltip:!0,tooltipPosition:"rtl"===e.locale.uiLanguageDirection?"e":"w"}),o.render(),"edit"===t?(o.set({icon:Fp,label:n("Edit source")}),o.bind("isEnabled").to(s)):"save"===t?(o.set({icon:Tu,label:n("Save changes")}),o.bind("isEnabled").to(s)):o.set({icon:On,label:n("Cancel")}),o.on("execute",i),o}class AM extends ad{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("htmlEmbed",(()=>{const e=this._createButton(Bn);return e.set({tooltip:!0,label:t("Insert HTML")}),e})),e.ui.componentFactory.add("menuBar:htmlEmbed",(()=>{const e=this._createButton(Yu);return e.set({label:t("HTML snippet")}),e}))}_createButton(e){const t=this.editor,i=t.commands.get("htmlEmbed"),n=new e(t.locale);return n.set({icon:''}),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",(()=>{t.execute("htmlEmbed"),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),n}}class TM extends ja{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let t="",i="";e=(e=e.trim().replace(/<\?xml\s[^?]*\?>/i,(e=>(i=e,"")))).trim().replace(/^]*?>/i,(e=>(t=e,"")));const n=this._toDom(e),o=this.domConverter.domToView(n,{skipComments:this.skipComments}),s=new _c(o.document);s.setCustomProperty("$fullPageDocument",n.ownerDocument.documentElement.outerHTML,o);const r=Array.from(n.ownerDocument.querySelectorAll("head style"));return s.setCustomProperty("$fullPageHeadStyles",r,o),t&&s.setCustomProperty("$fullPageDocType",t,o),i&&s.setCustomProperty("$fullPageXmlDeclaration",i,o),o}toData(e){let t=super.toData(e);const i=e.getCustomProperty("$fullPageDocument"),n=e.getCustomProperty("$fullPageDocType"),o=e.getCustomProperty("$fullPageXmlDeclaration");return i&&(t=i.replace(/<\/body\s*>/,t+"$&"),n&&(t=n+"\n"+t),o&&(t=o+"\n"+t)),t}}function EM(e){return e.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}class SM extends Hi{tiles;focusTracker;keystrokes;constructor(e){super(e),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new ei,this.keystrokes=new oi,Sb({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>n.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(e,t){const i=new Bn(this.locale);return i.set({label:e,withText:!0,class:"ck-character-grid__tile"}),i.extendTemplate({attributes:{title:t},on:{mouseover:i.bindTemplate.to("mouseover"),focus:i.bindTemplate.to("focus")}}),i.on("mouseover",(()=>{this.fire("tileHover",{name:t,character:e})})),i.on("focus",(()=>{this.fire("tileFocus",{name:t,character:e})})),i.on("execute",(()=>{this.fire("execute",{name:t,character:e})})),i}render(){super.render();for(const e of this.tiles)this.focusTracker.add(e.element);this.tiles.on("change",((e,{added:t,removed:i})=>{if(t.length>0)for(const e of t)this.focusTracker.add(e.element);if(i.length>0)for(const e of i)this.focusTracker.remove(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}}class PM extends Hi{constructor(e){super(e);const t=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",IM),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:t.to("name",(e=>e||""))}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:t.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}}function IM(e){return null===e?"":"U+"+("0000"+e.codePointAt(0).toString(16)).slice(-4)}class VM extends Hi{items;focusTracker;keystrokes;_focusCycler;categoriesView;gridView;infoView;constructor(e,t,i,n){super(e),this.categoriesView=t,this.gridView=i,this.infoView=n,this.items=this.createCollection(),this.focusTracker=new ei,this.keystrokes=new oi,this._focusCycler=new Nn({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.categoriesView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.categoriesView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class OM extends Hi{_groupNames;_dropdownView;constructor(e,t){super(e),this.set("currentGroupName",Array.from(t.entries())[0][0]),this._groupNames=t,this._dropdownView=new yf(e,Ef),this.setTemplate({tag:"div",attributes:{class:["ck","ck-character-categories"]},children:[this._dropdownView]})}render(){super.render(),this._setupDropdown()}focus(){this._dropdownView.focus()}_setupDropdown(){const e=new Xt;for(const[t,i]of this._groupNames){const n={type:"button",model:new sf({name:t,label:i,role:"menuitemradio",withText:!0})};n.model.bind("isOn").to(this,"currentGroupName",(e=>e===t)),e.add(n)}const t=(0,this.locale.t)("Category");this._dropdownView.set({label:t,isEmpty:!1}),this._dropdownView.fieldView.panelPosition="rtl"===this.locale.uiLanguageDirection?"se":"sw",this._dropdownView.fieldView.buttonView.set({withText:!0,tooltip:t,ariaLabel:t,ariaLabelledBy:void 0,isOn:!1}),this._dropdownView.fieldView.buttonView.bind("label").to(this,"currentGroupName",(e=>this._groupNames.get(e))),this._dropdownView.fieldView.on("execute",(({source:e})=>{this.currentGroupName=e.name})),Ou(this._dropdownView.fieldView,e,{ariaLabel:t,role:"menu"})}}const RM="All";class LM extends ad{static get pluginName(){return"SpecialCharactersArrows"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Arrows",[{title:t("leftwards simple arrow"),character:"←"},{title:t("rightwards simple arrow"),character:"→"},{title:t("upwards simple arrow"),character:"↑"},{title:t("downwards simple arrow"),character:"↓"},{title:t("leftwards double arrow"),character:"⇐"},{title:t("rightwards double arrow"),character:"⇒"},{title:t("upwards double arrow"),character:"⇑"},{title:t("downwards double arrow"),character:"⇓"},{title:t("leftwards dashed arrow"),character:"⇠"},{title:t("rightwards dashed arrow"),character:"⇢"},{title:t("upwards dashed arrow"),character:"⇡"},{title:t("downwards dashed arrow"),character:"⇣"},{title:t("leftwards arrow to bar"),character:"⇤"},{title:t("rightwards arrow to bar"),character:"⇥"},{title:t("upwards arrow to bar"),character:"⤒"},{title:t("downwards arrow to bar"),character:"⤓"},{title:t("up down arrow with base"),character:"↨"},{title:t("back with leftwards arrow above"),character:"🔙"},{title:t("end with leftwards arrow above"),character:"🔚"},{title:t("on with exclamation mark with left right arrow above"),character:"🔛"},{title:t("soon with rightwards arrow above"),character:"🔜"},{title:t("top with upwards arrow above"),character:"🔝"}],{label:t("Arrows")})}}class BM extends ad{static get pluginName(){return"SpecialCharactersText"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:t("Single left-pointing angle quotation mark")},{character:"›",title:t("Single right-pointing angle quotation mark")},{character:"«",title:t("Left-pointing double angle quotation mark")},{character:"»",title:t("Right-pointing double angle quotation mark")},{character:"‘",title:t("Left single quotation mark")},{character:"’",title:t("Right single quotation mark")},{character:"“",title:t("Left double quotation mark")},{character:"”",title:t("Right double quotation mark")},{character:"‚",title:t("Single low-9 quotation mark")},{character:"„",title:t("Double low-9 quotation mark")},{character:"¡",title:t("Inverted exclamation mark")},{character:"¿",title:t("Inverted question mark")},{character:"‥",title:t("Two dot leader")},{character:"…",title:t("Horizontal ellipsis")},{character:"‡",title:t("Double dagger")},{character:"‰",title:t("Per mille sign")},{character:"‱",title:t("Per ten thousand sign")},{character:"‼",title:t("Double exclamation mark")},{character:"⁈",title:t("Question exclamation mark")},{character:"⁉",title:t("Exclamation question mark")},{character:"⁇",title:t("Double question mark")},{character:"©",title:t("Copyright sign")},{character:"®",title:t("Registered sign")},{character:"™",title:t("Trade mark sign")},{character:"§",title:t("Section sign")},{character:"¶",title:t("Paragraph sign")},{character:"⁋",title:t("Reversed paragraph sign")}],{label:t("Text")})}}class MM extends ad{static get pluginName(){return"SpecialCharactersMathematical"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:t("Less-than sign")},{character:">",title:t("Greater-than sign")},{character:"≤",title:t("Less-than or equal to")},{character:"≥",title:t("Greater-than or equal to")},{character:"–",title:t("En dash")},{character:"—",title:t("Em dash")},{character:"¯",title:t("Macron")},{character:"‾",title:t("Overline")},{character:"°",title:t("Degree sign")},{character:"−",title:t("Minus sign")},{character:"±",title:t("Plus-minus sign")},{character:"÷",title:t("Division sign")},{character:"⁄",title:t("Fraction slash")},{character:"×",title:t("Multiplication sign")},{character:"ƒ",title:t("Latin small letter f with hook")},{character:"∫",title:t("Integral")},{character:"∑",title:t("N-ary summation")},{character:"∞",title:t("Infinity")},{character:"√",title:t("Square root")},{character:"∼",title:t("Tilde operator")},{character:"≅",title:t("Approximately equal to")},{character:"≈",title:t("Almost equal to")},{character:"≠",title:t("Not equal to")},{character:"≡",title:t("Identical to")},{character:"∈",title:t("Element of")},{character:"∉",title:t("Not an element of")},{character:"∋",title:t("Contains as member")},{character:"∏",title:t("N-ary product")},{character:"∧",title:t("Logical and")},{character:"∨",title:t("Logical or")},{character:"¬",title:t("Not sign")},{character:"∩",title:t("Intersection")},{character:"∪",title:t("Union")},{character:"∂",title:t("Partial differential")},{character:"∀",title:t("For all")},{character:"∃",title:t("There exists")},{character:"∅",title:t("Empty set")},{character:"∇",title:t("Nabla")},{character:"∗",title:t("Asterisk operator")},{character:"∝",title:t("Proportional to")},{character:"∠",title:t("Angle")},{character:"¼",title:t("Vulgar fraction one quarter")},{character:"½",title:t("Vulgar fraction one half")},{character:"¾",title:t("Vulgar fraction three quarters")}],{label:t("Mathematical")})}}class NM extends ad{static get pluginName(){return"SpecialCharactersLatin"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:t("Latin capital letter a with macron")},{character:"ā",title:t("Latin small letter a with macron")},{character:"Ă",title:t("Latin capital letter a with breve")},{character:"ă",title:t("Latin small letter a with breve")},{character:"Ą",title:t("Latin capital letter a with ogonek")},{character:"ą",title:t("Latin small letter a with ogonek")},{character:"Ć",title:t("Latin capital letter c with acute")},{character:"ć",title:t("Latin small letter c with acute")},{character:"Ĉ",title:t("Latin capital letter c with circumflex")},{character:"ĉ",title:t("Latin small letter c with circumflex")},{character:"Ċ",title:t("Latin capital letter c with dot above")},{character:"ċ",title:t("Latin small letter c with dot above")},{character:"Č",title:t("Latin capital letter c with caron")},{character:"č",title:t("Latin small letter c with caron")},{character:"Ď",title:t("Latin capital letter d with caron")},{character:"ď",title:t("Latin small letter d with caron")},{character:"Đ",title:t("Latin capital letter d with stroke")},{character:"đ",title:t("Latin small letter d with stroke")},{character:"Ē",title:t("Latin capital letter e with macron")},{character:"ē",title:t("Latin small letter e with macron")},{character:"Ĕ",title:t("Latin capital letter e with breve")},{character:"ĕ",title:t("Latin small letter e with breve")},{character:"Ė",title:t("Latin capital letter e with dot above")},{character:"ė",title:t("Latin small letter e with dot above")},{character:"Ę",title:t("Latin capital letter e with ogonek")},{character:"ę",title:t("Latin small letter e with ogonek")},{character:"Ě",title:t("Latin capital letter e with caron")},{character:"ě",title:t("Latin small letter e with caron")},{character:"Ĝ",title:t("Latin capital letter g with circumflex")},{character:"ĝ",title:t("Latin small letter g with circumflex")},{character:"Ğ",title:t("Latin capital letter g with breve")},{character:"ğ",title:t("Latin small letter g with breve")},{character:"Ġ",title:t("Latin capital letter g with dot above")},{character:"ġ",title:t("Latin small letter g with dot above")},{character:"Ģ",title:t("Latin capital letter g with cedilla")},{character:"ģ",title:t("Latin small letter g with cedilla")},{character:"Ĥ",title:t("Latin capital letter h with circumflex")},{character:"ĥ",title:t("Latin small letter h with circumflex")},{character:"Ħ",title:t("Latin capital letter h with stroke")},{character:"ħ",title:t("Latin small letter h with stroke")},{character:"Ĩ",title:t("Latin capital letter i with tilde")},{character:"ĩ",title:t("Latin small letter i with tilde")},{character:"Ī",title:t("Latin capital letter i with macron")},{character:"ī",title:t("Latin small letter i with macron")},{character:"Ĭ",title:t("Latin capital letter i with breve")},{character:"ĭ",title:t("Latin small letter i with breve")},{character:"Į",title:t("Latin capital letter i with ogonek")},{character:"į",title:t("Latin small letter i with ogonek")},{character:"İ",title:t("Latin capital letter i with dot above")},{character:"ı",title:t("Latin small letter dotless i")},{character:"IJ",title:t("Latin capital ligature ij")},{character:"ij",title:t("Latin small ligature ij")},{character:"Ĵ",title:t("Latin capital letter j with circumflex")},{character:"ĵ",title:t("Latin small letter j with circumflex")},{character:"Ķ",title:t("Latin capital letter k with cedilla")},{character:"ķ",title:t("Latin small letter k with cedilla")},{character:"ĸ",title:t("Latin small letter kra")},{character:"Ĺ",title:t("Latin capital letter l with acute")},{character:"ĺ",title:t("Latin small letter l with acute")},{character:"Ļ",title:t("Latin capital letter l with cedilla")},{character:"ļ",title:t("Latin small letter l with cedilla")},{character:"Ľ",title:t("Latin capital letter l with caron")},{character:"ľ",title:t("Latin small letter l with caron")},{character:"Ŀ",title:t("Latin capital letter l with middle dot")},{character:"ŀ",title:t("Latin small letter l with middle dot")},{character:"Ł",title:t("Latin capital letter l with stroke")},{character:"ł",title:t("Latin small letter l with stroke")},{character:"Ń",title:t("Latin capital letter n with acute")},{character:"ń",title:t("Latin small letter n with acute")},{character:"Ņ",title:t("Latin capital letter n with cedilla")},{character:"ņ",title:t("Latin small letter n with cedilla")},{character:"Ň",title:t("Latin capital letter n with caron")},{character:"ň",title:t("Latin small letter n with caron")},{character:"ʼn",title:t("Latin small letter n preceded by apostrophe")},{character:"Ŋ",title:t("Latin capital letter eng")},{character:"ŋ",title:t("Latin small letter eng")},{character:"Ō",title:t("Latin capital letter o with macron")},{character:"ō",title:t("Latin small letter o with macron")},{character:"Ŏ",title:t("Latin capital letter o with breve")},{character:"ŏ",title:t("Latin small letter o with breve")},{character:"Ő",title:t("Latin capital letter o with double acute")},{character:"ő",title:t("Latin small letter o with double acute")},{character:"Œ",title:t("Latin capital ligature oe")},{character:"œ",title:t("Latin small ligature oe")},{character:"Ŕ",title:t("Latin capital letter r with acute")},{character:"ŕ",title:t("Latin small letter r with acute")},{character:"Ŗ",title:t("Latin capital letter r with cedilla")},{character:"ŗ",title:t("Latin small letter r with cedilla")},{character:"Ř",title:t("Latin capital letter r with caron")},{character:"ř",title:t("Latin small letter r with caron")},{character:"Ś",title:t("Latin capital letter s with acute")},{character:"ś",title:t("Latin small letter s with acute")},{character:"Ŝ",title:t("Latin capital letter s with circumflex")},{character:"ŝ",title:t("Latin small letter s with circumflex")},{character:"Ş",title:t("Latin capital letter s with cedilla")},{character:"ş",title:t("Latin small letter s with cedilla")},{character:"Š",title:t("Latin capital letter s with caron")},{character:"š",title:t("Latin small letter s with caron")},{character:"Ţ",title:t("Latin capital letter t with cedilla")},{character:"ţ",title:t("Latin small letter t with cedilla")},{character:"Ť",title:t("Latin capital letter t with caron")},{character:"ť",title:t("Latin small letter t with caron")},{character:"Ŧ",title:t("Latin capital letter t with stroke")},{character:"ŧ",title:t("Latin small letter t with stroke")},{character:"Ũ",title:t("Latin capital letter u with tilde")},{character:"ũ",title:t("Latin small letter u with tilde")},{character:"Ū",title:t("Latin capital letter u with macron")},{character:"ū",title:t("Latin small letter u with macron")},{character:"Ŭ",title:t("Latin capital letter u with breve")},{character:"ŭ",title:t("Latin small letter u with breve")},{character:"Ů",title:t("Latin capital letter u with ring above")},{character:"ů",title:t("Latin small letter u with ring above")},{character:"Ű",title:t("Latin capital letter u with double acute")},{character:"ű",title:t("Latin small letter u with double acute")},{character:"Ų",title:t("Latin capital letter u with ogonek")},{character:"ų",title:t("Latin small letter u with ogonek")},{character:"Ŵ",title:t("Latin capital letter w with circumflex")},{character:"ŵ",title:t("Latin small letter w with circumflex")},{character:"Ŷ",title:t("Latin capital letter y with circumflex")},{character:"ŷ",title:t("Latin small letter y with circumflex")},{character:"Ÿ",title:t("Latin capital letter y with diaeresis")},{character:"Ź",title:t("Latin capital letter z with acute")},{character:"ź",title:t("Latin small letter z with acute")},{character:"Ż",title:t("Latin capital letter z with dot above")},{character:"ż",title:t("Latin small letter z with dot above")},{character:"Ž",title:t("Latin capital letter z with caron")},{character:"ž",title:t("Latin small letter z with caron")},{character:"ſ",title:t("Latin small letter long s")}],{label:t("Latin")})}}class FM extends ad{static get pluginName(){return"SpecialCharactersCurrency"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:t("Dollar sign")},{character:"€",title:t("Euro sign")},{character:"¥",title:t("Yen sign")},{character:"£",title:t("Pound sign")},{character:"¢",title:t("Cent sign")},{character:"₠",title:t("Euro-currency sign")},{character:"₡",title:t("Colon sign")},{character:"₢",title:t("Cruzeiro sign")},{character:"₣",title:t("French franc sign")},{character:"₤",title:t("Lira sign")},{character:"¤",title:t("Currency sign")},{character:"₿",title:t("Bitcoin sign")},{character:"₥",title:t("Mill sign")},{character:"₦",title:t("Naira sign")},{character:"₧",title:t("Peseta sign")},{character:"₨",title:t("Rupee sign")},{character:"₩",title:t("Won sign")},{character:"₪",title:t("New sheqel sign")},{character:"₫",title:t("Dong sign")},{character:"₭",title:t("Kip sign")},{character:"₮",title:t("Tugrik sign")},{character:"₯",title:t("Drachma sign")},{character:"₰",title:t("German penny sign")},{character:"₱",title:t("Peso sign")},{character:"₲",title:t("Guarani sign")},{character:"₳",title:t("Austral sign")},{character:"₴",title:t("Hryvnia sign")},{character:"₵",title:t("Cedi sign")},{character:"₶",title:t("Livre tournois sign")},{character:"₷",title:t("Spesmilo sign")},{character:"₸",title:t("Tenge sign")},{character:"₹",title:t("Indian rupee sign")},{character:"₺",title:t("Turkish lira sign")},{character:"₻",title:t("Nordic mark sign")},{character:"₼",title:t("Manat sign")},{character:"₽",title:t("Ruble sign")}],{label:t("Currency")})}}class DM extends cd{constructor(e){super(e),this.affectsData=!1,this.value=!1}execute(){const e="ck-show-blocks",t=this.editor.editing.view;t.change((i=>{for(const n of t.document.roots)n.hasClass(e)?(i.removeClass(e,n),this.value=!1):(i.addClass(e,n),this.value=!0)}))}}class zM extends ad{static get pluginName(){return"ShowBlocksEditing"}static get isOfficialPlugin(){return!0}init(){const{editor:e}=this;e.commands.add("showBlocks",new DM(e))}}class HM extends ad{static get pluginName(){return"ShowBlocksUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("showBlocks",(()=>{const e=this._createButton(Bn);return e.set({tooltip:!0,icon:''}),e})),e.ui.componentFactory.add("menuBar:showBlocks",(()=>this._createButton(Yu)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("showBlocks"),o=new e(i),s=i.t;return o.set({label:s("Show blocks"),isToggleable:!0,role:"menuitemcheckbox"}),o.bind("isEnabled").to(n),o.bind("isOn").to(n,"value",n,"isEnabled",((e,t)=>e&&t)),this.listenTo(o,"execute",(()=>{t.execute("showBlocks"),t.editing.view.focus()})),o}}const UM='';class $M extends Hi{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(e){super(e);const t=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(t("Find in text…")),this._findPrevButtonView=this._createButton({label:t("Previous result"),class:"ck-button-prev",icon:cm,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:t("Next result"),class:"ck-button-next",icon:cm,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(t("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:t("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:t("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:t("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new ei,this._keystrokes=new oi,this._focusables=new wi,this.focusCycler=new Nn({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(),vf({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 Hi(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 Hi(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 o=()=>{const t=this._findInputView.fieldView.element;if(!t||!ht(t))return;const i=new Ze(n.element).width,o="ltr"===e.uiLanguageDirection?"paddingRight":"paddingLeft";t.style[o]=i?`calc( 2 * var(--ck-spacing-standard) + ${i}px )`:""};this.on("change:_resultsCounterText",o,{priority:"low"}),this.on("change:isDirty",o,{priority:"low"}),this._findInputView.template.children[0].children.push(n)}_createAdvancedOptionsCollapsible(){const e=this.locale.t,t=new Uf(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e("Advanced options"),isCollapsed:!0}),t}_createActionButtonsDiv(){const e=new Hi(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 Au(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 Au(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 Bn(this.locale);return t.set(e),t}_createInputField(e,t){const i=new yf(this.locale,Af);return i.label=e,i.class=t,i}}class qM extends ad{static get requires(){return[eg]}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,o)=>{if(i.isEnabled){if(n instanceof wu){const e=n.buttonView;e.isOn||e.fire("execute")}else n.isOn?e.plugins.get("Dialog").view.focus():n.fire("execute");o()}})),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,t=e.locale.t,i=Pu(e.locale);return i.once("change:isOpen",(()=>{this.formView=this._createFormView(),this.formView.children.add(new Rn(e.locale,{label:t("Find and replace")}),0),i.panelView.children.add(this.formView)})),i.on("change:isOpen",((e,t,i)=>{i?this._setupFormView():this.fire("searchReseted")}),{priority:"low"}),i.buttonView.set({icon:UM,label:t("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),i}_createDialogButtonForToolbar(){const e=this.editor,t=this._createButton(Bn),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(Yu),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 t=this.editor,i=t.commands.get("find"),n=new e(t.locale),o=t.locale.t;return n.bind("isEnabled").to(i),n.set({icon:UM,label:o("Find and replace"),keystroke:"CTRL+F"}),n}_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:jn,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const e=this.editor,t=new(bf($M))(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 o=i.get("findNext"),s=i.get("findPrevious"),r=i.get("replace"),a=i.get("replaceAll");return t.bind("_areCommandsEnabled").to(o,"isEnabled",s,"isEnabled",r,"isEnabled",a,"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 jM extends cd{_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:o}=n,s=n.plugins.get("FindAndReplaceUtils");let r,a="";r="string"==typeof e?(...n)=>({results:s.findByTextCallback(e,{matchCase:t,wholeWords:i})(...n),searchText:e}):e;const l=r;r=(...e)=>{const t=l(...e);return t&&"searchText"in t&&(a=t.searchText),t};const c=o.document.getRootNames().reduce(((e,t)=>s.updateFindResultFromRange(o.createRangeIn(o.document.getRoot(t)),o,r,e)),null);return this._state.clear(o),this._state.results.addMany(c),this._state.highlightedResult=c.get(0),this._state.searchText=a,r&&(this._state.lastSearchCallback=r),this._state.matchCase=!!t,this._state.matchWholeWords=!!i,{results:c,findCallback:r}}}class WM extends(G()){constructor(e){super(),this.set("results",new Xt),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 o of i)this.highlightedResult===o&&(t=!0),e.markers.has(o.marker.name)&&n.removeMarker(o.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?GM(e,[...i]).indexOf(t)+1:0}}function GM(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 KM extends cd{_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((o=>{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(o.createText(e,s),n),this._state.results.has(t)&&this._state.results.remove(t)}))}}class JM extends KM{execute(e,t){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){const e=GM(this.editor.model,[...this._state.results]);this._state.highlightedResult=e[i%e.length]}}}class YM extends KM{execute(e,t){const{editor:i}=this,{model:n}=i,o=i.plugins.get("FindAndReplaceUtils"),s=t instanceof Xt?t:n.document.getRootNames().reduce(((e,i)=>o.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(i)),n,o.findByTextCallback(t,this._state),e)),null);s.length&&n.change((()=>{[...s].forEach((t=>{this._replace(e,t)}))}))}}class QM extends cd{_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 XM extends QM{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)}}class ZM extends ad{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(e,t,i,n){const o=n||new Xt;return t.change((n=>{[...e].forEach((({type:e,item:s})=>{if("elementStart"===e&&t.schema.checkChild(s,"$text")){let e=i({item:s,text:this.rangeToText(t.createRangeIn(s))});if(!e)return;"results"in e&&(e=e.results),e.forEach((e=>{const t=`findResult:${_()}`,i=n.addMarker(t,{usingOperation:!1,affectsData:!1,range:n.createRange(n.createPositionAt(s,e.start),n.createPositionAt(s,e.end))}),r=function(e,t){const i=e.find((({marker:e})=>t.getStart().isBefore(e.getStart())));return i?e.getIndex(i):e.length}(o,i);(e=>o.find((t=>{const{marker:i}=t,n=i.getRange(),o=e.getRange();return n.isEqual(o)})))(i)||o.add({id:t,label:e.label,marker:i},r)}))}}))})),o}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=`(${o=e,function(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}(Ah(o))})`;var o;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 s=new RegExp(n,i);return function({text:e}){return[...e.matchAll(s)].map(eN)}}}function eN(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}}class tN extends ad{static get requires(){return[ZM]}static get pluginName(){return"FindAndReplaceEditing"}static get licenseFeatureCode(){return"FAR"}static get isPremiumPlugin(){return!0}static get isOfficialPlugin(){return!0}state;init(){this.state=new WM(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",((e,t,i,n)=>{const{model:o}=this.editor;o.change((e=>{if(n){const t=n.marker.name.split(":")[1],i=o.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=Wi(((e,t,i)=>{if(i){const e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(i.marker.getRange());yt({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 jM(this.editor,this.state)),this.editor.commands.add("findNext",new QM(this.editor,this.state)),this.editor.commands.add("findPrevious",new XM(this.editor,this.state)),this.editor.commands.add("replace",new JM(this.editor,this.state)),this.editor.commands.add("replaceAll",new YM(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,o=i.document.differ.getChanges(),s=i.document.differ.getChangedMarkers();o.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 r=[],a=this.editor.plugins.get("FindAndReplaceUtils");e.forEach((e=>{const t=a.updateFindResultFromRange(i.createRangeOn(e),i,this.state.lastSearchCallback,n);r.push(...t)})),s.forEach((e=>{if(e.data.newRange){const t=a.updateFindResultFromRange(e.data.newRange,i,this.state.lastSearchCallback,n);r.push(...t)}})),!this.state.highlightedResult&&r.length?this.state.highlightedResult=r[0]:this.state.refreshHighlightOffset(i)}}class iN extends Nd{}iN.builtinPlugins=[class extends ad{static get requires(){return[ng,Mm,Bh,Um,Dh,fh,Xm]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[sg]}static get pluginName(){return"CKFinderUploadAdapter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(sg).createUploadAdapter=t=>new cg(t,e,this.editor.t))}},class extends ad{static get requires(){return[Px,Rx]}static get pluginName(){return"CodeBlock"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[gh]}static get pluginName(){return"Autoformat"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Revert autoformatting action"),keystroke:"Backspace"}]})}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&ug(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&ug(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&ug(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&ug(this.editor,this,/^\[\s?x\s?\]\s$/,(()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")}))}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=mg(this.editor,"bold");dg(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),dg(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=mg(this.editor,"italic");dg(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),dg(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=mg(this.editor,"code");dg(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get("strikethrough")){const e=mg(this.editor,"strikethrough");dg(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter((e=>e.match(/^heading[1-6]$/))).forEach((t=>{const i=t[7],n=new RegExp(`^(#{${i}})\\s$`);ug(this.editor,this,n,(()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})}))}))}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&ug(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&ug(e,this,/^```$/,(()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})}))}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&ug(this.editor,this,/^---$/,"horizontalLine")}},class extends ad{static get requires(){return[pg,vg]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[_g,Cg]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Ag,Eg]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Pg,Vg]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Rg,Bg]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Ng,Dg]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Hg,$g]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Kg,Jg]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[of,rf]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[jf,Gf]}static get pluginName(){return"Image"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Yf,Xf]}static get pluginName(){return"ImageCaption"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[mp,fp]}static get pluginName(){return"ImageStyle"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[fm,gf]}static get pluginName(){return"ImageToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(fm),n=e.plugins.get("ImageUtils");var o;i.register("image",{ariaLabel:t("Image toolbar"),items:(o=e.config.get("image.toolbar")||[],o.map((e=>z(e)?e.name:e))),getRelatedElement:e=>n.getClosestSelectedImageWidget(e)})}},class extends ad{static get requires(){return[qv,Qv,iy,Wv]}static get pluginName(){return"ImageResize"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Np,Wp,Jp]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}},class extends ad{static get requires(){return[Mv,Uv]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}},Zg,class extends ad{static get requires(){return[cy,gy]}static get pluginName(){return"Alignment"}static get isOfficialPlugin(){return!0}},class extends ad{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return"Autosave"}static get isOfficialPlugin(){return!0}static get requires(){return[Md]}constructor(e){super(e);const t=e.config.get("autosave")||{},i=t.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=Wi(this._save.bind(this),i),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new($e()),this._config=t,this._pendingActions=e.plugins.get(Md),this._makeImmediateSave=!1}init(){const e=this.editor,t=e.model.document;this.listenTo(e,"ready",(()=>{this.listenTo(t,"change:data",((e,t)=>{this._saveCallbacks.length&&t.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave())}))})),this.listenTo(e,"destroy",(()=>this._flush()),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",((e,t)=>{this._pendingActions.hasAny&&(t.returnValue=this._pendingActions.first.message)}))}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then((()=>Promise.all(this._saveCallbacks.map((e=>e(this.editor)))))).finally((()=>{this._savePromise=null})).then((()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)})).catch((e=>{throw this.state="error",this.state="saving",this._debouncedSave(),e})),this._savePromise)}_setPendingAction(){const e=this.editor.t;this._action||(this._action=this._pendingActions.add(e("Saving changes")))}get _saveCallbacks(){const e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}},class extends ad{static get requires(){return[Gw,iv,uv,gv]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}},class extends ad{static get pluginName(){return"PasteFromOffice"}static get licenseFeatureCode(){return"PFO"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[Qd]}init(){const e=this.editor,t=e.plugins.get("ClipboardPipeline"),i=e.editing.view.document,n=[],o=this.editor.plugins.has("MultiLevelListEditing"),s=this.editor.plugins.has("TablePropertiesEditing"),r=!!this.editor.config.get("experimentalFlags.useExtendedTableBlockAlignment");n.push(new Oy(i,o,s,r)),n.push(new Fy(i)),n.push(new zy(i)),t.on("inputTransformation",((t,o)=>{if(o._isTransformedWithPasteFromOffice)return;if(e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const s=o.dataTransfer.getData("text/html"),r=n.find((e=>e.isActive(s)));r&&(o._parsedData||(o._parsedData=function(e,t){const i=new DOMParser,n=function(e){return Hy(Hy(e)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(e){const t="